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

A PWM-based DC motor speed control system built with the ATmega32 microcontroller. The system uses Timer0 (OC0/PB3) to generate a PWM signal that drives a DC motor through an N-channel MOSFET, with push-button speed…
PWM motor speed controller is an open-source printed circuit board by daviddavid4real, from the daviddavid4real/ATmega32_PWM_DC_Motor_Control-main repository on GitHub. It is a 2-layer board of 100.5 × 80 mm with 19 parts on 44 nets, routed with 117 tracks and 0 vias.
It is built around the ATMEGA32A-PU. Its parts include 5 resistors, 4 diodes, 4 switches, 2 capacitors and 1 IC. It belongs with the robots and motor control boards and the AVR (ATmega, ATtiny) boards of this library.
A PWM-based DC motor speed control system built with the ATmega32 microcontroller. The system uses Timer0 (OC0/PB3) to generate a PWM signal that drives a DC motor through an N-channel MOSFET, with push-button speed control and LED speed-level indicators.
This project demonstrates pulse-width modulation (PWM) as a method of controlling the average power delivered to a DC motor. Instead of simply switching the motor ON/OFF, the ATmega32 generates a variable-duty-cycle square wave that adjusts motor speed smoothly across five discrete levels (0%, 25%, 50%, 75%, 100%).
| Control | Function |
|---|---|
| Increase button (PA0) | Raises PWM duty cycle by one level |
| Decrease button (PA1) | Lowers PWM duty cycle by one level |
| Stop button (PA2) | Immediately sets duty cycle to 0% |
| LEDs (PB0–PB2) | Indicate current speed level |
| PWM output (PB3 / OC0) | Drives the motor via MOSFET switching |
[Push Buttons] --> [ATmega32: Timer0 PWM] --> [Gate Resistor] --> [MOSFET] --> [DC Motor]
| |
[LED Indicators] [Flyback Diode]| Component | Designator | Purpose |
|---|---|---|
| ATmega32-P | U1 | Main controller and PWM generator |
| DC Motor | M1 | Controlled actuator |
| N-Channel MOSFET | Q1 | Motor driver (low-side switch) |
| 1N4007 Diode | D4 | Flyback / back-EMF protection |
| Push buttons | SW1–SW4 | Increase, decrease, stop, reset |
| LEDs | D1–D3 | Speed-level indication |
| 8 MHz Crystal | Y1 | External clock source |
| 220 ohm resistor | R2 | MOSFET gate current limiting |
| 330 ohm resistors | R3–R5 | LED current limiting |
| 10 kohm resistor | R1 | Reset pull-up |
Full pin assignments are documented in documentation/pin_mapping_table.md.
The ATmega32's Timer0 is configured in Fast PWM mode, outputting on PB3 (OC0). The duty cycle is controlled by the OCR0 register:
D ≈ (OCR0 / 255) x 100%Pressing the increase or decrease button changes OCR0 in steps, moving the motor between five predefined speed levels. Full calculations are in documentation/duty_cycle_calculation.md, and the timer/register configuration is explained in documentation/pwm_configuration.md.
ATmega32_PWM_DC_Motor_Control/
│
├── README.md
│
├── firmware/
│ ├── src/ # Firmware source code (.c)
│ ├── include/ # Header files (.h)
│ └── hex/ # Compiled .hex output
│
├── kicad/
│ ├── schematic/ # KiCad schematic files
│ ├── pcb/ # KiCad PCB layout files
│ └── gerber/ # Generated Gerber fabrication files
│
├── simulide/
│ ├── circuit/ # SimulIDE circuit file (.sim1)
│ └── screenshots/ # Simulation screenshots
│
├── documentation/
│ ├── block_diagram.png
│ ├── flowchart.png
│ ├── pwm_configuration.md
│ ├── duty_cycle_calculation.md
│ ├── pin_mapping_table.md| Tool | Purpose |
|---|---|
| KiCad | Schematic design and PCB layout |
| MPLAB for VS Code | Firmware development (C) |
| SimulIDE | Circuit simulation and PWM verification |
| Git / GitHub | Version control and submission |
main()
{
initialize_gpio();
initialize_pwm();
while(1)
{
read_buttons();
update_duty_cycle();
update_speed_indicators();
}
}Source code is available in firmware/src/, and the compiled .hex file used for both hardware programming and SimulIDE simulation is in firmware/hex/.
The circuit was simulated in SimulIDE before PCB fabrication to verify PWM generation, button response, LED indication, and motor behavior. An oscilloscope probe on PB3 confirmed the PWM waveform changed correctly across all five speed levels. Full results are documented in documentation/test_results.md.
| Stage | Status |
|---|---|
| Schematic design (KiCad) | Complete |
| PCB layout (KiCad) | Complete |
| DRC / ERC checks | Complete |
| Firmware (PWM, buttons, LEDs) | Complete |
| SimulIDE simulation | Complete |
| Gerber file generation | Complete |
| Documentation | Complete |
A suggested next step for this project is closed-loop speed control using a rotary encoder, where the ATmega32 measures actual motor speed from encoder pulses and adjusts the PWM duty cycle automatically to maintain a target speed.
Student project for ATmega32 PWM-based DC Motor Speed Control assignment.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 4 | SW_Push | Button_Switch_THT:SW_PUSH_6mm | SW1, SW2, SW3, SW4 |
| 3 | 330 | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R3, R4, R5 |
| 3 | LED | LED_THT:LED_D5.0mm | D1, D2, D3 |
| 2 | 22pF | Capacitor_THT:C_Disc_D3.0mm_W1.6mm_P2.50mm | C1, C2 |
| 1 | 10k | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R1 |
| 1 | 1N4007 | Diode_THT:D_DO-41_SOD81_P10.16mm_Horizontal | D4 |
| 1 | 220 | Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_Horizontal | R2 |
| 1 | ATmega32A-P | Package_DIP:DIP-40_W15.24mm | U1 |
| 1 | Conn_01x02 | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | J1 |
| 1 | Motor_DC | Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical | M1 |
| 1 | Q_NMOS_GDS | Package_TO_SOT_THT:TO-92_Inline | Q1 |

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 100.5 × 80 mm and has 2 copper layers, 1 mm thick.
19 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 daviddavid4real/ATmega32_PWM_DC_Motor_Control-main repository on GitHub, at the commit this page was made from: the board is kicad/project/PWM_motor_speed_controller.kicad_pcb and its schematic kicad/project/PWM_motor_speed_controller.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 daviddavid4real before reusing the design.