A custom-built, real-time smart clock running on the Raspberry Pi Pico W using FreeRTOS, written in C++. Developed by Jezreel Tan.
You can view the real-time data from this smart clock on ThingSpeak:
- 🕒 Overview
- 🔧 Features
- 📁 Project Structure
- 🚀 How It Works
- 🔨 Build Instructions
- 🔌 Flashing to Pico
- 📚 Dependencies
- 🔲 Block Diagram
- 📐 Schematic Diagram
- 📄 License
- 👤 Author
The Pico SmartClock is a lightweight embedded system designed for accurate real-time clock functionality on the Raspberry Pi Pico W. It is implemented with multithreading using **FreeRTOS** and includes modular support for I2C and PWM peripherals. This project showcases how a clean architecture can drive real-time behavior on a constrained embedded platform.
- Real-time clock control with modular system component architecture
- Dual-core execution using
multicore_launch_core1for RTOS tasks - FreeRTOS kernel integration with a custom CMake setup
- USB-based debugging with
stdio_usbenabled - Expandable component system via the
SystemComponentsclass
Pico_SmartClock/
├── Pico_SmartClock.cpp # Main application entry point
├── CMakeLists.txt # Build configuration using CMake
├── pico_sdk_import.cmake # Imports the Pico SDK
├── bin/
│ └── FreeRTOS-Kernel/ # FreeRTOS kernel files
├── setup.hpp # System configuration and class declarations
└── .git/ # Git repository metadata
Main Application Logic (simplified)
int main() {
stdio_init_all(); // Initialize standard IO
Smart_Clock.Initialize(); // Set up clock components
multicore_launch_core1(core1_rtos_process); // Launch RTOS on core 1
Smart_Clock.Run(); // Main loop
return 0;
}
void core1_rtos_process() {
Smart_Clock.RunRTOS(); // Execute RTOS tasks on the second core
}
- SystemComponents handles I2C, PWM, and other hardware control.
- SYSTEM_class instance (Smart_Clock) manages scheduling and operations.
- Easily extendable by attaching new peripheral objects via components list.
- Raspberry Pi Pico SDK
- CMake >= 3.13
- ARM GCC Toolchain (arm-none-eabi-gcc)
- Python 3 and Git
# Clone the repository
git clone https://github.com/yourusername/Pico_SmartClock.git
cd Pico_SmartClock
# Initialize submodules (for FreeRTOS etc.)
git submodule update --init --recursive
# Create build directory
mkdir build && cd build
# Run CMake configuration
cmake ..
# Compile the firmware
make
⚠️ Make sure PICO_SDK_PATH is correctly exported in your shell or set via CMake GUI.
- Press and hold the BOOTSEL button on your Pico.
- Connect it to your PC via USB.
- Drag and drop the generated .uf2 file (inside /build) to the RPI-RP2 drive.
- Raspberry Pi Pico SDK
- FreeRTOS Kernel
- Pico libraries for hardware_pwm, hardware_i2c, and pico_multicore
- Optional: pico_cyw43_arch_lwip_poll for WiFi support
MIT License.
Jezreel Tan 📧 jvt6@hi.is
This project was created for embedded systems exploration and real-time application demos on low-power microcontrollers.

