Please note that an open analog input produces magic values. You need to have a defined potential, otherwise it reads rubbish. So either pull it up or down or connect an analog output device to it, but reading open leads is useless ;=) If you want to find out more search for pull up resistors
I agree . . but This Thread , the way I read the posts, seems to indicate that the ADC inputs on the Farmduino board do have pullups enabled “by firmware default” (?)
{ This might be a huge ASSUME by me }
Can some kind person post a link to the Farmduino v1.4 board electronics schematic ?
That would be awesome ! I’m struggling to locate it.
Hey, no, there are no pullups in the schematic, afaik. And yes, the pullups are enabled on all analog input pins in Arduino firmware (farmbot_arduino_controller.cpp) to reduce the number of things that can go wrong with unused ports. The default soil moisture sensor seems (!?) to provide enough current to outvote the pullup. Experimenting with other sensors like capacitive moisture sensors or distance sensors will generate wrong values due to the enabled pullups.
At the moment there are two solutions:
compile custom firmware for Arduino with pullup disabled (until next automatic firmware update…)
use this farmware
(3.) wait until new scheduled software fix in webapp, introducing a pin type “analog_no_pullup”
Analog pins without pullups and nothing connected read as random values, as can be tested using the above farmware on an unused pin.
Poking the moisture sensor twice in the same place, right after another, returns dryer readings the second time. This is due to a thin layer of air along the sensors surface in the second measurement. At least this is a result, I get repeatable with a capacitive sensor.
Hi JoeHou,
I run the “Set Pin IO Mode” farmware with 0 for “input” in the beginning of any sequence measuring soil moisture. The readings I get, are between 370 (soaking wet) and 570 (air). This should correspond to 1.8V - 2.78V as sensor reading (the 10 bit A/D converter returns increments of 5V/1024).
I use a “homeengineer capacitive moisture sensor”
Its analog output voltage is 0-3V, so this corresponds fairly well. The values are quite stable although I do not have any experience with the temperature drift yet (still winter here).
Possible that some pins have additional connections on the board and behave differently therefore. I have my sensor wired on pin 59.
Georg (qurzschluss)
Hi @qurzschluss, due to my problems with the standard moisture sensor, I bought exactly the same capacitive sensor and mounted it to the UTM.
Then I tried naively just to read the sensor, but it didnt bring back senseful values.
I’m a software developer, but less a hardware guy and not too deep into arduino stuff.
I understand from your post that I need to set the “Pin IO Mode” somehow, could you explain in more details what needs to be done here?