Hi,
I'm trying to design a smart discharger for my batteries in order to determine their capacity and automatically shut off the discharge when the batteries go below a certain voltage. In my course of preparing the software and hardware, I realised a very interesting phenomenon across the various analog channels available in the Teensy 3.0. As I need to be able to accurately compare the voltages at different points in my circuit, I needed all of the ADC channels to be matched. I built a simple circuit such that I connect a single battery across every analog channel (A0-A9), measured their ADC values and plotted a frequency histogram of the data. The numbers are quite interesting:
The frequency histogram may be more telling:
From top view:
Notice that moving from channel A0 to A9, there is an offset in the "earlier" channels compared to the rest. The channels start to be more matched in terms of their output starting from A1. However, channel A0 is offset by at least 2 ADC values compared to A1-A9. Therefore, if you need matched ADC outputs, seems like channels A1 to A9 are better suited and A0 should not be used. For more critical applications, seems like channels A5 to A9 are very well matched and A1 to A4 are also well matched.
Further more, when I connect the ground of the battery to AGND, I'm getting a lot of noise on the circuit (the ADC values generated above are based on connection to AGND). From the values above, the variance is in the region of around 7 ADC units (using a resolution of 12 bits). However, when I connect to GND instead of AGND, the variance is around only 1.5 ADC units. So which ground reference pin should I be using in this case? Also, I have also tried to connect a 1uF capacitor across the ADC channels to ground for the analog pins that I'm reading. Is that a good practice and recommended?
I'm trying to design a smart discharger for my batteries in order to determine their capacity and automatically shut off the discharge when the batteries go below a certain voltage. In my course of preparing the software and hardware, I realised a very interesting phenomenon across the various analog channels available in the Teensy 3.0. As I need to be able to accurately compare the voltages at different points in my circuit, I needed all of the ADC channels to be matched. I built a simple circuit such that I connect a single battery across every analog channel (A0-A9), measured their ADC values and plotted a frequency histogram of the data. The numbers are quite interesting:
Code:
A0 A1 A2 A3 A4 A5 A6 A7 A8 A9
1685 0 1 0 0 0 0 0 0 0 0
1686 0 0 0 0 0 0 0 0 0 0
1687 0 0 1 0 0 0 0 0 0 0
1688 0 0 0 0 0 0 0 0 0 0
1689 0 0 0 0 0 0 0 0 0 0
1690 1 0 0 1 0 0 1 0 0 0
1691 0 1 0 0 3 1 2 0 0 0
1692 6 0 1 1 1 1 1 3 1 2
1693 4 0 4 0 1 2 4 2 2 6
1694 5 0 10 0 4 6 5 3 3 4
1695 8 7 5 7 3 2 7 3 6 8
1696 6 8 13 13 4 8 9 11 4 3
1697 22 19 19 7 10 8 14 8 9 9
1698 37 23 20 24 15 12 17 23 20 15
1699 78 36 33 33 27 26 18 34 23 28
1700 199 57 52 58 67 42 39 53 54 42
1701 412 166 118 166 106 85 104 112 97 82
1702 1050 336 253 360 267 196 223 242 189 165
1703 2330 805 573 813 622 455 478 542 433 360
1704 4909 1840 1381 1854 1523 1057 1149 1261 1040 897
1705 8853 3879 2931 3893 3168 2396 2425 2768 2298 2071
1706 13871 7329 5824 7504 6168 4941 4820 5470 4775 4238
1707 18777 12130 10182 12323 10463 8846 8848 9669 8458 7650
1708 21312 17360 15143 16868 15723 13737 13682 14547 13378 12508
1709 20422 20620 19592 20535 19600 18495 18379 19102 18384 17418
1710 16712 21209 20843 20729 21094 21162 20840 21024 20879 20580
1711 11106 18254 19394 17892 19285 20120 20054 19664 20070 20551
1712 6432 12895 14980 12986 14558 16339 16534 15597 16498 17228
1713 3212 7824 9831 8145 9540 11308 11383 10540 11729 12726
1714 1572 4093 5719 4339 5325 6848 6858 6073 7104 7818
1715 681 1969 3007 2223 2664 3470 3600 3145 3762 4310
1716 255 875 1419 917 1274 1640 1648 1498 1849 2133
1717 113 399 639 449 517 750 728 591 778 922
1718 46 168 258 176 228 274 323 264 349 369
1719 19 87 119 73 84 111 137 116 153 178
1720 14 32 53 37 52 50 69 59 49 76
1721 7 18 22 20 29 29 35 22 36 32
1722 8 22 15 16 13 16 16 12 17 30
1723 12 12 15 7 18 15 11 11 12 9
1724 4 4 11 9 10 12 11 8 10 7
1725 0 6 3 5 10 11 7 5 11 7
1726 0 4 5 3 5 11 3 7 6 3
The frequency histogram may be more telling:
From top view:
Notice that moving from channel A0 to A9, there is an offset in the "earlier" channels compared to the rest. The channels start to be more matched in terms of their output starting from A1. However, channel A0 is offset by at least 2 ADC values compared to A1-A9. Therefore, if you need matched ADC outputs, seems like channels A1 to A9 are better suited and A0 should not be used. For more critical applications, seems like channels A5 to A9 are very well matched and A1 to A4 are also well matched.
Further more, when I connect the ground of the battery to AGND, I'm getting a lot of noise on the circuit (the ADC values generated above are based on connection to AGND). From the values above, the variance is in the region of around 7 ADC units (using a resolution of 12 bits). However, when I connect to GND instead of AGND, the variance is around only 1.5 ADC units. So which ground reference pin should I be using in this case? Also, I have also tried to connect a 1uF capacitor across the ADC channels to ground for the analog pins that I'm reading. Is that a good practice and recommended?