Jump to content

Using a Raspberry Pi to check bulk batteries


Gerlach

Recommended Posts

While I was busy checking around for stuff to build and program a Pi to run Amp clamp meters, this idea pop up in my mind to maybe check to build a Pi setup that can check individual  batteries V in a battery setup where you run more then one battery in a setup. I think this will be something nice to have.

Maybe someone on the forum that maybe have taken a shot in this direction? 

Link to comment
Share on other sites

28 minutes ago, Gerlach said:

build a Pi setup that can check individual  batteries V in a battery setup

Been discussed some years ago. The first issue is that the Pi doesn't have an ADC (analog-digital converter) onboard. Even boards that have such a thing usually only has one or two. So for the hobbyist it will almost always be better to use something else. Like an arduino (which also only has one ADC... but it can multiplex it onto multiple inputs and make it look like it has more), and then simply spit the values across a serial link to your Pi.

The trouble is the rather large range that you have to operate over. Your arduino is a 5V device, so you have to keep the inputs below 5V. Your batteries can however swing up as high as 70V (in a failure situation), so the measurement you're taking from battery number 4 (if we assume 4 x 12V batteries, with number 1 being the one with the inverter negative cable on it) is right up there. If you simply split this down with a voltage divider, that's a 1:14 ratio, and assuming your resistors have a 1% error... well that means you can be over 10% off on the voltage reading of that top battery.

That means you need to get all clever with the measurements, the simplest would likely be to make a small board (use a small processor, something like an ATtiny85) that handles one battery, then use serial comms to talk to another "main" control unit. Use opto-couplers to isolate the serial comms (since each lives at its own battery voltage).

So yeah... an interesting project... but you need to think about it a bit.

Link to comment
Share on other sites

33 minutes ago, Gerlach said:

Hahahaha!! think that will be a long think about. Way more advance that I have think 🙈

Maybe get a bunch of cheap ESP8266 units and just stick it on MQTT via WiFi. That's a cheap way to get isolation 🙂

 

Link to comment
Share on other sites

I actually built exactly this using an Arduino and a 12-bit ADC with 8 channels. Yes, it runs on 70V, uses a little switch-mode converter as linear can't handle the massive voltage drop well. The challenge I found was accuracy. I measured each resistor in the divider and in software calibrated each channel to be as accurate as I could get it - using this manual method it was actually very good. I made the 'sweetspot' around 13V where it's the most accurate. The whole idea was to measure 8 batteries using one device so I can 'see' if any issues crop up with batteries going out of sync.

At the time I didn't have a midpoint shunt and since then bought a 712 so the Arduino board is lying in my cupboard. It was a great little project but if I do it again I would use a different processor so I can get native WiFi/BT but for now the 712 and HA02 I have is doing a sterling job. Batteries always on 0% deviation, maybe 0.1% once in a blue moon. As a last thought, going to something like an ESP the reference voltage drops to 3V3 which makes it even more of a challenge with the divider. With the Arduino I used an external 4.096V reference.

Ingo

 

Link to comment
Share on other sites

37 minutes ago, plonkster said:

Maybe get a bunch of cheap ESP8266 units and just stick it on MQTT via WiFi. That's a cheap way to get isolation 🙂

 

Thanks Plonkster. I actually need to get a ESP8266 for another project to. Did a bit googling and found some info on the ESP8266 for battery monitoring. 

Link to comment
Share on other sites

36 minutes ago, Ingo said:

I actually built exactly this using an Arduino and a 12-bit ADC with 8 channels. Yes, it runs on 70V, uses a little switch-mode converter as linear can't handle the massive voltage drop well. The challenge I found was accuracy. I measured each resistor in the divider and in software calibrated each channel to be as accurate as I could get it - using this manual method it was actually very good. I made the 'sweetspot' around 13V where it's the most accurate. The whole idea was to measure 8 batteries using one device so I can 'see' if any issues crop up with batteries going out of sync.

At the time I didn't have a midpoint shunt and since then bought a 712 so the Arduino board is lying in my cupboard. It was a great little project but if I do it again I would use a different processor so I can get native WiFi/BT but for now the 712 and HA02 I have is doing a sterling job. Batteries always on 0% deviation, maybe 0.1% once in a blue moon. As a last thought, going to something like an ESP the reference voltage drops to 3V3 which makes it even more of a challenge with the divider. With the Arduino I used an external 4.096V reference.

Ingo

 

Thanks for your help there to Ingo.

Nice about this forum, guys like you that have tested this stuff before. 

Link to comment
Share on other sites

If I had to do it over again I would go the Slave/Master route as @plonkster suggested. It was one of my options but I decided against it only because I wanted a quick and nasty to test the viability. I would look at an attiny for slaves and the ESP as the master to give me WiFi access. Good Luck on yours.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...