Pages: [1]   Go Down
Author Topic: Smoothing PWM for analog output  (Read 1602 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 46
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would like to smooth the PWM signal to get analog output from the Arduino. I assume that I can do this with a capacitor? I am pretty new to all of this so how do I go about selecting the correct capacitor type/value? I would need 0 - 1.6 volts output. This would control the holding current for a stepper driver.
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2855
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You would need a resistor and a capacitor. What matters a lot is where this signal is going. What stepper driver are you using?

--
The Rugged Circuits Yellowjacket: 802.11 WiFi module with ATmega328P microcontroller, only 1.6" x 1.2", bootloader
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 46
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been looking at a number of them. The A3977 seems promising. Ideally what I am looking for is to control it with Pulse + direction. AND be able to specify the current (100% during motor running, 10% holding current, and disable motor completely). The A3977 specifies 1.6 volts to one pin to run with 1.0 AMP of motor current. So I can do 1.6 volts while running, then .16 volts (approx) for holding current, and also disable the driver completely. My app consists of lifting a load on a ball screw (1 AMP current while running) then holding the load at the top (10% motor current is fine), when in the 'lowered' position disable the motor. Hopefully this makes sense.
Logged

Newcastle, England
Offline Offline
Sr. Member
****
Karma: 3
Posts: 489
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/forum/index.php/topic,59228.0.html

0-5 volts in 255 steps. Yes, you said you needed 1.6V max, but a few extra volts might come in useful! (Or break the applience. Be careful not to exceed the maximum voltage!)

Onions.
Logged

My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) smiley-grin

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34547
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The A3977 specifies 1.6 volts to one pin to run with 1.0 AMP of motor current.
So where is this current going to come from. A PWM signal pin is limited to about 30mA so you will need a driver. However you will then want to change the voltage rapidly and your filter will get in the way. I can't see this working. For a discussion on filters see:-
http://www.thebox.myzen.co.uk/Tutorial/PWM.html
Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12467
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Look at the datasheet - Vref is presumably what the original poster wants to control via LP filtered PWM.
Logged

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

Boston, MA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 83
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I hope I'm not hijacking this thread but I've been wondering about a related question.  Basically when driving high currents, is it better to smooth the PWM before the current amplifying transistor or after?

Here are my thoughts:

If you do it before the transistor (i.e. to the base of the transistor) you don't need a big cap, but you are running in the "active" region (i.e. unsaturated) so it is burning energy and you are relying on a specific hopefully nearly linear Hfe transistor curve.

Also, if you do it after, some wire is carrying high current PWM... would that emit undesireable RF?

Cheers!
Andrew
Logged

http://www.toastedcircuits.com Lightuino LED driver: 16 sources, 70 sinks, remote controlled.  Also high powered LED drivers.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you do it before the transistor (i.e. to the base of the transistor) you don't need a big cap, but you are running in the "active" region (i.e. unsaturated) so it is burning energy and you are relying on a specific hopefully nearly linear Hfe transistor curve.

agree, it's the difference between running the final amplifier in class D (switching) Vs class A (ugly efficiency, lots of waste heat to deal with, etc) I would think it's a no brainer, use postfiltering if required, usually just a lowpass filter right to remove the switching frequency, just run it as high a frequency as possible to ease the filtering requirements

Also, if you do it after, some wire is carrying high current PWM... would that emit undesireable RF?

Possibly, but many high power switching power supplies use high frequency switching frequencies without wiping every AM radio nearby out. Maybe just proper shields of components and external wiring is all that would be necessary?

Logged

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12467
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I hope I'm not hijacking this thread but I've been wondering about a related question.  Basically when driving high currents, is it better to smooth the PWM before the current amplifying transistor or after?

Here are my thoughts:

If you do it before the transistor (i.e. to the base of the transistor) you don't need a big cap, but you are running in the "active" region (i.e. unsaturated) so it is burning energy and you are relying on a specific hopefully nearly linear Hfe transistor curve.

Also, if you do it after, some wire is carrying high current PWM... would that emit undesireable RF?

Cheers!
Andrew


It really depends on the application - sometimes the end load can do the low-pass filtering anyway (such as an inductive load like a motor).  For class D audio amplifiers the whole motivation is efficiency so you put up with large LC filter components at the output in order to get the 90 to 95% efficiency of amplification.   If the load is inherently analog and does not provide low pass filtering you might want analog amplification after a low-power low-pass filter (low power filters can be cheaper and better performance).

For LEDs there is no need to filter if the frequency is high enough, the human eye does the work. 

In general digital amplification is prefered because the circuitry is more efficient, cheaper and component specs are less critical.  The last 20 to 30 years have seen switch-mode take over from linear-mode in many areas.

The whole question of preventing unwanted RFI is important of course, and you are right that high currents (and voltages) make the problem worse, but good design goes a long way - you have to do more to suppress RFI but then you don't have to deal with so much heat dissipation (which is usually going to cost more to cure - heatsinks, fans, larger power supply).
Logged

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34547
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I would filter before the high current driver. This is because the capacitor is much smaller and so the circuit is more reliable and has a longer life. It is easer to deal with the heat generated by a linear buffer than the life time of a large capacitor switching gob loads of current.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well I would filter before the high current driver. This is because the capacitor is much smaller and so the circuit is more reliable and has a longer life. It is easer to deal with the heat generated by a linear buffer than the life time of a large capacitor switching gob loads of current.

It's certainly a trade off. I own a vintage late 70s Pioneer SX-1980 stereo receiver. Rated at 270 WPC RMS @ 8 ohms, it weights in at 78 pounds. No fans but hugh heatsinks. A modern equievlent would probably weight 10 lbs and sell for $200.

Quote
" Its retail price in 1978 was $1295.00. According to the average historical price of gold, it would have listed for an equivalent of $8199.42 in 2010"

http://en.wikipedia.org/wiki/Pioneer_SX-1980

Lefty
Logged

Pages: [1]   Go Up
Jump to: