I have spent the past few days trying to reverse engineer a capacitive moisture sensor I ordered from eBay a while ago. The particular one I received looks like this:
What fascinated me about this sensor was that I could put it in a plastic bag and it would still be able to give accurate moisture readings. In air, the output voltage of the sensor is about 2.3V; in water, I am getting around 0.7V when submerged directly and 1.6V when submerged in a plastic bag. After analysing the circuit, I came up with this schematic (Note: I have left out the voltage regulator and the four corresponding caps, because I am feeding in 3.3V DC from my bench supply directly):
I then built a prototype on a breadboard, which gave me this result:
Unfortunately, my sensor does not work as well as the one I bought, because the voltage drops seem to be a lot smaller.
The output voltage in the air is the same. But when submerging it directly in water, I am getting 1.6V (as opposed to 0.7v for the bought one). When submerging it in a plastic bag, I can only see a voltage drop of 10mv to about 2.29V.
I have already re-measured the component values several times and also buzzed out all the traces again to make sure I got the connections right, but I obviously must be missing something.
One thing I have noticed while testing is that decreasing the value of C1 from 23nF to something like 470pF causes larger voltage drops, which makes my custom built sensor behave more like the bought one. But I’m still far from what I would like to see.
I’m an electronics beginner and this is one of my first reverse engineering projects, so any advice/tip would be greatly appreciated. I suspect that there is something wrong with my 555 timer circuit, but since I don’t have access to an oscilloscope, I could not really confirm that idea so far.
SOLUTION: I finally managed to get my custom sensor to work like the bought one. To make it work, I did the following:
- Replace all electrolytic capacitors with ceramic ones
- Added a 100nF ceramic capacitor between VCC and GND
- Change the value of C3 from 40nF to 10nF
- Change the value of C1 from 23nF to 470pF
Also, the 555 chip used makes a huge difference. When using a TI NE555DR, I doesn’t work as well as when using the original NE555 of the bought sensor.sensorcapacitancereverse-engineeringhumidityshareedit follow flagedited 4 hours agoasked yesterdayAlexander Richter4333 bronze badges New contributor
- 1please draw a properly formatted schematic … power at top, ground at bottom, input on left, output on right … C1, R2, R3 should be drawn in vertical orientation … same for C2, R4 … U1 should be turned 90 degrees clockwise – jsotola yesterday
- 1@jsotola the schematic is laid out so that the components are placed and rotated exactly like they are on the PCB. I thought it would be easier to follow this way… – Alexander Richter yesterday
- 1definitely not easier to follow … a schematic diagram is not a wiring diagram … it does not represent component placement … it represents the electrical relationship between components … also, never draw lines through components, like you did between pin 2 and pin 6 – jsotola yesterday
- 1does the probe have only one wire going into the dirt? – jsotola yesterday
- 1No, it does have two wires: 1) the one labeled PROBE in the schematic/wiring diagram, and 2) one connected to ground – Alexander Richter yesterday
- 1I can see C1-6 on the ident in the photo. You “left out the voltage regulator and the four corresponding caps” so there should be two remaining in your circuit. The circuit diagram shows C1-3? Are you sure which caps belong to the power section and the sensing section? – mhaselup yesterday
- 1The link to eBay shows the circuit incorporates a probe on the PCB. In your implementation are you using the same probe section or is your probe implemented as a couple of wires going into the soil/water? Could the original item have capacitance in the probe that isn’t present in your implementation? – mhaselup yesterday
- 1@mhaselup The caps at the input are connected like this: C5 & C6 are connected in parallel to VCC and GND. Then comes the linear voltage regulator U2, which is not present in my particular model. Instead, it is jumped using a 0 ohm resistor. Then, caps C1 & C2 would be connected to the output of the voltage regulator and to ground, and they’re also connected to the 555 chip where it needs input voltage. But since there is no regulator present on my model, C1 & C2 also just connect across VCC and GND. – Alexander Richter yesterday
- 1@mhaselup as for the probe capacitance: I have cut off the probe section of the PCB and soldered wires to it, so I guess it should work. When I reconnect it to the original PCB using the wires, I do observe the correct behavior… Can I somehow measure the capacitance of the probe? – Alexander Richter yesterday
- @Alexander Richter, you are indeed a ninja grade electronics reverse engineer. I am glad to join in the chat for the following reasons: (1) To improve my broken English, (2) To improve my photography skills, (3) To learn eBay marketing and product evaluation and quality assurance and control skills. (4) To learning capacitve measurement, which I have zero knowledge and experience (I do know quite a lot of the 555 thing) / to continue, … – tlfong01 9 hours ago
- I have played with a couple of moisture sensors, all of which are not capacitive, and this let me feel inferior. Anyway now let me search my junk box for any capacitive moisture sensors, before I join in the chat group. I will be back. – tlfong01 9 hours ago
- Now I have found some moisture sensing stuff, and took a picture for reference in our coming chat sessions. “tlfong01’s Moisture Sensor and NE555 Timers”: i.imgur.com/RfMZHhn.jpg. I remember I have some more sensors identical to the OP’s from eBay, so I will carry on searching. I will be back. – tlfong01 8 hours ago
- So I have found the capacitive sensors seemingly identical to the OP’s. They have been lying in the junk box for a long while, collecting dust. Anyway, I have also taken a picture, but Imgur did not allow me to upload any more pics and told me to come later. I guess they have placed my name in a long queue for boring pictures, and my experience is that I have a wait for next day. I am impatient to wait. So I am drafting an answer to place my photos and perhaps schematics there, so the crowd can chat, referring to my uploads. – tlfong01 8 hours ago
- 1@tlfong01: I hate to curb your enthusiasm but “I am glad to join in the chat for the following reasons:” is not appropriate. SE sites aren’t chat sites and the comment section is for clarification on questions and answers although a moderate amount of side-comments is tolerated. Can you delete the irrelevant comments above to clean up (and I’ll delete this). There are chat rooms and Meta for the other stuff. – Transistor 2 hours ago
- @Transistor, Many thanks for your advice. So I will delete my inappropriate comment about chats. Cheers. – tlfong01 21 secs ago Edit
- You’re using a bipolar 555 and the original obviously has a CMOS TLC555 (marked TL555). There are a number of differences aside from power supply current draw including greater output swing (particularly noticeable on a 5V supply).
- Diode on the original is probably a 1N4148 or similar. A 1N400x is too slow for this application.
- I would expect C1 to be more like 470pF.
- You are using an electrolytic capacitor for the filter, which may be too leaky for the 1M resistor. It may be okay, but you should be aware of the distinction between a ceramic capacitor (10G or 0.5nA max leakage at 5V) and an electrolytic (maybe 3uA leakage after 1 minute maximum) which is 6,000 times worse.
- 11. You’re right. The 555 on the product photo is actually a TL555, but the PCB I received has a chip labeled “NE555 69M GM184 64” on it. Does that still make a difference? I have already tried swapping out my 555 for the one on the original PCB by using a breakout adapter board, but I only see a very minimal improvement. 2. In my actual build, I am already using a 1N4148. I have updated my schematic accordingly. 3. & 4. I will try that out later today, maybe that is in fact the way to go. – Alexander Richter yesterday
How come my reverse engineered capacitive moisture sensor not working?
Now I am calibrating my capacitive moisture sensor.
/ to continue, …
/ to continue, …
Appendix A – The OP’s Capacitive Moisture Sensor v1.2
Appendix B – tlfong01′ Collection of Moisture Sensors
Appendix C – Capacitive Sensor Schematic by Alsan Parajuli
Appendix D – NE555 Astable
Appendix D – Moisture Sensor IC/MCU
- 1How does this answer the question? – ocrdu 1 hour ago
- @ocrdu, Ah thanks for pointing out that actually I have not yet come to the main part of the question, how to reverse engineer the sensor. My plan is to use a scope to check out the oscillation, and then compare with the 555 oscillator, and then find the value of the capacitance, and how it values varies with the percentage immersed in water. In other words, I am just preparing the prerequisite for answer. The prerequisite is also for other newbies who want to know how to do reverse engineering. Stay tuned. – tlfong01 3 mins ago Edit