Adafruit recently released their own Raspberry Pi image, Occidentalis v0.1:
This is our first distro, Occidentalis v0.1. Rubus occidentalis is the black raspberry. It is derived from Raspbian Wheezy July 15
We have made a few key changes to make it more hardware-hacker friendly!
- Updated to Hexxeh firmware
- 4 Gig SD image (will not fit in 2 G cards!)
- I2C and hardware SPI support
- I2C/SPI modules initialized on boot
- sshd on boot
- ssh keygen on first boot
- runs ahavi daemon (Bonjour client) and is called raspberrypi.local
- Realtek RTL8188CUS wifi support
- One wire support on GPIO #4 when loaded
I thought that looked like a nice list of improvements. I'd already been using I2C with bootc.net's image, but the new 1-wire support piqued my interest. I downloaded & flashed the Occidentalis image onto a SD card and then booted up:
The login is the usual pi/raspberry. Before I tested out 1-wire, I thought I would check to see if my Asus USB-N13 was supported as Adafruit compiled the driver it needs, rtl8192cu, into the kernel in their image. To my delight, the USB-N13 was immediately recognized (unlike with the "regular" Raspbian Wheezy image):
Alright, on to some electronics! The Occidentalis page states about 1-wire:
One wire is most commonly used for DS18B20 temp sensors. The Pi does not have 'hardware' 1-wire support but it can bitbang it with some success.
The page also highlights the commit that makes it possible:
I already had the temperature sensors, so I just hooked it up as the page described:
Connect a DS18B20 with VCC to 3V, ground to ground and Data to GPIO #4. Then connect a 4.7K resistor from Data to VCC.
(note: I'm using the Adafruit Pi Plate on top of Raspberry Pi to make the connections; FTDI cable for serial console is also pictured)
I continued to follow the documentation:
Then run as root: modprobe w1-gpio and then modprobe w1-therm to attach the temperature submodule. Then you can run cat /sys/bus/w1/devices/28-*/w1_slave to read the temperature data from the bus
The first line has the CRC, if its "NO" then the data is corrupted. If you get a good CRC check, the second line has t=temperature in 1/100 of a degree Centigrade. For example, below, the temperature is 24.5°C
Since 1-wire is bitbanged, its flakier than SPI or I2C. We do not have any 1-wire tutorials for the RPi at this time
Here is a screenshot of my results:
The temperature value was 34000 which I believe would mean 34 C or 93 F. This seems hotter than it actually was, so I'm planning to verify the results with the I2C TMP102 temp sensor next to the DS18B20.