I would like to create a voltage tester like the one described in this video, using 555 ic, and then connect it to Raspberry Pi, in order to log the frequency a 220V waterpump is switched on.

My questions are:

  • How should I connect it to the Raspberry Pi? Should I connect it to a PWM pin?
  • Do I need some extra components to protect the device or get more accurate readings?
  • The Raspberry Pi does not have any analogue inputs and PWM is (usually) an output. The circuit shown in the video is operating at 9v so you'd need to either change that or do some level-shifting. There might be better suited ways of detecting the current flowing through a mains cable from your Pi. Mar 19 '19 at 16:06
  • As @RogerJones has indicated, you could do that, but there will be some minor challenges in interfacing the device you linked with the RPi. Have you considered the alternative of perhaps spending a little more $$, and perhaps doing a little less work? There are many commercially-manufactured current sensors that might meet your objectives. Here's one (as an example) for about $28.
    – Seamus
    Mar 19 '19 at 16:39
  • @Seamus In the proposed solution, can I place the wire bucket as is or do I need to split the wires and pass only one of them? I don't want to measure current, just know when pump is on or off.
    – Marinos An
    Mar 19 '19 at 17:00
  • An MCP3008 chip will let you read analog when properly connected to a Raspberry Pi, but you would need to read additional guides on how to connect it. Also, as others noted, be mindful of the voltages going in.
    – Brick
    Mar 19 '19 at 17:35
  • 1
    I assume the 555 Vcc is 5V. I guess the 555 oscillates when the copper wire antenna picks up the AC mains signal nearby. So the problem is how to detect the 555 oscillator AC output at pin 3. One method is to use a very simple RC (resistor + capacitor) low pass filter to convert the AC signal to roughly DC signal. In other words, the low pass filter output is roughly 5V when water pump is on. You need to use a potential divider to shift down the roughly 5V signal to around 3V, which can can be read by any Rpi GPIO pin.
    – tlfong01
    Mar 20 '19 at 6:06


Let me first summarize the OP's question.

He has a 220VAC water pump. He knows that a 555 IC can tell AC current on by blinking a LED. His question is how to let Rpi talk to 555 to find the pump is on or off.


I am guessing how 555 detects AC current.

As soon as the AC current passes a wire, electromagnetic field is created. The electromagnet field induces a small 50Hz voltage/signal on the ugly looking DIY copper wire antenna which is connected to 555's trigger input.

When the AC signal is high enough, 555's monostable timer starts and stops in less than 1/50 second. The AC signal cycles every 1/50 second, so is the timer, which now outputs a 50Hz square wave signal, when water pump is switched on.


Now let me suggest a quick and dirty answer.

Let Rpi repeats reading 555 output, say 10 times, in 1/50 second, and taking the average. If water pump/current is on, the average should be somewhat high, else very low.


OP's Original Video Reference on 555 Timer Based AC Current Detector https://www.youtube.com/watch?v=vp-IbQC6KK0

NE555 Timer Datasheet - Texas Instruments http://www.ti.com/lit/ds/symlink/ne555.pdf

555 Timer Tutorial - Electronics Tutorials https://www.electronics-tutorials.ws/waveforms/555_timer.html

555 Timer Circuits - All About Circuits https://www.allaboutcircuits.com/textbook/experiments/chpt-8/555-ic/

ACS712 AC/DC 5A Current Sensing Module Summary https://penzu.com/p/e0b38806


enter image description here

NE 555 timer in monostable mode

  • One can also use an interrupt driven counter. Also, PWM will show up as an analog voltage so can be read using an ADC
    – crasic
    Mar 21 '19 at 4:54
  • Yes, 555 output can interrupt Rpi which updates a counter, instead of Rpi looping. I am not too sure if 555 recycling monostable looks like PWM, so I am using a sine wave signal generator to simulate AC mains antenna output, and feed to 555 trig input to see if 555 indeed does what I guess. A first trial looks good. You might like to look at my scope display results - penzu.com/p/e0b38806
    – tlfong01
    Mar 21 '19 at 7:33
  • @crasic: Yes, using ADC to measure current magnitude is a good idea. The NE555 timer method only checks current or no current, which is useful for the OP, because he only wishes to know if the water pump is on or off. I am playing with DC motor and needs to measure current magnitude using ADC, and I found ADC712 module good. You might like to see more details in my PenZu journal penzu.com/p/e0b38806
    – tlfong01
    Mar 21 '19 at 14:40
  • Also no need to blink any LED. Now Rpi detects signal, no need to set monostable to less than 1/50 second. Can set it longer to say, one second. As soon as the first AC signal comes up, 555 will start its monostable, and stop one second after the AC signal goes away. The accuracy is one second, but the OP does not care. Also no need to use low pass filter, Rpi GPIO can directly read shifted down output, or let event driven interrupt do the job. I guess my quick and dirty answer is more or less coming to an end. I will exit thread to ACS712 which is off topic of NE555 here.
    – tlfong01
    Mar 22 '19 at 2:20

Use either a microcontroller with built-in ADC (ATMega/Arduino/etc) or dedicated I2C/SPI ADC chip, then design input protection and voltage divider circuitry suitable for the input voltages required to convert them within your ADC's range (0-3.3V or 0-5V are common). A voltage divider works for DC circuits, probably want a clamping diode to protect your circuit if the voltage goes over the maximum value, and an inline resistor to limit current into the ADC input. For AC, you'll need more sophisticated circuitry to convert the AC to DC for measurement (see true RMS multimeters).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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