Raphael Profile picture
Mar 3, 2021 13 tweets 3 min read Read on X
Here’s the fascinating way these capacitive soil moisture sensors work. Image
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. An RC circuit
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: Capacitor charging 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: Capacitor charging curve fo...
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: Image
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
 

Keep Current with Raphael

Raphael Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @rbaron_

Aug 1, 2022
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.
Read 21 tweets
Feb 9, 2022
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: A rusty printed circuit board
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.
Read 18 tweets
Aug 15, 2021
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.
Read 23 tweets
May 30, 2021
I spent some time this weekend looking into another cheap smart watch. This ones sells for $17 on AliExpress Watch & box
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
Read 17 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(