This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DIY Battery Monitor - ESP32 based
#1
I have 3 batteries on my boat and after doing a Engine monitor project using ESP32, a friend asked me to look at Battery Monitors for both our boats, so after some research I bought some parts and started to throw a plan together.  The video below shows what I am using and goes through the code.

 

hope people find it useful!

the code, schematics and list of parts are on the Github page: https://github.com/Techstyleuk/SensESP_3...ry_Monitor

there will be a later video with further work such as:

- board layout that will be implemented on the boat
- packaging
- NMEA2000 integration
- other functions - the Batteries on my 336 are in the rear lazarettes.  also in the area is the black water tank and fuel tank - I will be trying to add external black water level sensing, as well as seeing if I can grab the fuel level without interfering with the analogue gauge
Reply
#2
Thanks, Jason. Until I saw this, I was going to install a free-standing PZEM-015 battery monitor down below at the nav station. However, after seeing your video, I realized that your concept is a much better monitoring solution as I'll be able to conveniently see my battery status on any device screen along with OpenCPN, Grafana outputs etc.

The size of your shunt concerns me. How did you determine that this is the size which you require? The PZEM-015 uses a 300A shunt which, based on Victron's shunt, is apparently even smaller than commonly used.
Reply
#3
(2023-02-22, 07:26 PM)Techstyle Wrote: I have 3 batteries on my boat and after doing a Engine monitor project using ESP32, a friend asked me to look at Battery Monitors for both our boats, so after some research I bought some parts and started to throw a plan together.  The video below shows what I am using and goes through the code.

 

hope people find it useful!

the code, schematics and list of parts are on the Github page: https://github.com/Techstyleuk/SensESP_3...ry_Monitor

there will be a later video with further work such as:

- board layout that will be implemented on the boat
- packaging
- NMEA2000 integration
- other functions - the Batteries on my 336 are in the rear lazarettes.  also in the area is the black water tank and fuel tank - I will be trying to add external black water level sensing, as well as seeing if I can grab the fuel level without interfering with the analogue gauge
Thanks Jason, very nice development!
I am also working to sense diesel tank level. To do that (without interference with gauge reading) I plan to measure el voltage on the signal terminal of the gauge with an I2C ADS115. I shall measure signal voltage at different tank levels and build data in SENSESP "CurveInterpolator" . Rest of code will be similar to temperature reading.
Reply
#4
(2023-02-26, 06:15 PM)HeviiSailor Wrote: Thanks, Jason. Until I saw this, I was going to install a free-standing PZEM-015 battery monitor down below at the nav station. However, after seeing your video, I realized that your concept is a much better monitoring solution as I'll be able to conveniently see my battery status on any device screen along with OpenCPN, Grafana outputs etc.

The size of your shunt concerns me. How did you determine that this is the size which you require? The PZEM-015 uses a 300A shunt which, based on Victron's shunt, is apparently even smaller than commonly used.

You may be correct and I will run some testing when on the boat, but the Shunt I am using is based on a 50mV drop at 100A, meaning that at 300A it would be 150mV, I read the one you were looking at was 75mV at 300A (half the drop).  The max current draw is when the engine is cranking, I will do some testing at this but it would normally split between all three batteries, unless you are cranking on just your start battery. It could be useful to double up (put 2) shunt resistors for the start battery, which would make the same size as the one you specify.

but the reason I want to keep it small is that I believe most of the time, my current draw is <10amps, which would be 5mV for the 100A shunt and 2.5mV for the 200A (or your 300A/75mV) - that's not a lot

(2023-02-26, 07:18 PM)SARASTRO Wrote:
(2023-02-22, 07:26 PM)Techstyle Wrote: - other functions - the Batteries on my 336 are in the rear lazarettes.  also in the area is the black water tank and fuel tank - I will be trying to add external black water level sensing, as well as seeing if I can grab the fuel level without interfering with the analogue gauge
Thanks Jason, very nice development!
I am also working to sense diesel tank level. To do that (without interference with gauge reading) I plan to measure el voltage on the signal terminal of the gauge with an I2C ADS115. I shall measure signal voltage at different tank levels and build data in SENSESP "CurveInterpolator" . Rest of code will be similar to temperature reading.

Thanks, I am going to do the same with the INA219 and also build a lookup curve like you suggest, the only thing that concerns me is I may need to know the input voltage and don't want to run a wire all the way to the helm(gauge).  however, I think I can use the battery voltage from one of the other batteries.

my build is moving along quite quick, I am looking at contact-less sensors for the black water tank to determine the level (https://www.aliexpress.us/item/2251832778905166.html), there will be 4 or 5 of them at different heights and then some calcs for level.
Reply
#5
(2023-02-27, 04:27 AM)Techstyle Wrote: my build is moving along quite quick, I am looking at contact-less sensors for the black water tank to determine the level (https://www.aliexpress.us/item/2251832778905166.html), there will be 4 or 5 of them at different heights and then some calcs for level.

Hi Jason.  Welcome back from Bimini.  Looks like either we were thinking the same thing, or you liked my idea that I wrote you about a month ago and are running with it.

Any reason for going the 4-5 sensor route vs. the continuous level capacitance sensing? (Video demo or  TI's reference design)

Chad
Reply
#6
(2023-02-28, 05:16 PM)we9v Wrote:
(2023-02-27, 04:27 AM)Techstyle Wrote: my build is moving along quite quick, I am looking at contact-less sensors for the black water tank to determine the level (https://www.aliexpress.us/item/2251832778905166.html), there will be 4 or 5 of them at different heights and then some calcs for level.

Hi Jason.  Welcome back from Bimini.  Looks like either we were thinking the same thing, or you liked my idea that I wrote you about a month ago and are running with it.

Any reason for going the 4-5 sensor route vs. the continuous level capacitance sensing? (Video demo or  TI's reference design)

Chad

Thanks Chad, the Bimini trip was awesome and the boat was insane.  It was just featured at the Miami boat show on the Jeanneau stand.

 I am not sure where the idea came with, somebody posted they were using the sensors I linked above and as these are just switches, it is really easy to incorporate as long as you have enough digital inputs.  I guess the sensor you suggest may be better, but probably harder to get hold of the right size and then get the software sorted out.  I like to have everything complete before the end of March.

This week I have been working on the NMEA 2000 integration and I think I am nearly there, just got "State of Charge" and "time remaining" to incorporate.  The NMEA 2000 version if for a friend that doesn't have Signal K.

Jason
Reply
#7
Hi Jason,

I'm in the middle of a rather length shopping list for many electronic goodies. While I had watched your video yet again to make sure that I hadn't missed anything, I actually did find something which I hadn't noticed earlier: You've connected your shunt on the positive side of the battery. Can you explain please why you've done it like this? I've always understood that shunts should be on the negative side. Nevertheless, I'm not too old to learn something new!
Reply
#8
(2023-03-06, 11:48 PM)HeviiSailor Wrote: Hi Jason,

I'm in the middle of a rather length shopping list for many electronic goodies. While I had watched your video yet again to make sure that I hadn't missed anything, I actually did find something which I hadn't noticed earlier: You've connected your shunt on the positive side of the battery. Can you explain please why you've done it like this? I've always understood that shunts should be on the negative side. Nevertheless, I'm not too old to learn something new!

the INA219 is a high side (positive side) DC current sensor which is good to 26V, where some of the others available are not capable at that voltage and therefore they need to be on the low side (negative side).  The ones on the negative side need a second sensor to report the battery voltage whereas this does not.  It does need the same 0V reference though, so when you are testing on the bench, you need to tie the battery ground into the ESP32 ground, even if you are powering the ESP via USB from another source - ask me how I know that? Lol!
Reply
#9
(2023-03-07, 12:00 AM)Techstyle Wrote: HeviiSailor

the INA219 is a high side (positive side) DC current sensor

Ah, I see. However, I wonder if this might be a bit of a conundrum for me; my battery management system requires the shunt to be on the negative side. I had planned to use the same shunt.

Are you able to say how the other sensor which you had mentioned must be wired into this system if it were on the low side?
Reply
#10
(2023-03-07, 02:05 AM)HeviiSailor Wrote:
(2023-03-07, 12:00 AM)Techstyle Wrote: HeviiSailor

the INA219 is a high side (positive side) DC current sensor

Ah, I see. However, I wonder if this might be a bit of a conundrum for me; my battery management system requires the shunt to be on the negative side. I had planned to use the same shunt.

Are you able to say how the other sensor which you had mentioned must be wired into this system if it were on the low side?

you could use the INA219 on the low side, you just wouldn't get the battery voltage.  I believe that INA226 can grab the voltage as well as getting low side current sensing but do not have experience with it

https://www.ti.com/lit/ds/symlink/ina226...252FINA226

I just put up a second video on the subject showing the NMEA2000 integration, and getting into more details about the board preparation and assy.

https://youtu.be/MREGixRx_No
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)