Skip to the content
4 layers65 × 30 mmATMEGA Power Circuit, the printed circuit board in 3D

ATMEGA Power Circuit

evan-loe/atmega-power-hat

And thats it! Your hat should be ready to use

Size
65 × 30 mm
Copper layers
4
Thickness
1.6 mm
Parts
40
Nets
63
Pads
178
Tracks, vias
261, 44
Pours
7
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
3 Oct 2025
Updated
1 Jun 2026

Overview

ATMEGA Power Circuit is an open-source printed circuit board by evan-loe, from the evan-loe/atmega-power-hat repository on GitHub. It is a 4-layer board of 65 × 30 mm with 40 parts on 63 nets, routed with 261 tracks and 44 vias.

It is built around the ATMEGA328P-AU, XC6206P332MR and DS3231SN#T&R, with the BSS138 and CR2032 among its other parts. Its parts include 11 resistors, 10 capacitors, 4 ICs, 3 diodes and 3 connectors. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

5

README

README.md

ATMEGA Power Hat docs

Introduction

The ATMEGA Power Hat is an RTC enabled Raspberry Pi compatible HAT (Hardware-Attached-on-Top) that can automatically wakeup and shutdown the pi on a given schedule.

Setup Instructions

Run configure_i2c_rtc.sh
  • Run configure_i2c_rtc.sh with sudo. This script configures the RTC on the hat as a device recognizable by the Pi as a clock source by adding a dtoverlay. Now, the PI can keep its system time even if it powers off and does not get a chance to sync over NTP.
Flash the ATMEGA
  • Use the provided .hex files under build/ to flash the firmware onto the ATEMGA using your ISP and programs such as Microchip Studio or AVRDude.
  • FUSE BITS (Low High Ext): E2 D9 FF
  • ATMEGA should come shipped with the correct High and Extended fuse bits. Change the low fuse bit to 0xE2 to enable internal clock running at 8 MHz

And thats it! Your hat should be ready to use

Firmware Description

The source code of the firmware is available in power.cpp. It was developed using the Arduino v2.3.6 libararies.

The code does the following when powered ON:

  • Sets up the ATMEGA as an I2C receiver on address 0x20.
  • Tells the power controller to send power to the PI by default
  • Starts a watchdog that will restart the PIs power if it does not receive communication from the PI

While waiting for successful boot

  • **It is the PI's responsibility to tell the ATMEGA of it's successful boot via the Boot Success I2C command

After receiving the Boot Success signal

  • The ATMEGA waits for the Shutdown command

When the Shutdown command is received

  • The ATMEGA waits n seconds as specified by the command. Then, it tells the power chip to cut power. It enters deep sleep mode until the RTC alarm wakes it. Upon awakening, it turns back on the power to the PI, waiting for the Boot Success command to be sent from the PI.

The ATMEGA does not program the RTC over i2c.

Supported I2C Transactions

The following section describes the transaction format recognized by the ATMEGA. The first byte denotes the command type, and the second byte denotes the value if applicable.

The Base Address of the ATMEGA is 0x20

CommandFirst Byte (txn_type)Second Byte (data)DescriptionAction
Shutdown0x000x00-0xFFShutdown commandSets shutdown_in variable to data value
Boot Success0x01Any valueBoot success signalSets successful_boot flag to 1
Note on max number size

Since any data is encoded in a single byte, the max delay from receiving the i2c signal to cutting power is 2^8=256 seconds.

Hardware

The CAD files can be found in the ATMegaPowerCircuit folder.

ATMEGA Hardware Connections

Compiling the firmwre

Select the Aruduino UNO as your device. Paste power.cpp into your Arduino IDE and click Sketch > Export Compiled Binary

Additional Reference Information

RTC lib docs: https://adafruit.github.io/RTClib/html/index.html (We are using the DS3231 RTC chip)

Parts

40
QtyValueFootprintReferences
7100nCapacitor_SMD:C_0402_1005Metric_Pad0.74x0.62mm_HandSolderC1, C2, C3, C4, C5, C6, C8
410KResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR6, R7, R10, R11
4MountingHoleMountingHole:MountingHole_2.7mm_M2.5H1, H2, H3, H4
34k7Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR1, R2, R4
21.0 ufCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC9, C10
2B5819W SLPCM_JLCPCB:D_SOD-123D1, D2
2BSS138BSS138:SOT95P240X111-3NQ1, Q2
2Screw_Terminal_01x02Weurth_Terminal_01x02_691210910002:691210910002J3, J4
10Jumper:SolderJumper-2_P1.3mm_Open_Pad1.0x1.5mmR5
1100kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR8
1100uFPCM_JLCPCB:C_CASE-B-3528-21(mm)C7
110kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR3
122k1Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR9
1ATmega328P-APackage_QFP:TQFP-32_7x7mm_P0.8mmU1
1CR2032Battery:BAT-TH_CR2032-BS-6-1BT1
1Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalUART
1ICSPConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalICSP
1Raspberry_Pi_2_3Connector_PinHeader_2.54mm:PinHeader_2x20_P2.54mm_VerticalJ5
1RedPCM_JLCPCB:D_0603D3
1TPS2557DRBRTPS2557DRBR:SON65P300X300X100-9NU3
1XC6206P332MRPCM_JLCPCB:SOT-23-3_L2.9-W1.6-P1.90-LS2.8-BRU4
1ds3231sn-footprints:21-0042B_16_MXMU2

Similar boards

  • 2 layers73 × 94 mmSportiduino base, the printed circuit board in 3D

    Sportiduino base

    sportiduino/sportiduino

    Electronic timing system for orienteering and similar outdoor sports events on Arduino

    119 parts78GPL-3.0
  • 4 layers100 × 100 mmPCB Design, the printed circuit board in 3D

    PCB Design

    ConquerToFreedom/SwasthEdge

    Low-cost self-diagnosing edge controller for industrial sensor reliability

    89 parts2
  • 2 layers80 × 45 mmKizami, the printed circuit board in 3D

    Kizami

    hasky00/kizami-core

    FPGA side of Kizami — cycle-exact timecode + audio witness on iCE40

    36 partsMIT
  • 4 layers160 × 100 mmEsp32 s3 dwm3000 uwb anchor with relay outputs, the printed circuit board in 3D

    Esp32 s3 dwm3000 uwb anchor with relay outputs

    Takingo/Mypcb35

    OmniCircuit AI is a local proof of concept for an autonomous PCB/PCBA design and manufacturing suite. The current implementation focuses on the ESP32-S3 + DWM3000 UWB Anchor example and establishes the architecture for:

    323 parts
  • 2 layers94 × 72 mmHome sense meteostation, the printed circuit board in 3D

    Home sense meteostation

    trabem/home_sense_meteostation

    Репозиторій автономної battery-powered метеостанції на ESP32-C3-WROOM-02. Містить firmware (ESP-IDF / FreeRTOS), KiCad-проєкти двох плат і матеріали фінальної презентації.

    93 parts
  • 2 layers139.7 × 48.3 mmSuperClockController, the printed circuit board in 3D

    SuperClockController

    silicagel777/SuperClock

    A DIY desk clock with retro-style dot matrix display

    82 partsMIT
  • 2 layers79.2 × 59.2 mmGpstracker, the printed circuit board in 3D

    Gpstracker

    blemasle/gpstracker-pcb

    Connected GPS tracker PCB

    205 parts33MIT
  • 2 layers136 × 88 mmVayuO2, the printed circuit board in 3D

    VayuO2

    wyolum/vayuO2

    controller board for oxygen concentrator

    180 parts2

Questions

How big is the ATMEGA Power Circuit PCB?

It measures 65 × 30 mm and has 4 copper layers, 1.6 mm thick.

What parts does the ATMEGA Power Circuit use?

40 parts, built around the ATMEGA328P-AU, XC6206P332MR, DS3231SN#T&R and BSS138. 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 ATMEGA Power Circuit KiCad files?

From the evan-loe/atmega-power-hat repository on GitHub, at the commit this page was made from: the board is ATMEGA Power Circuit/ATMEGA Power Circuit.kicad_pcb and its schematic ATMEGA Power Circuit/ATMEGA Power Circuit.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the ATMEGA Power Circuit design in my own project?

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