I'm putting a Raspberry pi zero on a model train. The train tracks supply 12V DC which I step down to 5v with a Pi Jack. However, because the power is being supplied via the tracks, I can't be certain of the polarity of the DC power.

How can I invert DC polarity if it's reversed from what I expect?


If the train power supply is a relatively-constant 12 Vdc supply, simply feed the two 12V terminals into a bridge rectifier. The output of the bridge will be the same polarity no matter what the input polarity is.

If you are concerned about the voltage drop in the bridge, create your own bridge rectifier using 4- Schottky diodes. Choose appropriate diodes for both voltage and current.

  • \$\begingroup\$ Perfect, thank you. I didn't know what I needed to google :) \$\endgroup\$ – Gregology Oct 30 at 2:57

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.