This GPS-based project displays analogue clock and room temperature on a TFT display. GPS time is a precise time standard that is related to Coordinated Universal Time (UTC). The displays of most electronic hobby projects are based on LCD, GLCD, OLED or TFT. This project is based on an 8.89cm (3.5-inch) TFT display having 480×360 pixel resolution (Fig. 1).
Fig. 1: TFT LCD Arduino shield
The latest Chinese TFT displays are quite low in price but work perfectly with Arduino and Raspberry Pi. There are two different types of TFT shields available: one with 26 pins (13×2 DIL) for Raspberry Pi and the other as Arduino TFT shield for Arduino Uno board.
Arduino TFT shield
Arduino TFT shield can be perfectly mounted on top of an Arduino Uno board. But a major disadvantage is that after mounting the shield on Arduino Uno board, it is difficult to use its GPIO pins for any other application.
The Arduino TFT shield has a micro SD card attached that gets connected to its serial peripheral interface (SPI) pins for communication with the microcontroller. This micro SD card is not used in this project.
The main hurdle with this display is that it is not common and is available only from mcufriend.com. Fortunately, the mcufriend_kbd.h header file is freely available and it works out of the box for this and many other similar displays. The other header file required for this display is Adafruit_GFX.h. Both these header files, along with the main source code, are given below.
This project creates an analogue dial clock along with digital date, time and temperature display using an LM35/TMP36 temperature sensor. The time signal is derived from a U-Blox NEO-6M GPS receiver module. Once the technique is understood, it can be deployed for many other applications.
The project for the GPS analogue clock with temperature display requires the following components:
- 8.89cm TFT shield
- Arduino Uno
- U-Blox NEO-6M GPS receiver
- LM35/TMP36 temperature sensor
- 3.3V DC regulator/power supply
Fig. 2: Circuit diagram of the GPS analogue clock
The connections are easy to make as shown in Fig. 2. The pin connections of the Arduino TFT shield are straightforward; you just need to mount the shield on top of the Arduino Uno board. The pin-to-pin connection details between TFT shield and Arduino Uno are given in the table.
Since top portion of the Arduino Uno is covered by TFT shield, the connections for the TMP36 and GPS receiver are taken from the bottom side of the Arduino Uno board (refer Fig. 3). In case you want to free some Arduino pins then you should see the mcufriend_shield.h file and re-write the connections to do so.
Fig. 3: Connections for GPS and TMP36
The shield is basically for 3.3V operation, but may work up to 5V. However, prolonged operation on 5V is not recommended as it gets overheated at that voltage. The 3.3V supply is derived from an LD1117V33 voltage regulator.
Writing the Arduino code/sketch (GPS_analog_clock.ino) for the project is real fun! You can make TFT display in many different ways through coding. Creating a thick border line, making the hour and minutes hands move smoothly were quite challenging as Adafruit_GFX library is not so much developed. High school trigonometry is all that you need to make it happen for you.
Open GPS_analog_clock.ino code from Arduino IDE and include the header files. Compile and upload the code to Arduino Uno board.
Another sketch (GPS_analog_clock2.ino) for changing colours of the minute hands every minute is also included.
Operation and testing
After uploading the code, solder the pins of TMP36 and GPS module to the Arduino board. Then mount the TFT shield on top of the Arduino board. After all the connections are done as per Fig. 2, connect it to 3.3V DC source. GPS module requires a few minutes to trace the satellites.
Fig. 4: Author’s prototype for GPS analogue clock
Most GPS receivers have an inbuilt patch antenna that can locate the low Earth orbit (LEO) GPS satellites very easily, even if your room’s windows are closed. As soon as two such satellites are located, the time starts appearing on the analogue dial. At the same time, the date, time and temperature are shown digitally on right side of the TFT display.
Temperature sensor TMP36 works on 3.3V. An LM35 can also be used instead, but for that we need a 5V DC supply.
Download Source Folder
Somnath Bera is an avid user of open source software. Professionally, he is a thermal power expert and works as additional general manager at NTPC Ltd