Browsed by
Category: Arduino

Arduino 16 bit DAC: INL, DNL, Gain and Offset.

Arduino 16 bit DAC: INL, DNL, Gain and Offset.

Following on with step 1c from the article: Making a high resolution ADC from an Arduino Mini Pro

Well since the PWM output is only capable of 61069 steps, it really is not 16 bits, as 16 bit resolution would allow for 65535 discrete steps so I will call it a 15+ bit DAC.

Now that we actually have the DAC working, it is time to verify how well it works.  Here is a look at some of the data from the first unit I tested but first a quick description of how the data was taken for this: I set up the PWM to take a step approximately every 1.2 seconds. I programmed the PWM to start from zero then when it reached 61069 it would start back down again. The PWM output was fed through the 4th order RC filter. To take the DC value I used an 18bit measure system (over +/-10V) that was programmed to average a about 16,000 measurements every 950mS from the filter output.  We ended up with a total of 72064 data points over the 61069 output steps. Since I did not fully synchronize the data measured with every step taken the actual INL and DNL are approximate. The measured values I came up with for this Arduino Mini Pro board:

LSB = ~ 0.000076V (76uV)

INL= ~ 0.00225V (2.25mV)

DNL= ~ 0.0015V (1.5mV)

Min Measurement = 0.00313686V

Maximum Measurement = 4.64705V

Gain error = 0.928782628 ( Hmm.. this seems to explain the step response we were seeing on the scope capture in the filter article, when I was expecting a 409mV step and was seeing about 374mV on the scope)

Offset error =   0.00313686V

The DNL is really bad news. Why? Because it means effectively we are losing a little more than 4 bits of resolution. It is like this: From step to step there can be an error of 1.5mV so there is no point in looking for anything smaller than 1.5mV then for the full scale range of 4.647V divided by 1.5mV gives us about 3100 discrete values which is a little more than 11 bits of resolution. I really need to see if this is an inherent problem with the PWM generator design or if it is just an issue with this one device. So I will end up running this test again on another one or two more devices.

Below are The Mad Scientist Hut graphs of the actual data for the first device, and also a copy of the raw data if you are interested in looking it over.

Here is a copy of the raw data, you will need office 2010 to open this since it has more than 65,535 rows of data

DAC_Raw_Data_B1

This is a graph of the measured data:

Arduino DAC Graphed output
Arduino DAC Graphed output

So our 15+ bit DAC seems to work pretty well.

To calculate INL We took the end points of the data and subtracted a linear line from the actual data taken and ended up with a worst case measurement of about 0.00225V or approximately an error of 0.5% of the expected programmed output.

Here is what the INL graph looks like:

Arduino DAC INL
Arduino DAC INL

To calculate  DNL  We just took every data point and subtracted the previous measurement and graphed the result. This resulted in about a 0.0015V error from measurement to measurement, really this is a pseudo DNL, this would work much better with a synchronized step to measurement.

Here is a look at the DNL graph:

Arduino DAC DNL
Arduino DAC DNL

So if you are wondering why is the DNL getting wider, lets examine the output a little closer.

Here is the output for several steps around 0.5V, looks pretty decent….

DAC_0p49_to_0p51v

Here is the output for several steps around 2.5V, starting to see a real monotonicity issue here. I am going to take a guess that this part has some divider issue that is occurring on every forth step (it is the 3rd bit in the clock divider that may be does not do what is expected)

DAC_2p5V

Here is the output for several steps around 4.5V and here it is getting close to the maximum output and where the worst case DNL was happening.

DAC_4p5v

Filter PWM Down to a Usable DC Level

Filter PWM Down to a Usable DC Level

Following on with step 1b from the Mad Scientist Hut article: Making a high resolution ADC from an Arduino Mini Pro

Starting with simulating the filter, I found that a fourth order RC filter would suit my needs for getting a nice DC level out of the PWM signal. I am expecting less than 1mV peak to peak with this filter.  The filter is a little slow for large steps but for what I am doing it should be fine. The filter bandwidth is  fc = 15.9154943092[Hz]

There is a nice filter calculator page here: http://sim.okawa-denshi.jp/en/PWMtool.php

Here is a look at the filter in LTSpice:

4th order RC filter for PWM signal
4th order RC filter for PWM signal

This is what each section of the filter looks like in the simulation:

4th order RC filter for PWM signal response
4th order RC filter for PWM signal response

If you want to play with this in LTSpice, you can download this file here: PWM_131Hz_filter

Now it is time to go cut it on the LPKF

RC Filter in Eagle
RC Filter in Eagle

After the LPKF and some solder

LPKF PWM Filter board
LPKF PWM Filter board

Actual DC output from the filter. I programmed a PWM to 10000, wait for 2S then set the PWM to 15000, wait 2 seconds again, repeat. It settles in less than a half second with this filter, very close to the simulation values, see above.  I was expecting around a 409mV change in voltage but was only getting 374mV. Something to look into…

PWM Filter DC output switching between a setting of 10,000 and 15,000 every 2 seconds
PWM Filter DC output switching between a setting of 10,000 and 15,000 every 2 seconds
16 Bit PWM output on an Arduino?

16 Bit PWM output on an Arduino?

Following on with step 1a from the Mad Scientist Hut article: Making a high resolution ADC from an Arduino Mini Pro

In order to make a high resolution DC source we need a 16 bit PWM output from the Arduino. The standard libraries give you access to 8bits on the PWM pins, this only gives 256 discrete levels, if you had 16bits it will yield 65535 steps. Timer1 on the Mini Pro and UNO is capable of going into 16bit mode. With just a little Googling I found a library that give access to the 16bit timer modes, as well as letting you reprogram the PWM output frequency, the library was created by the user ‘runnerup’  AKA Sam Knight (as the copyright header in the lib indicates) in the Arduino forums: Here

The library is located here: PWM Frequency Library , the library also is supposed to work on both  the Arduino Mega and UNO.

Timer1 is the only 16bit timer on the atmega328 (UNO and Mini Pro) and it only comes out on two pins, 9 and 10. If you were to use the Mega  it has many more pins capable of 16 bit mode on the PWM outputs. I got the below timer/bit/pins table from: Advanced Arduino: direct use of ATmega counter/timers

timer bits channel Arduino pin Mega pin
timer0 8 A 6 13
timer0 8 B 5 4
timer1 16 A 9 11
timer1 16 B 10 12
timer2 8 A 11 10
timer2 8 B 3 9
timer3 16 A 5
timer3 16 B 2
timer3 16 C 3
timer4 16 A 6
timer4 16 B 7
timer4 16 C 8
timer5 16 A 44
timer5 16 B 45
timer5 16 C 46

Being able to reprogram the frequency is very important since it has an effect on the actual resolution that can be achieved.  See the table at the bottom for an output from the demo program from the PWM Frequency library that shows the differences for frequency to resolution. Since 131 Hz gives almost 16 bits of resolution at 61069 steps, this is what frequency I am going to use as I experiment. This will give approximately 81uV DC filtered step sizes on average using a 5V Mini Pro, we will try to verify this later, the best meter I have here is good for 100uV resolution in the 11V range, I will try to borrow one that has higher resolution in the next couple of weeks.

So lets try it out…

I wrote a quick program to try a few things: first did the frequency set?  second does high resolution PWM work on both channels 9 and 10 independently ( there was a note in the library that you would lose the second channel )?  third is it really high resolution?

We set PWM on channel 9 and 10 separately at a frequency of 131HZ  ( reciprocal of 131Hz is 0.0076335…. seconds) the period should be about 7.63mS. See screen shot, yes to both of those!

Arduino Mini Pro running 131Hz 16Bit mode PWM
Arduino Mini Pro running 131Hz 16Bit mode PWM

Now does the 16 bit resolution work. The reciprocal of 131Hz divided by 61069 steps is ~125nS.  This picture shows where I set the PWM to a setting of 1. Yes it works!

Arduino Mini Pro running 131Hz 16Bit mode PWM 125ns
Arduino Mini Pro running 131Hz 16Bit mode PWM 125ns

Here it is with PWM set to 2 and yes it is now ~250nS

Arduino Mini Pro running 131Hz 16Bit mode PWM 250ns
Arduino Mini Pro running 131Hz 16Bit mode PWM 250ns

Now onto designing a filter to get DC out of this….

Demonstrate Frequency Effect On Resolution Table ( I only ran it to 3931 HZ, but you get the idea….)

1 Hz 7813 steps 12 bits
11 Hz 2841 steps 11 bits
21 Hz 5953 steps 12 bits
31 Hz 4033 steps 11 bits
41 Hz 3049 steps 11 bits
51 Hz 2451 steps 11 bits
61 Hz 2050 steps 11 bits
71 Hz 14085 steps 13 bits
81 Hz 12346 steps 13 bits
91 Hz 10990 steps 13 bits
101 Hz 9901 steps 13 bits
111 Hz 9010 steps 13 bits
121 Hz 8265 steps 13 bits
131 Hz 61069 steps 15 bits
141 Hz 56738 steps 15 bits
151 Hz 52981 steps 15 bits
161 Hz 49690 steps 15 bits
171 Hz 46784 steps 15 bits
181 Hz 44199 steps 15 bits
191 Hz 41885 steps 15 bits
201 Hz 39801 steps 15 bits
211 Hz 37915 steps 15 bits
221 Hz 36200 steps 15 bits
231 Hz 34633 steps 15 bits
241 Hz 33196 steps 15 bits
251 Hz 31873 steps 14 bits
261 Hz 30652 steps 14 bits
271 Hz 29521 steps 14 bits
281 Hz 28470 steps 14 bits
291 Hz 27492 steps 14 bits
301 Hz 26579 steps 14 bits
311 Hz 25724 steps 14 bits
321 Hz 24923 steps 14 bits
331 Hz 24170 steps 14 bits
341 Hz 23461 steps 14 bits
351 Hz 22793 steps 14 bits
361 Hz 22161 steps 14 bits
371 Hz 21564 steps 14 bits
381 Hz 20998 steps 14 bits
391 Hz 20461 steps 14 bits
401 Hz 19951 steps 14 bits
411 Hz 19465 steps 14 bits
421 Hz 19003 steps 14 bits
431 Hz 18562 steps 14 bits
441 Hz 18141 steps 14 bits
451 Hz 17739 steps 14 bits
461 Hz 17354 steps 14 bits
471 Hz 16986 steps 14 bits
481 Hz 16633 steps 14 bits
491 Hz 16294 steps 13 bits
501 Hz 15969 steps 13 bits
511 Hz 15656 steps 13 bits
521 Hz 15356 steps 13 bits
531 Hz 15066 steps 13 bits
541 Hz 14788 steps 13 bits
551 Hz 14520 steps 13 bits
561 Hz 14261 steps 13 bits
571 Hz 14011 steps 13 bits
581 Hz 13770 steps 13 bits
591 Hz 13537 steps 13 bits
601 Hz 13312 steps 13 bits
611 Hz 13094 steps 13 bits
621 Hz 12883 steps 13 bits
631 Hz 12679 steps 13 bits
641 Hz 12481 steps 13 bits
651 Hz 12289 steps 13 bits
661 Hz 12103 steps 13 bits
671 Hz 11923 steps 13 bits
681 Hz 11748 steps 13 bits
691 Hz 11578 steps 13 bits
701 Hz 11413 steps 13 bits
711 Hz 11252 steps 13 bits
721 Hz 11096 steps 13 bits
731 Hz 10944 steps 13 bits
741 Hz 10797 steps 13 bits
751 Hz 10653 steps 13 bits
761 Hz 10513 steps 13 bits
771 Hz 10377 steps 13 bits
781 Hz 10244 steps 13 bits
791 Hz 10114 steps 13 bits
801 Hz 9988 steps 13 bits
811 Hz 9865 steps 13 bits
821 Hz 9745 steps 13 bits
831 Hz 9627 steps 13 bits
841 Hz 9513 steps 13 bits
851 Hz 9401 steps 13 bits
861 Hz 9292 steps 13 bits
871 Hz 9185 steps 13 bits
881 Hz 9081 steps 13 bits
891 Hz 8979 steps 13 bits
901 Hz 8880 steps 13 bits
911 Hz 8782 steps 13 bits
921 Hz 8687 steps 13 bits
931 Hz 8593 steps 13 bits
941 Hz 8502 steps 13 bits
951 Hz 8413 steps 13 bits
961 Hz 8325 steps 13 bits
971 Hz 8239 steps 13 bits
981 Hz 8155 steps 12 bits
991 Hz 8073 steps 12 bits
1001 Hz 7993 steps 12 bits
1011 Hz 7913 steps 12 bits
1021 Hz 7836 steps 12 bits
1031 Hz 7760 steps 12 bits
1041 Hz 7685 steps 12 bits
1051 Hz 7612 steps 12 bits
1061 Hz 7541 steps 12 bits
1071 Hz 7470 steps 12 bits
1081 Hz 7401 steps 12 bits
1091 Hz 7333 steps 12 bits
1101 Hz 7267 steps 12 bits
1111 Hz 7201 steps 12 bits
1121 Hz 7137 steps 12 bits
1131 Hz 7074 steps 12 bits
1141 Hz 7012 steps 12 bits
1151 Hz 6951 steps 12 bits
1161 Hz 6891 steps 12 bits
1171 Hz 6832 steps 12 bits
1181 Hz 6774 steps 12 bits
1191 Hz 6718 steps 12 bits
1201 Hz 6662 steps 12 bits
1211 Hz 6607 steps 12 bits
1221 Hz 6553 steps 12 bits
1231 Hz 6499 steps 12 bits
1241 Hz 6447 steps 12 bits
1251 Hz 6395 steps 12 bits
1261 Hz 6345 steps 12 bits
1271 Hz 6295 steps 12 bits
1281 Hz 6246 steps 12 bits
1291 Hz 6197 steps 12 bits
1301 Hz 6150 steps 12 bits
1311 Hz 6103 steps 12 bits
1321 Hz 6057 steps 12 bits
1331 Hz 6011 steps 12 bits
1341 Hz 5966 steps 12 bits
1351 Hz 5922 steps 12 bits
1361 Hz 5879 steps 12 bits
1371 Hz 5836 steps 12 bits
1381 Hz 5793 steps 12 bits
1391 Hz 5752 steps 12 bits
1401 Hz 5711 steps 12 bits
1411 Hz 5670 steps 12 bits
1421 Hz 5630 steps 12 bits
1431 Hz 5591 steps 12 bits
1441 Hz 5552 steps 12 bits
1451 Hz 5514 steps 12 bits
1461 Hz 5476 steps 12 bits
1471 Hz 5439 steps 12 bits
1481 Hz 5402 steps 12 bits
1491 Hz 5366 steps 12 bits
1501 Hz 5330 steps 12 bits
1511 Hz 5295 steps 12 bits
1521 Hz 5260 steps 12 bits
1531 Hz 5226 steps 12 bits
1541 Hz 5192 steps 12 bits
1551 Hz 5158 steps 12 bits
1561 Hz 5125 steps 12 bits
1571 Hz 5093 steps 12 bits
1581 Hz 5061 steps 12 bits
1591 Hz 5029 steps 12 bits
1601 Hz 4997 steps 12 bits
1611 Hz 4966 steps 12 bits
1621 Hz 4936 steps 12 bits
1631 Hz 4905 steps 12 bits
1641 Hz 4876 steps 12 bits
1651 Hz 4846 steps 12 bits
1661 Hz 4817 steps 12 bits
1671 Hz 4788 steps 12 bits
1681 Hz 4760 steps 12 bits
1691 Hz 4731 steps 12 bits
1701 Hz 4704 steps 12 bits
1711 Hz 4676 steps 12 bits
1721 Hz 4649 steps 12 bits
1731 Hz 4622 steps 12 bits
1741 Hz 4596 steps 12 bits
1751 Hz 4569 steps 12 bits
1761 Hz 4543 steps 12 bits
1771 Hz 4518 steps 12 bits
1781 Hz 4492 steps 12 bits
1791 Hz 4467 steps 12 bits
1801 Hz 4442 steps 12 bits
1811 Hz 4418 steps 12 bits
1821 Hz 4394 steps 12 bits
1831 Hz 4370 steps 12 bits
1841 Hz 4346 steps 12 bits
1851 Hz 4322 steps 12 bits
1861 Hz 4299 steps 12 bits
1871 Hz 4276 steps 12 bits
1881 Hz 4254 steps 12 bits
1891 Hz 4231 steps 12 bits
1901 Hz 4209 steps 12 bits
1911 Hz 4187 steps 12 bits
1921 Hz 4165 steps 12 bits
1931 Hz 4143 steps 12 bits
1941 Hz 4122 steps 12 bits
1951 Hz 4101 steps 12 bits
1961 Hz 4080 steps 11 bits
1971 Hz 4059 steps 11 bits
1981 Hz 4039 steps 11 bits
1991 Hz 4019 steps 11 bits
2001 Hz 3999 steps 11 bits
2011 Hz 3979 steps 11 bits
2021 Hz 3959 steps 11 bits
2031 Hz 3939 steps 11 bits
2041 Hz 3920 steps 11 bits
2051 Hz 3901 steps 11 bits
2061 Hz 3882 steps 11 bits
2071 Hz 3863 steps 11 bits
2081 Hz 3845 steps 11 bits
2091 Hz 3826 steps 11 bits
2101 Hz 3808 steps 11 bits
2111 Hz 3790 steps 11 bits
2121 Hz 3772 steps 11 bits
2131 Hz 3755 steps 11 bits
2141 Hz 3737 steps 11 bits
2151 Hz 3720 steps 11 bits
2161 Hz 3702 steps 11 bits
2171 Hz 3685 steps 11 bits
2181 Hz 3669 steps 11 bits
2191 Hz 3652 steps 11 bits
2201 Hz 3635 steps 11 bits
2211 Hz 3619 steps 11 bits
2221 Hz 3602 steps 11 bits
2231 Hz 3586 steps 11 bits
2241 Hz 3570 steps 11 bits
2251 Hz 3554 steps 11 bits
2261 Hz 3539 steps 11 bits
2271 Hz 3523 steps 11 bits
2281 Hz 3508 steps 11 bits
2291 Hz 3492 steps 11 bits
2301 Hz 3477 steps 11 bits
2311 Hz 3462 steps 11 bits
2321 Hz 3447 steps 11 bits
2331 Hz 3433 steps 11 bits
2341 Hz 3418 steps 11 bits
2351 Hz 3403 steps 11 bits
2361 Hz 3389 steps 11 bits
2371 Hz 3375 steps 11 bits
2381 Hz 3360 steps 11 bits
2391 Hz 3346 steps 11 bits
2401 Hz 3332 steps 11 bits
2411 Hz 3319 steps 11 bits
2421 Hz 3305 steps 11 bits
2431 Hz 3291 steps 11 bits
2441 Hz 3278 steps 11 bits
2451 Hz 3264 steps 11 bits
2461 Hz 3251 steps 11 bits
2471 Hz 3238 steps 11 bits
2481 Hz 3225 steps 11 bits
2491 Hz 3212 steps 11 bits
2501 Hz 3199 steps 11 bits
2511 Hz 3186 steps 11 bits
2521 Hz 3174 steps 11 bits
2531 Hz 3161 steps 11 bits
2541 Hz 3149 steps 11 bits
2551 Hz 3137 steps 11 bits
2561 Hz 3124 steps 11 bits
2571 Hz 3112 steps 11 bits
2581 Hz 3100 steps 11 bits
2591 Hz 3088 steps 11 bits
2601 Hz 3076 steps 11 bits
2611 Hz 3064 steps 11 bits
2621 Hz 3053 steps 11 bits
2631 Hz 3041 steps 11 bits
2641 Hz 3030 steps 11 bits
2651 Hz 3018 steps 11 bits
2661 Hz 3007 steps 11 bits
2671 Hz 2996 steps 11 bits
2681 Hz 2984 steps 11 bits
2691 Hz 2973 steps 11 bits
2701 Hz 2962 steps 11 bits
2711 Hz 2951 steps 11 bits
2721 Hz 2941 steps 11 bits
2731 Hz 2930 steps 11 bits
2741 Hz 2919 steps 11 bits
2751 Hz 2909 steps 11 bits
2761 Hz 2898 steps 11 bits
2771 Hz 2888 steps 11 bits
2781 Hz 2877 steps 11 bits
2791 Hz 2867 steps 11 bits
2801 Hz 2857 steps 11 bits
2811 Hz 2846 steps 11 bits
2821 Hz 2836 steps 11 bits
2831 Hz 2826 steps 11 bits
2841 Hz 2816 steps 11 bits
2851 Hz 2807 steps 11 bits
2861 Hz 2797 steps 11 bits
2871 Hz 2787 steps 11 bits
2881 Hz 2777 steps 11 bits
2891 Hz 2768 steps 11 bits
2901 Hz 2758 steps 11 bits
2911 Hz 2749 steps 11 bits
2921 Hz 2739 steps 11 bits
2931 Hz 2730 steps 11 bits
2941 Hz 2721 steps 11 bits
2952 Hz 2711 steps 11 bits
2961 Hz 2702 steps 11 bits
2971 Hz 2693 steps 11 bits
2981 Hz 2684 steps 11 bits
2991 Hz 2675 steps 11 bits
3001 Hz 2666 steps 11 bits
3012 Hz 2657 steps 11 bits
3021 Hz 2649 steps 11 bits
3031 Hz 2640 steps 11 bits
3041 Hz 2631 steps 11 bits
3051 Hz 2623 steps 11 bits
3061 Hz 2614 steps 11 bits
3071 Hz 2606 steps 11 bits
3081 Hz 2597 steps 11 bits
3091 Hz 2589 steps 11 bits
3101 Hz 2580 steps 11 bits
3111 Hz 2572 steps 11 bits
3121 Hz 2564 steps 11 bits
3131 Hz 2556 steps 11 bits
3142 Hz 2547 steps 11 bits
3152 Hz 2539 steps 11 bits
3162 Hz 2531 steps 11 bits
3172 Hz 2523 steps 11 bits
3182 Hz 2515 steps 11 bits
3191 Hz 2508 steps 11 bits
3201 Hz 2500 steps 11 bits
3211 Hz 2492 steps 11 bits
3221 Hz 2484 steps 11 bits
3231 Hz 2477 steps 11 bits
3241 Hz 2469 steps 11 bits
3252 Hz 2461 steps 11 bits
3261 Hz 2454 steps 11 bits
3271 Hz 2446 steps 11 bits
3281 Hz 2439 steps 11 bits
3292 Hz 2431 steps 11 bits
3301 Hz 2424 steps 11 bits
3311 Hz 2417 steps 11 bits
3322 Hz 2409 steps 11 bits
3331 Hz 2402 steps 11 bits
3341 Hz 2395 steps 11 bits
3351 Hz 2388 steps 11 bits
3361 Hz 2381 steps 11 bits
3371 Hz 2374 steps 11 bits
3381 Hz 2367 steps 11 bits
3391 Hz 2360 steps 11 bits
3401 Hz 2353 steps 11 bits
3411 Hz 2346 steps 11 bits
3421 Hz 2339 steps 11 bits
3432 Hz 2332 steps 11 bits
3442 Hz 2325 steps 11 bits
3451 Hz 2319 steps 11 bits
3461 Hz 2312 steps 11 bits
3472 Hz 2305 steps 11 bits
3481 Hz 2299 steps 11 bits
3491 Hz 2292 steps 11 bits
3501 Hz 2286 steps 11 bits
3511 Hz 2279 steps 11 bits
3521 Hz 2273 steps 11 bits
3532 Hz 2266 steps 11 bits
3541 Hz 2260 steps 11 bits
3552 Hz 2253 steps 11 bits
3561 Hz 2247 steps 11 bits
3571 Hz 2241 steps 11 bits
3581 Hz 2235 steps 11 bits
3592 Hz 2228 steps 11 bits
3601 Hz 2222 steps 11 bits
3611 Hz 2216 steps 11 bits
3621 Hz 2210 steps 11 bits
3631 Hz 2204 steps 11 bits
3641 Hz 2198 steps 11 bits
3651 Hz 2192 steps 11 bits
3661 Hz 2186 steps 11 bits
3671 Hz 2180 steps 11 bits
3681 Hz 2174 steps 11 bits
3691 Hz 2168 steps 11 bits
3701 Hz 2162 steps 11 bits
3712 Hz 2156 steps 11 bits
3722 Hz 2150 steps 11 bits
3731 Hz 2145 steps 11 bits
3741 Hz 2139 steps 11 bits
3752 Hz 2133 steps 11 bits
3761 Hz 2128 steps 11 bits
3771 Hz 2122 steps 11 bits
3782 Hz 2116 steps 11 bits
3791 Hz 2111 steps 11 bits
3802 Hz 2105 steps 11 bits
3811 Hz 2100 steps 11 bits
3822 Hz 2094 steps 11 bits
3831 Hz 2089 steps 11 bits
3842 Hz 2083 steps 11 bits
3851 Hz 2078 steps 11 bits
3861 Hz 2073 steps 11 bits
3872 Hz 2067 steps 11 bits
3881 Hz 2062 steps 11 bits
3891 Hz 2057 steps 11 bits
3902 Hz 2051 steps 11 bits
3911 Hz 2046 steps 10 bits
3921 Hz 2041 steps 10 bits
3931 Hz 2036 steps 10 bits
Making a high resolution ADC from an Arduino Mini Pro

Making a high resolution ADC from an Arduino Mini Pro

I want to make a high voltage Geiger/ Photo Multiplier Tube (PMT) supply that is regulated by an Arduino UNO or Mini Pro. The Arduino would need to control the voltage by reading if it is above or below target then adjusting the voltage as necessary, as a side job it will set the user programmed voltage and also display the target output voltage to an LCD display. Since the high voltage supply may go to over 1.5KV and I want very fine resolution control of less than 250mV,  this means as a minimum I will need to be able to read back at least 6000 discrete steps.  Is it possible? Yes I do think it should be possible, the atmega328 is quite a capable little micro-controller and with just a handful of low cost external components (some resistors, capacitors, and a comparator) it should source a high resolution voltage as well as measure one. Lets find out at the Mad Scientist Hut.

I will do this in several steps over many days or weeks, here is my plan of attack:

1) Create a high resolution Digital to Analog Converter (DAC) source.

a) We need a 16 bit PWM output from the Arduino. (Completed 4/4/15 ) Click here: Link to this article

b) We need to filter the PWM signal down to a usable stable DC value. (Completed 4/5/15 )Click here: Link to this article

i) Simulate

ii) Protoype

c) Lets verify the Integrated Non Linearity (INL) , Differential Non Linearity (DNL), Gain and offset of the DAC source just to see how good it actually is. (In progress 4/11/15 )Click here: Link to this article

2) Create a high resolution Analog to Digital Converter (ADC) measure system.

a) The compare circuit.

b) Calibration.

c) Lets verify the INL, DNL, Gain and offset of the ADC just to see how good it actually is.

3) Finally the High Voltage supply.

a) The HV generation.

b) Control and measurement.

c) How well does it work?