1

I am working with the GPIO, successfully connected a couple things already. Now I have the following challenge when connecting a door bell to the GPIO:

  • I can use the voltage that's going to the speaker
  • at the speaker the voltage (vs ground) is 15,5V
  • ringing the bell moves the voltage to 12,5V, i.e., there's ~3V over the speaker
  • I want to use the GPIO input to detect this change

When I part the Voltage to ensure not to put more than 3,3V to the GPIO, the difference in Voltage is not big enough anymore to reliably detect the change as logical 0 / 1.

How can I best do this?

Thanks a lot for your help!

  • Hello and welcome. So you say that there's 15.5V (DC?) at the speaker if it is not ringing and 12.5V (AC/DC?) when ringing? – Ghanima Nov 14 '16 at 9:25
  • Yes, I believe so. That is measured against ground. In the system itself it's 0V over the speaker normally and -3V when ringing. – fluxon Nov 14 '16 at 10:16
  • Is there any current flowing in the circuit when the bell is not ringing? – Bex Nov 14 '16 at 11:01
  • 2
    A little more insight into the circuit would be helpful to understand what is going on here. Could you try to draw some crude schematics from what you could figure so far? If there's 0V across the speaker (off) then there is no current flowing which means that the 15V are not driving the speaker. Is the speaker connected to ground at all? – Ghanima Nov 14 '16 at 12:03
  • Without knowing anything more it is hard to tell but maybe things like this could help epanorama.net/circuits/telephone_ringer.html – Ghanima Nov 14 '16 at 12:03
1

If ringing the bell puts ~3V over the speaker (and I assume there's ~0V when it's not ringing), that voltage could be detected by the GPIO directly. Assuming the RPi and your doorbell have separate GND, you can just connect the GND of your RPi to the negative terminal of the speaker and the the GPIO pin to the positive terminal. If the voltage is AC (or you're not sure which terminal is which), you can use a diode bridge to rectify. Adding a zener for overvoltage protection may also be a good idea. So:

schematic

simulate this circuit – Schematic created using CircuitLab

0

If you want to have 0 in case of 12.5V and 1 in case of 15.5V, then you need another circuit called Subtractor (http://www.electronics-tutorials.ws/opamp/opamp_5.html). The difference is 3V and Raspberry can detect this voltage as 1. It should not be exactly 3.3V. Maybe you will need some zener diodes for overvoltage protection.

  • 1
    This might overcomplicate things a little. One would additionally need a DC power supply that exceeds the voltage level used as signal to power the opamp. If the difference is three volts there is little harm to use a voltage divider first (say 1:3..4) to reduce the input voltage. This would still leave the difference between on/off at an high enough level (a little less than 1V) to be safely detected. So the supply voltage for the amp might be ok at 5V available at the Pi. A comparator might then work and is simpler than a differential amp. However, I still think a passive circuit should do. – Ghanima Nov 14 '16 at 12:13
0

First of all, check if it's AC or DC in there. If it's AC, you should make it DC using sample diode bridge or you might have unexpected behaviours or even burn some components.

If you have DC, you can divide the problem into 2 parts.

Voltage detection part

I'd go for sample comparator. You can use this calculator to get exact values of resistors you have to provide, so it would switch properly.

enter image description here

GPIO input

I'd suggest using Opto-isolator to avoid unknown voltage going directly to GPIO.

Additional explanation is available on many blogs on the internet, for example http://raspberrypihobbyist.blogspot.com/2012/09/gpio-input-circuit_19.html

enter image description here

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.