Go Down

Topic: 0-3.3v shift to 0-5v Fio Help (Read 2388 times) previous topic - next topic


Hello folks,

I have an Arduino Fio that outputs 0-3.3v on the D3 pin with PWM.  I need to "level shift" this range to either 0-5 or 1-4vdc for an input on my motor controller as shown in the diagram, but i can't seem to figure out how!  i've tried to make a non-inverting op amp circuit to do so, using an LM358n, with little success.  i'm at a loss and need help.  any suggestions?

i'm also a bit of a newb, so I may be missing something.  For example, i've seen reference to many logic level shifters, that specify digital only - but my output should technically be analog, i think?!  I don't have a scope handy to analyze the signal.  The given output to my controller works well, but is only on a scaled range as it should be 0-5 not 0-3.3

Any help is appreciated.  Thanks.



Pin D3 is not putting out 0-3.3V but either 0V or 3.3V but in PWM mode it is switching between the two states very fast and is holding either state for different parts of the time depending on the overall value you wanna put out. That means the easiest way to put that signal to 0/5V is by using a transistor. Put a resistor to pin 3 and the other end to the base of a NPN transistor, emitter to GND, collector with a pull-up to 5V. The collector holds your input signal for the motor controller then.


Doh!  That makes sense.  So the transistor is essentially doing the same PWM switching that the arduino is doing, but i'm switching the 5v collector instead.

Shouldn't i actually take the emitter and send it to my controller instead of ground?  The controller will have the same common ground so the signal will find ground through the controller input.


My description is for a NPN transistor, a PNP is the other way round. Search on Google for the different wiring schemes of NPN/PNP transistors.


You can also use a 74HCT14 at 5V power (or any other 74HCT gate) to shift the level to 5V, then low-pass filter the output of that.  If the gate is inverting it will invert the sense of the signal (but two in a row will re-invert in that case).

Note it must be the HCT family which is guaranteed to read 3.3V as high when powered from 5V.  HC chips are not guaranteed to do so.

The low pass filter RC circuit must have a high enough impedance so as not to overload the output of the gate, something like R = 1k might be reasonable.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up