The easiest place to add a sensor is to Trinket GPIO #1. GPIO pins #0 and #2 are used for the display and #3 and #4 are shared with the USB port. Using #3 and #4 is perfectly fine, but you may have to disconnect the connections on those pins when uploading software. Also, limiting a project to pins #0 to #2 gives you a similar pinout to the Adafruit Gemma wearable controller.
This project demonstrates using the DHT22 temperature and humidity sensor. It provides a 0-100% humidity reading with 2-5% accuracy and -40 to 80°C temperature readings with ±0.5°C accuracy. The sensor only requires one digital pin for readings, perfect.
You may want to review the Adafruit tutorial on DHT sensors for more background.
See the wiring on the Fritzing diagram (first page) and the picture (second page). It is fairly easy to connect to the DHT sensors. They have four pins - from left to right with the grilled opening facing you:
- VCC (3 to 5V power)
- Data out
- Not connected
- Ground
You may ignore pin 3, its not used. Place a 1K ohm resistor between VCC (5V) and the data pin to act as a pull up on the data line. Do not use the 10K resistor normally used from 5v to the data pin.
Text editor powered by tinymce.