Howto setup I2C and 1-wire (DS18B20) on a NanoPi NEO Air?


first thanks for fixing the wifi bug at the NanoPi NEO Air [1] very fast!

Now i’ve got two new issues at the latest DietPi image (rev 141, DietPi 4.9.0-sun8i):

1) I2C seems to be disabled:
root@DietPi:~# dietpi-software list | grep i2c
id 72 | =0 | i2c: enables support for i2c based hardware | disabled for hw_model

How can i enable i2c at my NanoPi?

2) I failed to setup the 1-wire bus:
modprobe w1_gpio
modprobe w1-therm
both seem to work
root@DietPi:~# dmesg | grep wire
[ 1036.997465] Driver for 1-wire Dallas network protocol.

But in /sys/devices/ i do not see any 1-wire directory.

How can i setup 1-wire properly?

Thanks very much!



You should try the latest NanoPi Neo version 141. The kernel has been changed to 4.9 and I believe one of the changes incorporated in 4.9 was I2C support for H3 processors.

Then in config.txt file in boot there are some i2C dtparam you can turn on.

About a year ago when I was playing with ds3231 hardware clock I added

#----- Hardware Clock -------- GW addition for DS3231 This will also turn on i2c

to the config.txt file. I didn’t need to explicitly turn on i2c as this command did it as well.

I’ve no idea whether that would fix your problem. You would have to try it to see.

As another thought you could look at the dietpi-software code for how to enable it if it wasn’t blocked.

Gordon Williams

Thanks for your hints, Gordon! Unfortunately it didn’t work. You’re talking about a NanoPi NEO, right? I’m using an Air, which might make the difference.

Additionally i found this script:
/DietPi/dietpi/func/dietpi-set_hardware i2c enable
which doesn’t enable i2c as well.

root@DietPi:~# i2cdetect -y 0
Error: Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
root@DietPi:~# i2cdetect -y 1
Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

I’m having the same difficulties.

How did he solve it?

I have a NanoPI NEO and there is no interface that enables i2c.

Does anyone know how to resolve?

See The access to smbus, i2c and gpio is missing on NanoPi NEO2 · Issue #3746 · MichaIng/DietPi · GitHub

1 Like