13

I have a few DS18B20 temperature sensors. These are normally used in Arduino projects, but I don't see why not to use them with a Pi. There is a software called DigiTemp that seems to drive the device and I have compiled and installed it on the Pi. The not so clear thing is, how do I connect them? Directly to the UART?

tlhIngan
  • 3,372
  • 5
  • 21
  • 33
Tomas
  • 273
  • 1
  • 3
  • 11

2 Answers2

5

Adafruit has released a distro called occidentalis which has 1-wire support built in.

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. 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.

This will allow you to read the temperature with commands like

cat /sys/bus/w1/devices/28-*/w1_slave

I don't know if digitemp can be made to work with those, but it should be fairly straightforward to write a munin plugin if you just want to get the temperature graphs

John La Rooy
  • 12,005
  • 9
  • 48
  • 77
4

I think the secret sauce is the last line on this page

It links to DS9097U which does the UART to 1-wire conversion

I have previously use the "pic arbiter" with these devices. It works in a similar role getting the data from the 1-wire devices and making it suitable for consumption by the UART

It's also possible to connect I2C devices such as the MCP9804 directly to GPIO pins. The downside is that you need 4 wires

John La Rooy
  • 12,005
  • 9
  • 48
  • 77