1
\$\begingroup\$

I'm working on a sensor module that uses an STM32L4 but I hit a roadblock when trying to figure out how to power the thing. I was hoping that it could be powered by

  • 5v supplied by USB
  • External 5v power supply
  • Battery

How is it that arduinos or most other boards are able to distinguish between which supply to source power from? For example, if the device is connected to an external 5v power supply and I want to program it via USB, how do I not make it blow up?

\$\endgroup\$
2
  • 6
    \$\begingroup\$ Since you know an Arduino does it, have you looked at Arduino schematics how it does it? It may be simpler than you think, like most circuits just use diodes to combine the supplies together. \$\endgroup\$
    – Justme
    Aug 30, 2021 at 9:50
  • \$\begingroup\$ I've looked at other boards that use STM32s but I was not able to figure out how they did it. I'll learn about diodes now. thank you for your help! \$\endgroup\$
    – kenobi
    Aug 31, 2021 at 8:37

1 Answer 1

2
\$\begingroup\$

Just a few look on the NUCLEO-L452RE schematics :

To use the board with an external battery :

enter image description here

To use the board from a +5V power supply or from +5V USB :

enter image description here

Like @justme said, the solution is just using diodes. Theses diodes avoid the current to go back up to the other sources. (For example : you doesn't permit to power your pc usb hub from the external battery of your Nucleo board)

\$\endgroup\$
1
  • \$\begingroup\$ Got it! I've got to read up on diodes. This is my first time designing a whole board so I had no idea where to start. Thank you for your help! \$\endgroup\$
    – kenobi
    Aug 31, 2021 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.