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

#1

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

0 Likes

#2

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

0 Likes

Using node-red-contrib-i2c to display text on LCD RGB from Seeed
#3

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

0 Likes

#4

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

0 Likes

#5

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

0 Likes

#6

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

0 Likes

#7

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

0 Likes

#8

That is a link to the module the i2c node uses. The node itself is here https://github.com/nielsnl68/node-red-contrib-i2c

1 Like

#9

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

0 Likes

#10

Ok...

0 Likes

#11

Oops I should not post before breakfast!

0 Likes