2018-06-09, 09:47 AM
I think it's easier to use an ADS1115. There are instructions on the Internet. If you can solder immediately with a soldering iron it should be no problem.
Greetings Jürgen
Greetings Jürgen
(2018-06-09, 09:37 AM)Lazzz Wrote: [ -> ](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???
(2018-06-09, 02:45 PM)Opie91 Wrote: [ -> ](2018-06-09, 09:37 AM)Lazzz Wrote: [ -> ](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???
Yes, the code still does work with V1.0, but the installation is a little different. OP V1.0 seems to handle add on tools a little differently and now requires a separate folder for each tool. I have it working on my pi now and will post new instructions in the next day or two.
For now you can start it manually by going to the folder "Voltage_Code_1.0" is in and type "python Voltage_Code_1.0". That should start the code and it will show up on the SignalK bus.
As far as the settings go, They are all in the code for now. When I get some time ill get that working.
Good luck!
(2018-06-10, 02:34 AM)Opie91 Wrote: [ -> ]Updated for OP V1.0
***After downloading the attached files and before putting them on your pi change the file type to .py from .txt (cannot put a .py file on forum)***
1. Create a new a new folder in the /home/pi/.openplotter/tools folder called "voltage_code". To do this first change you directory to the tools folder and then create the file (sudo mkdir /home/pi/.openplotter/tools/voltage_code). Then change the folder owner to pi (sudo chown pi:pi /home/pi/.openplotter/tools/voltage_code)
2. Once the folder has been created, place the files “voltage_code.py” and “SDL_Pi_INA3221.py” in it. (/home/pi/.openplotter/tools/voltage_code)
3. In the terminal while in folder /home/pi/.openplotter/tools/voltage_code type “sudo chmod a+x voltage_code.py” to make the code executable
4. To enable the tool open the OpenPlotter configuration file in /home/pi/.openplotter/openplotter.conf. Go to section [TOOLS] and add: “, ['INA3221 Sensor', 'Adds INA3221 Sensor to I2C Bus', 'voltage_code', '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 = [['Demo Tool', 'Tool example', 'demo_tool', '0'],['Analog ads1115', 'put analog values to SignalK', 'analog_ads1115', '0'],['Analog Firmata', 'put analog values to SignalK', 'oppymata', '0'], ['Moitessier HAT', 'configure Moitessier HAT settings', 'moitessier_hat', '0'], ['INA3221 Sensor', 'Adds INA3221 Sensor to I2C Bus', 'voltage_code', '1']]
5. Reboot or start the tool in the Openplotter menu. The sensor should start automatically at each boot.
Ill answer any questions I can and please let me know if it works for you.
Thanks & Good luck.
(2020-05-27, 02:36 PM)tjmack Wrote: [ -> ]This is an old thread but I like what was done with an INA3221 in OP1. Could someone give me some pointers for doing this in OP2? Specifically, how do I insert the program in OP2 where there isn't a "Tools" folder? I am new to this and I'm still at a point where I do 95% of my python by copying examples. Thanks in advance.