I wanted to play with some cheap Temp/Humidity sensors from Adafruit so I bought their AHT20 sensor and their MCP2221 based USB to I2C adapter.
After plugging it into the Rio and rebooting I can see that the kernel detects it, but I don’t see any reference to a complete /dev device path.
I tried installing the AHT20 node but it requires NodeJS >= 14 and the Rio as of the current firmware is on 12.x.
I then tried using the I2C contrib node for RPi but I’m guessing it connects directly to the I2C hardware and not through a USB interface since it didn’t find anything.
In short, we only include the FTDI USB to Serial chip /dev/ driver for TTY devices.
So, not sure what options are here for you… I2C to serial converter and then use one of the FTDI genuine converters?
Or, (without looking into it) what Linux drivers are there for I2C? Could you build one from source and go that way?
We do intend to bump the version of NodeJS in an upcoming firmware update, but please don’t hold your breath for that, no solid ETA on that, don’t wan you turning blue!
Well I think the MCP2221 already provides a serial interface. I was hoping I would see some kind of /dev/tty or /dev/ttyAMC0 or the likes in the system log, reference it in a Node Red node and it “just works”
Here’s the Adafruit link with more details:
It doesn’t look like I should need an additional USB->Serial converter.
Thanks for the link. That micro is a USB device, not a USB to Serial converter. Its a USB to I2C ‘converter’ (its not really even that, its more of a ‘USB to many other devices including GPIO’ converter). So hence when you plug it in, Linux does not know what to do with it as it can not know what devices are plugged into the other end and how it should talk to them.
Your second link is getting closer to the mark in that you can write some code to talk to the I2C device you have connected to the adapter. Since you know what I2C devices are on the other end, you can tell the Linux kernel how to talk to them out the USB port.
A lot of customers are doing cool things with Python on EPIC. There are many threads on the forums here talking about some tweaks you may end up doing.
Keep in mind that shell fun and games does not carry through a firmware update, so keep good notes and please keep popping back here with how things go. Cool project for sure.
This is not a Node-RED node, so you can run it as your shell user just fine.
The sample code he gives should like wise be run as your shell user.
Once you have temp and humidity data in your shell terminal, then you can think about how you are going to tie a bow around your data and what your end goal is.
I was hoping the pure NodeJS module would work around the need for all the python stuff. I wasn’t able to do the pip install, I can’t remember the error, but it was likely due to the fact it doesn’t look like dev packages are available in the Opto 22 repositories (no libudev-dev package).
Sorry, what meant to say is that I think that micro is blank, it does not know what I2C sensors any customer is going to attach, so they just sell the board and you have to program the micro in Python with the library that match the sensors (in your case, humidity and temperature).
The Python is linked from the Adafruit page you first posted with.
Once that is done, then you can connect to the RIO and have a better chance of it returning the two values (at the moment Im suspecting its undefined undefined because, well, the sensors are undefined in the micro) and from there you can see about getting that into Node-RED on the RIO.
I see what you mean, you REALLY have to have their circuitpython libraries to talk to the devices… Almost have it working on my Nano running Fedora 36.
I got it working on my Fedora Linux desktop computer. You really need to make sure the kernel driver isn’t loaded. I could rmmod it, get results for the sensor, but a short time later found the driver loaded again.
I’ve almost got it working on my Jetson Nano, but the adafruit library knows it’s running on a Jetson and is trying to access the native GPIO which I’m trying to work around.
That’s a pretty good update all things considered.
Perhaps now that the micro knows its sensors, its worth trying the small example you tried last time on the RIO and got the two undefined.
Thanks for keeping us all in the loop, its fun to follow along.