how i use "node-red-contrib-i2c 0.5.2"

can anyone tell me (show example) of how i use “node-red-contrib-i2c 0.5.2” or point me in the right direction as i am complete lost with it so far

i can see address 40 & 70 but beyond that not sure what to do

i have a servo board that uses it pca9685

Hi
I installed that node and then thought same as you - how on earth do we use it!

But I’ve been a bit lucky and managed to get it to send and receive some info from an i2C board (its a PiRoCon robot controller board that has an Arduino wired to the Pi via I2C which has a lot of info on the i2c commands)

So I found out the board had an address of 34 using the scan node

And then by looking at exisiting software for the board, I found out that to set up an input I had to send a command byte (14) and then action byte (1) to set port 0 on it to analogue input

Then I found out to read the analagoue value - I needed to send command byte(1) and then wait for 2 bytes (representing low and high bytes of a 0 - 1024 value) to be received

Have a look at my flows and see if you can work out how to do something with your board with similar commands

[{"id":"a52d7898.c71278","type":"i2c out","z":"6e77bbbe.8836c4","name":"","address":"34","command":"14","payload":"1","payloadType":"num","count":"1","x":535,"y":245,"wires":[]},{"id":"e333b0f6.342f","type":"inject","z":"6e77bbbe.8836c4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":284,"y":246,"wires":[["a52d7898.c71278"]]},{"id":"95998b69.b57e78","type":"i2c in","z":"6e77bbbe.8836c4","name":"","address":"34","command":"1","count":"2","x":518,"y":112,"wires":[["fa329f91.24f76"]]},{"id":"fa329f91.24f76","type":"debug","z":"6e77bbbe.8836c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":114,"wires":[]},{"id":"d623f42a.5ce708","type":"inject","z":"6e77bbbe.8836c4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":286,"y":112,"wires":[["95998b69.b57e78"]]}]

Simon

Thanks that helps a little I will have a play.
I have also found this “node-red-contrib-pca9685” which is the board I have which might help but it keeps telling me pwm is undefined but I don’t know why

The readme looks fairly comprehensive, so if its not working I’d try dropping the author a note

ok sorry i know i am a bit thick but how do i know who the author is and where is the readme?

i dont see how to contact people (how do you drop the author a note)

Go to https://flows.nodered.org/ and search for the node. There is usually a link on the node page to GitHub. In this case https://github.com/kelly/node-i2c

That is a link to the module the i2c node uses. The node itself is here GitHub - nielsnl68/node-red-contrib-i2c: This set of node-red nodes communicate with the Raspberry Pi I2C driver and uses the I2C-bus package.

1 Like

I think the conversation has moved on from node-red-contrib-i2c to using node-red-contrib-pca9685 instead

Ok...

Oops I should not post before breakfast!