Skip to the content
2 layersTotp, the printed circuit board in 3D

Totper schematic, pcb design and firmware

Copper layers
2
Thickness
1.6 mm
Parts
5
Nets
16
Pads
28
Tracks, vias
27, 0
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
28 Mar 2026
Updated
28 Mar 2026

Overview

Totp is an open-source printed circuit board by Filippo-Carta, from the Filippo-Carta/Totper-Device repository on GitHub. It is a 2-layer board with 5 parts on 16 nets, routed with 27 tracks and 0 vias.

Its parts include 3 connectors and 2 switches.

README

README.md

ESP32 TOTP Firmware

TOTP (Time-based One-Time Password) generator running on an ESP32-C3, controlled via USB serial from the companion Android app. No WiFi, no cloud, no internet connection required at any point.

License: CC BY-NC-ND 4.0 Platform Standard

Overview

TOTP secrets are stored exclusively on the physical ESP32 device in non-volatile storage (NVS). The device has no network interface — time is supplied by the Android app over USB serial each time it connects. Once synced, the ESP32 tracks elapsed time internally using its own clock, so codes remain valid for the entire session.

Access to the device is protected by a 5-digit PIN entered via two physical buttons. After 5 failed attempts, all stored accounts are permanently wiped and the device reboots.

Hardware

All of the necessary schematic are available in the /schematic/ folder in the repository. You can print the pcb by exporting the files and sending them to a pcb manufacturer.

ComponentDetails
MicrocontrollerESP32-C3
DisplaySSD1306 OLED, 128x32, I2C
Button 1 (Cycle)GPIO 5 — cycles digits / switches account
Button 2 (Confirm)GPIO 6 — confirms digit / advances to next
I2C SDAGPIO 4
I2C SCLGPIO 3

Dependencies

Install these libraries via the Arduino Library Manager or PlatformIO:

Security Warning

This firmware stores TOTP secrets in ESP32 NVS flash in plaintext. NVS is not encrypted by default.

This means that anyone with physical access to the device and a USB connection can dump the entire flash contents using standard tools and read every stored secret directly — regardless of the PIN. The PIN only protects the serial interface. It does not protect the flash memory itself.

If you do not enable flash encryption, physical possession of the device is equivalent to full access to all your TOTP secrets.

Without flash encryption this device should be treated as a convenience tool only, not as a secure hardware token. With flash encryption enabled, physical attacks become significantly harder.

Serial Protocol

Communication runs at 115200 baud, 8N1 over USB CDC. All commands are newline-terminated (\n).

CommandResponseAuth required
TIME <unix>OK:time_set:<unix>No
STATUSOK:ready:<n>Yes
LISTJSON array [{index, name}, ...]Yes
ADD <n> <base32>OK:added:<idx>:<n>Yes
REMOVE <idx>OK:removed:<idx>:<n>Yes
CLEAROK:clearedNo

Any command requiring auth while the device is locked returns ERR:locked.

TIME and CLEAR are always permitted regardless of lock state. CLEAR wipes all accounts and reboots the device.

Constraints

  • Account name: maximum 12 characters
  • Base32 secret: minimum 8 characters, uppercase, standard Base32 alphabet

PIN System

The PIN is 5 digits, entered using the two physical buttons:

  • Cycle button — increments the current digit (0-9, wraps around)
  • Confirm button — confirms the digit and advances to the next position

On first boot, the device enters a PIN setup flow before doing anything else. The PIN is stored in NVS alongside the accounts.

To change the PIN, hold the Confirm button while powering on the device. The change flow requires the current PIN before setting a new one.

After 5 consecutive wrong PIN attempts, all data is wiped via nvsClearAll() and the device restarts.

Time Sync

The device has no RTC and no network access. On every USB connection, the Android app sends:

text
TIME <unix_seconds>

The firmware records the Unix timestamp and the value of millis() at that moment. From then on, the current time is calculated as:

text
currentTime = baseUnix + (millis() - baseMillis) / 1000

Until a TIME command is received, the display shows "Waiting for time sync" and no TOTP codes are generated.

TOTP Implementation

The firmware implements RFC 6238 using HMAC-SHA1 from the mbedTLS library (bundled with the ESP32 Arduino core). The time step is 30 seconds and codes are 6 digits.

text
counter = currentTime / 30
TOTP    = HOTP(secret, counter)

NVS Storage Layout

All data is stored under the totp namespace in NVS flash.

KeyTypeDescription
pinString5-digit PIN
countIntNumber of stored accounts
name_NStringAccount name at index N
sec_NStringBase32 secret at index N
fail_cntIntConsecutive failed PIN attempts

Companion App

The Android app that communicates with this firmware is available at:

https://github.com/filippo-carta/Totper

License

Copyright Filippo Carta — CC BY-NC-ND 4.0

Free to use and share with attribution. Modification and commercial use are not permitted.

HAVE FUN!

Parts

5
QtyValueFootprintReferences
2Conn_01x08_PinConnector_PinHeader_2.54mm:PinHeader_1x08_P2.54mm_VerticalJ2, J3
2SW_Push_DualButton_Switch_THT:SW_PUSH_6mmSW1, SW2
1Conn_01x04_PinConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1

Similar boards

  • 2 layers98 × 27 mmXy limit, the printed circuit board in 3D

    Xy limit

    opulo-inc/lumenpnp

    The LumenPnP is an open source pick and place machine.

    5 parts3.7k
  • 2 layers21 × 33 mm24g2usb pico2w, the printed circuit board in 3D

    24g2usb pico2w

    joypad-ai/joypad-os

    Universal controller firmware for building adapters, dongles, and custom controllers.

    5 parts1.7kApache-2.0
  • 2 layers53.2 × 59.6 mmA10 OLinuXino Lime Rev B SHIELD TEMPLATE, the printed circuit board in 3D

    A10 OLinuXino Lime Rev B SHIELD TEMPLATE

    OLIMEX/OLINUXINO

    OLINUXINO is Open Source / Open Hardware, low cost from EUR 24 Linux Industrial grade Single Board Computer capable to operate -25+85C

    5 parts1.5k
  • 2 layers30 × 11 mmMain control board servo tester, the printed circuit board in 3D

    Main control board servo tester

    jamro/tiny-engineer

    A small desktop robot that brings an AI coding assistant to life, physically acting out when it reads files, thinks, writes code, and finishes work.

    5 parts1.1k
  • 2 layers78.8 × 35.3 mmKiCadTest, the printed circuit board in 3D

    KiCadTest

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    5 parts915
  • 2 layers50 × 23 mmMiniCircuits LTCC, the printed circuit board in 3D

    MiniCircuits LTCC

    VanceVagell/kv4p-ht

    Open source handheld ham radio project KV4P-HT

    5 parts828GPL-3.0
  • 2 layers20.3 × 15.2 mmL0 light sensor, the printed circuit board in 3D

    L0 light sensor

    Luos-io/luos_engine

    Open-source and real-time orchestrator for cyber-physical-systems, to easily design, test and deploy embedded applications and digital twins.

    5 parts546MIT

Questions

What parts does the Totp use?

5 parts. 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 Totp KiCad files?

From the Filippo-Carta/Totper-Device repository on GitHub, at the commit this page was made from: the board is schematic/totp.kicad_pcb and its schematic schematic/totp.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Totp design in my own project?

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