Hi All, I have a DS18B20 waterproof temperature sensor. I connect it to 3.3 Volt, ground and PIN 7, GPIIO 42, with a 4.7 KOhm resistor between + and data The sensor is working on a ESP8266 module, but I want to connect it directly to my Udoo. How can I add this 1-wire device and read the values of it? I try to add it to Domoticz.
This library should be compatible with the Arduino Due ( the Arduino in the Udoo Quad): https://github.com/PaulStoffregen/OneWire
If you want to read your 1-wire sensors from the Linux i.MX6 side rather than from the Arduino SAM3x, there is a nice package called 'owfs-fuse' (ows = "one-wire file system") available in the Debian and Ubuntu repositories-- just do "apt-get install owfs-fuse" to install. This presents all detected Dallas 1-wire sensors as virtual filesystem objects, organized by their device-type byte and ROM serial number. Code: root@imp:~# ls -l /1w total 0 drwxrwxrwx 1 root root 8 Nov 19 02:39 26.4D2615000000 drwxrwxrwx 1 root root 8 Nov 19 02:39 26.C74E15000000 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.570F32050000 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.A15A31050000 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.B4A831050000 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.D3D131050000 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.FF1A6E221703 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.FF7FC0711703 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.FFB4AF711703 drwxrwxrwx 1 root root 8 Nov 19 02:39 28.FFC962221703 drwxrwxrwx 1 root root 8 Nov 19 02:39 29.D3200C000000 drwxrwxrwx 1 root root 8 Nov 19 02:39 29.FA3600000000 drwxr-xr-x 1 root root 8 Nov 18 23:59 alarm drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.1 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.2 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.3 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.4 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.5 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.6 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.7 drwxr-xr-x 1 root root 8 Nov 18 23:59 bus.8 drwxr-xr-x 1 root root 8 Nov 18 23:59 settings drwxrwxrwx 1 root root 8 Nov 19 02:39 simultaneous drwxr-xr-x 1 root root 8 Nov 18 23:59 statistics drwxr-xr-x 1 root root 32 Nov 18 23:59 structure drwxr-xr-x 1 root root 8 Nov 18 23:59 system drwxr-xr-x 1 root root 8 Nov 18 23:59 uncached They can be read very easily from shell scripts or other code. e.g. Code: root@imp:~# cat /1w/28.FF1A6E221703/temperature ; echo 64.4 Besides plain 18B20's, it knows about DS2438-based humidity sensors, DS2406+TAI8570 barometric pressure sensors, DS2408 8-bit PIO chips, and just about everything else Dallas/Maxim has ever made. Although there is a software-based Linux 1wire driver now, I connect my sensors via I2c using a DS2482-800 chip behind a 3.3V-5V level converter, since some are 5V-only and/or on long cables, and I need the extra noise-resistance and bus isolation provided by this iC. It also reduces CPU load by taking over the more time-critical 1wire communication tasks. With this hardware, I invoke the owfs daemon from /etc/rc.local as /usr/lib/owfs/owfs -c /etc/owfs.conf --i2c=/dev/i2c-0:ALL -F /1w And my owfs.conf contains Code: server: device = /dev/i2c-0 mountpoint = /1w allow_other server: port = localhost:4304 error_print=1 error_level=3 although I'm not sure whether that file is really necessary; it didn't exist when I first started using owfs, some years ago. The -F parameter gives temperature readings in Fahrenheit, rather than the default Celsius. If you prefer Celsius, just leave this off. If you want to connect 1-wire devices directly to an Udoo pin, this is supported by owfs now, using --w1 rather than --i2c as above, but you'll first need to reconfigure your Udoo's device tree to change the desired pin from a GPIO, letting the 1-wire driver take it over instead. This can be done using Udoo's provided dtweb utility (easiest), or by manually editing your .dts file and recompiling it with dtc.