You can put a ~10nF cap on each pin to ground to make the Arduino insensitive to the divider impedance. More than about 10k, and you will start to see issues with the sampling capacitor of the ADC not charging. But you need to be careful about maintaining a low enough output impedance of each divider to drive the Arduino ADC. Big resistors obviously also help regardless of whether you switch them. That means that for a 5 cell system with 4.2V max, you need to divide each voltage by at least 6:1. So perhaps 3.5V is the right choice, nice round number that's smaller than 3.8V. So if you get a FET with Vth specified as being between 0.4 and 1.2V, say, then you need all the Ax values to end up below (5V - 1.2V) = 3.8V. You need each Ax pin to end up below Vcc (or whatever the GPIO output high voltage is) by more than the threshold voltage of the FET. If they're too high, then the FETs aren't actually turned on, because they're only turned on by the difference between the GPIO voltage and the measured divider voltage. This works ONLY IF the measured voltages at the Ax pins are expected to be low enough. When low, all the FETs are off and no current is drawn. When this GPIO is high, you get the divided output. All the NFET gates then get tied together and sent to a GPIO. So for instance for channel A4 you would disconnect R2 from pin A4, and then connect the NFET source to A4 and the drain to R2. Another way, slightly more "clever" but also with drawbacks, is to put a single "logic level" NFET between each ADC pin and each high side resistor. Then you use an open collector driver (which can be just an NFET) with a resistor on the output to pull down each PFET gate when you want to measure. You put a PFET with source connected to each cell positive, and a source-to-gate resistor in parallel with a ~8V zener diode. One way is to apply a high side switch to each divider. (to be clear none of these are "good" in terms of being a professional/production solution) Sure there are a couple of solutions here. Thanks a lot for reading, I am sorry, if i have fogotten something essentialĮDIT: I hope this is the right sub, sorry if not! I just now could not find a alternative online, that does not use a voltage divider.Īs far as I understand, the voltage devider was crappy calculated, with a much so low resistance, so the cells got sort of shorted out, or the resistance of the voltage divider added to the internal resistance, so that the cells discharged just though the voltage devider. Is there a clever way to read out the individual voltages of the cells, without discharging the cells? Or is it working in theory, but the resistors were calculated poorly? How ever, I just wanted to continue the project, but the first two cells were discharged to about 1.5 or 1 V, so beyond recharge. It worked, but I broke the display, so I had to wait for a new one to arrive and I did not take out the cells. I had help of a friend, who studies something electronic related and he gave me the hint to use a voltage divider, to pull down the voltage enough for the arduino to handle (I calculated it with about 4.5V, and adjusted the values in the code, to match the measured voltage). I checked the voltage of the individual cells after letting it rest for a while, and the voltages seemed to be fine. This code runs on all Arduino variants as well as the ATtinyx4 series chips.įor a more in-depth article, which includes calculation details, applications and calibration how-to, see Secret Arduino Voltmeter – Measure Battery Voltage.I started a Li-Ion 18650 battery-project for a diy-bluetooth speaker this summer, but only reacently got around to continue working on it. You can however, calibrate the scale factor for greater accuracy. There are some limitations in accuracy due to tolerances on the internal voltage reference. Uint8_t low = ADCL // must read ADCL first - it then locks ADCH While (bit_is_set(ADCSRA,ADSC)) // measuring set the reference to Vcc and the measurement to the internal 1.1V reference In the code following, we will actually measure the internal voltage reference, and then use this value to calculate our actually Vcc. The way to perform these feats is use the internal reference to actually measure Vcc. Improve accuracy of analogRead() in many situations Monitoring battery voltage to your Arduino This trick can be used in all sorts of ways such as: A little known feature of many AVR chips is the ability to measure the internal analog voltage reference.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |