Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

1-bit DAC on AVR with no PWM

1-bit DAC on AVR with no PWM

2004-11-17 by alan_probandt

Hello,
  I'm interested in implementing a super cheap DAC (1 or 2 resistors 
and a capacitor) on an output pin of a Tiny 11 AVR.  This AVR has no 
Pulse Width Modulation register/timer that would normally be used to 
implement a pseudo-DAC like this.  
  Any anyone done this?  Are there optimal resistor/capacitor values? 
I'd like to make an adjustable very low frequency oscillator (0.1 to 
5 Hz triangle or sine wave) between +2.5 and 4 volts.  I'd also like 
to make its speed controllable by changing the external system clock 
speed that is fed into the Tiny 11.
  I'm not even sure what keywords to use for a Google search on this 
one.

Thanks,
Alan Probandt
Portland, Oregon USA

Re: [AVR-Chat] 1-bit DAC on AVR with no PWM

2004-11-17 by Leon Heller

----- Original Message ----- 
Show quoted textHide quoted text
From: alan_probandt
To: AVR-Chat@yahoogroups.com
Sent: Wednesday, November 17, 2004 11:59 PM
Subject: [AVR-Chat] 1-bit DAC on AVR with no PWM



Hello,
  I'm interested in implementing a super cheap DAC (1 or 2 resistors
and a capacitor) on an output pin of a Tiny 11 AVR.  This AVR has no
Pulse Width Modulation register/timer that would normally be used to
implement a pseudo-DAC like this.
  Any anyone done this?  Are there optimal resistor/capacitor values?
I'd like to make an adjustable very low frequency oscillator (0.1 to
5 Hz triangle or sine wave) between +2.5 and 4 volts.  I'd also like
to make its speed controllable by changing the external system clock
speed that is fed into the Tiny 11.
  I'm not even sure what keywords to use for a Google search on this
one.

Microchip has a PIC app. note (AN655) on this that you might find useful, 
with source code for sine wave generation. It's all done in software, so 
should be OK on the Tiny11. It's only a couple of pages so it would be quite 
easy to translate into AVR code.

Leon

Re: [AVR-Chat] 1-bit DAC on AVR with no PWM

2004-11-18 by Jim Wagner

You can certainly do a software PWM at those frequencies.
Just think of a pin thats off 100% of the time, on 50%, off
50%, or on 100%. That should be pretty easy with any timer.
You would make the R-C time constant many times the period
of the PWM repetition period. There is LOTS of lattitude in
the choice. Normally, a PWM is made fairly high in
frequency so you don't have to use big caps. A 1K resistor
and a 1uf cap only has a time constant of 1ms. You probably
would NOT want to use that combo with a PWM frequency below
10KHz (period = 0.1ms).

I'm not very clear how the second part ties in with the
first, if it even does. A square-wave from an external
clock is really easy. Triangle not. 

Square wave would be to have the port pin on for so many
clocks, and off for the same number. Feed variable
frequency clock and out comes the square wave at some
integer division of the input frequency.

Triangle means either a many-bit dac to simulate the steady
rise and fall of the triangle OR using an external circuit
to shape the signal from the micro into a triangle. The BIG
problem is your desire for variable frequency. You really
can't get there from here with fixed R and C values. 

Drop me a line if you need more info.

Jim Wagner
Corvallis, OR
On Wed, 17 Nov 2004 23:59:42 -0000
 "alan_probandt" <alan_probandt@yahoo.com> wrote:
> 
> Hello,
> &nbsp; I'm interested in implementing a super cheap DAC
> (1 or 2 resistors 
> and a capacitor) on an output pin of a Tiny 11 AVR.&nbsp;
> This AVR has no 
> Pulse Width Modulation register/timer that would normally
> be used to 
> implement a pseudo-DAC like this.&nbsp; 
> &nbsp; Any anyone done this?&nbsp; Are there optimal
> resistor/capacitor values? 
> I'd like to make an adjustable very low frequency
> oscillator (0.1 to 
> 5 Hz triangle or sine wave) between +2.5 and 4
> volts.&nbsp; I'd also like 
> to make its speed controllable by changing the external
> system clock 
> speed that is fed into the Tiny 11.
> &nbsp; I'm not even sure what keywords to use for a
> Google search on this 
> one.
> 
> Thanks,
> Alan Probandt
> Portland, Oregon USA
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Sponsor
> 
> 
>   ADVERTISEMENT 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> To visit your group on the web, go
> to:http://groups.yahoo.com/group/AVR-Chat/&nbsp;
> To unsubscribe from this group, send an email
> to:AVR-Chat-unsubscribe@yahoogroups.com&nbsp;
> Your use of Yahoo! Groups is subject to the Yahoo! Terms
> of Service.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.