No Such File /dev/i2c-1

Hi, Been trying to solve this for several days and no luck!

Attempting to communicate with BMP-388, Node Red debug returns
"Error: ENOENT: no such file or directory, open '/dev/i2c-1'"

Using node-red-contrib-i2c and for S&Gs tried node-red-contrib-bme280 with same results.
RasPi 4 with Docker 20.10.3
Node Red V1.2.7
NodeJS v14.15.4
nmp v7.5.1

Raspi-config i2c interface is on. Confirmed in /boot/config.txt

I can run all i2cdetect commands without sudo and returns expected results.

Created a BUS 4 i2c to test using:
Same results not finding /dev/i2c-4

i2c-1 and -4 do exist in /dev and i2c-4 has 777 perms

htop shows "pi" as running node red.

Thanks for any help!

Are those the right pins to use?

I thought the I2C bus on the RasPi wasGPIO 2 and 3

If I am reading the line you posted correctly: 23 and 24 are the SPI pins.
Not I2C

True! When using BUS 1, SDA = GPIO 2 & SCL = GPIO 3.

Setting up a software i2c can be designated BUS 3 or BUS 4 (BUS 2 is internally designated for pi use). Bus 3 would be set up on SDA = GPIO 17 and SCL = GPIO 27.

Of course, while testing this I have moved the connections from BUS 1 to BUS 4 designated pins. However, I think it irrelevant since Node Red fails to access the i2c file.

My inclination is that the problem is related to Node Red in a Docker container not accessing the local file system even though the users are aligned and perms for the test i2c-4 are wide open. It is my understanding that enabling the i2c interface in Raspi-config opens the files to all users and should be enough, but not my case. Still testing & searching for a solution!

I wonder if this thread in SO may be of any help to you.

Thanks Andrei!
A new failure = progress!

I set the user to 1000:998 and that got rid of my last error. Now using i2c-1 bus 1 and wired I get:
"Error: ENXIO: no such device or address, read"
with the i2c-In node and an array with a single value of 118 from i2c-scan node.
118 is not the temp and is outside of of the pressure range.

Below is the Docker Compose YAML that I used.
Still digging for the new failure resolution.

version: '3.8'

    container_name: node-red-test
    image: nodered/node-red:latest
    user: "1000:998"
    privileged: true
      - "1880:1880"
      - node-red-data:/data
      -   node-red-net
      - /dev/mem:/dev/mem
      - /dev/gpiomem:/dev/gpiomem
      - /dev/i2c-1:/dev/i2c-1
    restart: unless-stopped


Perhaps 118 (hex 0x76) is the I2C address of the sensor ?

Thank you!
Dec 118= Hex 76 the address of the BMP338.
Apparently it recognizes the BMP is there!

1 Like