14

Is it possible to use a cheap temperature sensor such as the DHT-22 with the Raspberry Pi? I have found Arduino drivers for this and many similar things, and would be comfortable porting the code to the Raspberry Pi, but my understanding is that because it requires such specific timings that having a dedicated microcontroller without a full OS makes it much simpler.

Without the ability to disable interrupts (a'la cli() and sei(), in AVRs), is the level of timing required even possible?

I am attempting to build a controller for a climate control system for aging, for instance, cheese. It would need to be connected to a couple of relays and a temperature and humidity sensor, and this seems like it would be an extremely cost effective way to do it.

Specifically — has anyone seen or written drivers for 1-wire type temperature sensors that run on the 'pi?

Maria Zverina
  • 5,188
  • 5
  • 32
  • 42
chrisrhoden
  • 243
  • 1
  • 2
  • 7

5 Answers5

8

Adafruit now even has a tutorial to connect the DHT22 to the pi. The example code works on most Pis, I had to tweak the C code a little like posted in the raspberrypi.org forums (increase a sleep timer).

For other working sensors (including 1-wire and I²C) take a look at my blog. But e.g. the TMP102 is still missing in the list.

Avio
  • 1,239
  • 2
  • 15
  • 27
mauorrizze
  • 96
  • 1
  • 2
1

If you were to run your process in real-time, it's possible you would get the timing tight enough to work most of the time. Maybe to be more reliable you could use a buffer IC to receive data from the device, so the Pi can then query the buffer IC at a more irregular rate.

I'm not familiar enough with the device, but perhaps it would be possible to connect it to the Pi's serial port instead, if the speeds are compatible? Then the timing and buffering is already taken care of for you, and all you have to do is decode the bits arriving in from the serial port when it suits you.

Malvineous
  • 2,109
  • 15
  • 25
0

Microchip MCP950X have a logic output that changes state at a particular temperature

Available switching temperature are

-35°C,-25°C, -15°C, -5°C, 5°C, 15°C, 25°C, 35°C, 45°C,
55°C, 65°C, 75°C, 85°C, 95°C, 105°C, 115°C, 125°C

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

re: 1-wire, Adafruit's new image has support and I've used it to read 1-wire DS18B20 temp sensor.

pdp7
  • 161
  • 2
0

Yes adafruit has. but I would recommend a better sensor then that. This has a comparison of the sensor to others along with links to libraries and datasheets: http://simplyautomationized.blogspot.com/2015/10/the-raspberry-pi-temperature-sensors.html

raspi-ninja
  • 889
  • 2
  • 8
  • 15