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 23 hours agoasked 2 days agoAlexander 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 2 days ago
- 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 2 days ago
- 2definitely 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 2 days ago
- 1does the probe have only one wire going into the dirt? – jsotola 2 days ago
- 1No, it does have two wires: 1) the one labeled PROBE in the schematic/wiring diagram, and 2) one connected to ground – Alexander Richter 2 days ago
- 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
- 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 yesterday
- 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 yesterday
- 3@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 21 hours ago
- @Transistor, Many thanks for your advice. So I will delete my inappropriate comment about chats. Cheers. – tlfong01 18 hours ago
- 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
- 1How did you go? – mhaselup 5 hours ago
How come my reverse engineered capacitive moisture sensor not working?
1. Troubleshooting suggestions
Suggest to troubleshoot from the NE555 astable. Check out test points TP1 (NE555 Output Pin 3), TP2 (Before rectifying diode), and TP3 (Sample and hold cap), using a scope or a status LED.
Scope show the open air frequency is around 360 kHz, output around 2.5V
Update and apologies 2020sep26hkt1137
Clarification on the way I am answering the question
My apologies to all those misled by me that I have suggested an answer. Actually I have not yet started! So far I have been writing appendices that describe the prerequisite knowledge that is need to understand the OP’s problem.
It is only after understanding the circuit then we can efficiently troubleshoot the OP’s already reverse engineered NE555 based capacitive moisture sensor.
Of course the OP might have already understood the circuit, but I am not sure if I correctly understand thoroughly myself. So I am sort of doing some research which I think other newbies or future readers might also learn together.
What I have research so far
(1) I started by a preliminary inspection of the three mositure sensors to get a overall picture of capacitive sensor, and why and how it is different from resistive sensor. Basically the capacitance is referring to that of the long metallic blade inserted into the soil, or just in open air if used as a rain detector.
(2) I studied the operation of the NE555 based astable (oscillator) and understand that the capacitance is referring to the capacitor used in the NE555 circuit.
(3) I did a basic test to make sure the moisture sensor I am testing more or less works properly.
(4) I am thinking of trying the following next, / to continue, …
Comments and counter suggestions welcome.
/ 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
Appendix E – Calibrating the Capacitive Sensor
Now I am calibrating my capacitive moisture sensor.
Appendix F – Grove Capacitive Moisture Sensor Schematic/Wiring Diagram/Eagle Gerber Files
Appendix G – The OP’s reverse engineered capacitive moisture sensor wiring diagram and bread broad photo
Appendix H – Capacitive Soil Moisture Sensor V1.2 Components Layout
Appendix I – NE555 Datasheet Summary
Appendix J – NE555 Astable Operation Parameters
Appendix K – Scope display of NE555 Output at Pin 3 when sensor is in open air
- 2How does this answer the question? – ocrdu 19 hours 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 18 hours ago
- @ocrdu. So I have suggested the first troubleshooting trick for the OP. Please feel free to ask me to clarify any parts not clear, or suggest other troubleshooting approaches. Cheers. – tlfong01 1 min ago Edit