Hello Forum members! I recently picked up a few Pico W boards and have been successfully running the example programs inside the Arduino IDE. I then picked up some soil moisture capacitive sensors with the goal of recreating Bill's IoT plant moisture sensor system. But I'm stuck at the calibration step/sketch. No matter what I do, the ADC reads zero, no exception. I've even probed the pins with my voltmeter and I can see varying voltages 0.8 - 1.9v (between ground and ADC0 pins) as I bring my arm near the probe. (Soil theremin, LOL.) I've tried both my pico W boards, so it seems more likely that I'm doing something wrong. Any suggestions?
For what it's worth, I've experimented using ADC0 vs 1 vs 2 (pins 31,32,34); using 3v3_OUT (pin 36) vs ADC_VREF (pin 35) for power; jumpering pins 35 & 36 together.
I've googled around as usual, but haven't found a solution yet.
Thanks for your help!
(Soil theremin, LOL.)
Ha, good one!
I'm curious, what voltage are you gettting from the ADC_VREF pin.
Tom
To err is human.
To really foul up, use a computer.
@thrandell Pin 35 (ADC_VREF) is +3.26v above pin 33 (GND). Pins 35 and 36 (3v3(OUT)) appear identical on my voltmeter.
An update: I got something working a different way, but I still lack understanding...
To simplify my problem, I removed all the probe stuff, and tried just reading ADC4 (the pico w's built-in temperature reading). Again, thru the Arduino IDE, everything came back zeroes.
But then I followed a MicroPython tutorial, and this worked. The "adc = machine.ADC(4)" followed by "voltage = adc.read_u16()" gave me a reasonable and always-slightly-changing number. Bingo!
I then used this same approach to read "machine.ADC(0)" (my soil probe), and to blink an LED when the probe is "too dry" (based on my wet/dry calibration measurements.) This appears to be working fine.
So why didn't the Arduino IDE method of "sensorval = analogRead(0)" work? It's almost like it's addressing the wrong pin..? (I'm always uneasy about hardcoding numbers like "0", instead of using manufacturer-provided, board-specific constants like "ADC0" or "GPIO15").. I'd appreciate whatever insight anyone can offer. Thanks!
(p.s. I can post my microPython code if anyone wants it, but it essentially just follows the linked tutorials above.)
To err is human.
To really foul up, use a computer.
@dk55432 As a rule using supplied constants is advised over hard coded numbers. Not sure why you were fooling around with some of those other pins and shorting pins together, Bill's sketch and wiring diagram is very simple.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.