Trying to Convert 5v PWM signal to 0-10v analog

Thread Starter

Mustafa_Osarwala

Joined Jun 26, 2017
7
So I am Trying to Convert a 5v PWM signal from an Arduino to a 0-10 v analog signal to drive a VFD.
the way i have come up with is simple i use two transistor (one to convert from 5 to 10v pwm and one to invert the inverted pwm) and a Linear Voltage Regulator to get 10v PWM and the an RC filter to convert pwm to analog.
Attached is the drawing of my circuit.

Now the problem is that it works great without the RC filter bt when I introduce the RC filter the voltage dropd drastically and even at a 100% signal the max voltage I get is 2.6v.
I dont know why that is happening.
May be its because of the transistor m using is BC547.
or is it because of the RC filter design???

20171206_201312_813x427.jpg
 

MaxHeadRoom

Joined Jul 18, 2013
20,927
You might find a few designs on the CNCzone forum.
It is in common use in the DIY CNC community.
Traditionally done with OP amp.
Max.
 

Thread Starter

Mustafa_Osarwala

Joined Jun 26, 2017
7
Yes its true that the circuit m trying is quite lame (I am new to electronics) I knw it.
But it would be a great help if you @MaxHeadRoom could explain what is wrong with this RC filter.
Because the whole thing works perfectly fine without the RC filter.
 

cmartinez

Joined Jan 17, 2007
7,022
So I am Trying to Convert a 5v PWM signal from an Arduino to a 0-10 v analog signal to drive a VFD.
the way i have come up with is simple i use two transistor (one to convert from 5 to 10v pwm and one to invert the inverted pwm) and a Linear Voltage Regulator to get 10v PWM and the an RC filter to convert pwm to analog.
Attached is the drawing of my circuit.

Now the problem is that it works great without the RC filter bt when I introduce the RC filter the voltage dropd drastically and even at a 100% signal the max voltage I get is 2.6v.
I dont know why that is happening.
May be its because of the transistor m using is BC547.
or is it because of the RC filter design???
Your circuit is called a "level shifter" and I think it's not done right. Let me sim it, and I'll get back to you.
 

philba

Joined Aug 17, 2017
960
Here is what I did on a GRBL header board for VFD control. 2 pole filter has a fairly aggressive cut off frequency of 59.3 hz. Needs around 12V to get 0 to 10V. iirc, latency is about 100 mS. Ripple with 10% PWM at 1Khz is acceptable. The funky looking trimpot symbol is a custom one I made to allow different footprint trimmers to be used on the PCB. Calibration is simple - input 5V solid (i.e. 100% PWM) on SPWM and adjust for 10V on SP0_10.

pwm to 0-10V.png
I tinkered with a circuit that doesn't require calibration but it needs a rail to rail op amp and better than 1% resistors which added cost. Plus, a 2X gain can't factor in input variation.
 
Last edited:

Thread Starter

Mustafa_Osarwala

Joined Jun 26, 2017
7
I am Sorry guys i was out for 2 3 days. I tried that circuit by you all. they all worked far more better than what i came up with but still when i introduced it to my vfd the voltage dropped to half.
but i got the solution which worked great for me.
This works fine but the signal is not smooth enough, and if i put an RC Filter the voltage drops drastically. :(((((
attached is the circuit i have prepared.
 

Attachments

cmartinez

Joined Jan 17, 2007
7,022
I am Sorry guys i was out for 2 3 days. I tried that circuit by you all. they all worked far more better than what i came up with but still when i introduced it to my vfd the voltage dropped to half.
but i got the solution which worked great for me.
This works fine but the signal is not smooth enough, and if i put an RC Filter the voltage drops drastically. :(((((
attached is the circuit i have prepared.
You need to add an opamp configured as a voltage follwer to the circuit's (my circuit) output if you want to boost the available current.

upload_2017-12-9_12-10-27.png
 

Attachments

philba

Joined Aug 17, 2017
960
Actually, you want an OP Amp configured for around a 2X gain (not as a voltage follower). See the circuit I posted above. It works in actual hardware for 0-10V output (as opposed to a simulation). Note that you can not get exactly 10V max with fixed resistors unless you know what the exact input voltage is - it won't be precisely 5V. You will need to measure the actual output of your micro/logic and then make the gain with precision resistors so it gives you 0-10V. Or, just use a potentiometer like I did to adjust it to exactly 10V output for 100% duty cycle.

And, by the way, the two pole filter I showed above does a very good job at 1Khz. It has around a 50 hz cut-off. In general, to keep the ripple low, increase your PWM frequency. For the circuit I posted above, 500 hz had pretty bad ripple. You want to specifically check low duty cycle - like 10% for ripple. Fortunately for my use, GRBL outputs at 960 hz so it does a reasonable job.
 
Last edited:

Thread Starter

Mustafa_Osarwala

Joined Jun 26, 2017
7
@philba i think my circuit resembles exactly like yours except for the rc filter near the input and that you have grounded -Vcc and i have tried to provide a negetive voltage so that it can go all the way to 0v.
(I am sorry if am making any mistakes I am actually a Mechanical Engineer and knw very less about electronics, for years my mindset was "if something doesnt fit into place you can always use a sledge hammer" )
 

Thread Starter

Mustafa_Osarwala

Joined Jun 26, 2017
7
I played a lil with the frequency of my micro controller and increased it to around 4KHz, now the circuit i posted above works great, still has a ripple of about 0.04Volts but that is ok coz my vfd shows pretty good results now.
thank you guys. thank you all.
each and every person who answered above did help me not only to help build the circuit but also and more to improve my knowledge which is more important to me.
@philba , @cmartinez , @MaxHeadRoom , @Alec_t
Thank you all....
attached is the final circuit and its results.Screenshot (21).png Screenshot (22).png Screenshot (23).png
 

Attachments

Top