Adding the Sensor

Once you have the display connected to the Trinket, you can expand the project in many ways. One of the most popular is to add sensor(s) of some sort. The Adafruit store has a wonderful selection to chose from.

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.

Trinket GPIO Pin #1 is shared with the onboard red LED. Connecting the DHT, the sensor requires a 1,000 ohm pullup resistor (not provided) between Trinket GPIO #1 and 5V to pull up the voltage to be read by the Trinket.
This guide was first published on Sep 28, 2013. It was last updated on Sep 28, 2013. This page (Adding the Sensor) was last updated on Oct 16, 2019.