I understand Pi's GPIO voltage is 3.3V. Now I would like it to control a digital signal input of 30V. How do I achieve this?

(Edit) To be specifically, the target device pins of interest are pin1(30V), pin2(Ground), pin3(control signal). I need to control pin3's logic level. I don't need fast switching capablity like in PWM.


A transistor does well for this job like this, but if you're not going to continuously use it and voltage spikes are common, a relay with a flyback diode would do well too.

  • Thanks a lot. Both recommendations look good. Looks like the relay solution is even easier. My understanding is I don't even need a 30V power supply (like for the transistor) if I use the relay, right? – Penghe Geng Aug 12 '13 at 18:25
  • By seeing your edit in your post, it looks like you need to control the device with a logic pin. Are you trying to control the power supply to the device or are you trying to control it through the logic pin? If you're controlling the device through the logic pin, you would only need a transistor, or even just a direct input from the Pi. Otherwise, you would need a relay to control the device's power supply. – zeldarulez Aug 12 '13 at 21:09

As far as I understand you want to use the Raspberry PI to generate a 30V signal to control some input with it. So you want a 30V output and need maximum a few milliamps of current to drive a logic input and not a motor or anything that needs power. An easy way to get it working is to use a comparator circuit using an LM339 or a similar type. You need a comparator that is rated for at least 30V. Do the following circuit, with the difference that +15V becomes your +30V and -15V becomes your GND level.

level shifter using a comparator

  • So this requires a +15V and -15V voltage source. Looks more complex than a simple transistor or relay solution. What additional benifits this will bring? – Penghe Geng Aug 12 '13 at 18:26
  • 1
    No, not at all. You only need the +15V and -15V (dual supply) if you want to generate a negative output, which in this case you don't. Just use +30V and 0V (single supply) instead. Check link for application notes. On the last few pages there are many examples with single supply very close to your application. – Mike Dynamite Aug 13 '13 at 8:14

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.