- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- LCDs
- Switches
- KBDs
- Sensors
- Motors
- Analog
-
Comm
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
- Miscellaneous
Humidity Sensor
The DHT22 is an excellent (and inexpensive) relative humidity (RH) sensor, perfect for PIC applications. It has impressive credentials: RH from 0% to 100%, to one decimal place, and temperature from -40 to 257 degrees Fahrenheit, again to one decimal place). It's also got a little brother, the DHT11, with slightly reduced ranges and good to the nearest whole number, but still worthy of many everyday applications. Here's a pic of both:
That's the DHT22 on the left and the DHT11 on the right.
I've written a PMP unit for use with either of these devices. But in this demo, we'll see the DHT22 in action. I got mine from Amazon. The circuit on a breadboard, then, is a snap:
The communication to the PIC is by means of a sort of weird, proprietary one-wire protocol. But not to worry, the library unit I've written takes care of it all, and even includes a feature to spit out error messages if something goes wrong. If you're really curious about the grisly details, by all means, see this:
I wrote this project up for the article "The DHT22 Humidity/Temperature Sensor Demystified," Nuts & Volts Magazine, March 2013, pp. 50-53, should you wish to know more. Back then, I was using the Great Cow Basic compiler, but I think you'll find the newer version here in PIC Micro Pascal far easier and far more elegant to work with.
For another day, it might be fun to code up a storm to convert the RH/temperature to a dewpoint value. Should be some interesting mathematics/programming there!
And hey, here's something to keep in mind. These sensors perform best when once they been run all the way up and all the way down. In other words, expose the device to a Florida summer, then ship it to Death Valley for some drying out. Seriously though, expect best results when you've used them across the broadest extremes possible in your neighborhood. Sort of like doing stretching exercises before working out.
Click to get the source code.
Click to get the schematic PDF.
Next Project: Barometric Pressure Sensor
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment