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
How I made Waveshare power monitor HAT work with Node Red
Disclaimer - I don't know what I'm doing. If you chose to follow my advice your as big a liability as i am! 

I bought one of these

For my OP build, thinking it was I2C and it would be straight forwards to set up. 

To make a long story short, it wasn't. The chips (there are 4) on this product are called INA219 and are not (at time of writing) supported by the OP I2C app, nor is there a SignalK plug available to read them. 

There is, however a node red plugin available to read them. Its called and can be downloaded from within Node Red admin > manage pallet > Download

It provides an input node with delivers both voltage and current data from the senor into your node red flow. Bonza. 

However, in the config for the node there is a hard coded choice of 4 addresses 

The second two of these are not correct for this product and require to be changed before channels 3 and 4 will deliver any data.

I'm sure there is a better, programmatic way to do this but that's beyond my skills as a meddler, here's how I did it.

First check what the addresses for your connected I2C devices are:

Open a terminal and run "i2cdevice -y 1"

This will give you a list of addresses I2C devices, for me it returned 0x40, 0X41, 0X42 & 0X43

The standard addresses in the plugin code are: 0x40, 0x41, 0x44 & 0x45 so if your addresses are different from that, you'll need to follow the rest of this guide to change the plugin to suit your addressing. 

Navigate to> /home/pi/.signalk/red

Open .confignode.s.json in a text editor

Scroll down until you find node-red-contrib-easybotics-ina219-sensor, it was at the bottom for me as it's the last plugin I installed. copy the "file" property, this tells you where the code is stored on your local machine. 
For me it was: "/home/pi/.signalk/red/node_modules/node-red-contrib-easybotics-ina219-sensor/ina.js"

Go there

Open "ina.html" in a text editor 

Scroll to the list of addresses and change the <option value=0x40> lines to suit the addresses you got from the i2cdetect step above. 

You can change the text directly before </option> to whatever you would like to appear on the drop down label. I changed mine to "Channel 1" "Channel 2" etc. 

Save the file and close. 

Navigate to 


Open ina219.js in a text editor. 

Scroll down to "I2C Address/Bits"

In the first subsection where it says "var -INA219_ADDRESS...._A0...._A1 etc change all the addresses to match what you got form the I2Cdetect step 

Save the file and exit. 

(I'm not sure this last step is actually required, but i did do it and mine is working......)

If you have it - Navigate to /home/pi/.signalk/red/node_modules/ina219

Open repeat the steps above for the identical ina219.js file that'll you find there. 

You should now have a functioning Waveshare Power Monitor Hat with all four channels feeding data into node read with 1 INA219 input each. 
Again, this is not advice, I'm sure there are tidier ways to do this I am just a hack - but it did work for me. 

Happy bodging.

Forum Jump:

Users browsing this thread: 1 Guest(s)