Smart Pocket Watch With Spotify and F1 Info Dashboard
by codenik29 in Circuits > Wearables
803 Views, 11 Favorites, 0 Comments
Smart Pocket Watch With Spotify and F1 Info Dashboard
I built a pocket-sized, battery-powered Smart Dashboard! I call this the Smart Pocket Watch, a portable multi-API smart IoT hub that tracks your Spotify playback, live Formula 1 standings, local weather, and time, all in the palm of your hand.
I designed this project to breathe life into a LILYGO TTGO T-Display board that was gathering dust in my drawer. Powered by a small LiPo battery, it can act as an awesome pocket gadget or sit elegantly on your desk to provide glanceable information without interrupting your workflow.
Supplies
To build this project, you will need a few simple components. No complex wiring is required, as the board handles mostly everything for us!
Hardware:
- LILYGO TTGO T-Display (An ESP32 board with a built-in 1.14" LCD and 2 programmable buttons).
- 3.7V Li-Po Battery (Ensure it has the correct JST connector for the TTGO board—typically a 1.25mm pitch connector).
- USB-C Cable (For programming and charging the battery).
- Access to a 3D Printer (For the sleek enclosure).
Software & Accounts:
- Arduino IDE (or PlatformIO) installed on your computer.
- A free Spotify Developer Account.
- A free OpenWeatherMap Account.
3D Printing the Enclosure
To make this truly a "Pocket Watch" and protect the battery, we need a good enclosure. We will be using an excellent existing design from Thingiverse that fits the TTGO T-Display and leaves enough room for a small Li-Po battery on the back.
- 3D Model Link: TTGO T-DISPLAY Enclosure by royalfarris
Printing Tips:
- Use PLA or PETG for durability.
- Print the top and bottom halves.
- A layer height of 0.2mm works perfectly.
- Depending on your printer's tolerances, the halves might snap fit, or you may need a tiny dab of glue or tape
Hardware Assembly & Battery Setup
The beauty of the TTGO T-Display is its built-in battery management system (BMS).
- Connect the Battery: Carefully plug your 3.7V Li-Po battery into the JST connector on the back of the TTGO board. Warning: Always double-check the polarity of the JST connector. If the red and black wires are swapped compared to the board's + and - markings, you will need to swap them in the connector housing before plugging it in to avoid frying your board!
- Seat the Board: Place the board into the front half of the 3D-printed enclosure, ensuring the two tactile buttons line up with the cutouts.
- Tuck the Battery: Rest the battery neatly behind the board.
- Close the Enclosure: Snap the back cover on.
When you plug in the USB-C cable, the TTGO board will automatically charge the attached Li-Po battery!
Software Setup (Libraries)
Next, let's prepare the Arduino IDE.
- Add ESP32 board support to Arduino IDE via the Boards Manager.
- Select ESP32 Dev Module (or TTGO T1 if available) in the Boards menu.
- Install the required libraries via the Arduino Library Manager:
- TFT_eSPI (For driving the LCD)
- ArduinoJson (For parsing the web API responses)
- HTTPClient (Included with ESP32 core)
Configuring the TFT_eSPI Library: The TFT_eSPI library requires a specific setup file to know what screen you are using. You'll need to edit the User_Setup_Select.h file inside the library folder, comment out the default setup, and uncomment #include <User_Setups/Setup25_TTGO_T_Display.h>.
Getting the API Keys
This pocket watch grabs live data from the internet. You will need to generate some free API keys:
1. Spotify:
- Go to the Spotify Developer Dashboard.
- Create an app to get your Client ID and Client Secret.
- Set your redirect URI to get your Initial Refresh Token (there are many great guides online on how to get an ESP32 Spotify Refresh Token). This project handles the OAuth2 token refreshing automatically so you don't have to keep re-authenticating!
2. OpenWeatherMap:
- Sign up at OpenWeatherMap.
- Generate a free API key.
- Find your local "City ID" to get localized weather.
Note: The F1 API used in this project does not require an authentication key—it uses public REST APIs to fetch the top 10 driver standings!
The Coding Part
Now it's time to bring the hardware to life.
- Clone or Download the Code: Get the project code from my repository:
- Configure your Credentials: Open the code in your IDE. You will find a config.h file (or credential variables at the top of the main file). Update them with your details:
- WiFi: Your network SSID and Password.
- Spotify: Your Client ID, Client Secret, and Refresh Token.
- Weather: Your API Key and City ID.
- Compile and Upload: Connect your TTGO board via USB-C and hit the Upload button in the Arduino IDE.
How to Use Your Smart Pocket Watch
Once the upload finishes, the device will boot up, connect to your Wi-Fi, and sync the current time over NTP. Here is how you navigate the UI using the two built-in hardware buttons:
- Top Button: Cycles through the main dashboard views (Clock -> Spotify -> Clock).
- Bottom Button: Jump straight to the live Formula 1 Driver Standings! Perfect for when you are arguing with a friend about the current points leader and need to quickly pull the stats out of your pocket.
Battery Performance: Because it runs off a Li-Po battery, you can carry it around the house. To save battery, you can implement deep sleep modes in the code when the device hasn't been interacted with for a while, waking it up only via button presses!