OpenMarine

Full Version: [solved] Battery monitor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
See my solution:
[URL] Automation pHat as a Voltmeter?

https://r.tapatalk.com/shareLink?share_f...are_type=t[/URL]
Hi,

If anyone is interested I managed to get an INA3221 (SwitchDocs Lab) to send signal K data for voltage from all three pickups. Kinda of mangled together the INA3221 and the demotool.py code together.

Its pretty basic and not complete yet(I am horrible with code), but it will give you an accurate voltage reading from three sources. Ill post the it if anyone is interested.
(2018-02-27, 02:54 AM)Opie91 Wrote: [ -> ]Hi,

If anyone is interested I managed to get an INA3221 (SwitchDocs Lab) to send signal K data for voltage from all three pickups. Kinda of mangled together the INA3221 and the demotool.py code together.

Its pretty basic and not complete yet(I am horrible with code), but it will give you an accurate voltage reading from three sources. Ill post the it if anyone is interested.

Yes please I am very interested.

I've had an INA3221 sitting here waiting to install when I get some free time - doesn't seem to happen Sad
Did you have to change the hardware/module?
I had to make no changes to the hardware, but there is a jumper you can cut and change the I2C address. I may do that so as not to interfere with the other sensor that is at 0X40.

Give me a few days to clean everything up(the best I can) and then Ill post it.
I must have done something to my INA3221. It stopped being recognized by the I2C bus. Another one on the way, once it gets here Ill verify the changes I made and post it.
Here is the modified code for the INA3221 sensor. This is still pretty basic and only measures voltage, but it seems to work well.

I plan on making the configuration file work with OP sometime in the future, but not right now.

One important thing: Only use the positive inputs (INA1+, INA2+, INA3+) from your voltage source(batteries, solar, charger, etc...) for measuring voltage. The grounds from your voltage sources must be tied to a Pi ground for proper voltage reference. So do not use INA1-, INA2- or INA3- or your voltages will measure incorrectly.

Directions:

**First rename the .txt files to the file names below**
 
1.       Place files “Voltage_Code_1.0.py” and “SDL_Pi_INA3221.py” in folder “~/.openplotter/tools” on your Pi

2.       In the terminal while in folder ~/.openplotter/tools type “sudo chmod a+x Voltage_Code_1.0.py” to make the code executable

3.       To enable the tool open the OpenPlotter configuration file in ~/.openplotter/openplotter.conf. Go to section [TOOLS] and add:  “,['INA3221 Sensor', 'Adds INA3221 Sensor to I2C Bus', 'Voltage_Code_1.0.py', '1']” to py.

Mine looks like this (You can cut and paste this into your config file if you have no other special tools):

[TOOLS]
py = [['Analog ads1115', 'put analog values to SignalK', 'analog_ads1115.py', '0'], ['Analog Firmata', 'put analog values to SignalK', 'oppymata.py', '0'], ['SignalK Simulator', 'change values with sliders and send values to SignalK', 'SK-simulator.py', '0'], ['Auto Setup', 'configure basic system', 'autosetup_tty.py', '1'],['INA3221 Sensor', 'Adds INA3221 Sensor to I2C Bus', 'Voltage_Code_1.0.py', '1']]

4.       Reboot or start the tool in the Openplotter menu. The sensor should start automatically at each boot.
 
For more info about the adding tools see the Openplotter manual. OP Manual

Good luck. Ill answer any questions I can.
Thanks very much for that - much appreciated.

I'll give it a go soon.
@opie

Thank you very much for your efforts and your codes. 

I solved the problem in the meantime with ads1115. 

Nevertheless, I think it's great that there is now another possibility. 

I think the problem can now be marked as solved. 
Greetings Jürgen
(2018-03-04, 01:01 AM)Opie91 Wrote: [ -> ]Here is the modified code for the INA3221 sensor. This is still pretty basic and only measures voltage, but it seems to work well.

I plan on making the configuration file work with OP sometime in the future, but not right now.

One important thing: Only use the positive inputs (INA1+, INA2+, INA3+) from your voltage source(batteries, solar, charger, etc...) for measuring voltage. The grounds from your voltage sources must be tied to a Pi ground for proper voltage reference. So do not use INA1-, INA2- or INA3- or your voltages will measure incorrectly.

Directions:

**First rename the .txt files to the file names below**
 
1.       Place files “Voltage_Code_1.0.py” and “SDL_Pi_INA3221.py” in folder “~/.openplotter/tools” on your Pi

2.       In the terminal while in folder ~/.openplotter/tools type “sudo chmod a+x Voltage_Code_1.0.py” to make the code executable

3.       To enable the tool open the OpenPlotter configuration file in ~/.openplotter/openplotter.conf. Go to section [TOOLS] and add:  “,['INA3221 Sensor', 'Adds INA3221 Sensor to I2C Bus', 'Voltage_Code_1.0.py', '1']” to py.

Mine looks like this (You can cut and paste this into your config file if you have no other special tools):

[TOOLS]
py = [['Analog ads1115', 'put analog values to SignalK', 'analog_ads1115.py', '0'], ['Analog Firmata', 'put analog values to SignalK', 'oppymata.py', '0'], ['SignalK Simulator', 'change values with sliders and send values to SignalK', 'SK-simulator.py', '0'], ['Auto Setup', 'configure basic system', 'autosetup_tty.py', '1'],['INA3221 Sensor', 'Adds INA3221 Sensor to I2C Bus', 'Voltage_Code_1.0.py', '1']]

4.       Reboot or start the tool in the Openplotter menu. The sensor should start automatically at each boot.
 
For more info about the adding tools see the Openplotter manual. OP Manual

Good luck. Ill answer any questions I can.


I tried this with V1.0 but OP doesn't recognize the INA3221 and when I click on settings nothing happens.

Do you know if it works with the new version or is it easier to get a ADS1115???
Pages: 1 2 3