Below is the issue I am facing, any help would be really appreciated. Please note I am a rookie in the field of electronics so forgive me if I haven't provided enough information, I am happy to provide any additional information.

My Goal

I would like to use a RaspberryPi to open a door by controlling the doors buzzer.

My Problem

As soon as I connect both wires of the buzzer to the optocoupler, the buzzer activates, regardless if the RaspberryPi (the LED) is on or not.

It is my understanding however that the buzzer should not activate until the RaspberyPi is on. I.e. the problem is, is that the buzzer's circuit closes as soon as I connect it to the optocoupler.

My Setup

A RaspberryPi and a door buzzer circuit are coupled together using this optocoupler. By turning on a pin on the RaspberryPi, the LED lights up and the optocoupler should close the buzzer's circuit.

Raspberry Pi uses Optocoupler to turn on buzzer

Credit for the image goes to user daniel-crane created the diagram for question #213621. It has been slightly modified

What I have tried

  • Instead of the buzzer, I have used an LED (power source and ground are provided by the RaspberryPi using a different pins. In this case, the optocoupler works as it excpected; i.e. the LED replacing the buzzer will only light up if the RaspberryPi's LED is on.

Please help!


  • \$\begingroup\$ I'm guessing your 'door buzzer' runs on AC. DO you know what voltage? That opto is meant for DC, so it's VECO: 7Vreverse voltage spec is probably being violated for every AC half-cycle... \$\endgroup\$ – brhans Apr 11 '17 at 14:54
  • \$\begingroup\$ I've done this before without any Pi which is overkill, but I see you want to make an error free door buzzer. Layout, power , wiring type , sources of stray interference and schematic are essential inputs to resolve. The problem may be due to Magnetic Buzzer pulse currents spew EMI in your layout, which can be fixed. Use twisted pair or very short leads for Magnetic pulse currents and good ground to nearby decoupling cap \$\endgroup\$ – Sunnyskyguy EE75 Apr 11 '17 at 15:08
  • \$\begingroup\$ Give buzzer specs and power source used with wire type and length with specs in a simple drawing \$\endgroup\$ – Sunnyskyguy EE75 Apr 11 '17 at 15:20
  • \$\begingroup\$ @brhans I think you might be right about the AC vs DC! Thanks for the tip!!!! \$\endgroup\$ – Dan Apr 12 '17 at 9:58

The opto-coupler output is probably inappropriate for switching on the buzzer. Many door "buzzers" run on AC line power. The little transistor in the opto-coupler can't handle that voltage, and only works for current in one direction.

Loose the opto-coupler and use a relay instead. The digital output won't be able to drive the relay directly. You need a transistor in between to amplify the current. There are many examples of how to drive relays from digital signals on this site. Here is one example.

  • \$\begingroup\$ Thanks Olin! Perfect response, I completely understand it. I'll get a relay, try and amplify the current and give it a go. update to come... \$\endgroup\$ – Dan Apr 12 '17 at 9:58


simulate this circuit – Schematic created using CircuitLab

The Opto Isolator series R is about the same as a low current Relay.

This choice is not the problem.

Rather it is the area loop and magnetic Buzzer pulse current is RF and must be contained in long wires by decoupling cap near buzzer (e.g. 0.01uF across buzzer and twisted pair wires thru-out.

One can also put a small RF cap (0.01uF) across relay coils or Opto isolator Diode or collector to reduce antenna coupling effects.

  • \$\begingroup\$ thanks for the suggestion Tony, I don't entirely understand it but I have the jist, Google will help me translate what I don't understand :D \$\endgroup\$ – Dan Apr 12 '17 at 10:00
  • \$\begingroup\$ dI/dt Current loop noise becomes false trigger... thus stays on. eliminate loop area and filter spikes with cap on Buzzer.. Relay may make it worse or better but not best \$\endgroup\$ – Sunnyskyguy EE75 Apr 12 '17 at 13:31

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.