Multiple sensors on one Arduino?
nerukam last edited by
Pardon me if this is a dumb question, I've seen in other messages that people talk about having multiple sensors all hooked up on one Arduino + nRF24.
I also see in the docs that
present()takes two arguments, one of which is
Am I understanding correctly that one Arduino + NRF24 (I'm guessing that is what a node is?) can report data from more than one sensor?
I have about a dozen plants sitting one next to another, it would be great to sense moisture in each pot without requiring ten Arduinos and ten NRF24; but rather one Arduino and one NRF24 reading from ten moisture sensors, all appearing as separate "plants" in the controller and triggering separate alerts when low on water (so I can tell which plant specifically needs watering).
Did I get that right? Can I get away with one Arduino + one NRF24 reporting data from 10 moisture sensors?
@nerukam you're correct.
From the getting started guide, in case you haven't seen it:
each radio node can report data for 254 attached child sensors
The most commonly used Arduino, the Pro Mini, only has 6 analog pins though. It is possible to add more through additional chips, but since Pro Minis are cheap it will probably be better to build two nodes.
nerukam last edited by
chisight last edited by
@nerukam 10 moisture sensors only requires two analog ports. You don't want the sensors on all the time or they will corrode away quickly, so you always turn them on and off with a transistor anyway.
One end of the sensor goes to Vcc.
The other end of the sensor goes to the an analog input.
The sensor/analog input is also connected to a resistor.
The other end of the resistor goes to the transistor's collector.
The transistor's emitter goes to ground.
A digital output goes through a resistor to the transistor's base.
A second sensor goes in parallel to the first with it's own resistor and goes to it's own analog port.
The exact values of the resistors isn't critical but 4.7K should be a good value for all of them in a 5V system.
To read sensor X1 and X2, turn digital output X on, read the two analog inputs and when done, turn it off.
Repeat this 5 times and you have 10 sensors using 2 analog and 5 digital pins.
For even better sensor lifespan, use an H bridge and switch the direction of the current on each read. (design left as an exercise for the reader.)
You can actually connect up to 8 sensors to each digital output for a total of up to 48 soil moisture sensors on a single Pro Mini + NRF24 and more if you want to resort to port expanders. (As stated before, port expanders are not really realistic due to them costing about the same as a whole Pro-Mini.) Not all Pro Minis expose all 8 analog pins, choose one that does if you want the most possible sensors.