2018-06-09, 02:45 PM
(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!