-
1XIAO 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 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.
the Adafruit's SSD1306 library can be use 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.
-
2Design
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.
-
3Assembly 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
-
4Assembly 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.
-
5CODE
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
-
6RESULT
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.
Leave a comment if you need any help regarding this project. This is it for today, folks.
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!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.