Today I set out to follow Edward O'regan's procedure for connecting a Dallas Semiconductor DS18B20 temperature sensor to the Raspberry Pi development board.
The first problem I ran into was with the sort of IDE cable I was using. If you look close you can see it's an 80-pin IDE connector.
The problem with an 80-pin IDE connector as it turns out, is that it not only interleaves a ground between each pin on the ribbon cable, it also grounds specific pins within the socket. In the picture above we can see the ground plane that I pulled out of the socket for illustration purposes. we can see that at various points along the plane there are sharp protuding pins that make contact with the various pins in the socket. this is BAD for the raspberry pi as I found out (GPIO 4 worked but when I rebooted the pi, it locked up).
But, this wasn't all for nothing. Since I opened up the socket while troubleshooting, I noticed that the pins stick out far enough to be soldered to. Next I had to check to see if the plastic could take the high temperatures incurred during soldering. They did, very nicely. I heated them all at the same time for about 20 seconds and the plastic didn't give way whatsoever.
So I took a 6-foot hunk of cat-5e and soldered Brown, Orange, and Green to socket pins corresponding to Ground, +3.3v, and GPIO-4 (these are the pins needed to interface with a 1-wire device such as the DS18b20 temperature sensor).
Everything worked great on the first try. I added a second DS18B20 in parallel with the first and the second one was detected within a few seconds. I pulled temperature readings from both sensors. The fastest I could poll the sensors was bout 1-second per check. Not too fast, but not bad all things considering.
Next I tried configuring the sensor for "1-wire" or "parasitic" operation by shorting pins 1-3 to ground and leaving GPIO-4 connected to pin2 for data.
At first it seemed to work, but upon closer inspection, both sensors returned 85-degrees-celcius every time regardless of the actual temperature. The strange thing is that the checksum was correct each time.
Since I don't mind stringing a third wire to each temp sensor I went forward with the 3-wire configuration.
Next I made a more permanent cable.
At the base of the wire I have the first of two sensors. And at the end of the cable is the second sensor.
close-up of both sensors along with the header.
1-liner used for testing
root@raspberrypi:/sys/bus/w1/devices# while : ; do for I in 28-* ; do echo $I ; cat $I/w1_slave ; done; doneSample output
28-000002cd667f59 01 4b 46 7f ff 07 10 a2 : crc=a2 YES
59 01 4b 46 7f ff 07 10 a2 t=21562
28-000002cd9b29
50 05 4b 46 7f ff 0c 10 1c : crc=1c YES
50 05 4b 46 7f ff 0c 10 1c t=85000






