Pre-story: there's an analogue speaker connected to some circuit (wireless doorbell really).

I want to figure when speaker becomes active (i.e. produces some sound). Basic measurements show there's +2.6V whenever speaker is active. I do not need to know the voltage or current on the speaker (so there's no need for ADC), just the fact the signal is there. 2.6V seems to be close enough to HIGH - but the tricky question is how to measure this.

Very schematically the circuit is drawn here:

schematic circuit

The question is: how can I detect the speaker is active using GPIO, ideally without ADC?


The signal to the speaker is most probably an alternating current of audio range frequency. I suggest you arrange a half or full wave rectifier to convert the signal to direct current and sum it on a capacitor with a drain resistor. Set up an interrupt to call an interrupt handler function when the voltage rises above some trigger level. Alternately, poll the GPIO line to see if the voltage is up. You may need a voltage divider or zener diodes to make sure you do not let the voltage to the pi rise above 3.3VDC. Google "audio detector circuits".

  • I'd also put a series resistor between the detection circuit and the GPIO (1kΩ to 10kΩ).
    – Chris H
    Feb 25 '16 at 8:55

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.