Ideas on how to add additional sensors?

I’m currently controlling environmental conditions in a mushroom fruiting room. I’m using a HTU21D-F Altas Scientific temp/RH sensor and a MH-Z19B CO2 sensor as my sole inputs, and using a KASA smart strip for my outputs.
I’d like to control more rooms in a similar manner, with the same pi 3b+.
I’m learning more about this everyday, but I’m still pretty new. From what I understand, I can’t add any more of the MH-Z19B sensors because they communicate on the pi’s serial port on the GPIO pins (Tx, Rx). I should be able to add up to 64 i2c sensors from what I have gleaned. Is there a way to use more than one of the MH-Z19B sensors? If not, I may consider switching to Sensirion SCD30 temp/RH/CO2 sensor. Do you know how many of those sensors I can add and have controlled by one pi? Will they have differing i2c addresses, or do I have to address them differently myself? Will I be running into power issues as I add more sensors? I’m certainly willing to do the reading and calculations myself, I’m just not sure where to start.
Please and thanks!

1 Like

You can add multiple MH-Z19B sensors. Using UART to USB converters allows you to plug each sensor in via USB. Each sensor will be assigned a device (e.g. /dev/ttyUSB0, USB1, etc.).

The SCD-30 is a nice sensor, and only has 1 I2C address, but you can connect multiple sensors with an I2C multiplexer, which allows you to create multiple I2C busses (and setting the correct bus in each of your Input settings).

For long wire lengths using I2C, you will likely want to use an I2C extender, like the LTC4311.

1 Like

I’m running unshielded 50’ lengths of wire from my pi to my sensors. Haven’t had any trouble yet, but what should i be on the lookout for?
I’ll definitely look into i2c extenders in the future as i expand. Thanks a million for the help and inspiration

1 Like

50 feet is quite a length on I2C to not be experiencing any issues. About 10 feet is typically what is mentioned as the limit, but with increased shielding, and other characteristics, that distance can be increased. Typical symptoms include communication errors that prevent measurements from being acquired. Some I2C devices are more sensitive than others. It can also depend whether you are using 3.3 volts or 5 volts, since long wire lengths increase voltage drop (but this isn’t the main reason for the signal degradation, see the LTC4311 link for an explanation on that).

hey there. i’m having a setup of multiple cases for pump-case, sensor-case and rpi-case.
it works with a rj12 10inch cable.
but a 3 feet cable results in no-data.

so i tried raspi → grove-hub → Adafruit LTC4311 I2C Extender → rj12
but still, no-data :frowning:

do anyone have an idea of what the cause is?
is 5V (4amp) too less? is the voltage drop too high with 5V? :confused:

thanks

The LTC4311 goes at the end of the wire, not that the start of it.

oh boy… thank you. i’ll try it.

i never would have thought about it, since adafruit advise it on the beginning of the chain O_o (which would have come far cheaper :confused: )

Using this board is easy: connect it to your I2C bus at the beginning of the chain (if you don’t have a massively long cable, you can also try at the end of the chain)

i’ll try the PCA9615 for beginning of the chain.
that one is used by sparkfun for “midpoint” aswell as “endpoint” rj45 breakout boards.
i’ll give it a go and write back here.

1 Like

Actually, you’re right, it shouldn’t matter where it is on the wire, since all it’s doing is pulling the line high as soon as it detects the voltage rise above a threshold, thereby making the wave that looks sawtooth as a result of the long wire into a more square wave. So it may be something else that’s the issue in your system.

this is not the best approach to do it for long range. The best long range protocol is RS-485.
There are some serial to RS-485 converters.
Another option is to use wireless communication. Use of ESP8266 connected directly to each sensor, and each ESP8266 sending data to the mycodo via mqtt.