My interphone's buzzer receives an AC voltage of 12V. I would like to substitute this buzzer with an embedded board (raspberry-pi).

What would be the ideal way of converting such voltage to 5V DC?

(I have also noticed that when the buzzer goes off, the voltage changes from ~0V DC to 0.3V DC if that might be relevant)

  • \$\begingroup\$ 5V, instead of 3.3V, which is the maximum input voltage for RPi GPIO? \$\endgroup\$ – Matti Virkkunen Apr 10 '16 at 15:48

To clarify, it seems you want to detect the presence of 12 V AC in a processor that apparently has 5 V digital inputs.

Here is a simple circuit:

The positive halves of the AC input signal will turn on the transistor, which drives the output line low. D1 prevents the transistor from getting damaged by excessive B-E reverse voltage during the negative half of the input waveform.

The output will pulse at the AC input frequency. This can be easily dealt with in firmware similarly to switch debouncing. For example, let's say the input AC frequency is never less than 50 Hz. That means a complete cycle takes 20 ms or less, with the output low for roughly half that time. Consider the AC input to be present within 15-20 ms of the output being low.

If this is just supposed to react on a human time scale, then you can use 50 ms debouncing. I've found that to be just below where humans perceive a delay from pressing a button to a perceived action.



simulate this circuit – Schematic created using CircuitLab

Figure 1. Opto-isolated signal detector.

An opto-isolator electrically isolates and protects your micro from the AC and eliminates any ground-loop issues.

  • R1 limits the current to about 10 mA rms.
  • D2 provides reverse voltage protection for the opto-LED, D1.
  • D1 will illuminate on positive half-cycles of the 12 V AC signal.
  • Q1 will pull the GPIO pin low when the LED is on.
  • R2 will pull the GPIO pin high when the LED is off.
  • \$\begingroup\$ Yup. Default R value is 100. I missed it. Thanks. \$\endgroup\$ – Transistor Apr 10 '16 at 14:15

Have you considered a full wave rectifier with a voltage divider? Sorry I can't draw one up (on mobile), but here is one I found from kswichit.com:

enter image description here

Pretend the transformer is providing the 12 or 14 V you specified instead of the 9 V shown. The idea is the four diodes turn the AC signal to DC, and the divider lets you tune the output voltage to whatever you want (5 V in your case).


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.