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
I2C sensor driver hacking
#1
Thanks I’m new to this, but I’m having fun! I have some dev experience in low code environments, but I don’t know python - however I approach everything in life from a starting point of “ how hard can it be? “ (The answer usually is slightly harder than you think!)

Anyhoo, I’m looking for some advice. 

I’ve got a wave share power monitor hat which has 4nr I2C chips on it (Ina219 chips) these are not supported by the IC2 app built into OP. (Yes I could trade them for INA260s which are supported, but but they are an order or magnitude more expensive and where’s the fun in that?) 
So I’ve found a node for Node red (https://flows.nodered.org/node/node-red-...219-sensor) which will interface with them. Cracking. Means I’ll have to dashboard in node red but that’s ok. The node has. Drop down menu to select the address for Ina219 chip you want to access, the  possible addresses are:
0X40
0X41
0x44
0X45

When use the first two addresses the plug-in works flawlessly, when I use 0x44 or 0x45 it returns no data. 

I’ve done some digging, both with the OP I2C app and the documentation for the HAT and both imply that the correct addressing should be:
0x40
0x41
0x42
0x43

There is no option in the config of the plug-in to change this.


So I did some digging through the scrips from the plug-in and it turns out it references (ports was the word it used) a 3rd party driver for the INA219 which it installs as a dependant and this has the address references built into the JS code. 

Now, I tried what i now understand to be a hopeless noobie move of just editing the files in both the driver and node to reflect the “correct” addressing which obviously doesn’t work. 

I understand I need to “fork the development” and do something in a dev environment in order to make my edits. (If they’ll even work) 

I’m out of road. It seems like a relatively simple edit which might benefit others if I can publish it (as a new node red node maybe?) afterwards, but I don’t know how to do it. 

Can anyone sense check my logic to this point, and point me to a resource to help me understand how to make and test my edits. 

Thank you please!
Reply


Messages In This Thread
I2C sensor driver hacking - by Collco - 2021-01-09, 12:30 AM
RE: I2C sensor driver hacking - by tkurki - 2021-01-10, 10:08 AM
RE: I2C sensor driver hacking - by Collco - 2021-01-10, 09:03 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)