View: 4857|Reply: 16

Orange Pi Zero 2: 1-wire does't work. Temperature sensor DS18B20

[Copy link]

1

threads

1

posts

29

credits

Novice

Rank: 1

credits
29
Published in 2022-6-15 04:24:18 | Show all floors |Read mode
Hello,
I have a problem with an 1-wire interface. I can not make a temperature sensor (DS18B20) work.


I have an Orange Pi Zero 2 board. I installed the official image os, that is Orangepizero2_3.0.0_debian_bullseye_server_linux5.16.17.
My settings:


/boot/armbianEnv.txt
overlays=w1-gpio
param_w1_pin=PC10

/etc/modules
w1-gpio
w1-therm

lsmod command shows this:
w1_therm  28672 0
w1_gpio    16384 0
wire          40960 2 w1_gpio,w1_therm


The temperature sensor (DS18B20) is wired like this:

- ground on ground pin
- data on pin PC10 but I tried different pins with no success
- VCC on 3.3v pin
- a 4.7kohm resistor between the 3.3v and the data wire


Sensors (I have 3 pieces) work with Raspberry Pi so it's not a sensor problem.
Is there any issue with an 1-wire interface on Orange Pi Zero 2 boards? Or should I set it differently?

0

threads

1

posts

6

credits

Novice

Rank: 1

credits
6
Published in 2023-8-23 16:45:03 | Show all floors
This post was finally edited by JohnB at 2023-8-23 16:52

Hello, also faced this problem.


my board is OrangePi Zero2 1GB

OS : debian 3.0.6 Bullseye (Orange Pi 3.0.6 Bullseye)


Does not work because there is no device tree file (in the /boot/dtb/allwinner/) you need to create it.


How to:

1. You need to create text file "sun50i-h616-w1-gpio.dts"

/dts-v1/;
/ {
        compatible = "xunlong,orangepi-zero2\0allwinner,sun50i-h616";

        fragment@0 {
                target = <0xffffffff>;

                __overlay__ {

                        w1_pins {
                                pins = "PC9";
                                function = "gpio_in";
                                phandle = <0x01>;
                        };
                };
        };

        fragment@1 {
                target-path = [2f 00];

                __overlay__ {

                        onewire@0 {
                                compatible = "w1-gpio";
                                pinctrl-names = "default";
                                pinctrl-0 = <0x01>;
                                gpios = <0xffffffff 0x02 0x06 0x00>;
                                status = "okay";
                        };
                };
        };

        __symbols__ {
                w1_pins = "/fragment@0/__overlay__/w1_pins";
        };

        __fixups__ {
                pio = "/fragment@0:target:0\0/fragment@1/__overlay__/onewire@0:gpios:0";
        };

        __local_fixups__ {

                fragment@1 {

                        __overlay__ {

                                onewire@0 {
                                        pinctrl-0 = <0x00>;
                                };
                        };
                };
        };
};


2. After you need to compile it, with command "dtc -O dtb -o sun50i-h616-w1-gpio.dtbo sun50i-h616-w1-gpio.dts"

3. Copy it too /boot/dtb/allwinner/overlay/

4. Reboot All done:)




Published in byday 19:22 | Show all floors
Nice blog you got here. Id like to read something more about this theme. Thank you for giving this information.        Bioma
Published in yesterday 16:02 | Show all floors
Great post. I used to be checking continuously this blog and I’m impressed! Extremely helpful info particularly the final section   I deal with such info much. I was looking for this certain info for a long time. Thank you and best of luck.        david hoffmeister reddit
Published in yesterday 17:11 | Show all floors
you provided me the correct information I really bookmark it,for further reading,So thanks for sharing the information.        a course in miracles
Published in yesterday 17:42 | Show all floors
I wanted to thank you once again for your amazing web-site you have made here. It is full of useful tips for those who are truly interested in this specific subject, specifically this very post. You really are all really sweet as well as thoughtful of others and also reading your blog posts is a superb delight in my opinion. And thats a generous surprise! Ben and I are going to have enjoyment making use of your recommendations in what we must do in a few days. Our list is a mile long so your tips might be put to beneficial use.        a course in miracles
Published in yesterday 18:43 | Show all floors
I really like what you guys are up too. This sort of clever work and coverage! Keep up the very good works guys I’ve included you guys to my own blogroll.        티비위키
Published in yesterday 18:53 | Show all floors
My brother recommended I may like this website. He was once totally right. This put up actually made my day. You can not believe simply how a lot time I had spent for this information! Thanks!        david hoffmeister
Published in yesterday 18:54 | Show all floors
I feel this is among the most important details for me. And i am glad looking at your report. But want to remark on some general things, The web site style is excellent, the articles or blog posts is truly great : D. Very good work, cheers        acim daily lesson 1
Published in yesterday 18:57 | Show all floors
That may be additionally a fantastic post i truly loved understanding. It isn't really on a daily basis we carry the opportunity to uncover another thing.        acim podcast
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list