Introduction: DIY Digital Watch Project

About: Hello world;

Greetings and welcome back.

So here's something super simple: a DIY digital watch.

These days, smartwatches are more popular than ever. There are many different types of watches available, with different features inside, like an ARM CPU or a multitude of electronics seen in Apple watches.

With no additional functionality or smart features, this straightforward DIY watch project uses the XIAO ESP32C3 microcontroller coupled with an XIAO expansion board. The onboard 0.96-inch OLED displays the current time, and the RTC module keeps track of it after the device is turned off.

To power the expansion board, we are using a tiny 3.7V, 100mAh LiPo cell. This project is made using an OLED Casio watch body that we repurposed, along with a few 3D printed holders. Since this article will cover the project's entire assembly process, let us get started.

Step 1: XIAO Expansion Board With XIAO ESP32C3

An XIAO ESP32C3 microcontroller and an XIAO extension board manufactured by Seeed Studio comprised the heart of this project.

It comes with rich peripherals that include an OLED, RTC, SD Card Sot, passive buzzer, reset/user button, 5V servo connector, and Grove connector for pairing multiple Grove devices with XIAO.

We can power the entire setup using any Li-ion or LiPo cell thanks to its integrated Li-ion charging circuit.

If you would like to get one for yourself, here is the link to its page.

https://www.seeedstudio.com/Seeeduino-XIAO-Expansion-board-p-4746.html

The RTC, the battery input section, and the OLED display are the three components we employ in total on the expansion board.

The OLED and RTC are connected to the XIAO's i2c pins, allowing us to control them directly without requiring additional connections.

Adafruit's SSD1306 library can be used with the OLED screen, but you can also use the u8g2 library.

You can check out Seeed Studio's brief product introduction for the expansion board, which includes a ton of information, by clicking the link below.

https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/

Visit Seeed Studio to get a wide range of services, including 3D printing, PCB/PCBA, and microcontroller/module services.

Step 2: DESIGN

Initially, we had the idea of reviving an outdated CASIO vintage watch frame that I had with the XIAO expansion board.

The expansion board contains the display, microcontroller, RTC and even the battery, so we prepared a rectangular holder that will be fixed to the existing watch frame and will house the expansion board and battery.

Two sections of the expansion board holder were modeled. The battery was positioned between the expansion board and the top body, and the top portion essentially served as a holder that the expansion board was screwed onto.

On the bottom side, there's another part that is added from the internal side of the watch frame; this part is screwed on the bottom side of the top part through two M2 screws and holds the watch frame.

After finalizing the model, we 3D printed both parts with white PLA through a 0.4-mm nozzle and 20% infill.

Step 3: Assembly Process

The holder part is added from the bottom side of the frame after the top part has been assembled onto the watch frame. Two M2 screws are used to secure everything in place.

Step 4: Assembly Process: Final

  • Next, we connected the JST connector of the expansion board to the JST connector of the LiPo cell.
  • Next, we insert the battery into the top part and secure the expansion board in its proper position.
  • Next, by using four m2 screws, we secure the expansion board on the top part.
  • Assembly is now complete; all that is left to do is add code to the XIAO Board and test-run the project.

Step 5: CODE

Here's the code used in this project.

#include <PCF8563.h>
PCF8563 pcf;

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);

void setup() {
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);

pcf.init();//initialize the clock
pcf.stopClock();//stop the clock
//set time to to 31/3/2018 17:33:0

pcf.setYear(24);//set year
pcf.setMonth(2);//set month
pcf.setDay(19);//set dat
pcf.setHour(18);//set hour
pcf.setMinut(50);//set minut
pcf.setSecond(0);//set second

pcf.startClock();//start the clock
display.clearDisplay();
Serial.begin(9600);
}


void loop() {

Time nowTime = pcf.getTime();

display.setTextSize(1); //DAY
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println(nowTime.day);

display.setTextSize(1); //Dash
display.setTextColor(WHITE);
display.setCursor(13, 0);
display.println("/");

display.setTextSize(1); //Month
display.setTextColor(WHITE);
display.setCursor(20, 0);
display.println(nowTime.month);

display.setTextSize(1); //Dash
display.setTextColor(WHITE);
display.setCursor(27, 0);
display.println("/");

display.setTextSize(1); //YEAR
display.setTextColor(WHITE);
display.setCursor(34, 0);
display.println(nowTime.year);


display.setTextSize(2); //hour
display.setTextColor(WHITE);
display.setCursor(0, 15);
display.println(nowTime.hour);

display.setTextSize(2); //Dash
display.setTextColor(WHITE);
display.setCursor(27, 15);
display.println("-");

display.setTextSize(2); //minute
display.setTextColor(WHITE);
display.setCursor(40, 15);
display.println(nowTime.minute);

display.setTextSize(2); //Dash
display.setTextColor(WHITE);
display.setCursor(65, 15);
display.println("-");

display.setTextSize(3); //Second
display.setTextColor(WHITE);
display.setCursor(80, 15);
display.println(nowTime.second);


display.display();
display.clearDisplay();

delay(1000);
}


This sketch essentially creates a real-time clock using the PCF8563 RTC and displays the date and time on a 128x64 OLED display

Step 6: Result

Here's the end result of this super-small build: a digital wrist watch.

The XIAO expansion board serves as a functional clock module in this useful and functional watch. The inbuilt buzzer can be used as an alarm indicator, should we introduce an alarm feature to this watch in the future.

We also needed to install a CR1220 lithium cell on the cell hold provided on the bottom side of the expansion board in order to use the RTC.

Thanks to Seeed Studio for supporting this project.

You guys can check them out if you need great PCB and stencil service for less cost and great quality.

And I'll be back with a new project pretty soon!