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
#21
Yay, I got it working! Thank you so much for this! The amperage looks constant and right (with comparison to my handheld ammeter) but the voltage is still out of whack. with voltmeter battery is at 12.9, and the shunt registers it as 0.9. I have some noname bigass shunt with following markings: 150A, 60 mV, 0,5 (with no units mentioned. Any ideas if this can be calibrated in Signal K or should I modify your source code, and if yes, how?

Thanks a million. This truly is great.
Reply
#22
(2023-06-09, 12:17 PM)Tuomas_S Wrote: but the voltage is still out of whack. with voltmeter battery is at 12.9, and the shunt registers it as 0.9. 

check your cabling, the red + sensor cable goes direct to the battery +.
Reply
#23
can confirm, the + sensor cable is only wire in the battery side of shunt. There is a resistor between the terminals but that's it.

I switched the cables other way round to test, but only thing changed was the amperage polarity.
Reply
#24
(2023-06-09, 01:22 PM)Tuomas_S Wrote: can confirm, the + sensor cable is only wire in the battery side of shunt. There is a resistor between the terminals but that's it.

I switched the cables other way round to test, but only thing changed was the amperage polarity.

It sounds to me like you have it on the Negative side of the battery?

This is a high-side device, your shunt should be connected to the Positive side of the battery, with Vin+ connected to the Battery side and Vin- connected to the load side (the side that goes to the panel.  nothing else should be connected to the battery side of the shunt, all cables (chargers and consumers) should be connected to the load side of the shunt.

Also, ensure you have removed the onboard shunt resistor from the INA219 board?
Reply
#25
(2023-06-09, 01:59 PM)Techstyle Wrote:
(2023-06-09, 01:22 PM)Tuomas_S Wrote: can confirm, the + sensor cable is only wire in the battery side of shunt. There is a resistor between the terminals but that's it.

I switched the cables other way round to test, but only thing changed was the amperage polarity.

It sounds to me like you have it on the Negative side of the battery?

This is a high-side device, your shunt should be connected to the Positive side of the battery, with Vin+ connected to the Battery side and Vin- connected to the load side (the side that goes to the panel.  nothing else should be connected to the battery side of the shunt, all cables (chargers and consumers) should be connected to the load side of the shunt.

Also, ensure you have removed the onboard shunt resistor from the INA219 board?

Everything is wired as per your schema on github, and the onboard resistor has been yanked out. And it is definitively on the + side of things. Other end of shunt goes to battery, other end goes to boat electrical system.

and as an update, I disconnected everything and still got a similar voltage reading. So something is weird.


Attached Files Image(s)
       
Reply
#26
(2023-06-09, 02:15 PM)Tuomas_S Wrote:
(2023-06-09, 01:59 PM)Techstyle Wrote:
(2023-06-09, 01:22 PM)Tuomas_S Wrote: can confirm, the + sensor cable is only wire in the battery side of shunt. There is a resistor between the terminals but that's it.

I switched the cables other way round to test, but only thing changed was the amperage polarity.

It sounds to me like you have it on the Negative side of the battery?

This is a high-side device, your shunt should be connected to the Positive side of the battery, with Vin+ connected to the Battery side and Vin- connected to the load side (the side that goes to the panel.  nothing else should be connected to the battery side of the shunt, all cables (chargers and consumers) should be connected to the load side of the shunt.

Also, ensure you have removed the onboard shunt resistor from the INA219 board?

Everything is wired as per your schema on github, and the onboard resistor has been yanked out. And it is definitively on the + side of things. Other end of shunt goes to battery, other end goes to boat electrical system.

Looks like you have it hooked up right, and you said have current correct, so if you back calculate the Voltage drop across the Shunt (V=IR), do you get the 0.9V?  if so you may be looking at "busvoltage" vs "loadvoltage" (the names were not consistent with what I said earlier), here are the definitions:

"ina219_A.getBusVoltage_V()"  this equals the voltage available downstream, your Vin-
"ina219_A.getShuntVoltage_mV() / 1000" this equals the drop across the shunt
in my code I call:
Code:
float read_A_loadvoltage_callback() { return (ina219_A.getBusVoltage_V() + (ina219_A.getShuntVoltage_mV() / 1000));}
which adds the drop across the shunt to the downstream voltage to get the Battery voltage:
Code:
ina219_A_loadvoltage->connect_to(new SKOutputFloat("electrical.batteries.A.voltage"));
if you are using the code as is it should be good, but you could uncomment some of the following that I set up for debugging.

Code:
  ina219_B_current->connect_to(new SKOutputFloat("electrical.batteries.B.current"));

  ina219_B_loadvoltage->connect_to(new SKOutputFloat("electrical.batteries.B.voltage"));

  //ina219_B_shuntvoltage->connect_to(new SKOutputFloat("electrical.batteries.B.shuntv"));

  //ina219_B_busvoltage->connect_to(new SKOutputFloat("electrical.batteries.B.vin-v"));

  ina219_B_power->connect_to(new SKOutputFloat("electrical.batteries.B.power"));

  ina219_B_loadvoltage->connect_to(new SoCBInterpreter("/Battery B/Voltage/curve"))
      ->connect_to(new SKOutputFloat("electrical.batteries.B.capacity.stateOfCharge", "/Battery B State of Charge/sk_path"));

hope this helps!!
Reply
#27
I get this fluctuating 0.9 volts even when the shunt is unhooked so something is really weird here. I enabled the shunt variables but they don't make much sense either way. The circuit I use is a crowtail INA219B, I don't know if it handles the variables differently but will start to look into it.    

It turns out I'm an idiot. I've been running this from usb to be able to monitor it, and how could it sense voltage if it doesn't have a common ground? In the meantime I think I managed to burn my IDA219 but I think we are getting somewhere.
Reply
#28
(2023-06-11, 12:50 PM)Tuomas_S Wrote: I get this fluctuating 0.9 volts even when the shunt is unhooked so something is really weird here. I enabled the shunt variables but they don't make much sense either way. The circuit I use is a crowtail INA219B, I don't know if it handles the variables differently but will start to look into it.

It turns out I'm an idiot. I've been running this from usb to be able to monitor it, and how could it sense voltage if it doesn't have a common ground? In the meantime I think I managed to burn my IDA219 but I think we are getting somewhere.

sorry, I should have thought of that, it happened to me as well - I think I mention it in one of the videos, but not sure
Reply
#29
Interesting project. I was thinking of doing something similiar, you just made my point of view alot bigger. I was thinking of using voltage monitors through ESP to monitor just the voltage, but shunt project is so much deeper that i have to go with yours.

I had the OpenPlotter and Moitissier HAT in my closet for 2 years now and this year im finally installing it on the boat. Have you made your N2K integration to this board maybe? Since im thinking of having this box in the engine room id maybe power it through N2k directly (step-down in the middle of course). Since i have 2 battery banks (1 engine bank, 1 service) and i have Matty's N2K ESP box connected to OpenPlotter its the same for me going through N2k.
Reply
#30
Hey how did you actually calculate Rshunt? I have a 500A shunt with 75mV. Couldnt get my hands on anything smaller fast enough so ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)