4
\$\begingroup\$

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:

original pcb

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):

sensor schematic v2

I then built a prototype on a breadboard, which gave me this result:

enter image description here

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.

\$\endgroup\$
13
  • 2
    \$\begingroup\$ please 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 \$\endgroup\$
    – jsotola
    Commented Sep 23, 2020 at 23:25
  • 1
    \$\begingroup\$ @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... \$\endgroup\$ Commented Sep 23, 2020 at 23:28
  • 3
    \$\begingroup\$ definitely 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 \$\endgroup\$
    – jsotola
    Commented Sep 24, 2020 at 1:03
  • 1
    \$\begingroup\$ does the probe have only one wire going into the dirt? \$\endgroup\$
    – jsotola
    Commented Sep 24, 2020 at 1:49
  • 3
    \$\begingroup\$ @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. \$\endgroup\$
    – Transistor
    Commented Sep 25, 2020 at 10:04

2 Answers 2

7
\$\begingroup\$
  1. 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).

  2. Diode on the original is probably a 1N4148 or similar. A 1N400x is too slow for this application.

  3. I would expect C1 to be more like 470pF.

  4. 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.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ 1. 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. \$\endgroup\$ Commented Sep 24, 2020 at 7:24
  • 1
    \$\begingroup\$ How did you go? \$\endgroup\$
    – mhaselup
    Commented Sep 26, 2020 at 1:48
3
\$\begingroup\$

Question

How to troubleshoot a NE555 astable based, capacitive moisture sensor?

sensor physical layout

layout 2


Answer

Update 2020sep27hkt0904

Calibrating 4 capacitive moisture sensors. I also used a scope to test the NE555 pin 3 output and found all 4 sensor have 360 kHz square waves with very little deviation, perhaps less than 10%.

I noticed that the OP, me and Grove use different values for Ra, Rb resistors. I don't know the capacitance of the blade to test moisture. So I think I need to use a NE555 with fixed (Ra + 2Rb) value to test the effect of the astable output, while changing the blade contact with water, ...


Update 2020sep26hkt1508

1. Troubleshooting suggestions

richter 3

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

scope display 1


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 researched so far

(1) I started by a preliminary inspection of the three moisture 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 also thinking of using a bread board to test the circuit with different values of Ra, Rb, C1, and C4.

excel 6

/ to continue, ...


References

(1) Analog Capacitive Soil Moisture Sensor Corrosion Resistant With Cable v1.2 - eBay €5/5 pieces

(2) Capacitive Soil Moisture Sensor Tutorial (with schematic) - Alsan Parajuli, IotProjects, 2020feb02

(3) Calibration and Validation of a Low-Cost Capacitive Moisture Sensor System, E Achchillage etal, Saitama University, Japan 2019jul04

(4) 555 Timer Tutorial - Electronics Tutorials

(5) NE555 Timers Datasheet - TI

/ to continue, ...


Appendices

Appendix A - The OP's Capacitive Moisture Sensor v1.2

op's sensor


Appendix B - tlfong01' Collection of Moisture Sensors

tlfong01 collection 1/2


tlfong01 collection 2/2


Appendix C - Capacitive Sensor Schematic by Alsan Parajuli

(2) Capacitive Soil Moisture Sensor Tutorial (with schematic) - Alsan Parajuli, IotProjects, 2020feb02

moisture sensor schematic


Appendix D - NE555 Astable

(4) 555 Timer Tutorial - Electronics Tutorials

ne555 astable


Appendix E - Moisture Sensor IC/MCU

moisture sensor IC/MCU


Appendix F - Calibrating the Capacitive Sensor

Now I am calibrating my capacitive moisture sensor.

moisture sensor calibration


Appendix G - Grove Capacitive Moisture Sensor Schematic/Wiring Diagram/Eagle Gerber Files

grove schematic


Appendix H - The OP's reverse engineered capacitive moisture sensor wiring diagram and bread broad photo

op cct 1


Appendix I - Capacitive Soil Moisture Sensor V1.2 Components Layout

sensor v1.2 layout


Appendix J - NE555 Datasheet Summary

ne555 spec summary


Appendix K - NE555 Astable Operation Parameters

astable operation


Appendix L - Scope display of NE555 Output at Pin 3 when sensor is in open air

scope display 1


Appendix M - Trying to Duplicate The OP's Experiment Part 1

all in one images


Appendix N - Frequency Calculation

sensor physical layout

-----------------------------------------    
             R1         R2      C1
-----------------------------------------
tlfong01    10k        2k2       -
SeeeStudio  1k5        2k4     470pF
Richter     330?       1k6     23nF
----------------------------------------

calculation


\$\endgroup\$
3
  • 3
    \$\begingroup\$ How does this answer the question? \$\endgroup\$
    – ocrdu
    Commented Sep 25, 2020 at 11:28
  • \$\begingroup\$ @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. \$\endgroup\$
    – tlfong01
    Commented Sep 25, 2020 at 12:30
  • \$\begingroup\$ @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. \$\endgroup\$
    – tlfong01
    Commented Sep 26, 2020 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.