Connecting to generic i2c sensor with Jetson Nano, reading data into Jupyter Notebook

Hi all,

I am using the Jetson Nano to control some motors, with a Jupyter Notebook as my development environment. I want to be able to read a joystick input into the Jupyter Notebook program so that I can drive the motors with it. The joystick is an analog output, so I am using a 12 bit ADC from Adafruit (ADS1015) to convert the analog inputs to i2c.

Everything I have read online says that to use i2c with the Jetson Nano, you need to use the libi2c library ( https://github.com/amaork/libi2c ). I have installed this with sudo apt-get install libi2c-dev i2c-tools. My problem is even though I have downloaded and installed this, I cannot import it into my Jupyter Notebook. When I use the line import pylibi2c (as the github page suggests) I get “No module named ‘pylibi2c’.” I have tried moving the libi2c folder around to different directories (site-packages) and reinstalling with no luck. I would appreciate some help on this, I feel it is a very simple and correctable issue.

Thanks!
Joe

You can use i2c-tools to check the HW connection first.

http://wiki.dreamrunner.org/public_html/Embedded-System/Peripherals-Drivers/i2c-tools-usage.html

Hi Shane, thanks for the response.

Yes I am not having any problems with my connection, I can see my device listed when I use i2cdetect. My issue is that I cannot read the data into into my python program and therefore cannot perform any useful control operations with the data. Do you have any suggestions on how to solve my issue described in my original post?

Also, do you happen to have some more in-depth documentation on these i2c terminal commands? Is there a way of trying to read data into the terminal to further test the connection?

Thanks,
Joe

Does the i2c tools i2cget can get data from device?

I cannot read data back from the joystick yet. It seems that the i2cget command simply reads register values back. I am able to set register values with i2cset, but I don’t understand how to read actual joystick data into the registers.

That’s no reasonable, if you can set the REG you should be able read it back.
You may need to consult to the i2c chip vendor to get the detail information to access the REG.