If you are having software problems:

  • Ensure you have installed Trinket support in your Arduino IDE as listed in the Introducing Trinket tutorial.
  • Ensure you have installed the TinyDHT, and Adafruit_LiquidCrystal libraries listed on the first page of this tutorial. The Adafruit standard DHT and the Arduino LiquidCrystal libraries will not work.
  • Ensure you push the Trinket on board reset button before uploading your sketch, the red LED will blink when ready for upload, there is a 10 second window to do this.
  • If you place a large amount of code or other libraries in a sketch, it is very easy to exceed the available code space on the Trinket. If your program absolutely will not fit, consider switching to an Arduino Uno, Adafruit Boarduino, or Adafruit Flora with standard libraries.
  • If you get errors similar to the one below, you may have included decimal numbers and the floating point library was added by the Arduino IDE, exceeding the amount of program space available.

arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr25/crttn85.o:(.init9+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `exit' defined in .fini9 section in /arduino-1.0.1/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/avr25\libgcc.a(_exit.o)

For project issues:

  • If you get no display, go to the Hello World I2C sketch and ensure that works.
  • If you have no display on Hello World, on the I2C backpack, use the contrast knob to change the LCD display contrast to a readable level. If you decided on an external potentiometer to change contrast and not pin 16 on the backpack, use that.
  • If you get "Bad Read on DHT", the sensor is not talking to the Trinket correctly. Check your wiring and ensure you have a 1,000 ohm resistor from Trinket GPIO #1 to 5V. Resistors are commonly available at electronic stores on line and at retail locations like RadioShack.
  • If you get 0% Humidity and 32 degrees F/ zero C, ensure Trinket 5V 16 MHz is selected as the Board type in the Arduino IDE Tools menu. The sensor code will not give correct readings on a Trinket 3V or at 8 MHz.

Going Further

You can change the temperature sensor to a TMP36 or other sensor with some changes. GPIO #3 is analog pin A3 and GPIO #4 is analog pin A2 for reading analog sensors. But be sure you do the conversion from the analog level to temperature using integer math (best to use an int16_t integer size) to avoid linking in the big floating point library for only a few calculations.

A light sensor such as a cadmium sulfide photocell could be read, as in the Trinket / Gemma Mini Theramin, on GPIO #3 or #4, for a simple light meter displayed on the LCD display.

Once you have the display basics, you can use these technique as the human interface to a wide array of projects.

This guide was first published on Sep 28, 2013. It was last updated on Sep 28, 2013.

This page (Debugging and Going Further) was last updated on Sep 28, 2013.

Text editor powered by tinymce.