I"m using esp32 as soil moisture sensor. Its powered by a 5v adapter, to the VIN and GND pins. The capacitance probe is powered from 3v3 pin. The readings are 15% higher right at sundown, meaning lower voltage; and 15% lower right at sunup, meaning higher voltage. My house is powered by the mains. I don’t have solar panels. Mains voltage also varies per night and day, but only slightly and gradually - and I’d expect to see the inverse, since higher moisture % means lower voltage and visa-versa.
I also thought I read somewhere that the esp32 3v pin puts out a constant 3v regardless of voltage input, provided that it’s in an acceptable range.
It’s not really a problem for me, as it still provides an adequate estimate as to when to run the soaker (it’s for my foundation), but more of a curiosity. My best guess is that the city (San Antonio, Texas) switches from solar to gas providers or something, but I would expect to see a closer correlation to the house input voltage.
Can anybody guess as to the cause of this sudden ADC reading, apparently correlated by the sun? Is there an electronic way to level it out?
I considered that, but ruled it out, because (1) I have 2 other moisture sensors, though they’re esp8266 and battery powered, that’re in direct sunlight yet provide consistent readings; (2) neither sunlight nor temperature change as dramatically as the ADC readings; and (3) this sensor is in the shade and under rocks
You have to think in the big picture too.
People cooking meals at morning and evening, making coffee in the morning, lights coming on, industry starting up/shutting down and so on.
It can actually affect the electric grid a lot and if you have old electrical clocks that working on just the frequency in the electric grid then you will see them lose and gain time compared to digital clocks based on crystals.
Some of these events might also correlate with sun set and sun rise now but might not at other times in the year where sun set and sun rise have moved, which might not be the case for cooking and industries.
If it is the case of fluctuations in electric grid, then running the sensor on a large power bank should show you another result.
Thanks for your response. I think the peak and trough of the house’s input voltage shown in the bottom graph reflect the rise and fall of demand on the grid, noting that it is more of a curve than a sudden 15% shift of the ADC readings, which are strikingly correlated to the sun. I added that input voltage graph (from a UPS) to discount the correlation.
Was your UPS connected to the grid when you did this?
Are you sure your UPS is correct those fluctuations?
Normally an UPS will not draw directly from the battery when it is connected to the grid, because if the battery fails, then the power supply from the UPS will fail also.
Yeah. This is the voltage reading from the mains, not the battery. All the UPSs throughout the house show the same-ish voltage at the same time throughout the day, so the one I used as a reference is as accurate as far as consumer UPSs go. In any event, they all show a curve, not a sudden shift like the ADC.