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
[solved] Battery monitor
#11
See my solution:
[URL] Automation pHat as a Voltmeter?

https://r.tapatalk.com/shareLink?share_f...are_type=t[/URL]
Reply
#12
Photo 
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.


Attached Files Image(s)
   
Reply
#13
(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
Reply
#14
Did you have to change the hardware/module?
Angel  Entschuldigung für mein Englisch. Es ist "deepl.com english"
PN bitte auf german.  Big Grin
Reply
#15
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.
Reply
#16
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.
Reply
#17
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.


Attached Files
.txt   Voltage_Code_1.txt (Size: 1.93 KB / Downloads: 280)
.txt   SDL_Pi_INA3221.txt (Size: 5.97 KB / Downloads: 243)
Reply
#18
Thanks very much for that - much appreciated.

I'll give it a go soon.
Reply
#19
@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
Angel  Entschuldigung für mein Englisch. Es ist "deepl.com english"
PN bitte auf german.  Big Grin
Reply
#20
(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???
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)