1-wire
All Pigeon computers have the single-channel 1-Wire master interface. It uses DS2482S-100+ chip. External MOSFET provides extra power to the 1-Wire line, e.g., for use with 1-Wire devices that require a higher current temporarily to operate.
By default, OWFS 1-wire file system is installed and configured.
For example, we will show how to read the temperature from 1-wire digital thermometer DS18B20. The following table describes connections between the Pigeon and the DS18B20.
Table 1. Connections
1-WIRE | DS18B20 | TO-92 |
---|---|---|
GND | GND | 1 |
DQ | DQ | 2 |
+5V | VDD | 3 |
Note: VDD connection is optional, but recommended for a long cable.
List devices on the 1-wire bus:
ls /mnt/1wire/
28.06D63C020000 alarm bus.1 simultaneous structure uncached
28.D3E93C020000 bus.0 settings statistics system
There are two devices. Both of them are DS18B20.
Read temperature of the first DS18B20:
cat /mnt/1wire/28.06D63C020000/temperature
27.6875
The data from the 1-wire devices may be viewed from the owfs server. Open a browser on another computer other than the Pigeon, and go to the Pigeon IP address with port 2121 appended. For example:
http://192.168.1.14:2121/
Python
Example shows how to read temperature of DS18B20 in the Python language - ds18b20.py
wget https://raw.githubusercontent.com/kristech/pigeon-rb-examples/master/Python/ds18b20.py
nano ds18b20.py
#change id variable to id of your DS18B20
chmod u+x ds18b20.py
./ds18b20.py
Comments are closed.