Searching \ for '[EE] Simple D/A converter?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/io/d2a.htm?key=d%2Fa
Search entire site for: 'Simple D/A converter?'.

Exact match. Not showing close matches.
PICList Thread
'[EE] Simple D/A converter?'
2012\04\11@132040 by Neil

flavicon
face
Hi all,

Can any of you recommend a D-to-A converter with a single-wire digital-side interface?  As small as possible -- roughly SOT23-5 to SSOP-8 would be good, 5V powered, 0-5V output (I'll actually do 0.5V to 4.5V output with it).

Summary is that I need to add an analog output to an existing PIC16F883-based circuit (already working on PCB), but only have one general-purpose I/O available, and no PWM pins available.  I can get tons of I2C, SPI or other D/A converters, but not finding anything with actual single-wire serial.  FWIW, there's too much going on in the chip to get any decent bit-banged PWM.

I can do this with a small PIC, but since I only need 25 or so of these, I thought I'd check to see if anyone here knows of a purpose-built chip for this, so that I can save coding time.

Cheers,
-Neil.

2012\04\11@133843 by Wouter van Ooijen

face picon face
On 11/4/2012 7:20 PM, Neil wrote:
> Hi all,
>
> Can any of you recommend a D-to-A converter with a single-wire
> digital-side interface?  As small as possible -- roughly SOT23-5 to
> SSOP-8 would be good, 5V powered, 0-5V output (I'll actually do 0.5V to
> 4.5V output with it).

I'd opt for a PIC. UART in, PWM out.

--
Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu
C++ on uC blog: http://www.voti.nl/erblog

2012\04\11@140335 by Dwayne Reid

flavicon
face
At 11:20 AM 4/11/2012, Neil wrote:
>Hi all,
>
>Can any of you recommend a D-to-A converter with a single-wire
>digital-side interface?  As small as possible -- roughly SOT23-5 to
>SSOP-8 would be good, 5V powered, 0-5V output (I'll actually do 0.5V to
>4.5V output with it).
>
>I can do this with a small PIC, but since I only need 25 or so of these,
>I thought I'd check to see if anyone here knows of a purpose-built chip
>for this, so that I can save coding time.

If you *do* wind up having to do it yourself with a PIC, look at the PIC10f322 family.  They have native PWM hardware built-in, which may dramatically reduce your coding time.  No USART or I2C hardware, unfortunately.  The SOT23-6 package is easy to work with.

BTW - I've been purchasing SOT23-6 zero insertion force sockets (for programming) from <http://www.wvshare.com/product/499-P44-10-REV-B.htm> US $24.99 each in 3-lot.  I then made up little adapter boards that map the pins to a 6-pin header to match a PICkit 2 or 3.

dwayne

-- Dwayne Reid   <spam_OUTdwaynerTakeThisOuTspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax
http://www.trinity-electronics.com
Custom Electronics Design and Manufacturing

2012\04\11@141624 by Byron Jeff

flavicon
face
On Wed, Apr 11, 2012 at 07:38:17PM +0200, Wouter van Ooijen wrote:
> On 11/4/2012 7:20 PM, Neil wrote:
> > Hi all,
> >
> > Can any of you recommend a D-to-A converter with a single-wire
> > digital-side interface?  As small as possible -- roughly SOT23-5 to
> > SSOP-8 would be good, 5V powered, 0-5V output (I'll actually do 0.5V to
> > 4.5V output with it).
>
> I'd opt for a PIC. UART in, PWM out.

Why not do software PWM on the existing I/O pin then? All that is needed is a low pass filter.

BAJ

{Quote hidden}

> -

2012\04\11@145305 by Peter Johansson

picon face
On Wed, Apr 11, 2012 at 1:20 PM, Neil <.....picdude3KILLspamspam@spam@narwani.org> wrote:

> Can any of you recommend a D-to-A converter with a single-wire
> digital-side interface?  As small as possible -- roughly SOT23-5 to
> SSOP-8 would be good, 5V powered, 0-5V output (I'll actually do 0.5V to
> 4.5V output with it).

Maxim makes a few chips (MAX11645, MAX11213) that might suit your
needs.  They have evaluation boards for each, and at one point you
could request them as free samples.  I have one of the MAXADC LITE
eval boards and it is a nice piece of kit.

-p.

2012\04\11@145347 by Wouter van Ooijen

face picon face
> Why not do software PWM on the existing I/O pin then? All that is needed is
> a low pass filter.

Quote Neil: FWIW, there's too much going on in the chip
to get any decent bit-banged PWM.




--
Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: http://www.voti.nl/hvu
C++ on uC blog: http://www.voti.nl/erblog

2012\04\11@152757 by jim

flavicon
face

Neil,

Maybe something like this...

http://www.maxim-ic.com/app-notes/index.mvp/id/4627

Regards,

Jim

> ---{Original Message removed}

2012\04\11@161244 by Byron Jeff

flavicon
face
Reading is actually fundamental. That's what I get for reading the reply
and not the original post.

BAJ

On Wed, Apr 11, 2012 at 08:53:25PM +0200, Wouter van Ooijen wrote:
{Quote hidden}

> -

2012\04\11@171222 by Adam Field

flavicon
face
On Apr 11, 2012 2:54 PM, "Wouter van Ooijen" <wouterspamKILLspamvoti.nl> wrote:
>
> > Why not do software PWM on the existing I/O pin then? All that is
needed is
> > a low pass filter.
>
> Quote Neil: FWIW, there's too much going on in the chip
> to get any decent bit-banged PWM.
>
I remember someone here describing a D to A output based on a random
number. It wasn't timing sensitive. From my memory: if your random number
is below your target value turn the output on, else output is off. I don't
know if it's viable with a pseudo random generator

2012\04\11@214318 by Neil

flavicon
face
That seems to be the popular choice, which is not unexpected on the piclist :)

I'm using internal oscillators, so it's probably better for me to use something other than UART.  I'll probably just reuse code from a varying duty-cycle protocol I've used a few times before, where 33% & 67% represent 0 & 1 respectively.  It's very forgiving of timing variances.

Cheers,
-Neil



On 4/11/2012 1:38 PM, Wouter van Ooijen wrote:
> On 11/4/2012 7:20 PM, Neil wrote:
>> Hi all,
>>
>> Can any of you recommend a D-to-A converter with a single-wire
>> digital-side interface?  As small as possible -- roughly SOT23-5 to
>> SSOP-8 would be good, 5V powered, 0-5V output (I'll actually do 0.5V to
>> 4.5V output with it).
> I'd opt for a PIC. UART in, PWM out.
>

2012\04\11@224257 by Neil

flavicon
face
10F320/2 looks really good.  Only thing I'm wondering is that it seems the PWM voltage output is based on the supply voltage, so for higher accuracy, should I run the analog output back into an A/D for some type of dynamic closed-loop adjustment?  If so, I'd go for something with  >8-bit A/D.

Alternatively, I could monitor the power-supply voltage and adjust the PWM value accordingly.  But here too a 10-bit A/D would be nice.

The 12F1501 looks promising.

Cheers,
-Neil.



On 4/11/2012 2:03 PM, Dwayne Reid wrote:
> If you *do* wind up having to do it yourself with a PIC, look at the
> PIC10f322 family. They have native PWM hardware built-in, which may
> dramatically reduce your coding time. No USART or I2C hardware,
> unfortunately. The SOT23-6 package is easy to work with. BTW - I've
> been purchasing SOT23-6 zero insertion force sockets (for programming)
> from <http://www.wvshare.com/product/499-P44-10-REV-B.htm> US $24.99
> each in 3-lot. I then made up little adapter boards that map the pins
> to a 6-pin header to match a PICkit 2 or 3. dwayne

2012\04\11@225130 by Neil

flavicon
face
Nice, but pricey.  And having been burned by Maxim's supply issues before, the PIC route is much more appealing.


On 4/11/2012 3:27 PM, .....jimKILLspamspam.....jpes.com wrote:
>   Neil,
>
>   Maybe something like this...
>
>   http://www.maxim-ic.com/app-notes/index.mvp/id/4627
>
> Regards,
>
> Jim
>
>> ---{Original Message removed}

2012\04\11@231446 by Harold Hallikainen

face
flavicon
face

> On Apr 11, 2012 2:54 PM, "Wouter van Ooijen" <EraseMEwouterspam_OUTspamTakeThisOuTvoti.nl> wrote:
>>
>> > Why not do software PWM on the existing I/O pin then? All that is
> needed is
>> > a low pass filter.
>>
>> Quote Neil: FWIW, there's too much going on in the chip
>> to get any decent bit-banged PWM.
>>
> I remember someone here describing a D to A output based on a random
> number. It wasn't timing sensitive. From my memory: if your random number
> is below your target value turn the output on, else output is off. I don't
> know if it's viable with a pseudo random generator.
>

I also did some PWM with "sample and hold." When not PWMing the output,
I'd tristate it. The C of the series RC LPF acted as a hold capacitor.
Depending on required update time, accuracy, etc., it might be possible to
output a single pulse with a certain period high, then a certain period
low, then tristate until you come around again. I did this to drive 48
analog outputs with a single PWM output of a PIC (demultiplexing the
single PWM pin into a bunch of hold capacitors).

Harold



-- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone

2012\04\11@231446 by Harold Hallikainen

face
flavicon
face

> On Apr 11, 2012 2:54 PM, "Wouter van Ooijen" <wouterspamspam_OUTvoti.nl> wrote:
>>
>> > Why not do software PWM on the existing I/O pin then? All that is
> needed is
>> > a low pass filter.
>>
>> Quote Neil: FWIW, there's too much going on in the chip
>> to get any decent bit-banged PWM.
>>
> I remember someone here describing a D to A output based on a random
> number. It wasn't timing sensitive. From my memory: if your random number
> is below your target value turn the output on, else output is off. I don't
> know if it's viable with a pseudo random generator.
>

I also did some PWM with "sample and hold." When not PWMing the output,
I'd tristate it. The C of the series RC LPF acted as a hold capacitor.
Depending on required update time, accuracy, etc., it might be possible to
output a single pulse with a certain period high, then a certain period
low, then tristate until you come around again. I did this to drive 48
analog outputs with a single PWM output of a PIC (demultiplexing the
single PWM pin into a bunch of hold capacitors).

Harold



-- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone

2012\04\12@044156 by Richard Prosser

picon face
On 12 April 2012 14:42, Neil <@spam@picdude3KILLspamspamnarwani.org> wrote:
> 10F320/2 looks really good.  Only thing I'm wondering is that it seems
> the PWM voltage output is based on the supply voltage, so for higher
> accuracy, should I run the analog output back into an A/D for some type
> of dynamic closed-loop adjustment?  If so, I'd go for something with
>  >8-bit A/D.
>
> Alternatively, I could monitor the power-supply voltage and adjust the
> PWM value accordingly.  But here too a 10-bit A/D would be nice.
>
> The 12F1501 looks promising.
>
> Cheers,
> -Neil.
>
>

How about clamping the output PWM at a level a bit below the supply
voltage? That would reduce the dependency. Just watch out for
temperature variation!

RP

2012\04\12@072841 by RussellMc

face picon face
> Can any of you recommend a D-to-A converter with a single-wire
digital-side interface?

Any SOT23-5 PIC.
Scott Datallo's Sigma Delta ADC routines.
Software PWM if needs be.
Can interleave between ADC isochronous actions.
If IRQ available PWM can be IRQ driven AND simplify Sigma Delta
isochronous timing need.

Not totally trivial but reasonably simple.

For extra points you can almost certainly do the ADC input and digital
output on the same pin :-).


             Russell McMahon





On 12 April 2012 20:41, Richard Prosser <KILLspamrhprosserKILLspamspamgmail.com> wrote:
{Quote hidden}

>

2012\04\12@082620 by Neil

flavicon
face
What exactly do you mean by "clamping the output"?  I actually need 0.5V to 4.5V output, and Vdd will be 5V.  But I was looking for the A/D feedback,etc for accuracy, since the PWM voltage output will be subject to variations in Vdd.

Cheers,
-Neil.



On 4/12/2012 4:41 AM, Richard Prosser wrote:
> How about clamping the output PWM at a level a bit below the supply
> voltage? That would reduce the dependency. Just watch out for
> temperature variation! RP

2012\04\12@103417 by Adam Field

flavicon
face
> I remember someone here describing a D to A output based on a random number.
> It wasn't timing sensitive. From my memory: if your random number is below
> your target value turn the output on, else output is off. I don't know if
> it's viable with a pseudo random generator.

To expand on this, I found the original thread:

http://www.piclist.com/techref/postbot.asp?id=/piclist/2001/02/04/004250a&key=random%20analog

I haven't tried it yet, but it looks almost too interesting to not try

2012\04\12@162538 by Richard Prosser

picon face
Hi Neil,

On 13 April 2012 00:26, Neil <spamBeGonepicdude3spamBeGonespamnarwani.org> wrote:
> What exactly do you mean by "clamping the output"?  I actually need 0.5V
> to 4.5V output, and Vdd will be 5V.  But I was looking for the A/D
> feedback,etc for accuracy, since the PWM voltage output will be subject
> to variations in Vdd.
>
> Cheers,
> -Neil.
>

Basically I was thinking about a system where the output voltage was
limited to, say, 4.5V by means of a series resistor & precision zener
/ TL431 etc. This would then be independent of supply voltage but
subject to any temperature drift in the clamping device. The minimum
voltage would be close to zero - if you need it to be 0.5V, then you'd
need to add it in - use an opamp circuit to provide the clamping
function with a 0.5V offset.?

RP

2012\04\12@182129 by Chris Roper

picon face
If you use the PIC to do the ADC it will be susceptible to the same
voltage fluctuations as the DtoA output.
You would need to use a voltage reference chip for accuracy so why not
just power the PIC from a voltage reference and that would govern the
AtoD accuracy.

On 12 April 2012 22:25, Richard Prosser <TakeThisOuTrhprosserEraseMEspamspam_OUTgmail.com> wrote:
{Quote hidden}

>

2012\04\12@182245 by Chris Roper

picon face
Correction,  just power the PIC from a voltage reference and that
would govern the DtoA accuracy.

On 13 April 2012 00:21, Chris Roper <caroperEraseMEspam.....gmail.com> wrote:
{Quote hidden}

>> -

2012\04\12@223904 by Neil

flavicon
face
On 4/12/2012 4:25 PM, Richard Prosser wrote:
> Basically I was thinking about a system where the output voltage was
> limited to, say, 4.5V by means of a series resistor & precision zener
> / TL431 etc. This would then be independent of supply voltage but
> subject to any temperature drift in the clamping device. The minimum
> voltage would be close to zero - if you need it to be 0.5V, then you'd
> need to add it in - use an opamp circuit to provide the clamping
> function with a 0.5V offset.? RP
Gotcha now.  But space is super-tight, so op-amp is probably out.  I can just send the appropriate digital signal range (103 to 922) to get 0.5V to 4.5V, with the only side effect of reducing resolution by 20%.

2012\04\12@234554 by Neil

flavicon
face
Nice idea, if I can find an appropriate reference.  It would need to be  >4.5V (when supplied from down to 4.8V),  Only thing I find in this range is 4.5V with a MAX6107, but I'll avoid Maxim if possible.

I do intend to add a 2.5V reference though, and do some math to compare the output and compensate it accordingly.

Cheers,
-Neil.


On 4/12/2012 6:21 PM, Chris Roper wrote:
{Quote hidden}

>> -


'[EE] Simple D/A converter?'
2012\05\13@225301 by Neil
flavicon
face
Resurrecting this thread from a month ago.

I had issues fitting a piggy-back pc-board into the original product.  However, I have been slowly migrating the parent of this product from a 16F to an 18F23k22 and accelerated that effort as it would've possibly let me use the D/A technique below... specifically because I'm using the internal oscillator, and the 18F will let me run that much faster.

Net result is that it works nicely -- at 32Mhz.  And since I'm using C now for my 18F apps, it got implemented very rapidly.  Thanks for informing me of this technique.

Now though, I have to ask about this method -- why exactly the need for a random number?  I am simply sampling as much as possible, and toggling the output bit depending on if the sampled value is greater or less than the measured value.  That measured value being the filtered output bit.

Cheers,
-Neil.



On 4/12/2012 10:34 AM, Adam Field wrote:
>> I remember someone here describing a D to A output based on a random number.
>> It wasn't timing sensitive. From my memory: if your random number is below
>> your target value turn the output on, else output is off. I don't know if
>> it's viable with a pseudo random generator.
> To expand on this, I found the original thread:
>
> http://www.piclist.com/techref/postbot.asp?id=/piclist/2001/02/04/004250a&key=random%20analog
>
> I haven't tried it yet, but it looks almost too interesting to not try.

2012\05\13@231357 by Harold Hallikainen

face
flavicon
face

{Quote hidden}

output voltage and then setting the output bit high or low as appropriate.
This is similar to delta modulation. Is this what you're doing?

I think the random number approach did not use an ADC. Instead, the
desired output is compared to random numbers and the pin set high if the
desired output is above the random number and low if it's below. If the
random number were not random, but were, instead, a steadily increasing
number, you'd get standard PWM. But, you would have to increment the
number at fixed intervals to get the required duty cycle. As I read this
random number method, you can call run it at irregular intervals and the
output will still be correct due to the use of the random numbers.

It's a really interesting idea.

Harold




-- FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
Not sent from an iPhone

2012\05\14@002023 by Neil

flavicon
face
On 5/13/2012 11:13 PM, Harold Hallikainen wrote:
> > From your description, it sounds like you're using an adc to measure the
> output voltage and then setting the output bit high or low as appropriate..
> This is similar to delta modulation. Is this what you're doing?
>
> I think the random number approach did not use an ADC. Instead, the
> desired output is compared to random numbers and the pin set high if the
> desired output is above the random number and low if it's below. If the
> random number were not random, but were, instead, a steadily increasing
> number, you'd get standard PWM. But, you would have to increment the
> number at fixed intervals to get the required duty cycle. As I read this
> random number method, you can call run it at irregular intervals and the
> output will still be correct due to the use of the random numbers.
>
> It's a really interesting idea.
>
> Harold

Yes, that's pretty much what I'm doing... I think I'm missing part of a discussion somewhere where that random number technique was explained as the technique I used, and after thinking and thinking I could not figure out the purpose for random numbers.  I'll have to find that other discussion with the technique I used.

Curious though -- what's being used to *compare* the random number to the desired output

2012\05\14@072059 by Walter Banks

flavicon
face


Neil wrote:

{Quote hidden}

I wrote the original random number ATOD post a few years ago. I used the
random number ATOD trick to create a PWM on a few projects including
the tone generator for a DTMF dialler..

To understand the random ATOD start by reviewing how a normal timer based
PWM works. The output voltage is equal to the time on divided by time off
multiplied by voltage swing between 1 and 0 logical levels plus logic 0 offset.

A random number ATOD also creates a an output ratio of 1's and 0's. The
ratio of output 1's to the total bits The output voltage is equal to the ratio
of 1's to the total 1's and 0's multiplied by the voltage swing  between 1 and
0 logical levels plus logic 0 offset.

They will produce the same output voltage.

To create a Random number PWM.

1) Decide the range of the random number RandRange typically 2^8 or 2^16 .

2) The output voltage when output is logical 1 is Vout1 and output voltage when output is logical 0 is Vout0;

3) Desired Output voltage is Vout somewhere between Vout0 and Vout1

4) Calculate a random threshold number. The ratio of RandomThreshold  / RandomRange is equal to the desired output Vout / (Vout1 - Vout0)

5)  RandomThreshold = (Vout - Vout0) / (Vout1 -Vout0) * RandRange .

6) Generate a random number as often as possible and compare it to the RandomThreshold. If the RandomThreshold is higher or equal to the random number output a 1 else output a 0

Thats it.

I typically used a 8 bit random number for fast moving data like the DTMF and 16 bit random numbers
for slow moving data. The  resolution is very similar to a timed PWM.

Advantages of random PWM, the noise is easier to filter because it has higher frequency components than the timed PWM.

Disadvantages to the random PWM. It is computationally more intensive than a timed PWM.


Regards,


Walter..
--
Walter Banks
Byte Craft Limited
http://www.bytecraft.com



2012\05\14@153218 by alan.b.pearce

face picon face
I remember seeing an item in "Design Ideas" section of the old "Electronics" magazine (I believe it may have been absorbed in Electronics Design now) where a hardware DAC used a shift register with feedback taps to compare to the desired input value, and the output of the comparator then fed into a low pass filter. Thus a hardware version of the random number DAC was published back in the 1970s ...


-- Scanned by iCritical.

More... (looser matching)
- Last day of these posts
- In 2012 , 2013 only
- Today
- New search...