Flapulator - Pi Centric, Fully 3D Printable and World's Most Tactile Calculator
by Applepie1928 in Circuits > Raspberry Pi
51632 Views, 102 Favorites, 0 Comments
Flapulator - Pi Centric, Fully 3D Printable and World's Most Tactile Calculator
Meet the Flapulator, the “form over function” calculator. No more do you have to wait in silence as you calculate. Sit back and enjoy the clacks of a mechanical keyboard, as your display gently clicks its way to the next digit. Questionable accuracy, slow calculation speed, but maximum tactile pleasure.
This was a small passion project which I've been working on for a few evenings and weekends over the last month. I found out one of my favourite Mathematicians/Comedians/Pi-Lovers: Matt Parker was going to be doing a show in my hometown, and he is known for his signing of calculators. Upon discovering this at the start of March I then had four weeks to design and build a novel calculator which offered something no calculator has done before, and thus the Flapulator was born.
The concept was to create the most over-engineered calculator which had an analogue feel, but still with a digital brain. After exploring some ideas with flip dots, I eventually settled on split flaps as my display choice. The clack of big wheels of characters turning in airports has always been a sensory pleasure of mine, so I wondered how tough it would be to build a vastly smaller, but fully functional 3D printed version from scratch. Turns out it was fun and also quite a challenge!
To put in some subtle nods towards Matt and his love of Pi, I also hid Pi throughout the design in a number of places: The obvious being a dedicated Pi button which shows both the actual value of Pi and also Matt's most recently calculated approxomation from Pi. The trigonomic functions also only work in radians to keep everything as close to Pi as possible, and finally all of the angles used when designing the shell, lid and body are either some form of Pi or a derrivative of Pi. And the most the obvious is that of course I used a Raspberry Pi Pico microcontroller to handle all the logic.
Features
- 6 Digit Split Flap Calculator Display (where the decimal point, or negative sign also require 1 digit)
- Automated Calibration and Homing of Servo motors through Hall sensors
- Handwired Mechanical Keyboard with 24 keys (customisable functions can be written into the code)
- Battery Powered (around 4 hours of calculation time on a full charge)
- Raspberry Pi Pico Controlled (with full custom code available to download as part of this project)
- LED Illumination to keep track of current mathematic operation
- Fully asynchronous operation
So without further ado, what do you need if you want you want to build your own flapulator?
Supplies
In total this project requires around 350g of PLA filament for the 3D printed parts and the print time for a Bambu Lab P1S is around 13 hours in total. There is also an optional translucent viewing window which I printed in PETG Translucent, only 1g of this is required, so feel free to print this as a solid piece if you prefer.
Electronics
- 1 x Raspberry Pi Pico 2 (W version optional) - Main controller
- 1 x Adafruit Power Boost 1000 Basic - Battery Management and 5V Boosting
- 1 x Perforated Board (cut to 31.5mm x 21mm) - Power Distribution
- 1 x 18650 Lithium Ion Battery (with protection and JST connector) - Power Supply
- 1 x Two Position SPDT Micro Slide Switch - Power Switch
- 6 x Continuous Rotation Servos (FS90R) - Split Flap Drivers
- 6 x Digital Output Hall Sensors (KY-003) - Split Flap Position Detection
- 24 x Gateron KS-33 Low Profile Mechanical Switches - Keyboard Keys
- 24 x 1N4148 Diodes - Keyboard N-Key Rollover (probably optional)
- 4 x 5mm LED - Operation identification (I used Red, Yellow, Green and Blue)
- 4 x 220 Ohm Resistors - Led resistors (330 Ohm resistors would also work)
- 1 x Schottky Diode - Power Protection (probably optional, but recommended)
Sundries
- 12 x 2mm Machine Screws (6mm to 8mm length) - Hall sensor
- 6 x 2mm Machine Screws (4mm length) - Pi Pico and Power Switch
- 4 x 2.5mm Machine Screws (4mm length) - Powerboost and Perf Board
- 27 x 2.5mm Machine Screws (5mm length) - Shell and Servo
- 12 x 3mm Self-Taping Screws (6mm length) - Split Flap Digits
- 6 x 4mm Diameter, 2mm Depth Neodymium Magnets - Homing Detection
- 26 AWG Wire - Hall sensor, LED, Power, Keyboard and Switch connections
- 16 AWG Bare Copper Wire - Mechanical Keyboard connections
- Heatshrink Tubing/Insulating Tape - General insulation and safety
- Superglue
Printing Components
Start off by printing all the plates of the Makerworld project, these are split up to maximise quality whilst keeping print time as low as possible. This project does require a multi-material 3D printer in order to print the dual colour split flaps and keyboard keycaps, as these are too small to print the colours as seperate pieces. This build does however only require a build plate size of 205mm by 150mm, and all parts have been designed for 3D printing from the ground up and as such nothing in this project requires any support material.
The “Servo Gear” should be a snug fit on to the servo, but might require some slight setting alterations if it is too tight or too loose. The hole in this gear should also be a tight fit for one of the neodymium magnets and require a little force with a pushing tool to be inserted. If these fits work for you, then the rest of the dimensions in the project shouldn’t be an issue.
Constructing a Digit
Each digit is composed of the following parts:
- Digit Frame
- Spool Shaft
- Spool End
- Drive Gear Shaft
- Servo Gear
- 12 x Split Flaps
- Servo
- Hall Sensor
I will now go through each of the sub-steps required to construct one of these digits. Make sure to use the images and part names as reference as you follow along. Once completed, repeat these steps until you have all 6 digits completed.
Step 2.1
First, take the two parts of the spool, and using the keyed cutout attached these together with a little super glue. Apply some pressure and allow time for this to dry.
Step 2.2
Insert the flaps into their aligned holes inside of the spool. Start with the all-blank flap, and the follow with the flap containing blank on one side and “0” on the other. Repeat this process checking the order as you go through all 12 flaps. They will require a little pressure to insert and I found that applying a small amount of pressure to the ends of the spool helps them fall into place. All flaps should rotate freely when inserted, if not, take them out and sand/file as required.
Step 2.3
Position the spool inside of the frame, so that the hole in the spool aligns with the opening in the frame. Now take the drive gear shaft and insert it through the hole in the frame and into the spool. The gear should be almost flush with the frame, and the thicker circular part of the gear shaft should fill the hole. If this fit has some friction, a light sanding/filing inside the frame hole will make rotation a bit smoother.
Step 2.4
Take the servo and insert it through the frame so that the shaft is closest to the front of the frame. It should be a good push fit, but is also secured by 2 x 2.5mm machine screws (5mm length minimum, 8mm length maximum). The wires can also be secured with the wire holder at the bottom front of the frame.
Step 2.5
Insert the neodymium magnet into the hole in the servo gear, ensuring it is flush. I recommend using a strong non-metallic object to apply the force evenly. The servo gear can then be pushed onto the servo shaft with the magnet facing inwards.
Step 2.6
Before the hall sensor is fitted you should first attach three 28 AWG wires of roughly 20cm length to the 5V, GND and Signal holes in the board. Depending on the board you get, you may need to desolder the headers first to gain access to these pins.
Finally place the hall sensor board below the servo so that the sensor extends through the hole in the frame towards the servo gear with the embedded magnet. This board can be secured with two 2mm screws from under the frame (6mm to 8mm length works well). The screws just act as slightly offset posts and don’t require biting into anything above the sensor to work. Once attached use the wire holder to also secure the hall sensor wires.
With one digit now built, just repeat these same steps for the remaining 5 digits. Ensure that they all turn freely (easiest to check this without the servo gear attached), and make sure that no wires are pulled tight or trapped.
Building the Keyboard
Start by inserting the KS-33 switches into their slots in the orientiation shown above. They should click into place with a little pressure, but just be careful to support the printed keyboard insert part as you push these in.
The process I used for wiring the keyboard was based on a fantastic video by Joe Scotto who walks through the whole process visually and describes more detail about the reasons for some of the decisions made. I would highly recommend you watch that video, use the image include with this step as a reference and then follow along with the high level steps provided
- Measure and cut 6 lengths of 16 AWG copper wire which will connect each column of keys. These will connect to the top right pin on each switch.
- Solder these wires onto the 4 switches of each row attaching them to the top right pin.
- Solder a 1N4148 Diode to the remaining pins on each switch. Ensure that the anode side is the one connected to the pin and the cathode side (the side with the black line on) is left unattached at this stage.
- Measure and cut 4 lengths of 16 AWG copper wire which will connect the rows of keys (the wire will pass straight across the viewing window section).
- Lay these wires into position (as shown in the image above), and mark on each marker where they cross with the column wires. Apply heatshrink or insulating tape to these cross points to protect against short circuits.
- Wrap the cathode tail of each diode in a row around the copper wire for that row, and then solder the diodes onto the row wires.
- Trim any remaining tails off the diodes, and if necessary also trim down the copper wires so they don’t overhang the switches anymore than shown in the image above.
- Solder a good length (around 30cm) 26 AWG wire to each row wire and each column wire. The exact position where each of these wires attaches doesn’t matter except for cable management.
I also recommend test fitting the keycaps at this stage, and if they seem a little tight, use a KS-33 switch which hasn't been soldered to apply a bit of extra pressure. Once the keycaps have been successfully added once they are much easier to put on at the end of the final build.
Pre-Soldering Preparation
There is quite a bit of soldering that needs to get done next, and I found it easiest to install most of the components into the shell first to route the cables better and ensure good cable lengths. I also prepared my perf board as my power delivery at this stage by cutting it down into the required dimensions of 31.5mm by 21mm and drilling two 2.5mm holes along the centre with an offset of 17.7mm (use the holes in the perf board guide this, the two perf board holes to drill should be 8 apart).
Once the perf board is drilled we will use one side as our +5V rail and the other side as our Ground. Solder a short length of wire (10mm to 15mm) from the Power Boost 1000, positive output to the +5V side of the perf board, and do the same for the negative side.
This is also a good time to attach the slide switch to the Power Boost 1000, to act as our On/Off switch. Solder two wires to the switch, one attached to the centre pin and one attached to either side. Solder the other side of these wires to the “EN” pin and “GND” pin on the Power Boost 1000.
Now screw the Powerboost and perf board into the mounting holes of the shell near the battery compartment, and then screw the Raspberry Pi Pico onto the holes towards the front of the shell. The Powerboost and perf board each require two 2.5mm x 4mm screws, and the Pico requires four 2mm x 4mm screws.
Setup your Pico using the standard process and test it works with your choice of IDE before you start soldering any wires to it. To ensure clarity on where things are connected, it is worth using the Pico pinout diagram included to check which pins are getting soldered to which wires in our build.
With all the preparation work completed, we can now move onto to soldering everything together!
Electronics and Soldering
Pico Power
Start off by soldering in the main power connection for the Pi Pico, by taking one feed from the 5V side of the perf board and soldering that to the Schotkky diode, which then connects to VSYS 5V on the Pico (The diode should have the cathode side connected to the Pico so that USB power from the Pico can’t leak back into our battery powered system). Also solder one feed from the Ground side of the perf board to a ground connection on the Pico (I used pin 38, but any ground pin would be fine).
Split Flap Digits
Starting from the right most digit when looking at the Flapulator (this is digit 1, servo 1 and hall sensor 1). For each digit go through the following process:
- Place the digit inside the shell, and secure it from underneath using the two 3mm x 6mm self taping screws. Ensure that no wires are trapped, and that the servo and hall sensor wires are guided with the cable guide at the bottom front of each digits frame.
- Use the pinout diagram to check which Pico pins the servo and hall sensor need to attach to, and then trim all the wires down to an appropriate length, such that they are not taught, but don’t have too much excess.
- Solder the orange servo cable to the appropriate Pico pin.
- Solder the signal cable of the hall sensor to the corresponding Pico pin
- Solder the power and ground connections for both the servo and the hall sensor to the respective sides of the perf board.
Keyboard
Place the keyboard in front of the shell with the keys facing up, then flip it front to back, so that the wires are now facing up. This should ensure it is in the right direction to attach to the shell after you have wired it up. See the image above for a visual of the orientation.
Next solder the wires from the keyboard rows and columns to their appropriate pins. The diagram included links each row and column of the keys to their appropriate GPIO number as shown in red.
LEDs
To prepare the LEDs, a resistor of around 220ohms - 330 ohms should be soldered to the positive leg, as close to the top of the leg as possible. Also attach the wires to both legs and trim as much of the legs as possible. I also used some additional heatshrink tubing here to cover any bare metal.
For reference: LED 1 is the “plus” light, LED 2 is the “minus” light, LED 3 is the “multiply” light and LED 4 is the divide light.
Finally each LED can be wired to the appropriate pins, with the positive leg going to the Pico pin on the pinout diagram, and all the negative legs being connected to the ground side of the perf board (use the flat side of the LED body to find the negative leg).
That is the last of the wiring done, now you have to pray to the wiring gods that nothing has gone wrong, and that all that wire will fit inside the shell. Onto the final step!
Shell Construction
- Install the battery into the compartment and plug the JST connector into the Power Bank 1000 battery input JST port.
- Take some time to push the wires into sensible spaces inside the shell ensuring that they are staying clear of the gears of the digits, the top of the posts which support the keyboard and, the shelf that runs along the edge which the keyboard sits upon.
- Flip the keyboard and slowly start to press it into place, do this a bit at a time, checking that wires are not getting caught (particularly on top of the posts, or near the gears).
- Once the keyboard is sitting flush it can be secured with seven 2.5mm x 5mm machine screws along the edges and into the two support posts.
- Press each of the LEDs through their appropriate holes in the top insert piece, they should be a good push fit, but feel free to add some glue here as required.
- Lay the top insert piece above the keyboard, it should be supported by the back of the battery compartment, and screw it in with four 2.5mm x 5mm screws from the sides of the shell.
- Take the lid so that the “Flapulator” text is facing forward and insert it onto the top back section of the shell, it should be a snug fit. It can then be secured with four 2.5mm x 5mm screws in each corner.
- Finally place (or re-place) all of the key caps onto the keyboard. Just be careful about apply too much force here particularly on the top corner keys (“7” and “tan”) as they have the least support underneath.
And with that you have your very own Flapulator! Now you just need to get the code uploaded.
Code Setup
The code for this project consists of four files attached to this step:
- main.py - Contains the calculator state and runtime code
- split_flap.py - Contains the functions for digit control
- led.py - Contains lighting effects and logic
- keypad.py - A variant for this project of the micropython keypad package
Connect your Pico to your computer via USB and upload all three of these files to the root directory of the Pi. Then safely disconnect the Pico from the computer and flip the switch to activate your Flapulator.
The code has got plenty of room for improvement, but works well enough for the purposes of this project, so feel free to mess around, add your own functions or even change out some of the keys if you want to.
The entire code base has been written using Micro Python, and all functions are asyncronious so that keyboard inputs can be read consistantly and multiple digits can move/home at the same time.
If you would like more detailed information on the structure of the code, or the reasoning (or lack thereof) into any of my design choices, please just drop me a message and I would be more than happy to go through it.
Until then, happy Flapulating!
(Matt Parker Approved)