Noob building a battery datalogger - Page 1
Forum section: electronics / beginners

author: BlakeSeven
author_rank: Newbie
timestamp: November 15, 2020, 01:13:46 am
content: Hi Guys, first post I'm sure it won't be the last.I'm building a voltage and current datalogger for testing large (75-280Ah) lithium cells. I am blessed to be working with a great coder, but unfortunately I am pretty new to electronics. The system is Arduino based using ADS1115 ADCs and currently TSB712AIST rail-to-rail op amps for the voltage input circuit and a LEM LTSR 15-NP hall effect current sensor.The batteries under test will be single cells so around 4.2VDC max with a constant current discharge rate of about 50A max, but I would like to be able to log tests for battery packs to nominal 48V, so max around 70V for the system.It has taken me a long time to get to this stage, including trying different op amps: lm358 (output not close enough to the 5V rail), opa244 (same for ground rail), and ACPL-C87B (too much of a faff with the 2V input and separate ground - plus i don't need 1000s of volts isolation).I thought that I should ask for help before going any further. The code is good to go, but I am still struggling with the basics.This is my understanding so farThe TSB712AIST Opamps are rail-to-rail opamps and are rated to put out more than 4.8V at <= 1mA from a 5V rail. They cannot supply more to the ADCs than the 5V rail they are powered with.The Opamps have built in over-voltage protection. The sensing input voltage goes through a 3.3mR resistor so even without clamping the voltage, the current passed can never be enough to damage the Opamps.100V/3.3mR = .03mAThere are 2 voltage ranges going into separate opamps and ADC channels: 0V-4.8V and 0V-60V+. The 0V-60V range has a 10:0.8 divider so 10V=.8V and 60V = 4.8V. This is fairly accurate as I've series-ed a few fine tolerance resistors, but fine tuning can be done in software (finally accepted this after watching a few videos - one guy was complaining about trimpots). The smaller range has no voltage divider.I have been working on this on and off for a couple of months. Learning basic electronics along the way. As I have had a bit of time over lockdown, my project list has expanded massively so I (and the guy coding) would like to finish this one.Please let me know if I am on the right track. Have I missed something or am I not understanding something basic?Find attached my circuit diagram for the input protection and the voltage divider to 2 channels on the ADC. So much simpler than when I began. Based on one of Dave's videos.also, for a laugh, check my noddy PCB. First one!Thanks Guys and Gals, Blake

author: atmfjstc
author_rank: Regular Contributor
timestamp: November 15, 2020, 04:24:11 pm
content: What exactly do you mean by "mR"? MilliOhm? MegOhm?

author: BlakeSeven
author_rank: Newbie
timestamp: November 15, 2020, 04:32:19 pm
content: Meg Ohm, a million ohms - im not an engineer sorry!What's the correct way to write this?

author: Gyro
author_rank: Super Contributor
timestamp: November 15, 2020, 07:01:23 pm
content: Just 'M' (upper case) is sufficient for Megohms if it is clear that you're talking about a resistor, as is 'k' (lower case) for kilohms, and 'm' (lower case) for milliohms. Case is important and stick to Engineering notation (powers of 3).'R' tends to be used as the closest quick usage text approximation to theOmega special symbol for ohms. It is sometimes included for less common ranges ranges like milliohms.Typical examples of text usage:10mR - 10 milliohms2R2 - 2.2 ohms22R - 22 ohms4k7 - 4.7 kilohms47k - 47 kilohms470k - 470 kilohms6M8 - 6.8 Megohms68M - 68 Megohms... etc.Likewise with capacitors:2p2 - 2.2 picoFarads47pF - 47 picoFarads470pF - 470 picoFarads1n2 - 1.2 nanoFarads10nF - 10 nanoFarads...1uF - 1 microFarad4u7 - 4.7 microFarads470uF - 470 microFarads1F - 1 Farad (probably as far as you need to worry about!)P.S. Looking back at your diagram, you got all but the critical ones right anyway. Oh well, this is the beginners section and probably useful to someone.

author: atmfjstc
author_rank: Regular Contributor
timestamp: November 15, 2020, 07:02:29 pm
content: MegOhms, MOhms, Megs, M, point is, the M has to be capital.One other question, what do you need the opamps for? Ignoring the 0-60V range, and protection considerations for a moment, why not just connect the battery directly to the ADC input?

author: BlakeSeven
author_rank: Newbie
timestamp: November 15, 2020, 07:21:07 pm
content: Hi Guys, thanks for the replies and clarification. Yes I need to get my Units right (and orders of magnitude...).I am using an opamp to feed the signal to the ADCs because in a previous incarnation I didn't have the Meg ohm resistor in series with the input. The opamp was the buffer.So, if I have a high resistance on the input, I don't need the opamp as a buffer? I can safely attach a battery cell <4.2v to the system and use a voltage divider for anything above that?How do I then switch between the voltage ranges? I was hoping to limit the voltage to the lower range ADC by using the opamp that can't output more than the rail. I have a few switch ICs or I could just put a physical switch in i suppose.Please forgive my total ignorance - I dived in using a circuit based on someone else's design and I think I totally over-complicated it. I should have watched Dave's multimeter videos first. I have found out a lot about opamps in the last few months. Even if it turns out unnecessary for my circuit, at least I learned something along the way!CheersThanks

author: atmfjstc
author_rank: Regular Contributor
timestamp: November 15, 2020, 07:45:01 pm
content: The ADC already provides a high input impedance. Particularly since the ADS1115 has an internal amplifier which is a buffer in itself.The simplest circuit I can think of would be to just always pass the battery input through a divider so as to map the 0-60V range to 0-5V. When measuring single cells, you can just set up the ADC's internal amplifier to 8x or 16x to cancel out some of the reduction done by the divider. The rest of the adjustments can be done in software.The advantage to this approach is that you don't risk damaging anything by connecting a 48V pack while forgetting to switch to the range with the divider.The disadvantage is that the divider will continually drain current from the battery. And you can't make the resistors in it too large, as they mustn't become comparable to the input impedance of the ADC. It would be better to use an opamp to do the voltage reduction, but then you'd need to have a separate 60V+ supply for that opamp.You should think about and mention some more details about the battery usage scenarios that you will monitor. Will the batteries be discharging? Charging? What will be the typical current? Do you need high temporal resolution? High voltage resolution? Any of those details can massively impact the design of the required circuit.

author: BlakeSeven
author_rank: Newbie
timestamp: November 15, 2020, 09:12:14 pm
content: Hiya,My immediate use for this to test large lifepo4 cells. I will be charging at 20A and discharging at around 50-80A and want to log both accurately. The Arduino is currently reading the samples at 10Hz but this is only crucial at the start and end of the charge/discharge cycle when the voltage is changing fast. I would be more than happy with millivolt resolution.In the longer term, I would also like to use this device to monitor stand alone 24-48v PV battery systems where the sample reading could be once a minute but the standby current draw of the device needs to be as low as poss. I am planning on building separate modules for each system, so can adjust the voltage divider and software gain value as needed.I am now thinking a switched voltage divider will be fine. I can't see it skewing the test results that far unless I need to use very low resistance. I would ideally like to use the 6V gain range on the ADC. The ADS1115 input resistance is 10M ohms at that gain range. Would an input resistance of 3.3M be appropriate? Or should I go an order of magnitude down? The reason I want to use this resistance is simply because I have spent ages matching resistors to get an easy number to work with in the software.Blake