Power & Source of Big Ideas

[Solved] DS18B20 NanoPi Neo Core 2

Moderators: chensy, FATechsupport

Hi everyone. I have simple problem. I try to read temperature from DS18B20 sensor. I use ubuntu 16.04 and kernel: linux 4.16 it is default image from friendly elec. I try to activate 1-wire overlay so I write:

sudo modprobe w1-gpio gpio=203
sudo modprobe w1-therm

and after lsmod command:

Module Size Used by
w1_therm 16384 0
w1_gpio 16384 0
wire 28672 2 w1_gpio,w1_therm

I also have directory /sys/bus/w1/devices/ but this folder is empty. When I worked with Rpi I must also add overlay to /boot/config.txt but this system distribution don't have any config.txt in /boot. Do you have any idea what is wrong or what else I must to do? Thank you for any tip and advice :)
Does this device use .dtsi files? (Device tree)
Hi. I have nanoPi only few days but I think yes. Generally I know what is the device tree but I don't have any practice. There are some of files with .dtb extension f.e. in /boot/overlay
I have been trying to help a guy get I2C to work on the NanoPC-T2 ... unsuccessfully so far.

I would have a look through those .dbt files to see if there are anything to do with 1-wire.

The Raspberry Pi has this for 1-wire:

Code: Select all

dtoverlay=w1-gpio,gpiopin=4
r.baczynski.10 wrote:
Hi everyone. I have simple problem. I try to read temperature from DS18B20 sensor. I use ubuntu 16.04 and kernel: linux 4.16 it is default image from friendly elec. I try to activate 1-wire overlay so I write:

sudo modprobe w1-gpio gpio=203
sudo modprobe w1-therm

and after lsmod command:

Module Size Used by
w1_therm 16384 0
w1_gpio 16384 0
wire 28672 2 w1_gpio,w1_therm

I also have directory /sys/bus/w1/devices/ but this folder is empty. When I worked with Rpi I must also add overlay to /boot/config.txt but this system distribution don't have any config.txt in /boot. Do you have any idea what is wrong or what else I must to do? Thank you for any tip and advice :)




Hii,

Have you configured your sensor in device tree ??

Have you compiled your device tree after your device into device tree ??


I also have directory /sys/bus/w1/devices/ but this folder is empty. When I worked with Rpi I must also add overlay to /boot/config.txt but this system distribution don't have any config.txt in /boot. Do you have any idea what is wrong or what else I must to do?

You can add the overlay in /etc/modules

like for example I2C in NanoPC-T2

sudo nano /etc/modules

# Modules to be loaded at boot time

i2c-dev
i2c-adapter
i2c-nexell

place your modules in this file .
NanoPC-T2
If the software is friendlycore-xenial-4.4 there is sudo npi-config and in the advanced option is i2c enable/disable. It works perfect with nanoPi neo core and neo core 2.

To enable 1-wire there are 3 options to load kernel modules:

Code: Select all

sudo modprobe w1-gpio

Code: Select all

sudo dtoverlay w1-gpio gpiopin=4 pullup=0  # header pin 7

Code: Select all

insmod /lib/modules/4.4.0-21-generic/kernel/drivers/cpufreq/speedstep-lib.ko 


All of this command works well with Rpi but have no effect with my nanoPi. In /boot/config-4.14.0-h5 I found and change from m to y 3 lines:

Code: Select all

CONFIG_W1=m // this line
# 1-wire Bus Masters

# CONFIG_W1_MASTER_DS2490 is not set
# CONFIG_W1_MASTER_DS2482 is not set
# CONFIG_W1_MASTER_DS1WM is not set
CONFIG_W1_MASTER_GPIO=m // this line

# 1-wire Slaves

CONFIG_W1_SLAVE_THERM=m // this line
CONFIG_W1_SLAVE_SMEM=m
CONFIG_W1_SLAVE_DS2405=m
CONFIG_W1_SLAVE_DS2408=m


I also add w1-gpio to /etc/modules and after reboot module is enable but it still don't work. My path /sys/bus/w1/devices is empty.
I solved my problem. I install armbian for nano pi neo core 2 and enable in config 1-wire. Thanks for help.

Who is online

In total there are 11 users online :: 0 registered, 0 hidden and 11 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 11 guests