PWM Filter

Hello guys I am trying to use an Arduino Uno to PWM and Analogue output in the range on 0-12 VDC.

I have designed a circuit which I think may work. Just would like some feedback ideas on if I am on the right path.

Sorry not remotely correct. You will never get more than 5V out of that circuit.
You need the emitter to ground and the filter in the collector and if you connect A0 to the output presumably for feedback you will blow the Arduino with voltages over 5V.

thanks for the response. i am quite new to using transistors, i have re-wrote based on comments but i am unsure where to put the RC filter.

Better.
You don't need that diode across the transistor. Put the filter between the transistor's collector and the analogue output.
What sort of load will this be driving, that determins the component values you need to use

Great. I got it working :slight_smile: thanks for your help. I want it do drive an actuator that accepts a 0-10V input for position.

If I can see that this "inverts" the PWM which makes sense. Is there a way to have the analog write at 0 with the other side of transistor also off?

The 1k resistor should go between Arduino pin and base. Not to ground.
Connecting the Arduino directly to the base could destroy the output pin.

Maybe better to integrate the PWM signal first, and then amplify it to the desired voltage with an opamp.
Download LTspiceIV, and load the attachment. Click on the running man.
Use the probe to see the opamp’s output, or any other point.
Experiment with values.
Leo…

integrator.zip (620 Bytes)

I want it do drive an actuator that accepts a 0-10V input for position.

It is not the voltage that is important but the current.

Is there a way to have the analog write at 0 with the other side of transistor also off?

Only by using another transistor. However if you want the values 0 to 255 to represent off to full on then simply have the value in a variable ( which you will have any way ) and use analogWrite( 255 - v )

Sorry I missed the resistor bit it should be in series with the base.

and then amplify it to the desired voltage with an opamp.

No an op amp is useless for driving loads.

Grumpy_Mike:
No an op amp is useless for driving loads.

I understood that OP wanted to convert 5volt PWM to a 0-12volt control voltage.
I realise now that he wants to power some actuator motor.
Grrr. X-Y problem.
Leo..

If they are powering a motor the motor dynamics is a low pass filter itself.

When you take this stuff into the frequency domain (transfer functions between input V and output rpm/torque or force) there is no distinction between the electrical and mechanical elements..

So what would I need to do so the output would be 0VDC when the analog write is also 0/Low?

Better post a link to the actuator that you want to use.
Leo..

I already said, add an extra transistor.

Grumpy_Mike; Do you mean something like this would work?

v3.png

That way you will fry the second transistor. But just leave it, inverting it in software is wayyyyyyy easier. To make it very readable

#define analogInvertWrite(x,y) analogWrite(x,255-y)

And you can just use analogInvertWrite(x, 0) as being off.

But again, tell use which actuator you want to drive! Does it use a 0-10V signal line for position (so no current) or does it drive of that voltage and is current necessary?

Dazwah:
Grumpy_Mike; Do you mean something like this would work?

Add a resistor, about 4K7, between the 5V and the collector of that extra transistor.

Get rid of D1.

Thanks Mike, I had forgot to remove the diode.

The actuator 0-10V is for reference only (max 60mA).
It has its own 24VAC supply that drives the motor.

I know its easier to just invert the analog write. Curious to which version will draw less current?

Dazwah:
The actuator 0-10V is for reference only (max 60mA).

What do you mean with 60mA.
That transistor circuit can supply ZERO current to the following circuit.
Well, almost.
Leo..

Indeed, 60mA is still quite much! And indeed, the circuit will not work, meanly because of the filter and the fact the high voltage goes trough a 1k resistor.

Yes indeed that circuit is no good for that sort of power. The trick is to filter before the voltage boost and then use a FET in linear mode to regulate the current. Attached is a very reliable design I have used on fans and it will work on your system just as well.

fan.jpg

Can you please explain why the RC filter on the gate of transistor?

Maybe I am on the wrong path, but I would like to make the circuit somewhat a universal output, where I can either select via software the output is 0-10V DC (analog) or 12V DC to switch a relay.