Use and Going Further

Use It!

Supply 5 volts to the 2.1mm jack via a wall supply, or use a USB wall adapter and a long USB cable. Remember that initially the real-time clock module will not be set, if you have never programmed it. Run the first program to set the clock! The coin cell battery will provide timekeeping for 7 years.

Load the main program. You should see the time and date on the display after the 10 second bootloader time. If not, check your connections.

You can use the UP and DOWN buttons to adjust the hour for daylight savings time.

You can use the SELECT button to turn on or off the LCD backlight (useful for night time use). If you want a different color display, the RGB shield provides 8 different colors noted in the code.

Since the buttons are only polled every second, the buttons may not seem to register easily. Press and hold for a second and the desired function should happen.

Going Further

The combination of Trinket and the RGB LCD Shield is a good combination for display and input. There is enough code space to hook a number of sensors for real-time readout. If you believe the shield form factor is not ideal, use of the LCD with the I2C backpack is a good combination. See the tutorial for the Trinket Ultrasonic Rangefinder as an example.

The combination of the Trinket, display, and DS1307 clock makes for some trade-offs for projects. The amount of code space is limited to 5,310 bytes so you can easily go over if you include too many display or clock function calls. Even updating the real-time clock with RTC.adjust takes precious code, hence the use of an offset in the program here. The same with alarm functionality. Code optimization is crucial: use of floating point numbers is probably not possible. Use of signed integers even adds code. If you have heavy code, moving up to Arduino Uno might be necessary. Trinket provides a significant benefit in terms of cost and size if your project can fit in the code space available.

If you want a more precise clock, you can swap the DS1307 for a Chronodot, its code-compatible and is ultra-precise!
This guide was first published on Jan 27, 2014. It was last updated on Jan 27, 2014. This page (Use and Going Further) was last updated on Jul 15, 2019.