I am working on a hobby project, it will be a general purpose open source irrigation controller.

I haven't built the PCB yet but I want to power the board either through the USB port for small valves and through 12V to 24V for larger ones. Here is a block diagram of what I have in mind.

enter image description here

I am sharing the whole power section of the PCB so that the reader gets a better idea of the system. enter image description here

To select between these voltages I thought of using a circuit I usually use to select between VBUS and a single cell Lion/Lipo battery. The spice simulation gives an acceptable result as seen below. The green line is the voltage at Source of the PMOS and the blue line at the Drain.

enter image description here


However I am unsure if this is the "good" way of doing it, since VCC will also power the valves . Which are inductive loads. I will be using the circuit below to drive the Valves albeit with different components. I don't have any previous experience designing motor drivers.

enter image description here

I would very much appreciate it if you could point out any errors I may have in my line of thinking.

  • 2
    \$\begingroup\$ Does this answer your question? Automatic switching between external 5V and USB bus power supplies \$\endgroup\$ – Marcus Müller May 2 at 12:50
  • \$\begingroup\$ @MarcusMüller is there an advantage to using his voltage selector compared to mine? His have more mosfets. \$\endgroup\$ – Emre Mutlu May 2 at 12:56
  • \$\begingroup\$ Have you considered using a simple mechanical relay for swapping between the 5V USB and the higher voltage? Just a 2 throw relay energized with the higher voltage. The mosfet circuit may be an elegant way to do the switching, however if the switching mosfet were to short out (say from a spike on the line), your USB and what ever is behind that might quickly become toast. \$\endgroup\$ – Nedd May 3 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.