In last week’s blog post, we finished creating our first machine learning model using a public repository dataset. While this is a major step towards our end goal, it is missing a critical aspect: being able to use our own data on the model to train it and test it. The goal for the model is to eventually be able to apply it to many different types of data, and to easily be able to change in between use cases.
Collecting our own data:
To use our own data on the model, we first need to collect some data. In this case we will be using an accelerometer that outputs x, y, and z data. We are using the SEN0168 accelerometer with a BMA220 chip. This accelerometer uses an I2C or inter-integrated circuit interface to connect to the jetson nano.
- What is I2C?
I2C is actually not eye-two-C, but I-squared-C. This stands for “inter-integrated circuit interface”. I2C is a single-ended serial communication bus that is widely used for connecting integrated circuits (which can come on all kinds of sensors, motors, etc.) to processors and microcontrollers. Regardless of how many pins you have on your microcontroller, you can connect as many I2C devices as you’d like. I2C even supports connecting multiple microcontrollers to allow for more than one controller to communicate with all peripheral devices on the bus.
- Connecting to the Jetson
The jetson nano comes with a 40-pin header. The pins functions are shown in the image below.
For the I2C connection, we will only need to use 4 pins: VDC (power- in this case 3.3v), GND (ground), SCL (clock), and SDA (data). These pins on the jetson nano (pins 1, 3, 5, and 6) will be plugged into the corresponding pins on the BMA220.
Checking the connection:
If the BMA220 has been properly connected, it should light up. We can now check for the signal on the jetson nano.
Open the command line and run “ i2cdetect -y -r busnumber”. I am connected to I2C bus 1, and if you followed the same pin setup described above you should be as well.
We can see that we are detecting our I2C device on 0x0a, or port 10. If you connect to other buses, you can check that as well by changing the number of bus in the i2cdetect command.
We now have a properly connected I2C device to our Jetson Nano. In the next blog post, we will cover any configuration necessary and write some code to actually access the accelerometer’s data.