This project was the runner-up in the 2013 Radio Microcontroller Competition.
In symmetric cryptography, the Enigma machine is undoubtedly a pivotal existence. It completely shifted the focus of cryptographic research from linguistics to mathematics. The cipher involved here is not the narrow concept we usually think of, such as email or bank account passwords; that would be more appropriately termed a passphrase. The cipher discussed here transforms a text into something utterly unrecognizable, unreadable by anyone, achieving confidentiality. This article is suitable for computer enthusiasts, military buffs, history lovers, and math geeks, so prepare for a mental workout.
This is our prototype. The following tutorial will guide you step-by-step on how to perfectly replicate the famous German Enigma machine (hereafter referred to as the ‘Enigma machine’; those unfamiliar with the history can fill in the gaps on Wikipedia or Baidu). This open-source program based on Arduino can encrypt and decrypt any Enigma M4 type (naval version) information.
This first fully functional open-source replica of the Enigma machine is based on the article “Kid’s Game to Arduino Enigma Machine” written by sketchsk3tch.
Utilizing a multiplexed LED circuit, the entire circuit connects 115 LEDs with 38 pins and 36 buttons with 4 pins, all made possible by accurately placed resistors in the keyboard circuit and P-type transistors. Otherwise, the 4 16-segment displays and the LEDs on each button would significantly increase the total pin count required. Even with the Arduino Mega board, without the above two methods, it wouldn’t be as concise. Facing the excessive demands of the circuit, we designed a dedicated PCB at http://www.stgeotronics.com. More information can be found by skipping to step 10 and beyond. Additionally, we released a tested complete electronic assembly kit.
Step 1: Breadboard Verification
Before starting to make the electronic Enigma machine, we must ensure that we can drive the 16-segment LED display. If we can, we can proceed with all subsequent steps; everything else is trivial except for the mathematical issues.
Step 2: All Set
You will need:
-
1 Arduino Mega 2560 board
-
26 letter buttons
-
26 1/4 inch single-channel female connectors
-
10 1/4 inch single-channel male connectors
-
36 mechanical buttons
-
1 single-pole three-way switch
-
4 16-segment orange LED displays
-
4 injection-molded 2-liter soda bottle caps
-
1 plywood box
-
1 hinge
-
1 half-dovetail lock
-
1 wiring reel
-
38 470-ohm resistors
-
40 1k-ohm resistors
-
7 IRF9Z24N P-type transistors
-
1 metal sheet
-
and spray paint.
Optional:
Battery holder, rechargeable batteries, charger/rechargeable connector.
When we actually do it, we won’t use 1/4 inch connectors. They are too large and almost exceed the entire Enigma machine. Banana plugs are smaller and fit together more tightly than the original German Enigma machine.
Step 3: Arranging Components
The 6*8 inch wireless breadboard is the most suitable for placing all components, neither excessive nor cramped, and perfectly fits inside the Enigma machine box.
Initially, we divided the breadboard into three equal areas, but soon realized that this would make the electronic Enigma machine longer than the original mechanical one. So we scaled all components to just occupy the necessary space.
With each component position ready, the next step is soldering.
Step 4: Soldering
Alright, I have never soldered so many times on a single project. The 18 pins of the 16-segment displays, plus 26 letter keys multiplied by 4 pins each, along with 26 keyboard lights and some other LEDs, it’s truly a “Genghis Soldering”!
Our initial decision was to make these 16-segment LEDs look like old electronic tubes, which added quite a few solder points, “Mega Solder”!
Step 5: Appearance Work – Make a Box and Drill the Panel
After determining the positioning data inside the original M4 wooden box, we bought a piece of plywood, cut it, and then assembled the box.
We removed a piece of steel plate from an old server rack, which was just the right thickness needed. We placed the mold (with each key and light position already marked and holes cut) on the steel plate and used a marker to outline the holes that needed to be cut.
Next, we spray-painted it black, just like the real Enigma machine.
Step 6: Assembly Testing
First, permanently fix the metal plate to the breadboard to ensure all buttons work properly and all LEDs light up.
Next, assemble this large chunk into the wooden box, ensuring there are no gaps.
Step 7: Software!
During the hardware assembly, we also wrote a small Arduino program framework to test several specific parts:
Used to test whether each key signal can be accurately read, as well as the code for testing 10 functional keys.
Enigma_POST (power-on self-test) ensures that all keyboards can light up accurately in each mode and that each LED signal can be transmitted in each mode. We modified the original breadboard code to ensure that every component of the 4 16-segment LED displays is flawless.
However, even if all the program snippets in hand indicate that the machine is in good condition, reproducing the M4 naval type Enigma machine’s encryption and decryption functions is greatly reliant on the mathematics involved.
All Arduino program snippets can be found on our newly established cloud.
Below is the Enigma_POST program snippet (power-on self-test):
【There are many codes here; click the original reading link at the end of the article to view】
Step 8: More Software!
First, we wrote a function for each Enigma machine operating mode.
In mode 0, the default mode, the Enigma machine is merely an ordinary typewriter, displaying its model in a marquee fashion.
In mode 1, users can select three rotors from eight and choose one reflector from two for use.
In mode 2, users can arrange the order of the rotors.
Mode 3 is for customizing the initial letter arrangement of the rotors.
In mode 4, users can use up to 10 pairs of swapped letter arrangements on the wiring board.
Mode 5 is the operational mode, during which the Enigma machine can encrypt and decrypt any information input from the keyboard.
Below is the complete program snippet for the entire Enigma machine workflow:
【There are many codes here; click the original reading link at the end of the article to view】
If there is enough profit, we will develop printed circuit boards to produce a more easily assembled full-function replica of the Enigma machine. Please visit http://www.stgeotronics.com to check for product availability, pricing, ordering, or pre-ordering. The circuit diagram is ready, and the printed circuit is in the development stage, soon to be in internal testing.
Step 9: Circuit Diagram
Due to popular demand, here are two circuit diagrams.
The first shows how to wire the simulated electronic tubes (4 16-segment display units) for displaying the output signals of the rotors on the Enigma machine. They are also used for each debugging mode, providing feedback on the machine’s settings to the user.
The second circuit diagram shows how to wire the 26 letter keys, 10 functional keys, 26 keyboard lights, and 5 LEDs.
All LED resistors are 470 ohms, while the switch resistors are all 1k ohms. The printed circuit design document is still being revised. We hope you enjoy our first production tutorial, and thank you for taking the time to read it!
Step 10: PCB Prototype Version
Due to popular demand, we designed and customized some printed circuit boards.
They have finally been released, looking so pure and lovely! We are busy assembling and testing one of the samples to ensure its functionality is as perfect as its appearance. More importantly, it must function the same as the prototype testing machine. The baseboard we ordered is nearly perfect, needing only a few pin wires to fix design flaws. These flaws do not affect functionality, and fixing them is a cinch. With these pins, you can more easily create your own Enigma replica machine, much more conveniently than the wiring in the tutorial. We are pleased to announce that testing is complete, and the new board is just as powerful! To order, please visit http://www.stgeotronics.com, now available for sale. Assembly pictures can be found in step eleven. Thank you all for your unwavering support and valuable feedback!
Step 11: Completed Assembly
After a night of assembly, it is completed as shown above.