Info
1-Wire is a device communications bus system designed by Dallas Semiconductor Corp. that provides low-speed data, signaling, and power over a single conductor.
https://en.wikipedia.org/wiki/1-Wire
Pinout
In Archimede there are two 1-wire interfaces managed in bit banging connected to RoadRunner GPIO, as any other onboard interface these interfaces can be powered on and off using GPIO.
Interface | Enable PIN | RoadRunner PIN |
---|---|---|
1-W 0 | PD23 | PB30 |
1-W 1 | PB25 | PD24 |
For info about how to power on and off the interface see —LINK A UNA PAGINA DEDICATA—
Example 1: Taking a temperature reading
The 1-wire driver automatically scans every 10 seconds if new devices are plugged on the 1-wire bus.
For each 1-wire device detected a new directory is created on "/sys/bus/w1/devices/w1 bus master"
In this example a Dallas/Maxim DS18B20 thermal sensor has been plugged, in order to list all the attached devices type:
$ ls "/sys/bus/w1/devices/w1 bus master" 28-0000045d9d8a w1_master_add w1_master_remove 28-0000028fa89c w1_master_attempts w1_master_search driver w1_master_max_slave_count w1_master_slave_count power w1_master_name w1_master_slaves subsystem w1_master_pointer w1_master_timeout uevent w1_master_pullup
The two directories 28-xxxx indicate that two thermal sensors are probed on the bus (28 is the family ID) and the name correspond to your sensor’s unique serial number.
To view the current value just cat the file. You will have two lines of output. The temperature (in celsius) is at the very end.
$ cat /sys/devices/w1_bus_master1/28-0000045d9d8a/w1_slave 07 01 4b 46 7f ff 09 10 da : crc=da YES 07 01 4b 46 7f ff 09 10 da t=16437
The current reading is 16.4 degrees celsius.
Contact US
For clarification or suggestions to improve the documentation