Pages: [1]   Go Down
Author Topic: 0-3.3v shift to 0-5v Fio Help  (Read 1196 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

James


* levelshift.png (42.56 KB, 1166x614 - viewed 52 times.)
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5286
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 112
Posts: 5286
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12717
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: