
Mysterium pcb
coseyfannitutti/mysterium
TKL keyboard that can be entirely assembled using only through hole components, including usb type-c

GROUP8
ATmega32 Clock is an open-source printed circuit board by chikotaraufu-netizen, from the chikotaraufu-netizen/ATmega32_Timer_Digital_Clock_Scheduler- repository on GitHub. It is a 2-layer board of 80 × 60 mm with 20 parts on 39 nets, routed with 96 tracks and 0 vias.
It is built around the ATMEGA32A-PU. Its parts include 6 resistors, 5 capacitors, 4 switches, 2 diodes and 1 IC. It belongs with the lEDs and displays boards and the AVR (ATmega, ATtiny) boards of this library.
A precision digital clock and cooperative task scheduler built on the ATmega32 microcontroller, leveraging Timer1 in CTC mode for accurate 1Hz timekeeping with USART-based HH:MM:SS display and multi-task LED scheduling.
This project implements a real-time digital clock and cooperative task scheduler on the ATmega32 microcontroller running at 8 MHz with an external crystal oscillator. The system uses Timer1 in CTC (Clear Timer on Compare Match) mode with a prescaler of 1024 and an OCR1A value of 7812 to generate a precise 1 Hz interrupt—the heartbeat of the entire system.
The clock displays time in HH:MM:SS format via the USART interface at 9600 baud, while the task scheduler manages two LED tasks using a non-blocking, ISR-flag-driven architecture:
Three hardware buttons provide user interaction for time setting, field incrementing, and clock reset—all with internal pull-up resistors and active-low logic.
| Feature | Description |
|---|---|
| Precision Timekeeping | Timer1 CTC mode with 1024 prescaler generates accurate 1Hz tick |
| USART Display | Real-time HH:MM:SS output at 9600 baud (8N1) |
| Task Scheduler | Cooperative, flag-based scheduler with configurable task intervals |
| Status LED | Heartbeat indicator toggling every 2 seconds |
| Task LED | Periodic flash every 5 seconds for task activity indication |
| Time Set Mode | Cycle through HH → MM → SS fields with SET button |
| Increment Function | Increment the currently selected time field |
| Clock Reset | Instantly reset time to 00:00:00 |
| Non-Blocking Design | ISR sets flags only; all processing happens in the main loop |
| Low Power | Efficient design suitable for battery-powered operation |
The system follows a flag-based cooperative scheduling architecture where the Timer1 ISR sets scheduler flags, and the main loop polls and services those flags. This ensures deterministic behavior with minimal interrupt latency.
graph TB
subgraph Hardware["🔧 Hardware Layer"]
XTAL["8 MHz Crystal<br/>Oscillator"]
MCU["ATmega32<br/>Microcontroller"]
BTNS["Buttons<br/>SET | INC | RESET"]
LEDS["LEDs<br/>Status | Task"]
UART["USART<br/>TX/RX"]
end
subgraph Firmware["💻 Firmware Layer"]
TIMER["Timer1 ISR<br/>CTC @ 1Hz"]
SCHED["Task Scheduler<br/>Flag Polling"]
CLOCK["Clock Module<br/>HH:MM:SS"]
BTNDRV["Button Driver<br/>Debounce + Read"]
LEDDRV["LED Driver<br/>Toggle/Flash"]
UARTDRV["USART Driver<br/>9600 8N1"]
end
XTAL --> MCU
MCU --> TIMER
TIMER -->|"tick_flag"| SCHED
SCHED --> CLOCK
SCHED --> LEDDRV
BTNS --> BTNDRV| Component | Specification | Quantity |
|---|---|---|
| ATmega32 Microcontroller | PDIP-40 package (U1) | 1 |
| Crystal Oscillator | 8 MHz, HC49-U Vertical (Y1) | 1 |
| Load Capacitors | 22 pF ceramic (C3, C4) | 2 |
| Decoupling Capacitors | 100 nF ceramic (C1 VCC, C2 AVCC, C5 AREF) | 3 |
| LEDs | 5mm, any color (D1 Task, D2 Status) | 2 |
| LED Current Limiting Resistors | 220Ω, ¼W (R3, R5) | 2 |
| Button Pull-up Resistors | 10 kΩ (R1 Reset, R2 SET, R4 INC, R6 RESET_CLK) | 4 |
| Tactile Push Buttons | 6mm, normally open (SW1 Reset, SW2 SET, SW3 INC, SW4 CLOCK_RESET) | 4 |
| USART Connector | 1×3 pin header 2.54mm (J1: GND, TXD, RXD) | 1 |
| USB-to-UART Adapter | FTDI/CH340/CP2102 (3.3V/5V) | 1 |
| Breadboard or PCB | Standard breadboard or custom PCB | 1 |
| Power Supply | 5V DC regulated | 1 |
| Jumper Wires | Male-to-male, assorted | As needed |
+----[VCC 5V]----+
| |
[10kΩ]R1 [100nF]C1 (VCC decoupling)
| |
+----[SW1]----+---[RESET]------+---[GND]
|
+-----+-----+
| ATmega32 |
| |
| PA0 (40)---+---[10kΩ R2]---[VCC] [SW2 SET]---[GND]
| PA1 (39)---+---[10kΩ R4]---[VCC] [SW3 INC]---[GND]
| PA2 (38)---+---[10kΩ R6]---[VCC] [SW4 RST]---[GND]
| |
| PB0 (1)----+---[220Ω R5]---[LED D2 STATUS]---[GND]
| PB1 (2)----+---[220Ω R3]---[LED D1 TASK]-----[GND]
| |
| PD0 (14)---+---[J1 Pin3 RXD]
| PD1 (15)---+---[J1 Pin2 TXD] J1 Pin1 = GND
| |
| XTAL1(13)--+---[8MHz Y1]---+---[22pF C3]---[GND]
| XTAL2(12)--+---[8MHz Y1]---+---[22pF C4]---[GND]
| |
| VCC (10)---+---[5V] [100nF C1]---[GND]
| GND (11)---+---[GND]| Tool | Version | Purpose |
|---|---|---|
| AVR-GCC | ≥ 5.4.0 | C compiler for AVR targets |
| AVR Libc | ≥ 2.0.0 | Standard C library for AVR |
| AVRDUDE | ≥ 6.3 | Flash programmer utility |
| GNU Make | ≥ 4.0 | Build automation |
| Serial Terminal | PuTTY / minicom / screen | USART output viewing |
sudo apt-get update
sudo apt-get install gcc-avr avr-libc avrdude makebrew tap osx-cross/avr
brew install avr-gcc avrdudeDownload and install WinAVR or use the Microchip AVR Toolchain.
| Pin # | Port/Pin | Function | Direction | Configuration | Description |
|---|---|---|---|---|---|
| 40 | PA0 | SET_BTN | Input | External 10kΩ Pull-up (R2) | Enter time-set mode / cycle fields |
| 39 | PA1 | INC_BTN | Input | External 10kΩ Pull-up (R4) | Increment selected time field |
| 38 | PA2 | CLOCK_RESET | Input | External 10kΩ Pull-up (R6) | Reset clock to 00:00:00 |
| 1 | PB0 | LED_STATUS | Output | Active High, 220Ω (R5) | Status heartbeat LED (2s toggle) |
| 2 | PB1 | LED_TASK | Output | Active High, 220Ω (R3) | Task indicator LED (5s flash) |
| 9 | ~RESET | RESET | Input | External 10kΩ Pull-up (R1) | Hardware reset (SW1) |
| 10 | VCC | Power | — | +5V DC | Digital supply voltage |
| 11 | GND | Ground | — | 0V | Digital ground |
| 12 | XTAL2 | Crystal | — | 8 MHz + 22pF cap | Crystal oscillator output |
| 13 | XTAL1 | Crystal | — | 8 MHz + 22pF cap | Crystal oscillator input |
| 14 | PD0 | USART_RXD | Input | — | USART Receive Data |
| 15 | PD1 | USART_TXD | Output | — | USART Transmit Data |
| 30 | AVCC | Analog VCC | — | +5V DC | Analog supply voltage |
| 31 | AGND | Analog GND | — | 0V | Analog ground |
📖 For the complete 40-pin mapping, see documentation/pin_mapping_table.md
git clone https://github.com/yourusername/atmega32-digital-clock.git
cd atmega32-digital-clockVerify the following settings in Makefile:
MCU = atmega32
F_CPU = 8000000UL
PROGRAMMER = usbasp
PORT = usb
BAUD = 9600make allThis will produce main.hex in the build directory.
Configure the ATmega32 for an external 8 MHz crystal:
# Low Fuse: 0xFF (External Crystal, full swing, 16K CK + 64ms startup)
# High Fuse: 0xD9 (JTAG disabled, EEPROM preserved, Boot size 256 words)
avrdude -c usbasp -p m32 -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m⚠️ Warning: Incorrect fuse settings can brick your microcontroller. Double-check values before programming.
make flash
# or manually:
avrdude -c usbasp -p m32 -U flash:w:main.hex:i# Linux
minicom -D /dev/ttyUSB0 -b 9600
# macOS
screen /dev/cu.usbserial-XXXX 9600
# Windows
# Use PuTTY with COM port at 9600 baud, 8N1After programming and connecting the serial terminal, you should see:
=====================================
ATmega32 Digital Clock v1.0
Timer1 CTC Mode | 8MHz Crystal
=====================================
TIME: 00:00:00
[500ms Tick] Ext Task
TIME: 00:00:01
[500ms Tick] Ext Task
TIME: 00:00:02
[500ms Tick] Ext Task
TIME: 00:00:03
[500ms Tick] Ext Task
TIME: 00:00:04
[500ms Tick] Ext Task
TIME: 00:00:05
TASK: SENSOR SAMPLE
[500ms Tick] Ext Task
...Upon power-up, the clock starts at 00:00:00 and counts up. Time is displayed on the serial terminal every second.
| Button | Action | Behavior |
|---|---|---|
| SET (PA0) | Press | Enters time-set mode. Successive presses cycle: Hours → Minutes → Seconds → Exit |
| INCREMENT (PA1) | Press | Increments the currently selected field (wraps: 23→0 for hours, 59→0 for min/sec) |
| RESET (PA2) | Press | Immediately resets the clock to 00:00:00 |
| LED | Port | Behavior |
|---|---|---|
| Status LED | PB0 | Toggles ON/OFF every 2 seconds — heartbeat indicator |
| Task LED | PB1 | Brief flash every 5 seconds — scheduled task indicator |
atmega32-digital-clock/
│
├── README.md # This file
├── LICENSE # MIT License
│
├── firmware/ # Firmware source and hex
│ ├── src/ # C Source files
│ │ ├── main.c # Main application entry
│ │ ├── timer.c # Timer config and ISR
│ │ ├── display.c # USART output logic
│ │ ├── scheduler.c # Non-blocking scheduler
│ │ └── buttons.c # Button debounce logic
│ ├── include/ # Header files
│ │ ├── config.h # Pin definitions & constants
│ │ ├── timer.h
│ │ ├── display.h
│ │ ├── scheduler.h
│ │ └── buttons.h
│ ├── hex/
│ │ └── main.hex # Compiled firmware binary
│ └── Makefile # Build configuration
│
├── documentation/ # Project documentation
│ ├── timer_configuration.md # Timer1 CTC mode setup

Detailed documentation is available in the documentation/ directory:
| Document | Description |
|---|---|
| Timer Configuration | Detailed Timer1 CTC mode setup and register configuration |
| Compare Match Calculation | Step-by-step OCR1A value derivation with accuracy analysis |
| Pin Mapping Table | Complete ATmega32 PDIP-40 pin assignment reference |
| Test Results | Test plan, test cases, and verification results |
| Block Diagram | System architecture block diagram (Mermaid) |
| Flowchart | Program flow and ISR logic flowchart (Mermaid) |
This project is licensed under the MIT License.
MIT License
Copyright (c) 2026 ATmega32 Digital Clock Project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Built with ❤️ for embedded systems enthusiasts
ATmega32 · Timer1 CTC · USART · Cooperative Scheduling
| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | 10k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R1, R2, R4, R6 |
| 4 | SW_Push | Button_Switch_THT:SW_PUSH_6mm | SW1, SW2, SW3, SW4 |
| 3 | 100nF | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | C1, C2, C5 |
| 2 | 220 | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R3, R5 |
| 2 | 22pF | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | C3, C4 |
| 2 | LED | LED_THT:LED_D5.0mm | D1, D2 |
| 1 | 8MHz | Crystal:Crystal_HC49-U_Vertical | Y1 |
| 1 | ATmega32A-P | Package_DIP:DIP-40_W15.24mm | U1 |
| 1 | Conn_01x03_Pin | Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_Vertical | J1 |

coseyfannitutti/mysterium
TKL keyboard that can be entirely assembled using only through hole components, including usb type-c




null-ll/basketweave
Through-hole Alice-style keyboard with arrow keys and a rotary encoder


lyso1/LCK75
a 75% through-hole keyboard designed by myself with inspiration from the CFTKB Discipline and Yiancar Gingham

dsanchezseco/punk75
Ortholinear keyboard with 75 keys and all components through hole
It measures 80 × 60 mm and has 2 copper layers, 1.6 mm thick.
20 parts, built around the ATMEGA32A-PU. 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.
From the chikotaraufu-netizen/ATmega32_Timer_Digital_Clock_Scheduler- repository on GitHub, at the commit this page was made from: the board is kicad/pcb/ATmega32_Clock.kicad_pcb and its schematic kicad/schematic/ATmega32_Clock.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask chikotaraufu-netizen before reusing the design.