

Mega shield
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
2BME280
LGA-8(2.5x2.5)-40℃~+85℃ 0%RH~100%RH 1.71V~3.6V 1.8uA 16bit I2C、SPI ±0.5℃ ±3%RH LGA-8(2.5x2.5) Temperature and Humidity Sensor ROHSBoschTemperature And Humidity SensorDS3231MZ+
SOIC-8-40℃~+85℃ 2.3V~5.5V I2C Temperature compensation、Backup power management and battery charging、Alarm function、Periodic interrupt output SOIC-8 Real Time Clocks ROHSMaxim Integrated (Analog Devices)Real Time Clocks
README
README.mdBare 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.
-
ATmega2560 Microcontroller: Core processor- Direct Register Access: All peripherals are controlled through direct register manipulation, ensuring maximum control and efficiency.
-
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.
-
LCD 16x2 Module: Display with I2C backpack (I2C @ 0x27)
-
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.
-
-
MAX30102 Sensor: Monitors heart rate and SpO2 levels.
Project Structure5. BME280 Sensor: Captures environmental data such as temperature, humidity, and pressure.
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
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.hexFlashing
avrdude -p m2560 -c stk500v2 -P COM3 -b 115200 -U flash:w:smartwatch.hex:iPin Configuration
| Function | Pin | AVR Port | Interrupt |
|---|---|---|---|
| Button NEXT | PE4 | PORTE4 | INT4 |
| Button PREV | PE5 | PORTE5 | INT5 |
| Button ACTION | PD2 | PORTD2 | INT2 |
| I2C SDA | PD1 | PORTD1 | - |
| I2C SCL | PD0 | PORTD0 | - |
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
- INT4_vect: NEXT button handler
- INT5_vect: PREV button handler
- INT2_vect: ACTION button handler
- 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
- Check I2C address (0x27) with I2C scanner
- Verify pull-up resistors on SDA/SCL lines
- Check contrast adjustment on LCD module
RTC Time Not Updating
- Verify DS3231 I2C address (0x68)
- Check if coin cell battery is installed
- Ensure I2C communication is working
Buttons Not Responding
- Check pin configuration matches header defines
- Verify pull-up resistors are present
- 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| Qty | Value | Footprint | References |
|---|---|---|---|
| 7 | 100nF | Capacitor_SMD:C_0805_2012Metric | C1, C2, C3, C4, C5, C6, C7 |
| 6 | MountingHole_3.2mm | Arduino_MountingHole:MountingHole_3.2mm | MH1, MH2, MH3, MH4, MH5, MH6 |
| 4 | 10k | Resistor_SMD:R_0805_2012Metric | R3, R4, R5, R6 |
| 2 | 4.7k | Resistor_SMD:R_0805_2012Metric | R1, R2 |
| 2 | Analog | Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_Vertical | J3, J5 |
| 1 | 100 | Resistor_SMD:R_0805_2012Metric | R7 |
| 1 | BME280 | Connector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_Vertical | U2 |
| 1 | BTN_BACK | Button_Switch_THT:SW_PUSH_6mm | SW4 |
| 1 | BTN_DOWN | Button_Switch_THT:SW_PUSH_6mm | SW2 |
| 1 | BTN_SELECT | Button_Switch_THT:SW_PUSH_6mm | SW3 |
| 1 | BTN_UP | Button_Switch_THT:SW_PUSH_6mm | SW1 |
| 1 | Buzzer | Buzzer_Beeper:Buzzer_12x9.5RM7.6 | BZ1 |
| 1 | Communication | Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_Vertical | J6 |
| 1 | DS3231M | Package_SO:SOIC-16W_7.5x10.3mm_P1.27mm | U1 |
| 1 | Digital | Connector_PinSocket_2.54mm:PinSocket_2x18_P2.54mm_Vertical | J7 |
| 1 | PWM | Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_Vertical | J4 |
| 1 | PWM | Connector_PinSocket_2.54mm:PinSocket_1x10_P2.54mm_Vertical | J2 |
| 1 | Power | Connector_PinSocket_2.54mm:PinSocket_1x08_P2.54mm_Vertical | J1 |
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 mm

- 2 layers

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 mm

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 mm

IEQ Monitor
lalithk06/PCB_Designs
This repository contains various PCB design projects made using KiCad
88 parts - 2 layers87.2 × 71.3 mm

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 mm

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 mm

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 mm

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