# No Such File /dev/i2c-1

**URL:** <https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704>\
**Category:** General\
**Created:** [9 February 2021 21:30 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704 "2021-02-09T21:30:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenski](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jenski](https://discourse.nodered.org/u/jenski)\
**Post date:** [9 February 2021 21:30 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/1 "2021-02-09T21:30:31Z")

</div>

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  
dtparam=i2c\_arm=on

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

Created a BUS 4 i2c to test using:  
dtoverlay=i2c-gpio,bus=4,i2c\_gpio\_delay\_us=1,i2c\_gpio\_sda=23,i2c\_gpio\_scl=24  
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!

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [10 February 2021 04:03 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/2 "2021-02-10T04:03:25Z")

</div>

> [@jenski](#):
>
> dtoverlay=i2c-gpio,bus=4,i2c\_gpio\_delay\_us=1,i2c\_gpio\_sda=23,i2c\_gpio\_scl=24

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

---

<div class="post-metadata">

**Author:** ![jenski](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jenski](https://discourse.nodered.org/u/jenski)\
**Post date:** [10 February 2021 13:29 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/3 "2021-02-10T13:29:10Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [10 February 2021 15:41 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/4 "2021-02-10T15:41:40Z")

</div>

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

> <https://stackoverflow.com/questions/62719486/accessing-the-i%c2%b2c-bus-with-node-red-in-docker-on-a-raspberrypi-4>

---

<div class="post-metadata">

**Author:** ![jenski](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jenski](https://discourse.nodered.org/u/jenski)\
**Post date:** [11 February 2021 20:52 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/5 "2021-02-11T20:52:36Z")

</div>

Thanks Andrei!  
Update  
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.

```auto
version: '3.8'
services:

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

networks:
  node-red-net:

```

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [11 February 2021 21:37 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/6 "2021-02-11T21:37:52Z")

</div>

> [@jenski](#):
>
> 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.

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

---

<div class="post-metadata">

**Author:** ![jenski](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jenski](https://discourse.nodered.org/u/jenski)\
**Post date:** [11 February 2021 21:57 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/7 "2021-02-11T21:57:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 April 2021 21:58 UTC](https://discourse.nodered.org/t/no-such-file-dev-i2c-1/40704/8 "2021-04-12T21:58:32Z")

</div>

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