Skip to the content
PCBKitNew board
2 layers101.6 × 53.3 mmMega shield, the printed circuit board in 3D

This project is a bare-metal implementation of a smartwatch using an AVR microcontroller (ATmega2560). The smartwatch is designed to operate at a low level, utilizing direct register manipulation and avoiding high-level…

Size
101.6 × 53.3 mm
Copper layers
2
Thickness
1.6 mm
Parts
34
Nets
87
Pads
158
Tracks, vias
0, 0
Routed
Not yet
KiCad
KiCad 9.0 (file 20241229)
Created
10 Oct 2025
Updated
13 Nov 2025

Overview

Mega shield is an open-source printed circuit board by devcristi, from the devcristi/smartwatch repository on GitHub. It is a 2-layer board of 101.6 × 53.3 mm with 34 parts on 87 nets.

It is built around the BME280 and DS3231MZ+. Its parts include 7 capacitors, 7 resistors, 7 connectors, 4 switches and 2 ICs.

Main components

2

README

README.md

Bare Metal STM-32 Nucleo Based SmartWatch# Bare Metal STM-32 Nucleo Based SmartWatch

Project Overview## Project Overview

This project is a bare-metal implementation of a smartwatch using an AVR microcontroller (ATmega2560). The smartwatch is designed to operate at a low level, utilizing direct register manipulation and avoiding high-level abstractions. The entire project is written in C with modular architecture.This project is a bare-metal implementation of a smartwatch using the STM-32 Nucleo development board. The smartwatch is designed to operate at a low level, utilizing direct register manipulation and avoiding high-level abstractions. The project is written entirely in C.

Features## Features

  • Real-Time Clock (RTC): DS3231 module for precise timekeeping with I2C interface- Real-Time Clock (RTC): DS3231 module for precise timekeeping.

  • LCD Display: GC9A01 compatible 16x2 LCD via I2C- Motion Sensing: MPU6050 sensor for accelerometer and gyroscope data.

  • Menu Navigation: 3-mode menu system (Time, Temperature, Stopwatch)- Heart Rate and SpO2 Monitoring: MAX30102 sensor for health monitoring.

  • Stopwatch Functionality: Start/Pause and Reset operations with centisecond precision- Environmental Sensing: BME280 sensor for temperature, humidity, and pressure measurements.

  • Temperature Monitoring: Real-time temperature reading from DS3231 sensor- Battery Management: TP4056 module for battery charging and monitoring.

  • Button Control: Three interrupt-driven buttons for navigation and control- Display: GC9A01 round LCD for user interface.

  • Timer-Based Scheduling: TIMER1 for precise timing and interrupt handling

Development Approach

Hardware Components- Bare-Metal Programming: The project is implemented without an operating system, focusing on low-level programming.

  1. ATmega2560 Microcontroller: Core processor- Direct Register Access: All peripherals are controlled through direct register manipulation, ensuring maximum control and efficiency.

  2. DS3231 RTC Module: Real-time clock and temperature sensor (I2C @ 0x68)- Low-Level Drivers: Custom drivers are developed for each module to interface with the STM-32 microcontroller.

  3. LCD 16x2 Module: Display with I2C backpack (I2C @ 0x27)

  4. Push Buttons: ## Hardware Components

    • Button NEXT (PE4, INT4): Navigate menu forward1. STM-32 Nucleo Board: The core microcontroller platform.

    • Button PREV (PE5, INT5): Navigate menu backward 2. DS3231 RTC Module: Provides accurate timekeeping.

    • Button ACTION (PD2, INT2): Start/Pause/Reset stopwatch3. MPU6050 Sensor: Measures motion and orientation.

  5. MAX30102 Sensor: Monitors heart rate and SpO2 levels.

Project Structure5. BME280 Sensor: Captures environmental data such as temperature, humidity, and pressure.

6.

smartwatch/7. **GC9A01 LCD**: Displays smartwatch data and user interface.

├── Core/

│   ├── Inc/                    # Header files## Goals

│   │   ├── main.h              # Main application header- Develop a fully functional smartwatch with essential features.

│   │   ├── i2c.h               # I2C/TWI interface- Implement all functionalities using bare-metal programming techniques.

│   │   ├── buttons.h           # Button handling- Optimize performance and power consumption through efficient low-level coding.

│   │   ├── timer.h             # Timer interrupt handling

│   │   └── stopwatch.h         # Stopwatch interface## Future Enhancements

│   └── Src/                    # Source files- Add additional sensors or modules for extended functionality.

│       ├── main.c              # Main application logic- Implement power-saving modes to extend battery life.

│       ├── i2c.c               # I2C driver implementation- Enhance the user interface with advanced graphics.

│       ├── buttons.c           # Button ISR and handling

Development Approach

  • Bare-Metal Programming: No OS, direct hardware register access
  • Direct Register Manipulation: Full control over microcontroller peripherals
  • Modular Architecture: Separated concerns for easy maintenance and extension
  • ISR-Driven: Interrupt Service Routines for button inputs and timing
  • I2C Communication: Two-wire interface for RTC and LCD modules

Functional Modes

Mode 1: TIME Display

  • Shows current time from DS3231 RTC
  • Format: HH:MM:SS
  • Hold PREV button (>1s) to reset clock to 00:00:00

Mode 2: TEMPERATURE Display

  • Shows current temperature from DS3231 sensor
  • Format: XX.XX°C (with 0.25°C precision)

Mode 3: STOPWATCH

  • Start/Pause: Short press of ACTION button
  • Reset: Long press (>1s) of ACTION button
  • Format: MM:SS:CS (minutes:seconds:centiseconds)

Building the Project

Prerequisites

  • ARM GCC compiler for AVR (avr-gcc)
  • avrdude for flashing
  • Make (optional, for automated builds)

Compilation

bash
avr-gcc -mmcu=atmega2560 -DF_CPU=16000000UL -O2 \
  Core/Src/*.c Drivers/Custom/Src/*.c \
  -o smartwatch.elf

avr-objcopy -O ihex smartwatch.elf smartwatch.hex

Flashing

bash
avrdude -p m2560 -c stk500v2 -P COM3 -b 115200 -U flash:w:smartwatch.hex:i

Pin Configuration

FunctionPinAVR PortInterrupt
Button NEXTPE4PORTE4INT4
Button PREVPE5PORTE5INT5
Button ACTIONPD2PORTD2INT2
I2C SDAPD1PORTD1-
I2C SCLPD0PORTD0-

I2C Configuration

  • Speed: 100 kHz (TWBR = 72)
  • Devices:
    • DS3231 RTC: Address 0x68
    • LCD Module: Address 0x27

Timer Configuration

  • Timer1: 16-bit CTC mode
  • Prescaler: 256 (CS12 = 1)
  • Compare Register: 624 (generates 10ms interrupt at 16MHz)
  • Frequency: 100 Hz system ticks

Interrupt Service Routines

  1. INT4_vect: NEXT button handler
  2. INT5_vect: PREV button handler
  3. INT2_vect: ACTION button handler
  4. TIMER1_COMPA_vect: Timer compare interrupt for timing

Key Features Implementation

Debouncing

  • 50ms software debounce on button presses
  • Prevents false triggers from mechanical contact bounce

Time Management

  • System ticks every 10ms (from TIMER1)
  • Stopwatch counts in 10ms increments
  • Button press timing for long-press detection

I2C Communication

  • Blocking I2C transfers (appropriate for low-speed communication)
  • Standard START/STOP conditions
  • ACK/NACK handling for multi-byte reads

Future Enhancements

  • Add additional sensors (accelerometer MPU6050, heart rate MAX30102)
  • Implement BME280 environmental sensor
  • Add TP4056 battery charging management
  • Power management and sleep modes
  • More sophisticated menu system with settings
  • Data logging capabilities

Troubleshooting

LCD Not Displaying

  1. Check I2C address (0x27) with I2C scanner
  2. Verify pull-up resistors on SDA/SCL lines
  3. Check contrast adjustment on LCD module

RTC Time Not Updating

  1. Verify DS3231 I2C address (0x68)
  2. Check if coin cell battery is installed
  3. Ensure I2C communication is working

Buttons Not Responding

  1. Check pin configuration matches header defines
  2. Verify pull-up resistors are present
  3. Test with multimeter for continuity

License

This project is open-source and available under the MIT License.

Author

devcristi - Embedded Systems Development

References

  • AVR ATmega2560 Datasheet
  • DS3231 RTC Datasheet
  • I2C/TWI Communication Protocol

Parts

34
QtyValueFootprintReferences
7100nFCapacitor_SMD:C_0805_2012MetricC1, C2, C3, C4, C5, C6, C7
6MountingHole_3.2mmArduino_MountingHole:MountingHole_3.2mmMH1, MH2, MH3, MH4, MH5, MH6
410kResistor_SMD:R_0805_2012MetricR3, R4, R5, R6
24.7kResistor_SMD:R_0805_2012MetricR1, R2
2AnalogConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ3, J5
1100Resistor_SMD:R_0805_2012MetricR7
1BME280Connector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalU2
1BTN_BACKButton_Switch_THT:SW_PUSH_6mmSW4
1BTN_DOWNButton_Switch_THT:SW_PUSH_6mmSW2
1BTN_SELECTButton_Switch_THT:SW_PUSH_6mmSW3
1BTN_UPButton_Switch_THT:SW_PUSH_6mmSW1
1BuzzerBuzzer_Beeper:Buzzer_12x9.5RM7.6BZ1
1CommunicationConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ6
1DS3231MPackage_SO:SOIC-16W_7.5x10.3mm_P1.27mmU1
1DigitalConnector_PinSocket_2.54mm:PinSocket_2x18_P2.54mm_VerticalJ7
1PWMConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ4
1PWMConnector_PinSocket_2.54mm:PinSocket_1x10_P2.54mm_VerticalJ2
1PowerConnector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_VerticalJ1

Questions

How big is the Mega shield PCB?

It measures 101.6 × 53.3 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Mega shield use?

34 parts, built around the BME280 and DS3231MZ+. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Mega shield KiCad files?

From the devcristi/smartwatch repository on GitHub, at the commit this page was made from: the board is mega_shield/mega_shield.kicad_pcb and its schematic mega_shield.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Mega shield design in my own project?

Its repository states no licence, so its author keeps all rights: ask devcristi before reusing the design.

Similar boards

  • 2 layers61 × 61 mmJuwei17onstep bck, the printed circuit board in 3D

    Juwei17onstep bck

    xlazam01/Juwei17

    Upgrade of Juwei17 Astronomy Mount

    145 parts9MIT
  • 2 layersUnplugged, the printed circuit board in 3D

    Unplugged

    Kalash4152/smart-dustbin-round-two

    Designed and simulated a Smart Dustbin & Smart Traffic Lights system using Arduino, ESP32, and sensors at DJSCE Unplugged 2.0.

    24 parts1
  • 4 layers76 × 64 mmEWP Control, the printed circuit board in 3D

    EWP Control

    haum2002/EWP-Control

    SmartCoolingv2.1 menggabungkan firmware SmartCooling dengan reka bentuk EWP Controller ini. RP2350B kekal sebagai pengawal keselamatan dan actuator kritikal, manakala ESP32-S3 mengurus UI, Wi-Fi, BLE, diagnostik dan…

    93 parts
  • 4 layers72.9 × 62.9 mmIEQ Monitor, the printed circuit board in 3D

    IEQ Monitor

    lalithk06/PCB_Designs

    This repository contains various PCB design projects made using KiCad

    88 parts
  • 2 layers87.2 × 71.3 mmSensorBox, the printed circuit board in 3D

    SensorBox

    Lelk0e/DA_Sensorbox

    Diplomarbeit 2024-2025 mit der Firma B2 electronics. Das Ziel ist es eine Sensorbox mit dem ESP32, als Basis zu entwickeln. Diese Sensorbox soll über ein Mesh-Netzwerk erweiterbar werden.

    82 parts
  • 2 layers217.3 × 127.3 mmPCB ApiaryWaterDispensingSystem, the printed circuit board in 3D

    PCB ApiaryWaterDispensingSystem

    Mateuszworo97/Projects

    Apiary Water Dispensing System — This is a device design whose purpose is to automatically supply bee water from an underground tank. In hard-to-reach places and with limited access to fresh water.

    255 parts
  • 2 layers51 × 87.2 mmSTM32 NRF24L01 Sleep mode, the printed circuit board in 3D

    STM32 NRF24L01 Sleep mode

    OlegDemk/stm32F401CCU_NTF24L01_RX_TX_Sleep

    The project base on STM32F401CCU microcontroller and NRF24L01 radio module. Project was create on STM32 Cube IDE.

    73 parts
  • 4 layers84.6 × 91 mmDatalogger, the printed circuit board in 3D

    Datalogger

    PriyaUdhayakumar/ESP32-Environmental-Monitoring-Data-Logger

    ESP32-based environmental monitoring data logger using BME280, DS3231 RTC, microSD card, ESP-IDF and FreeRTOS.

    49 parts