Cheap way of 16bit analog accuracy

Go To Last Post
35 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to use Kinetis k20 series from freescale, they are around 5USD and have 16bit adc, but I wonder how can I achieve a two channel 16bit dac, can I reach the accuracy using pwm? Or I should go with external dac chips.
I also think the cheapest 2 channel 16bit dac is dac8552 from ti.the speed does not matter so much! something more than 1ksps.
Do you have any ideas?

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can achieve the resolution using pwm but accuracy is another matter. If you want precision with pwm you need to switch a voltage reference then filter it. In many instances it may just be easier to use a dac chip. Since you spec > 1ksps, that would require a pwm clock frequency of 65 532 000 Hz or around 65MHz. Maybe possible on a k20 - i havent looked closely at the specs.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
If you want precision with pwm you need to switch a voltage reference then filter it.

would you explain it more?

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a common technique - what do you want explained? Obviously the pwm output voltage is derived from the power rails - not exactly accurate. By switching a precision voltage reference, you will achieve much better accuracy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok,thanks.

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lots of IC D/A converters. I could serach for one, but I'm sure you can find one at Linear Tech, Analog devices, TI, etc.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you can spare an ADC channel, measure the filtered pwm and do closed loop control.

It all starts with a mental vision.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
If you can spare an ADC channel, measure the filtered pwm and do closed loop control.

Does simple RC filters be enough?

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why do you need 16 bits in the first place? What is the scope of the application?

I don't think close loop control is that easy, you always will have some ripple and getting the loop stable won't be trivial. Might work with 8 bits, but not 16.

You could roll your own delta-sigma modulator, very simple code and as much bits as you like - within reason. The digital output looks quite chaotic, but the frequency spectrum seems to have a few desirable properties compared to straight PWM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Remember that "16-bit" means that you are working to 1 part in 64K - to really achieve that is never going to be "cheap"!
Nor simple.

To put that in context:
1mV ripple on a 5V supply is 0.02%;
1 part in 64K is 0.002%.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a very long and detailed discussion and design for a 24bit DAC using PWM in the EEVBlog forum. The thread is long, but has interesting thoughts, insights and prototyping work/code about such a high resolution DAC.

The design discussed there is quite cheap and simple. To archive good precision (and not just resolution) you will need an excellent reference, this part is not cheap.

Markus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want a 16 bit voltage output, you could use 2 cheap DAC's with 10-12 bits resolution summed (weighted) in an opamp (for example 1st DAC - Gain 1, 2nd DAC - Gain 1/256), and using an 16 bit ADC you could do a Closed Loop. Much faster than using PWM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why go through all the massive trouble if you can buy a dual channel 16 bits rail-to-rail voltage output SPI DAC for $6.35?

http://www.linear.com/product/LT...

Why spend massive amounts of engineering time to save a few bucks, only to get an (very likely) inferior solution and gain a few extra gray hairs in the process?

All the intricate design details already been take care of for you by very clever LT engineers... so you can spend your time in a more sensible way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Why spend massive amounts of engineering time to save a few bucks

If you are making 5 I agree. If you are making 500,000 I don't ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I fully agree with that! ;) but I think the OP is not going to make 500K devices ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
There is a very long and detailed discussion and design for a 24bit DAC using PWM in the EEVBlog forum. The thread is long, but has interesting thoughts, insights and prototyping work/code about such a high resolution DAC.

The design discussed there is quite cheap and simple. To archive good precision (and not just resolution) you will need an excellent reference, this part is not cheap.

That’s a huge thread, do you have the good conclusions?

Quote:
To archive good precision (and not just resolution) you will need an excellent reference, this part is not cheap.

The K20 series have a good internal reference voltage, doesn’t it suffices?

Quote:
If you want a 16 bit voltage output, you could use 2 cheap DAC's with 10-12 bits resolution summed (weighted) in an opamp (for example 1st DAC - Gain 1, 2nd DAC - Gain 1/256), and using an 16 bit ADC you could do a Closed Loop. Much faster than using PWM.

Seems a good idea! Would you explain it in detail?

Quote:
Why go through all the massive trouble if you can buy a dual channel 16 bits rail-to-rail voltage output SPI DAC for
$6.35?

I have found DAC8552 from ti and they are around 3.5USD!, but why not integrating them in the MCU itself?

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lets describe some of the limits of a filtered PWM "dac" so that you will know why things are limited the way they are.

"Filtering" means that the output is the average of the logic level input signal. The filtering, itself is nice and linear because it is made of passive linear components. But, what sets logic high? It is your micro's Vcc. If Vcc is not 16 bit accurate, then the averaged value will not be 16 bit accurate.

Next, the series R of the first stage of the filter is driven by the port pin circuitry. There are two important transistors, one that pulls up to Vcc and the other that pulls down to ground. These transistors (typically 50 to 150 ohms, equivalent) are effectively in series with the filter resistor. And, those two transistors are not the same. So, there is a different resistance when the pin is making a high level, compared to when it is low. Under ideal conditions, this only affects the circuit time constant which does NOT affect the average.

BUT, if you have anything less than an infinite load, the filter attenuates the signal as though the filter series resistance is the generator (source) resistance. This, on its own, reduces the accuracy. But, now you have the apparent resistance time-varying, depending on which microcontroller output transistor is on. The effect is that the apparent source resistance changes with the average, so the system now becomes nonlinear.

At 8 bits or 10 bits, these affects are pretty much invisible. But, when you get to 16 bits, they start to become quite important. You will still get 2**16 discrete and monotonic output levels (resolution). But, it will NOT be 16-bit ACCURATE.

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

The K20 series have a good internal reference voltage, doesn’t it suffices?

You still haven't explained the need/use of these 16-bit values. Respondents might have more interest if they hear the justification.

Then you were pointed to a pertinent thread--and you ask for the summary version! I'll give you a summary: If you desire to approach 16-bits in your application, your analog subsystem will need to be squeaky-clean. The entire thing. Great attention to detail on board layout, supply/reference voltages, protecting the signal itself, and grounding to mention a few.

Anyway, a quick peek seems to indicate a +/- 3% range on the "untrimmed" internal reference. Over temperature it isn't too bad-- less than 1%.

Now, your squeaky-clean analog subsystem will have no error dropping your signal levels to ADC range? And you only need the few channels that will do the (up to) 16-bit conversions?

And the onboard 12-bit DAC (on some/most models) isn't good enough?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here is what is meant by "squeaky clean".

Suppose that your DAC reference is 5V. A 16 bit DAC has 65536 steps, so each step is worth 76.3uV.

Suppose the ground point of that DAC is connected to the point where you measure it with a voltmeter, and that trace has a resistance of 100mohms. Suppose that trace has 1ma flowing through it. Now, the place where you measure is 100mV different from the DAC, and it maybe be positive or negative, depending on the direction the current flows. Suddenly, your whole DAC has lost its 16 bit accuracy.

Similarly, if the reference is 5.00010 Volts (100mV high), the top end of the DAC output is now off by more than 1 bit.

Thus, to justify 16 bits on for ACCURACY (not resolution), the whole power supply, reference, and grounding system has to be clean, clean, clean. In other words, "squeaky clean"!

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've followed the references thread from the beginning as I was interested in its topic 'general purpose power supply'. The thread goes in great detail over the design of a 24bit DAC and covers and presents some options and even some sample code.

After following through all this I decided, that for my purposes, the built-in DAC and 1% reference of a xmegaA3U is sufficient. I'm sure one can pull it off, but I for me the built-in is good enough, so I don't wnt to spend additional effort there. The thread is still very insightful :-).

Markus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I have found DAC8552 from ti and they are around 3.5USD!, but why not integrating them in the MCU itself?

Probably because it's technically quite difficult, it would drive up the price of the chip significantly, and the overwhelming majority of customers are not interested in it I guess. DACs are a relatively uncommon peripheral anyway.

Not really too long ago, a 12 bit ADC or DAC was a highly specialized, very expensive component, sometimes multiple dies in one ceramic package. 16 bits was almost alien technology.

I have this book from Analog Devices about data conversion, and when I read it was quite surprised to find that ADCs and DACs were really difficult components back in the eighties. Technology has come a long way.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One of the things that has lead to the modern higher resolution (and accuracy) DAC is laser trimming. Not only the physical hardware but learning how to use it in a production environment.

As for why you don't see high resolution DACs in modern micros, the answer is :chip area. DACs really take quite a bit of silicon. When you make your money from delivering the same or more functionality in less and less silicon, a big die DAC is a hard pill to swallow. And, a costly one.

There is a related factor, however for such DACs not being in most micros. Demand. You can put in timers at very little cost and it does not matter much if only one in 100 uses all. But, a DAC raises the cost. If you don't have the demand that is willing to pay the added cost, you loose money.

Money is what its all about!

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Money is what its all about!

I certainly agree with you. I want to use the whole system for building a digital power supply. And the thread that markus_b send is a gift for me!

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys what’s your opinion about Ref voltage Chip.
I think ADR421 is a good candidate.

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you want a digital powersupply. I don't see the need for 16 bits, even with 60V range, that would allow you to set it ~1mV steps. Seems overkill to me. So what are the requirements?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I find it interesting that the xmega series, despite the added cost, do feature a 12bit DAC built in. The do have a large amount of built-in peripherals, like timers, USART, SPI, etc and come in cheaper than lesser equipped megas. I suppose this is due to the newer process. The only downside is that they don't run at 5V anymore.

It looks like Moores law brought us more fore less, once more :-).

Markus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It looks like Moores law brought us more fore less, once more

Kinetis series from freescale even are more wiser choice devices! They are cheap and 32bit, have 16bit adc and 12bit dac and 100MHz core....and more and they cost lower than xmegas!!!

ATxmega128A1 (ATXMEGA128A1-AU-ND)
http://www.digikey.com/product-d...

Compare it to MK10DN512ZVLL10-ND from freescale with 128KB ram and 512KB flash.
http://www.digikey.com/product-d...

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't really need 128k of RAM and have no intent to fill 512k Flash either. So I've chosen the atxmega32a4u ($2 in quantities).

The price of the MCU is one thing, is is not even the largest item in the BOM. For example I want a good display and found that they start at $10. There is enough stuff in there on the border of my knowledge, so going with an AVR is definitely an advantage for me. Especially as I'm confident that I'll find help here on AVRfreaks when I'm stuck.

Markus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've create a new thread to discuss my take on the topic of lab power supplies:
https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=122263

Markus

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ali_dehbidi wrote:
...and more and they cost lower than xmegas!!!
The XMEGA128A1 is an older variant. Better to compare with XMEGA256A3U: @Digi-Key
unless need the extra pins for EBI.
When Freescale Cortex-M0+ arrives this year that'll be a closer competition.

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
Kinetis series from freescale even are more wiser choice devices!

That depends entirely on the application and is no way generally applicable.

While a big semitruck is the right tool to transport a container across the country, that same truck is not right when you want to transport little parcels in a big crowded city; a bicycle is likely the best choice then :)

But I'm still curious why 16 bits are needed?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
But I'm still curious why 16 bits are needed?

Because they say it's 16bit but the actual effective number of bit's are lower. For k20 series it's about 14.5Bit.
And if you need 1mv resolution then you needs higher adc and dac units and you should have a bit of room for compensation.

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So I take it as that you are going to make a wide range 1mV precise power supply?

Something like:
http://www.tti-power.co.uk/preci...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or something like this!
http://www.hameg.com/638.0.html?L=0

I love Digital
and you who involved in it!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the DAC is the least difficult part if you want to make such device, which I bet, is not so trivial to design.