Temperature from DS18B20

It works!

I’ve made only 2 changes:

/plugin/;
...
gpios = < &gpio4 30 0 0xae >;

and adding w1: does stop booting the system so don’t add it.

So I have now working sensor!

Thank you!

[0][03:40][root@rock][/sys/bus/w1/devices/28-01186bce26ff] $ cat ./w1_slave
96 01 4b 46 7f ff 0c 10 a0 : crc=a0 YES
96 01 4b 46 7f ff 0c 10 a0 t=25375

First measure after reboot is ok, but each next not. I tried to reconnect resistor because it seems like it was failing here (its wires are garbled but not touching) but for now it is not working beside 1st time…

Still the problem is not solved.

When getting a 5.5-rc6 version of kernel running on the ROCK Pi 4 board, I find that data read from DS18B20 is correct. ROCK Pi 4 read data every ten seconds.

Now we need to apply some patches to the current version (4.4.154) of the kernel.

Thanks for the info. Then I will be awaiting new kernel patiently.

Hi, any chance to get 1wire support for RockPiS? Will modified rockchip-w1-gpio.dts file work for rk3308 instead of rk3399 SoC of RockPi4? Thx.

Hi Stephen,

when will be released new version of kernel?

Bump? Anything guyz? :slight_smile:

Bumping up, @Stephen!

After digging out, the w1 driver for ds18b20 is related to hwmon, gpio subsystem, etc. To fix the issue of read error, also need apply the patches for hwmon, gpio subsystem, etc. The question is, those subsystem changes a lot from 4.4 to 5.x in the recent years. Applying patches will bring a lot of risks.

@Stephen in that case, do we need to move to Armbian?

With new kernel (110) the sensor is still not working. “Not ready to read the temperature”.

In the end I didn’t managed to make DS18B20 work on Rock Pi 4B.

What I have tried:

  • official Ubuntu 20.04.3 LTS image
  • fresh Armbian image
  • editing boot options
  • kernel modules for gpio and therm always loaded
  • pin 36 and 37 for data, also other as provided in instructions with boot options change
  • 3.3 V and 5 V
  • different small cables as they get used over time

The problem might be now a faulty sensor, but I don’t have any second one to try it.
Will think about ordering few new sensors and then get back to tests.

One thing I’ve forgot:
file /boot/hw_intfc.conf should have an uncommented line(s):

# Add w1 on GPIO4_D6 to support devices such as DS18B20.
intfc:dtoverlay=w1-gpio4-30

But it still does not work.

Left = ground to 39
Middle = data to 37
Right = vcc to 1 or 2

Changed resistor and sensor appeared in /sys/bus/w1/devices/. Seems like resistor was faulty. But its serial number is strange and does not return correct data (CRC error).

EDIT: ok, it works from time to time:

[0][09:53][root@rock][/sys/bus/w1/devices/28-01186bce26ff] $ cat w1_slave
85 01 4b 46 7f ff 0c 10 31 : crc=31 YES
85 01 4b 46 7f ff 0c 10 31 t=24312

However Python script says:

w1thermsensor.errors.SensorNotReadyError: Sensor 01186bce26ff is not yet ready to read temperature

Sensor sometimes appear in the folder and when appear it gives correct or incorrect data. Don’t know why it disappears and why gives bad data…

I’ve ordered 6 pieces of the same DS18B20 and two of them didn’t worked as expected. Changing resistor has helped (looks like one was damaged) but Rock Pi does not behave as it should. In the end I get ca 1 correct reading for 7-8 tries. Tested it each second.

@Stephen can you please confirm that DS18B20 is working with the below kernel?

Linux rock 4.4.154-113-rockchip-gdb9dfc2cdd25 #1 SMP Sat Aug 14 09:26:12 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

No. DS18B20 is still a issue with kernel 4.4.154.

We have ROCK Pi 4 images with kernel 5.10 that may fix the issue. But I didn’t test it yet.
I have ordered two DS18B20 to test. Will update to you soon.

Does DS18B20 work with kernel from image rockpi-4b-ubuntu-focal-server-arm64-20220701-0351-gpt.img?

I’ve just tried and there is no support for w1thermsensor in this kernel.

This sensor is not working with both kernels 113/116 from a while ago (year 2021) and newest 5+ from today.