# Best way to linearly step-up MCU output 0-3.3V to 0-5V

I am about to move from Arduino to my own MCU platform and am currently looking at the likes of the ARM Cortex M7 and M0+. One of my worries is that these microcontrollers seem to be only capable of outputting 3.3V. I need to send digital, PWM and analog signals scaling up to 5V, for example a throttle signal going from 1 to 4V. What would be the best, most efficient way of doing that? Thank you!

• There is no single best way, it all depends on the properties of the signal you need – PlasmaHH Oct 27 '16 at 11:44
• "Best and efficient" depend on what you value.. simplicity, cost, parts availability, power, ruggedness..? – Wesley Lee Oct 27 '16 at 11:44
• one way would be to keep it all digital for transmission and use a serial DAC at the end where you need the analog. – JIm Dearden Oct 27 '16 at 11:55

## Digital

The first step is to make sure you really need 5 V output. Many digital inputs have a low enough minimum logic high threshold so that 3.3 V is solidly high.

If you really need 5 V logic signals, use level converters. These are small, cheap, and readily available. They have a split power supply. You power one side from the 3.3 V supply and connect it to 3.3 V logic, and power the other side from 5 V and connect it to 5 V logic.

Sometimes the requirements are simple so that this can be achieved with a single transistor. But, given the level of your question, the best answer is simply "use level converters".

## Analog

Converting from 5 V to 3.3 V is easily done with a voltage divider, which is made from two resistors.

For converting from 3.3 V to 5 V, again, first make sure that it's really needed. If it is, this can be done with a opamp in classic positive gain configuration. That means signal into the + input, and two resistors that divide the output voltage into the - input.

• FWIW, converting digital signals with simple voltage dividers (R only) is also quite feasible as long as need to decrease the voltage. – user20088 Oct 27 '16 at 17:13

Presumably you have a 5V power supply for the circuit that still requires 5V so, just use a TTL/CMOS buffer chip powered from the 5V rail. The 3V3 signal from the 3V3 powered device will almost certainly output a voltage higher than the 2V high threshold needed on the buffer's input and its CMOS output will be 5V.

The 74AHCT1G32GW/T1 is a dual input OR gate that does this but you can get buffers in the same range (such as the SN74AHCT1G125).

If you need an analogue signal amplifier use a rail-to-rail opamp with the appropriate gain setting resistors: -

As for the type of op-amp, this is speed and accuracy dependent but the OPA333 springs to mind for low speed and the AD8605 springs to mind for higher speed.

• There's no apparent reason why digital logic should be used. A pure, one-directional buffer IC like 74HCT125 is probably a better choice. – Lundin Oct 27 '16 at 11:57
• @Lundin - Note that I said use a buffer from the same range. – Andy aka Oct 27 '16 at 12:01
• In this case for a gain of 1.5 if I take Rg=1kohm and Rf=1.5kohm, would it be ok? – Eliott W Oct 27 '16 at 13:00
• For this op-amp circuit, gain = 1 + Rf/Rg therefore Rg should be twice Rf. – Andy aka Oct 27 '16 at 13:07