Temperature from DS18B20

@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.

I finally have the DS18B20 working on a new kernel (Armbian with 5.19.5-rockchip64 kernel) !!!

  1. Create and edit a w1-gpio.dts file as this:

/dts-v1/;
/plugin/;

/ {
compatible = “rockchip,rockpi”,“rockchip,rk3399”;

    fragment@0 {
            target-path = "/";

            __overlay__ {

                    w1: onewire@0 {
                            compatible = "w1-gpio";
                            pinctrl-names = "default";
                            gpios = <&gpio4 30 0>;
                            status = "okay";
                    };
            };
    };

};

  1. Compile it and put it where he must go (note dtc is normally installed with recents armbian):
    sudo dtc -I dts -O dtb -o /boot/dtb-5.19.5-rockchip64/rockchip/overlay/rockchip-w1-gpio.dtbo w1-gpio.dts
  2. Reboot, et voilà !!!
    sudo dmesg | grep w1
    [ 5.754498] w1_master_driver w1_bus_master1: Attaching one wire slave 10.000802e5e4d1 crc 3c

I think this trick should work with all distro using device tree (dietPi, armbian, etc…)

1 Like

Sorry, Alex, but I am not interested in malfunctioning toys like Armbian - I need DS18B20 working on OSes provided by Radxa. Do you have such solution?

@Stephen

Any news?

But armbian IS an OS provided by Raxda. Just see here:


I think ‘malfunctioning toys’ is pretty rude. My goal is to have a device for managing an aquaponic spot, so I need many thermal sensor, a ADC channel for Ph-meter, and GPIO output for relay.
Armbian make all what I want, and have an openHAB 3 (an home assistant clone opensource) software in armbian-config working perfectly with my sensors.
So, for me, armbian make the job.

Armbian is a toy for beginners. Nothing to do with real engineering. Half of the things dont work out of the box.

I understand that you dont have any solution for Debian nor Ubuntu. Thats not good.

That is completely normal - you need to read FAQ,
https://docs.armbian.com/User-Guide_FAQ/#why-does-hardware-feature-xy-work-in-old-kernel-but-not-in-more-recent-one

and your support contract. Where it doesn’t say anything about your rights to humiliate developers that donated their time to waste it for you.

You can deserve attention, support or gifts. Or not deserve.

Its up to you.

It took me 1/2 hour to have DS18B20 working on Ubuntu following my method (removing all errors founded). Here it is a copy of my lab notebook:

sudo xzcat rockpi-4b-ubuntu-focal-server-arm64-20220801-0355-gpt.img.xz | dd of=/dev/mmcblk1 bs=1M

#url ssh: rockpi-4b.local
#login/pw: rock/rock

sudo apt-get update -y
sudo apt-get -y install rockpi4-dtbo
sudo nano /boot/hw_intfc.conf

désactiver les consoles: #intfc:dtoverlay=console-on-ttyS2 et #intfc:dtoverlay=console-on-ttyS4

sudo nano /boot/extlinux/extlinux.conf
#remove console=ttyFIQ0,1500000n8 and console=ttyS2,1500000n8
sudo reboot

############################

Removing errors messages

############################
dmesg | grep w1
[ 20.024497] rockchip-pinctrl pinctrl: unable to find group for node w1_pins
[ 20.028947] w1-gpio: probe of onewire@0 failed with error -22

sudo apt-get -y install device-tree-compiler
sudo nano new_w1-gpio.dts

#copy and paste next lines*************************************
/dts-v1/;
/plugin/;

/ {
compatible = “rockchip,rockpi”,“rockchip,rk3399”;

    fragment@0 {
            target-path = "/";

            __overlay__ {

                    w1: onewire@0 {
                            compatible = "w1-gpio";
                            pinctrl-names = "default";
                            gpios = <&gpio4 30 0>;
                            status = "okay";
                    };
            };
    };

};
#end copy/paste ***********************************************

sudo mv /boot/overlays/w1-gpio4-30.dtbo /boot/overlays/w1-gpio4-30.old
sudo dtc -I dts -O dtb -o /boot/overlays/w1-gpio4-30.dtbo new_w1-gpio.dts
sudo reboot

###################

CHECKING RESULT

###################
dmesg | grep w1
[ 18.592842] w1_master_driver w1_bus_master1: Attaching one wire slave 10.000802e5e4d1 crc 3c
YEEEEEESSSSS !!!

cat /sys/bus/w1/devices/10-000802e5e4d1/w1_slave
35 00 4b 46 ff ff 07 10 98 : crc=98 YES
35 00 4b 46 ff ff 07 10 98 t=26312

I have nothing to do with developers, I am not offending anyone. I am scoring result of someone’s work which is poor. These are things, not people.

I tried your solution and needed to fix " characters to compile.

However sensor still is not visible in /sys/... folder.

The valid file:

/dts-v1/;
/plugin/;

/ {
compatible = "rockchip,rockpi","rockchip,rk3399";

    fragment@0 {
            target-path = "/";

            __overlay__ {

                    w1: onewire@0 {
                            compatible = "w1-gpio";
                            pinctrl-names = "default";
                            gpios = <&gpio4 30 0>;
                            status = "okay";
                    };
            };
    };
};

and command:

dtc -I dts -O dtb -o destination_file.dtbo source_file.dts

Oh, you are. With “malfunctioning toys” you are offending developers of open source community, Armbian developers and all projects that are using Armbian work. Basically complete single board computers ecosystem. Most of other projects can only be behind in the sense you are exposing.

Who is in the position to judge work that is provided for free and in best effort manner? Armbian (and developers in open source community at large) pay for what you get and for your education, which sadly doesn’t work well … just a small % of this “toying” gets some sort of compensation despite most of people that maintain Armbian finance everything and are developers super starts with decades of professional experiences. Its not about not getting there, but your attitude you are blaming gift giver for the quality of the gift.

If you are not happy, use something else, just ****.

If you want functions to work with modern kernel, you should be happy that you know someone that might help you. This is not something easy to find even you are loaded with bags of cash. But if you are asking or implying its sponsors duty to develop some features for you on their expense, you are again insulting someone.