Evan Gubarev

Evan Gubarev

Creating a custom, mechanical calculator from scratch

Open-source Custom Mechanical Keyboard

After playing around with the result for a couple weeks, I've learned quite a bit.

Goal

My goal was to create a calculator which I could rely on daily, while also being easy to produce and assemble. In the result I think I met my goal.

Process

Planning

This was a long process, starting around December of 2021. In total, this project took over ten months. Originally, this project was centered around the STM32L0 processor and several SMD pushbuttons. That's right, the project originally didn't even have mechanical keys! I prototyped several boards that centered around the chip, however I eventually found several flaws in my design, and had to abandon it.

I tinkered around using an ATMEGA328P chip and a breadboard with a 1602 display without any buttons. Eventually I got the display working and decided on the pinouts for the different keys.

Design (Eeschema)

It was time to draw the circuit in Eeschema, so I got the necessary components and drew them up.

Image of completed circuit diagram

After this, I ran an ERC (Electronic Rules Check) to ensure that my connections were in order, and upon passing, I moved onto the next step.

Design (PCBNEW)

The next step was to design the actual PCB. I had to arrange the different components to minimize RF interference and to minimize path length. I then had to manually connect the pads of every component, creating a solid electrical path between the two paths. The hardest part was connecting the display and the microcontroller, as I had to route over 10 wires between the two. It might not sound like much, but it was challenging.

Here is the completed PCB routing.

PCB Routing

Production and Assembly

As I designed the board using KiCAD 6.0, I could create manufacturing gerber files to send to different manufacturers. I eventually settled on JLCPCB as they were the cheapest. Upon reviewing their capabilities, I learned that they also offered assembly services, so I decided to pursue that possibility. I had to manually assign a component from LCSC to every footprint, but after doing that I could generate a BOM and positions file. I then uploaded both the gerbers and the assembly files to the manufacturer and ordered the boards for less than $20.

Final assembly steps

When I received the PCBS, I hand-soldered the power adapter and the socket for the CPU, along with the display and keys.

Software

The last step was to write software for the calculator. After all, without software the calculator would essentially just be a paperweight. I designed software to make the calculator, well, a calculator using the Arduino IDE, as this was compatible with my ATMEGA328P chip. I then had to write software to detect when the buttons were pressed and to prevent ghosting. This process helped me learn more about the practical applications of code.

Reflection

Upon completion of the project, I was quite satisfied with the result.

Final Result

I met my goal of creating a calculator that I would use, and I'm quite proud of that. I'm sure I'll go down the rabbit-hole of creating and manufacturing my own electronics sometime soon.