I2c on OrangePi Zero

Hi all.
I'm new .
On my OrangePi Zero install OLED LCD.
if list all device on my i2c bus show this :

i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

OrangePi_i2c

I install node-red-contrib-i2c
how I can list all devices on my i2c bus??
some example pls ..
my bus is used 0 not 1

thanks

i2c

[{"id":"a296b2f6.143b6","type":"inject","z":"95f61204.15452","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":624,"y":600,"wires":[["f57e2b0c.6cf508"]]},{"id":"f57e2b0c.6cf508","type":"i2c scan","z":"95f61204.15452","x":756,"y":600,"wires":[["869fbda3.677f4"],["502204e0.c7244c"]]},{"id":"869fbda3.677f4","type":"debug","z":"95f61204.15452","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":914,"y":576,"wires":[]},{"id":"502204e0.c7244c","type":"debug","z":"95f61204.15452","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":914,"y":612,"wires":[]}]

this is result :
i2c_scan

then on what bus search ?? 0 , 1 , or 2 ??

you need bus 1 per node-red-contrib-i2c 0.5.2
"Downside my nodes work only for newer version where the i2c driver is on /dev/i2c-1"

This is something i still need to try, I2C For Everyone
maybe this could help

hi.
Orange Pi zero have two TWI port , 0 and 1 .
My LCD is connected to 0 , but if connect to 1 and test node-red then work..
will be good if user can select want port want use ..I can redefine .. my code for LCD for port 1 .. but still will be good if user can select what bus want use ..

regards.

I have just tested -
"This is something i still need to try, I2C For Everyone"
and it works, So there is you solution it will work on both busses

Let me explain;
cd ~/.node-red/
npm install i2c-bus
node-red-stop
sudo nano ~/.node-red/settings.js
functionGlobalContext: {
// os:require('os'),
// jfive:require("johnny-five"),
// j5board:require("johnny-five").Board({repl:false})
//underscore:require('underscore'),
i2c:require('i2c-bus'),
},
cntr o
enter
cntr x
enter
node-red-start

var i2c=global.get('i2c');
i2c1 = i2c.openSync(0);

node.warn(as())
function as() {
var info = i2c1.readByteSync(3c, 255);
i2c1.closeSync();
return info;
}

Hi. I do it ..
try function but not response from bus .. return info not see on debug ..
I'm new nad don't good understand how node-red work ..then sorry..

The example i used is to read a chip in this case a pcf8574,

I think you need to write data to the oled screen, not read data from it.
maybe this can help you Display temp (18b20) on oled with just pi and nodered

Don’t run this line with sudo, a normal nano ~/.node-red/settings.js is fine. By editing as sudo, the file becomes owned by root after saving, meaning node-red running as the current user (as ~/.node-red suggests) might have trouble reading it, thus leading to running node-red as root too to get around. Just don’t use sudo here.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.