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
#31
(2023-08-07, 07:39 PM)xsashox Wrote: Hey how did you actually calculate Rshunt? I have a 500A shunt with 75mV. Couldnt get my hands on anything smaller fast enough so ...

V/I = Rshunt

0.075/500 = 0.00015

Rshunt = 0.00015
Reply
#32
Hey Jason,

Thanks for the help. Will try tommorow Smile did a system similiar to yours and added ADS1115 for the fuel level, engine data etc… have you maybe tried playing with smart switches?
Reply
#33
(2023-08-07, 09:10 PM)xsashox Wrote: have you maybe tried playing with smart switches?

I get very little time in the sailing season, so not yet.  I did draw a schematic for what I want to do though
Reply
#34
Well i have put some switches in the sketch, tried adding through KIP and it seems to work but then KIP hangs with an "Waiting for authorization" message. Still figuring it out. Since i'm at the boat right now i hope i can make it work in the next few days Smile thanks for all the work with this.
Reply
#35
Hey Jason,

Ok, got it made together and attached to my SK. Right now im getting some ridicolous data; just wanted to double check i did it right?

So, my Shunts are made like this:
   

My wiring is per your scheme; INA219 -> 0,5mF capacitor -> Vin+ / Vin- -> 10ohm resistor on both positive lines -> shunt (each one side)
My build is like this;
   

So basically resistors and capacitors are soldered under the INA219 (on Vin+ and Vin-)

Just to explain my config; Boat voltage is 12V.
- INA219 0x40 - Service battery bank
- INA219 0x41 - Solar charging
- INA219 0x44 - Motor battery bank

AD1115 for;
ADC's (fuel tank level, ... )
Some ADC's with resistors to recognize states (bilge pump, ... )

Additional outputs for 4-channel relay board (smartswitches - blower, bilge pump, bilge ligts, .. )

So for the INA's im currently getting;
   

My RShunt is = 0,00015
All the formulas are per your code. My ground is common for both RPi, ESP's, ... Shunt voltages measured with multimeter are normal (14,3 currently on charger). Where did i go wrong?

The actual pics on the boat;
   
   

The ESP is connected to CMG.

Edit: just disconnected battery charger and measured VIN+ and VIN- to ground and the voltages are normal (13,4-13,5) although i get the same reading with INA (as in the screen above). The B shunt (for solar) is currently not hooked up, but that should not have any meaning right? And i'm reading ESP32 through SK, not through USB.
Reply
#36
Ok, got it solved.

The problem was my INA219 calling in the code. If i did it your way (with all the other  i2c components on the bus) i got an error "Wire.h : NULL TX POINTER" so i did my own like this;
Code:
///////////////////////////INA219A start
auto ina219A = new Adafruit_INA219(0x40);
bool inaA_initialized = ina219A->begin(i2c);
debugD("INA219A: %d", inaA_initialized);

///////////////////////////INA219B start

auto ina219B = new Adafruit_INA219(0x41);
bool inaB_initialized = ina219B->begin(i2c);
debugD("INA219B: %d", inaB_initialized);


///////////////////////////INA219C start
auto ina219C = new Adafruit_INA219(0x44);
bool inaC_initialized = ina219C->begin(i2c);
debugD("INA219C: %d", inaC_initialized);

But it looks like this calling is not ok, so i solved it in the end like this;

Code:
ina219A.begin(i2c); 
bool inaA_initialized = ina219A.begin(i2c);
debugD("INA219A: %d", inaA_initialized);
ina219B.begin(i2c); 
bool inaB_initialized = ina219B.begin(i2c);
debugD("INA219B: %d", inaB_initialized);
ina219C.begin(i2c); 
bool inaC_initialized = ina219C.begin(i2c);
debugD("INA219C: %d", inaC_initialized);

This looks like it's ok. Measurement is ok now.
Reply
#37
Hello JAson
I am very interested in your Battery mmonitor/charger. Great

I am a  bit customeised with platformIO on Windows   but not on Pi

Would there be drivers and modules like the sensESP  available on PlatformIO with espressif332 board as you know?

I tried using the setup as published but i am lacking knowlede to complete it to a suuccesfull build


Regards
Herman (from NL)
Reply
#38
(2023-09-04, 07:14 PM)twillert Wrote: Hello JAson
I am very interested in your Battery mmonitor/charger. Great

I am a  bit customeised with platformIO on Windows   but not on Pi

Would there be drivers and modules like the sensESP  available on PlatformIO with espressif332 board as you know?

I tried using the setup as published but i am lacking knowlede to complete it to a suuccesfull build


Regards
Herman (from NL)

PlatformIO is just a plugin in VSCode. SensESP is a library and Espressif is a board manufacturer. I would suggest you first take a look at some youtube tutorials about using PlatformIO with ESP32 and how to use libraries. 

We have all been there so dont worry. In your case you will use PlatformIO just for ESP’s. Pi has its own OS (OP). Your Pi is just a server for your “sensor nodes” - ESPs. To program ESPs you will use VSCode woth PlatformIO plugin.
Reply
#39
(2023-09-04, 07:44 PM)xsashox Wrote:
(2023-09-04, 07:14 PM)twillert Wrote: Hello JAson
I am very interested in your Battery mmonitor/charger. Great

I am a  bit customeised with platformIO on Windows   but not on Pi

Would there be drivers and modules like the sensESP  available on PlatformIO with espressif332 board as you know?

I tried using the setup as published but i am lacking knowlede to complete it to a suuccesfull build


Regards
Herman (from NL)

PlatformIO is just a plugin in VSCode. SensESP is a library and Espressif is a board manufacturer. I would suggest you first take a look at some youtube tutorials about using PlatformIO with ESP32 and how to use libraries. 

We have all been there so dont worry. In your case you will use PlatformIO just for ESP’s. Pi has its own OS (OP). Your Pi is just a server for your “sensor nodes” - ESPs. To program ESPs you will use VSCode woth PlatformIO plugin.

I had no prior knowledge of ESP32, PlatformIO, VSCode or SensESP.  I just used the SenseESP documentation and went from there - https://signalk.org/SensESP/pages/getting_started/

it was really straightforward and once setup, and the template is downloaded, you just have to swap the src/main.cpp and platformio.ini to my version to have the same setup as me.
Reply
#40
Thank you so much for this!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)