circuit for software selectable arduino outputs of either 5V or 12V

Hi Guys,

I am trying to think of a simple solution to make the outputs on the Arduino source either 5V or 12V, selectable by software.

What would be the best way of doing this?

My current thinking is using MOSFET switches.

HI,

You may be able to find a power driver that takes TTL/Arduino inputs but has a separate plus power supply that can handle both 5V and 12V.

Then you'd only have to switch the power supply...

Anyone know of a good chip for this?

Do you need a single output to switch? Or more? Do those outputs need to source current only? Or sink only?

How many outputs, how many power? Is it 5V or 12V only or GND/5V/12V or high impedance (input)/GND/5V/12V?

Hi,
I designed a circuit one time for an application but never use it and I think it is maybe what you are looking for. It will switch the +12 or +5 voltage selection just by using one arduino output pin. A LOW switch the output to +5 and a HIGH switch the output to +12. You may need to select the components that suit your load/project. I used the components from the Circuit Lab Components listing to run the simulation.
Attached it the schematic.

switching-battery.pdf (21 KB)

If you only want to switch between 12V and 5 you can just replace the whole right part with a single (Schottky) diode...

Hi,
When I designed the circuit I was looking for complete isolation between the +12 and the +5. But I didn’t realized that by using one diode like you point out for the +5 since it is lower voltage it will not conduct. Good thinking. Thank You. I corrected the circuit to reflect what you mentioned. Tested and it ran OKAY.

switching-battery (1).pdf (20.3 KB)

Thank you for all the answers guys. My apologies for not supplying enough info. It will be multiple outputs that will only source. 12v, 5v, and GND. Current not likely more than 20mA.

Preferably the outputs should be switchable between those states individually.

JCW:
It will be multiple outputs that will only source. 12v, 5v, and GND.

What that means? It will never have to sink? Something like LEDs or heater connected? Or do you want to get valid levels? For example when driving I2C you need to sink current to achive GND. If you are driving LED you may tri-state pin (set as high impedance input) and you get no light from the LED - and maybe some coltage higher than GND on the driving pin but who cares?

This can be done with transistors (either MOSFET but for 20 mA BJT should work too). I don't know an IC to do this (it does not mean it does not exist!).

This may work (like Charlieplexing) to multiplex one Arduino output to 5V/12V/Hi-Z:

The left circut outputs 12V when 5V in on "IN" and the right one outputs 5V when GND is on "IN". If you connect them together (both "IN" to arduino pin and both "OUT" together) you should get 12V if you make OUTPUT HIGH, 5V if you make OUTPUT LOW and nothing if you make the pin INPUT. But you must ensure forward voltage drop of the two BE junctions of transistors plus forward drop of the diodes is higher than 5V. Blue/while LEDs or multiple "common" diodes should work. Also add resistors to limit base currents.
There may be better way, this was my first (quite complicated) idea, untested but should be viable.

Many low side MOSFET drivers like the MIC4422 can work from 4.5V to 18V supply, take a logic input and
will drive high currents if needed (or add series resistor on the output to limit)

Four in one DIP package: http://uk.farnell.com/microchip/tc4469epd/ic-mosfet-driver-and-inv-14dip/dp/1852212

So switch either 12V or 5V to Vdd on the package to control output voltage.

So I assume sourcing the 5V and 12V? And the GND, do you need to sink current? Or is just floating fine as well? Otherwise the circuit of Smajdalf is fine once you add a couple of base resistors and pull up/down resistors. And/Or swap the PNP for MOSFETs if you need power.