DS18B20 – is a digital thermometer that works through the 1-Wire interface. On one 1-Wire interface, potentially you can connect over 20 devices! In this article short review how to connect DS18B20 to Onion Omega 2 and read data.
Attention! The author of the article and the administration of the site do not bear any responsibility for any possible consequences! You use the posted information at your own risk!
For example, connect 2 sensors DS18B20 pins DQ (Data pin) were connected to 19 GPIO on Omega with pull-up resistor 4.7 kOm.
Next, run the command:insmod w1-gpio-custom bus0=0,19,0
where 19 – is a pin that uses for DS18B20. This command initiates to load kernel w1 module for enabling 1-Wire bus in Linux.
After, go to /sys/devices/w1_bus_master1/ and run ls -lh
It’s a devices ids. For each DS18B20 it must be unique. In sample it 2 devices with 2 unique ids. In Linux, these are folders with devices ids names. Next step – read data from the sensor.
Go to on one of sensor folder (for example, cd 28-0213137b4baa) and run cat w1_slave
If DS18B20 is valid, you must see data similar that data on the screenshot on top. In the sample, t=21000 – is a 21.0 degree in Celsius. That’s all)