TomaszTlusty/kittycalculator

just calculator written with AVR asm and C

C

3

20 commits

updated Oct 2, 2026

See the code

See what people are saying

SourceMessageScoreDate

Built a hardware calculator from scratch in pure C (r/SideProject)

Hey everyone, Wanted to share a small project I just finished: KittyCalc. It's a physical hardware calculator built entirely from scratch Source code & schematics: [https://github.com/TomaszTlusty/kittycalculator](https://github.com/TomaszTlusty/kittycalculator) Happy to answer any questions…

2

Oct 2, 2026

README

Kitty Calculator

A small desk companion — a calculator built entirely from scratch in pure C99 for the ATmega328P.

What it does

Works like a normal calculator but with a dangerously-cute looking style

Demo

Link to a Demo

Photos

Assembled build Enclosure in CAD First Prototype

How it works

This project steps away from the standard Arduino (.ino) environment and relies on bare-metal C99 programming (AVR libc) to maximize performance and demonstrate what happens under the hood.

  • Logic (FSM): The calculator logic isn't a messy if/else block in main.c. It's decoupled into calculator.c and operates as a Finite State Machine (FSM) with an accumulator and a display register, mimicking real Casio chips.
  • Hardware Debouncing: Keypad inputs are heavily debounced in software (20ms delay logic on state change) directly in the scanning matrix, effectively ignoring both press-bounce and the notoriously tricky release-bounce.
  • Direct Register Access: Uses direct port manipulation (PORTC, PORTD, etc.) instead of slow digitalWrite() wrappers for keypad scanning.

Wiring

The project uses an I2C module for the LCD to save pins, leaving enough GPIOs for the 4x4 matrix keypad.

Component / PinATmega328P (Arduino Uno) Pin
I2C LCD SDAA4 (PC4)
I2C LCD SCLA5 (PC5)
I2C LCD VCC5V
I2C LCD GNDGND
Keypad Row 1D2 (PD2)
Keypad Row 2D3 (PD3)
Keypad Row 3D4 (PD4)
Keypad Row 4D5 (PD5)
Keypad Col 1A0 (PC0)
Keypad Col 2A1 (PC1)
Keypad Col 3A2 (PC2)
Keypad Col 4A3 (PC3)

[Add a wiring diagram image — make one in Fritzing or annotate a clear photo:]

Wiring diagram

Firmware

This project is written in pure C. The logic is divided into modular files:

  • main.c - The system router.
  • calculator.c - FSM calculator logic.
  • lcd_i2c.c - Custom bare-metal I2C driver for the display.
  • keypad.c - Matrix scanning and debouncing.

To flash it, you can use avr-gcc with avrdude, or simply open the project in PlatformIO / Microchip Studio and hit upload.

Bill of Materials (BOM)

#PartQtyLinkApprox. price
1Arduino Uno (used as dev board)1link~20zł
24x4 matrix keypad1link~12zł
316x2 character LCD (with I2C backpack)1link~25zł
4Jumper wires (M-M / M-F)~15link~30zł
5Random screws8[link]FREE
63D-printed enclosure1cad/filament

Build notes

When I started building this project, I thought it was going to be easy—until I learned how hard it is to write raw asm bare-metal code for an LCD display originally designed for 16 parallel pins! That was the moment I switched my approach, utilized an I2C backpack, and structured the whole system in clean C99.

Another huge learning curve was physics: mechanical switch bouncing. Writing a custom matrix scanner that properly filters out both press and release noise without lagging the CPU was a major milestone for this build.

License

MIT License. Feel free to use the code and CAD files for your own desk companions!

TomaszTlusty/kittycalculator

just calculator written with AVR asm and C

C

3

20 commits

updated Oct 2, 2026

See the code

See what people are saying

SourceMessageScoreDate

Built a hardware calculator from scratch in pure C (r/SideProject)

Hey everyone, Wanted to share a small project I just finished: KittyCalc. It's a physical hardware calculator built entirely from scratch Source code & schematics: [https://github.com/TomaszTlusty/kittycalculator](https://github.com/TomaszTlusty/kittycalculator) Happy to answer any questions…

2

Oct 2, 2026

README

Kitty Calculator

A small desk companion — a calculator built entirely from scratch in pure C99 for the ATmega328P.

What it does

Works like a normal calculator but with a dangerously-cute looking style

Demo

Link to a Demo

Photos

Assembled build Enclosure in CAD First Prototype

How it works

This project steps away from the standard Arduino (.ino) environment and relies on bare-metal C99 programming (AVR libc) to maximize performance and demonstrate what happens under the hood.

  • Logic (FSM): The calculator logic isn't a messy if/else block in main.c. It's decoupled into calculator.c and operates as a Finite State Machine (FSM) with an accumulator and a display register, mimicking real Casio chips.
  • Hardware Debouncing: Keypad inputs are heavily debounced in software (20ms delay logic on state change) directly in the scanning matrix, effectively ignoring both press-bounce and the notoriously tricky release-bounce.
  • Direct Register Access: Uses direct port manipulation (PORTC, PORTD, etc.) instead of slow digitalWrite() wrappers for keypad scanning.

Wiring

The project uses an I2C module for the LCD to save pins, leaving enough GPIOs for the 4x4 matrix keypad.

Component / PinATmega328P (Arduino Uno) Pin
I2C LCD SDAA4 (PC4)
I2C LCD SCLA5 (PC5)
I2C LCD VCC5V
I2C LCD GNDGND
Keypad Row 1D2 (PD2)
Keypad Row 2D3 (PD3)
Keypad Row 3D4 (PD4)
Keypad Row 4D5 (PD5)
Keypad Col 1A0 (PC0)
Keypad Col 2A1 (PC1)
Keypad Col 3A2 (PC2)
Keypad Col 4A3 (PC3)

[Add a wiring diagram image — make one in Fritzing or annotate a clear photo:]

Wiring diagram

Firmware

This project is written in pure C. The logic is divided into modular files:

  • main.c - The system router.
  • calculator.c - FSM calculator logic.
  • lcd_i2c.c - Custom bare-metal I2C driver for the display.
  • keypad.c - Matrix scanning and debouncing.

To flash it, you can use avr-gcc with avrdude, or simply open the project in PlatformIO / Microchip Studio and hit upload.

Bill of Materials (BOM)

#PartQtyLinkApprox. price
1Arduino Uno (used as dev board)1link~20zł
24x4 matrix keypad1link~12zł
316x2 character LCD (with I2C backpack)1link~25zł
4Jumper wires (M-M / M-F)~15link~30zł
5Random screws8[link]FREE
63D-printed enclosure1cad/filament

Build notes

When I started building this project, I thought it was going to be easy—until I learned how hard it is to write raw asm bare-metal code for an LCD display originally designed for 16 parallel pins! That was the moment I switched my approach, utilized an I2C backpack, and structured the whole system in clean C99.

Another huge learning curve was physics: mechanical switch bouncing. Writing a custom matrix scanner that properly filters out both press and release noise without lagging the CPU was a major milestone for this build.

License

MIT License. Feel free to use the code and CAD files for your own desk companions!

Languages

C

72.3%

Assembly

22.3%

Makefile

5.3%