I use my raspberry 1 B+ with a DAC board (like hifiberry) and volumio/moode audio distribution.
The board is working as a pre-amp and it's connected to my hifi amplifier RCAs input, sending analog audio signals.

My raspberry is powered on all day long. As now I have to manually go to the amp and power it on (and off)...

My amplifier has a 3.5mm mono connector labeled "trigger input" (the manual says it works 3-30v AC or DC). That connector allows to turn on and off the amplifier remotely from a master device. You turn on the master device and the amp receives the signal and it wakes up from standby. I measured that if there is voltage it stays on, if <2.1v DC it goes into standby.

I tried sending with 3.0v DC from a lab power supply and it works as I want. Well it works as long as >2.1v DC. So it should work even from raspberry GPIOs. I measured the amp trigger input was pulling only 0.70/1mA at 3.0v DC and it worked perfectly.

I would like to drive this from the raspberry GPIO, with a script that fetch MPD status, and if not playing it should set the GPIO pin to low (0v) after 10 minutes of inactivity, thus turning off the amp. The script is not a problem, already found one and works.

The problem is the circuit, being electronic noob don't want to damage the raspberry.

  • Can I drive it directly from the GPIO (e.g. without a relay) being only 1mA load? I can hear the amp has a relay that clicks when i send voltage to that trigger, so it should be only relay's coil load?
  • How can I protect the gpio from shorts (e.g. pulling out the 3.5mm connector while ON) and eventual overvoltage(that shouldn't happen as there's no current on the amp side being an input, but don't know the circuit)

I have a load of passive components around, can solder, just can't design circuits.


  • If you are concerned you can put a low-ohm resistance in the signal line, ~100 ohm, this will help prevent excess current from voltage spikes on the signal line. This is poor mans conditioning and won't impact the high-Z input (1mA = highZ) . If you want a safety feature I would put a 3.3V zener from GPIO to gnd, this will clamp any voltage over 3.3V to 3.3V with the zener taking the overvoltage. These are simple passive options, active options would be using a FET switch or buffer component, requires 1 component and 1 resistor – crasic Aug 1 '17 at 22:24

To be safe, use an optocoupler (AKA: optoisolator, opto), which behaves similarly to a relay, but uses light instead of electro-magnatism. This will be fast responding & reliable (if used within specs). A relay, generally, will require too much current from the GPIO and would, also, require further drive components (e.g. transistor and other "passives").


simulate this circuit – Schematic created using CircuitLab

You will have to set/limit the current (via a resistor, R1) through the LED (input side): Say it is a commom opto such as 4N25, 4N26, 4N27 or 4N28 and you would like to use the 5V rail (which can generally supply more current than the 3V3 rail. Definately for a Pi); the LED is rated at 1.3V (V_f[typ]) @ 50mA (I_f): R = (SupplyVoltage - LED_voltage)/LED_current = (5-1.3) / 50m = 3.7 - 0.05 = 74 Ohm. A common value of 75 Ohms will work. 50 Ohms will allow too much current to pass and burn-out the LED AND exceed the capabilities of your GPIO.

This is too close for my comfort, so lets add a FET (2N7000). The FET (MOSFET to be precise in this example), also, adds another level of protection due to the way it works (too much to explain here). It conducts when its Gate (middle pin physically and on the schematic) "sees" a logic HIGH (3V3), allowing current to pass through to the opto. A pull-down resistor (10k is very common) may be required to prevent EM (electro-magnetic) noise from falsly triggering the FET, although you could faily confidently use the uC's (micro-controller's) or SBC's (Single Board Computer's) inbuilt pull-ups.

The ground (technically, 0V) leg of the LED needs to be connected to 0V (possibly labelled GND, even though it is rarely connected to earth/ground!!). There is no need for a resistor on the output of the opto, as your amplifier already limits the current, as you have already proven!

Opto explaination: When current (limited by the resistor) passes through the (usually InfraRed) diode inside the opto package, the IR light causes the photo-transistor to conduct. When the transistor conducts it, essentially, acts as a switch, "putting" the voltage on it's collector (top leg in diagram) onto its emitter (bottom leg), triggering your amplifier. In fact, the FET acts as a switch, too!

Bonus: To remember which is an Anode and Cathode; an Anode kind-of looks like an 'A', where a Cathode looks like a 'K'.

BTW, this is more of an Electronic/Electrical Engineering question ;)

| improve this answer | |

You should be fine connecting a GPIO pin directly to your amplifier. Given the spec (1mA, 3 to 30V), I'm pretty certain the relay you hear is not driven by this signal directly. A 3V relay would burn if you power it with 30V. Also, I've never seen a relay which works with only 1mA of current (typical value would be 50-100mA).

So your amplifier already has a circuit which adapts the input signal to its needs and amplifies the current to drive the relay. There's no point in making another circuit of your own for the same purpose.

I'm not sure how pulling out the connector can result in a shot circuit, but if you're concerned about that, consider adding a 200 Ohm resistor on the GPIO pin: this will limit the current to 16mA in case of a short, and will only drop 0.2V at 1mA of current (so you will be delivering 3.1V to the amplifier instead of 3.3V).

| improve this answer | |

I'm actually in the process of developing something similar to what you are looking for. The hifiberry dac+ has an output of it's own powering a led which I intend to use as an audio activity signal input back into the pi3. I'm also using adafruits 1000c ups with which I have added some parts to for using a power switch and automatic shutdown of the pi upon AC power loss. It's working with Kodi and libreelec with some minor glitches in the gpio sensing, but should be ironed out soon. I'm making my own boards that have the UPS, DAC and relay controls on one board within the pi3 footprint, like a hat. When it's fully tested I'll post all the schemes somewhere, and if there's a desire, I'll get some extra boards made for others. The DAC part should be a significant upgrade as I have all independent power supplies. Not sure exactly how much it may help you, but you may be able to get some ideas from it.

| improve this answer | |
  • Seems like that project is taking it's time… – kaiser Jul 9 at 22:31

a 1ma load shouldn't be a problem for the pi as it supports up to 50, but that click you hear is probably a relay and relays often require a large spike in amperage that your ammeter may not have picked up because of how fast it occurred, it would likely be safer to use a circuit such as one that goes off the 5volt gpio pin on the pi and connects to a transistor such as an npn transistor with the base being a gpio pin on the pi that when pulled to high would allow for power to pass through the 5volt line on the pi and into your amplifier. Furthermore the 5volt pin is isolated from the 3v3 power that your pi's microprocessor uses, as it is simply a usb passthrough which should also protect your pi during shorts, but will not protect your usb power supply, although it is likely that all but the lowest quality usb power supply have built in short circuit protection.

| improve this answer | |

If the amplifier's trigger only draws 1mA, that will be fine!

You could use a different (safer) connector in-line.

| improve this answer | |
  • Just my 2 cents: I've tested a Stetsom 400.4 amplifier and it consumes approx. 1.5mA on the remote wire. Turning it on from a Arduino works. – Fusseldieb Jul 20 '19 at 20:45

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.