Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
interfaces:1wire [2015/10/22 20:55]
darron
interfaces:1wire [2016/01/19 21:52]
darron
Line 1: Line 1:
-==== 1wire ====+==== 1wire bus ====
 <wrap right> <wrap right>
 {{:interfaces:1wire.jpg?200}} {{:interfaces:1wire.jpg?200}}
 +\\ \\
 +{{:interfaces:1wire-2.jpg?200}}
 +\\ \\
 +{{:interfaces:keyes.jpg?200}}
 </wrap> </wrap>
  
-The 1wire bus supports various low speed digital devices and is supported in Linux.+The 1wire bus supports various low speed digital devices and is supported in Linux on the Raspberry Pi.
  
 === Raspberry Pi === === Raspberry Pi ===
  
-boot/config.txt:+Edit boot/config.txt to assign gpio4 for 1wire.
 <code> <code>
 dtoverlay=w1-gpio,gpiopin=4 dtoverlay=w1-gpio,gpiopin=4
 </code> </code>
 +
 +Reboot and after load driver.
 +<code>
 +modprobe w1_gpio
 +</code>
 +
 +These are the GPIO header pin assignments for the 1 wire bus.
 +
 +^Pin ^Name  ^Function |
 +| 1  | 3V3 | POWER|
 +| 6  | GND| GROUND |
 +| 7  | GPIO4 | DATA|
 +
 +The relevant pins on the Pi header are as follows.
 +<code>
 +                +---P1---+
 +3V3             01      02 5V
 +GPIO0/GPIO2     03 A/A+ 04 5V
 +GPIO1/GPIO3     05 B/B+ 06 GND
 +GPIO4           07 2    08 GPIO14/TX
 +                ..      ..
 +</code>
 +
 +NB. The 1 wire data line must pulled high via 4K7 to 3V3 power.
 +
  
 === DS18B20 Thermometer === === DS18B20 Thermometer ===
 <code> <code>
 ++-------+
 +| 1 2 3 |
 ++-------+
 +  | | |
 +  | | |
 +  
 +1 GROUND
 +2 DATA
 +3 POWER
 </code> </code>
  
 +<code>
 +modprobe w1_therm
 +cat /sys/bus/w1/devices/28-041460bdd6ff/w1_slave 
 +8f 01 55 00 7f ff 0c 10 a0 : crc=a0 YES
 +8f 01 55 00 7f ff 0c 10 a0 t=24937
 +</code>
 +
 +=== KEYES DS18B20 module ===
 +
 +This module re-orders the pins so beware.
 +
 +<code>
 ++-------+
 +|DS18B20|
 +|       |
 ++-G R Y-+
 +  | | |
 +  
 +G GROUND
 +R POWER
 +Y DATA
 +</code>
 +
 +DATA is pulled up via a 4K7 resistor and an LED. The LED will flash
 +during communication with the chip.
 === DS2431 EEPROM === === DS2431 EEPROM ===
 <code> <code>
 ++-------+
 +| 1 2 3 |
 ++-------+
 +  | | |
 +  | | |
 +  
 +1 GROUND
 +2 DATA
 +3 NC
 +</code>
 +
 +<code>
 +modprobe w1_ds2431
 +echo "hello world" > /sys/bus/w1/devices/2d-00000de5d608/eeprom
 +cat /sys/bus/w1/devices/2d-00000de5d608/eeprom
 +hello world
 </code> </code>