Build a DIY Smart Watch Using Microcontroller

Summary of Build a DIY Smart Watch Using Microcontroller


The project builds a DIY smartwatch under $100 featuring a 1.7–1.8 inch resistive touchscreen, SD card, HC-05 Bluetooth, 600mAh LiPo with on-board charger, PIC32 microcontroller, and several apps (settings, game, paint). A custom L-shaped PCB houses the TFT, SD breakout, oscillator, LDO, and peripherals. Software uses protothreads as a state machine to handle UI, touch, Bluetooth UART, SD BMP display, and power management. Hardware/software tradeoffs include a 9-bit/3-bit SPI for the TFT and PWM-controlled backlight via a BJT.

Parts used in the DIY Smart Watch:

  • PIC32 microcontroller
  • 1.7/1.8 inch 128x160 TFT touchscreen (DM-TFT18-310)
  • Resistive touchscreen layers
  • HC-05 Bluetooth module
  • SD card breakout board (SD card, FAT32 formatted)
  • 600mAh LiPo battery
  • On-board LiPo charger
  • Linear regulator (LDO) to 3.0V
  • BJT for backlight and vibration motor drive
  • Vibration motor
  • Laser diode (slot provided)
  • 32 kHz MEMS oscillator (or MCP6002 op-amp oscillator)
  • MCP6002 op-amp (for oscillator)
  • Custom L-shaped PCB (OshPark manufactured)
  • Mini-USB port
  • Push button (side button)
  • Capacitors and resistors for power and circuits (including R5 220 Ohm, R6 2200 Ohm)
  • Flat flexible cable and connector for TFT

Introduction

Wearables (Smart Watch) are becoming increasingly more prevalent in today’s markets; however cost continues to limit the demand for such devices. My project aimed at producing a smartwatch with comparable functionalities to those available today. While running a total cost of less than $100. The watch is outfitted with a 1.7 inch touch screen, SD card, Bluetooth module, and various apps.

Build a DIY Smart Watch Using Microcontroller

High Level Design

Rationale

One of the main inspirations for this project was Jared Sanson’s implementation of a DIY smartwatch (REF 0). With several design iterations, he was able to produce a watch in a very small package that can communicate with a PC via USB HID, features an OLED display, and has support for an accelerometer. As my project was to be completed in the span of a mere month, several of the components I got were purchased for their ease of use rather than their compactness. As a result of this, and the fact that I did not have time for any PCB revisions, I started this project expecting my watch to be a bit larger than his.

I also wanted a touchscreen interface, and the smallest TFT touchscreen I could find was 1.8 inches, which already makes my watch fairly large. Another factor that enlarged the watch volume was battery life. I wanted a watch that could last at least 9 hours in idle mode, which meant that a fairly large battery was required. In short, because of time constraints, I knew my watch could not be quite as polished as watches you would see on the market, or the DIY watches on hackaday, but I wanted to have a product that could be comfortably worn on the wrist and used without too much difficulty.

User Interface

The watch currently has 3 apps: a settings app where the user can set screen brightness, change the time and date, and change the theme of the user interface; a game app, where the user controls a small paddle with the touch screen and attempts to deflect balls into goals; and a paint app, where the user touches to draw one of 8 selectable colors to the screen. The watch also has Bluetooth functionality, where it relays the time and date to a paired device upon receiving any character from said device.

An elastic strap is used to tether the watch to the user’s wrist. In order to extend battery life, the screen is set to turn off after 10 seconds of inactivity on the home screen. The watch wakes when a button on the side is pressed, and the sleep timeout is disabled if the user decides to proceed past the home screen. A resistive touchscreen on the TFT is used to navigate through menus and use the apps.

Date and time are displayed on the home screen. Touching the screen anywhere will bring the user from the home screen to a menu with all of the app icons. The user may then select an app by pressing on it. The apps also make use of the touch screen for user input. The 600mAh LIPO battery can be charged with an on-board charger. There is a mini-USB port on the side of the watch for powering the charger.

Logical Structure

The software was essentially a giant state machine, a simplified version of which is shown below. Bruce Land’s adaptation of Adam Dunkels’ protothreads library was used (REF 1) to manage the various processes. For a given state, a specific selection of protothreads were scheduled, when a state transition occurs, some protothreads simply are passed over in scheduling, while others are included. The protothread structure limited software overhead for scheduling, but requires that all threads are essentially running at once, with memory allocated for all of them at any given time. For the purposes of this project, protothreads was more than sufficient, however if many more apps were to be added, it would be necessary to use a different scheme.

Logical Structure (Smart Watch)

Quick Solutions to Questions related to DIY Smart Watch:

  • What is the battery capacity and expected idle life?
    The watch uses a 600mAh LiPo battery and is expected to last about 10 hours in idle mode based on estimated current draws.
  • How does the touchscreen detect touches?
    The resistive touchscreen uses two sheets; voltage is applied across one sheet and the ADC reads a voltage divider, then roles are swapped to get X and Y coordinates.
  • Which Bluetooth module is used and how does it communicate?
    The HC-05 Bluetooth module is used and communicates with the microcontroller via UART at 115200 baud.
  • How is the TFT backlight brightness controlled?
    A PWM signal from the microcontroller drives a BJT to supply current to the backlight; duty cycle sets brightness.
  • How are images displayed from the SD card?
    Images on the SD card are BMPs on a FAT32 filesystem and are transferred using SD SPI libraries to the microcontroller, then written to the TFT.
  • What SPI modification was made for the display?
    A 9-bit/3-bit SPI protocol was implemented by bit-banging a D/C bit before each 8-bit SPI transaction to save microcontroller pins.
  • How is timekeeping implemented accurately?
    A 32kHz MEMS oscillator feeds the microcontroller secondary oscillator and the RTCC module to improve accuracy versus the internal RC oscillator.
  • What software architecture manages the apps?
    The software is structured as a finite state machine using protothreads to schedule processes for each state.
  • How does the watch save power on the home screen?
    The screen turns off after 10 seconds of inactivity on the home screen; the watch wakes via a side button and timeouts are disabled once leaving home.
  • Can the Bluetooth trigger actions on a paired device?
    When the watch receives any character over Bluetooth it relays its current date and time to the paired device.

About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.