Maker Pro
Maker Pro

need sanity check on 10 bit DAC from atmel mega pwm

H

Hank

Hey, a real question from me (finally)!

I have a design that I want to make as minimal and cheap as possible. I am
already using an atmel mega32 8 bit microcontroller which runs at Fclk of 16mhz
and has 8 bit and 16 bit counters and pwm capability.

So...

I decided perhaps to use one of the 16 bit counters to create a 10 bit DAC using
an RC for charge storage and then an op-amp for buffering (pretty standard stuff
I guess).

From the atmel data sheet, in fast pwm mode, the pwm frequency will be Fclk /
(2^pwmbits), or for a 10 bit pwm resolution, 15.625khz.

I calculate this is going to give me a settling time of about 100mS using a 100k
resistor and a 0.1uF cap. I will have a ripple of about 8mV pp. The settling
time is fine, but 8mV of ripple with a theoretical resolution of 5V/1024 =~ 5mV
seems high. I could go with a larger resistor or cap to decrease ripple, but is
there a better way? (lol, other than just buying a 10 bit DAC, which takes the
minimalistic cheapo challenge out of it heh heh).

Thanks for any input.
 
T

Tim Wescott

Hank said:
Hey, a real question from me (finally)!

I have a design that I want to make as minimal and cheap as possible. I am
already using an atmel mega32 8 bit microcontroller which runs at Fclk of 16mhz
and has 8 bit and 16 bit counters and pwm capability.

So...

I decided perhaps to use one of the 16 bit counters to create a 10 bit DAC using
an RC for charge storage and then an op-amp for buffering (pretty standard stuff
I guess).

From the atmel data sheet, in fast pwm mode, the pwm frequency will be Fclk /
(2^pwmbits), or for a 10 bit pwm resolution, 15.625khz.

I calculate this is going to give me a settling time of about 100mS using a 100k
resistor and a 0.1uF cap. I will have a ripple of about 8mV pp. The settling
time is fine, but 8mV of ripple with a theoretical resolution of 5V/1024 =~ 5mV
seems high. I could go with a larger resistor or cap to decrease ripple, but is
there a better way? (lol, other than just buying a 10 bit DAC, which takes the
minimalistic cheapo challenge out of it heh heh).

Thanks for any input.

* It's going to give you a time constant of 10ms, a settling time of
about 50ms, and a ripple of about 3mV, if I did my math right.

* What are your bandwidth requirements? Can you just make a slower filter?

* If you're using an op-amp anyway you could make a 2nd-order active
filter out of it and get your ripple down considerably -- a 2nd-order
critically damped filter with poles at 500rad/sec would match your
(well, my) 3mV ripple, and you could go down from there if you wanted.
 
H

Hank

Tim Wescott said:
* It's going to give you a time constant of 10ms, a settling time of
about 50ms, and a ripple of about 3mV, if I did my math right.

* What are your bandwidth requirements? Can you just make a slower filter?

* If you're using an op-amp anyway you could make a 2nd-order active
filter out of it and get your ripple down considerably -- a 2nd-order
critically damped filter with poles at 500rad/sec would match your
(well, my) 3mV ripple, and you could go down from there if you wanted.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

Oops, I think I was off on my calculations..thanks Tim.

Just for a check I created a circuit in ltspice...adding a 10k, .01uF low pass
filter after the 100k, .1uF circuit gives me a ripple of quite a bit less than
1mV. I should be able to feed that into a high impedance op-amp...

I could use a pretty dang slow filter. I was wanting to use this as an input to
a driver for a largish TEC device, so response time is probably in seconds. :)
 
T

Tim Wescott

Hank said:
but is



Oops, I think I was off on my calculations..thanks Tim.

Just for a check I created a circuit in ltspice...adding a 10k, .01uF low pass
filter after the 100k, .1uF circuit gives me a ripple of quite a bit less than
1mV. I should be able to feed that into a high impedance op-amp...

I could use a pretty dang slow filter. I was wanting to use this as an input to
a driver for a largish TEC device, so response time is probably in seconds. :)

Well then -- I've got an article coming out in Embedded Systems
Programming magazine on making cheesy sigma-delta modulators. If you
need even more than 10 bits it's perfect for your application.
 
Top