Here’s the fascinating way these capacitive soil moisture sensors work.
If we stick them in the ground, we can monitor the moisture level in the soil via its analog output. It spits out a voltage that is proportional to how wet the soil is.
At its heart, it packs a humble resistor and capacitor circuit, like this one.
If we apply a positive voltage to the input, the capacitor C starts to charge up. In an RC circuit like this one, the voltage across the capacitor keeps increasing until it reaches the input voltage. It always follows this characteristic exponential curve:
We can control how fast or slow the capacitor charges up by varying the values of the resistor and capacitor. For example, if we keep the same resistor and try out two different capacitor values, we get:
Intuitively, the larger capacitor (with larger capacitance) requires more charge units to reach the input voltage, and so it takes longer to charge up.
Back to the sensor board. The astonishing part is that the capacitor C in the sensor is not a "real" capacitor. It is, instead, a very crude one, formed by just two copper traces on the board. If we look at it at just the right angle, we can make the large traces out:
If we apply a voltage between these two copper traces, positive charge will start accumulating on the positive side, just like in a regular capacitor, until it reaches the applied voltage.
This parasitic capacitance is usually tiny and undesirable, but this type of sensor cleverly exploits this cool phenomenon by making these copper traces deliberately big.
The last piece of the puzzle is the actual capacitance value of this ghost capacitor. It turns out that the capacitance is a function of the shape of the capacitor (the fixed copper traces) _and_ the material around it. You guessed it - vary the material, vary its capacitance:
When surrounded by water, the parasitic capacitance is larger - it needs more charges to charge up, so its voltage increases slowly, exactly like the slow sketch curve above.
Additionally, instead of a single pulse, the sensor inputs an alternating square signal to the RC circuit, which is why we see the capacitor charging and discharging multiple times in the scope.
The remaining components in the sensor board are responsible for generating the alternating input signal (a 555 IC) and extracting the peak values from the capacitor charging curve - which is what the sensor ultimately outputs.
• • •
Missing some Tweet in this thread? You can try to
force a refresh
This is the story of how daisy-chained a bunch of electronic shelf labels into a panel to decorate my office (a thread)
I had bought two dozen of these little displays after coming across @atc1441’s work. I played around with them for a little while and even made a small contribution to the project github.com/atc1441/ATC_TL…
Flash forward to a month ago. I watched @scottbez’s excellent “How a Split-Flap Display Works” video and was inspired by the idea of stringing the ESLs together to make a larger panel.
When I started working on my soil moisture sensor, I had little idea about how harsh an environment the soil really is. In this 🧵, cool failure modes & solutions when sticking electronics in the ground:
If left completely unprotected, water will slowly creep in when we stick a PCB in soil. In my tests, this takes from a few weeks to a couple of months.
The solder mask adds some protection to the top and bottom of the board, but the edges of the PCB are completely exposed and usually where water gets in first.
I recently joined the very exclusive club of cat printer owners. I spent some time reverse engineering its Bluetooth Low Energy protocol and wrote a little open source client for it. 🧵👇
This is a tiny, battery-powered thermal printer that sells on AliExpress for around $20. It’s meant to be controlled by its proprietary & closed source iOS/Android app. The app connects to the printer via Bluetooth Low Energy (BLE).
I used github.com/skylot/jadx to decompile the iPrint Android app back into Java code and hopefully figure out how it talks to the printer. The result of this decompilation is surprisingly good, but not perfect.
I spent some time this weekend looking into another cheap smart watch. This ones sells for $17 on AliExpress
There is no product name in the box & the marketing pics are a little misleading. The display is not even round, but just a square of 240x240 pixels. It's just glued to the middle of the dial
Inside there's the mysterious HS6620 system-on-a-chip. It's an ARM Cortex-M3 with 128KB of RAM. We can also see an external 1MB SPI flash chip in there