0%

EDIT: This Instructable has won Second prize in the 2013 Radio Shack Microcontroller Contest. Thank You to all who voted!

EDIT2: An Open Enigma with fake Standup Nixie Tubes like the ones pictured in this Instructable will soon be available as a Special Kickstarter edition.

This is our very first Instructable and this step by step guide will show you how to build a fully functional electronic replica of the world famous German Enigma machine. This Arduino based Open Source project is able to encrypt & decrypt any Enigma M4 encoded message.

This first ever fully functional Open Source Enigma "exact" Replica was inspired by the Kid's Game to Arduino Enigma Machine by sketchsk3tch.

Using Multiplexing for the LEDs, this circuit with 115 light emitting diodes uses only 38 pins and the 36 push buttons use only 4 pins total thanks to properly placed resistors (and the P-Channel MOSFETs) in the keyboard loop. These 4 16-Segment displays & an LED for each keyboard button would add up quickly the total number of pins required and even the Arduino Mega would have ran out of pins without the 2 methods mentioned above....

In response to the overwhelming demand, we designed the PCB and made it available through www.stgeotronics.com. Skip to Step 10 & beyond for more info. We also offer it as a complete electronics kit & an assembled & tested complete product.

## Step 1: Proof of Concept on Breadboard

Before going all out on the development of this electronic Enigma replica, we wanted to make sure we could properly drive the 16 Segment LEDs. If we can do that, than we will be able to do everything as the rest is only Math...

## Step 2: Gather the Raw Materials...

You will need:

• 1 Arduino Mega
1个Arduino Mega 2560板

• 26 Alpha Buttons
26个字母按键

• 26 1/4" Jacks Mono
26个1/4英寸单通道母接口

• 10 1/4" Plugs Mono
10个1/4英寸单通道公接口

• 36 Pushbuttons
36个机械按钮

• 1 On/Off/On Switch
1个单刀三掷开关

• 4 16Segment Orange
4个16段橙色LED显示

• 4 Injection molded 2-Liter Soda Bottle preform (test tubes)
4个注塑2升汽水瓶罩子

• 1 Case Plywood
1个胶合板盒子

• 1 Hinge & Hooks
一个铰链

• 1 Half-Mortise Lock
一个半榫接锁

• 1 Perfboard
一个接线盘

• 38 Resistors 470 Ohms
38个470欧电阻

• 40 Resistors 1K Ohms
40个1千欧电阻

• 7 IRF9Z24N P-Channel MOSFET
7个IRF9Z24N P沟道场效应晶体管

• 1 Piece of Metal & Spray paint
1块金属片以及喷漆

Optional:

• Battery Case
电池盒

• Rechargeable Batteries
充电电池

• Battery Charger/Connectors
充电电池

If we were to do it again, we wouldn't use 1/4" Jacks & Plugs as these are pretty big and tend to overwhelm the whole Enigma. Banana plugs & jacks are smaller & closer to the original connectors used by the real German Enigmas.

## Step 3: Lay the Components Down

The Radio Shack 6" x 8" Micro Perboard is the perfect size to host all components as it provides just the right amount of space to fit everything on & will fit perfectly inside the Enigma box.
6*8寸无线电面包版是最适合放置所有元件的，既不多余也不拥挤，而且和Enigma机盒子内部完美吻合。
We started dividing the space on the Perfboard equally between the 3 regions, but realized soon that this would make the electonic Enigma longer than the real one, so we compressed everything down to the proper spacing.

Once satisfied with the positioning of each components, next step is soldering.

## Step 4: Soldering, Soldering & a Little More Soldering

OK, this proved to be the most solder I have used on a single project ever. With 18 pins per 16 Segment, times 4 plus 26 keyboard keys + 26 keyboard lamps + a few LEDs & 1 SPDT on/off/on switch, that was a lot of solder.

Our decision to raise the 16 Segment displays up to make them look like old-time Nixie tubes certainly added a lot of solder points!

Our Arduino Mega Pin assignment:
Arduino Mega板上针脚的分配：

17 Segments:
Seg Pin Wire DuinoPin
a 2 blue 24
b 1 white 22
c 16 wh-bl 25
d 13 green 31
e 9 wh-br 38
f 8 brown 36
g 6 green 32
h 5 wh-or 30
k 4 orang 28
m 3 wh-bl 26
n 17 blue 23
p 15 orang 27
r 12 wh-gr 33
s 11 brown 35
t 7 wh-gr 34
u 14 wh-or 29
dp 10 wh-br 37
anode1 18 red 39
anode2 18 red 41
anode3 18 red 43
anode4 18 red 45

LEDs:
1 40
2 42
3 44
4 46
5 48

Lamps:
QAP 10
WSY 9
EDX 8
RFC 7
TGV 6
ZHB 5
UJN 4
IKM 3
OL 2
anode1 (First Row) 11
anode2 (Second Row) 12
anode3 (Third Row) 13

Function Keys:
A0

Keyboard:
First Row A1
Second Row A2
Third Row A3

## Step 5: Make a Box and Cut & Drill the Top Plate.

After obtaining the exact dimensions of the original M4 wooden box, we purchased a sheet of plywood & cut it in pieces so we could assemble our case.

We decided to cut a steel plate from an obsolete rack mounted server as it had just the right thickness of metal for our needs. After making a transparency that showed where every button/lamp was located & cutting it out, we were able to superimpose it on the metal piece and draw each required hole with a sharpie.

We then spray painted it textured black to look like the real Enigma.

## Step 6: Integration Tests

First is the permanent fitting of the metal plate on top of the perfboard making sure every button is working and every LED can shine.

Then is the fitting of this solid assembly into the wooden case ensuring we didn't introduce a short anywhere.

## Step 7: Software - Ohhhh.... Ouch!

During each hardware assembly phase, we had created small Arduino sketches that would test the specific individual section we were working on:

A code that tests that each keyboard button is read accurately.
A second code that tests each of the 10 function buttons.

An Enigma_POST (Power On Self Test) sketch that tests that each keyboard lamp can be lit precisely and move each LED through each mode, with some modifications to the original breadboard code to ensure each segment of the 4 16-Segment LEDs is working perfectly.
Enigma_POST（上电自检）确保在每种模式下所有键盘等都能准确亮起，在每种模式下每个LED信号都能传送。我们对原本面包板上的代码做了修正，确保4个16段LED显示的每个部件无懈可击。
But, even with all these sample codes on hand that tested every piece of hardware on the machine, the task of reproducing the encrypting/decrypting functionality of a real M4 Enigma was a Mathematics tour-de-force!

All Arduino sketches will be available on our Github that we are currently setting up.

Here is the Enigma_POST sketch:

## Step 8: More Software!

So we first created a function for each mode the Enigma operates in:

In Mode 0, Default Mode, the Enigma is nothing but a simple typewriter with a Marquee that displays its Model Number.

Mode 1 allows the user to select the 3 (out of 8) Rotors he will use along with which one (of the 2) Reflector he wants to use.

In Mode 2, the user can select the Internal position of each Rotor.

Mode 3 is used to specify the starting (external) position of each Rotor.

In Mode 4, a user can enter up to 10 Swapped pairs of letters.

Mode 5 is Run mode and at that point, the Enigma will encrypt or decrypt any letter typed on the keyboard.

Here is the Complete sketch that runs the whole Enigma:

IF there is enough interest, we plan on are creating a PCB that would will allow for a much easier assembly of this wonderful fully functional Enigma replica. Please visit http://www.stgeotronics.com to find out about availability, pricing & to place your order or pre-order now. The Circuit schematics are published, so the PCB has entered it's development stage. Soon to be tested.

## Step 9: Circuit Schematics

In response to the popular demand, here are the two Circuit Schematics.

The first one shows how our fake nixie tubes (the 4 elevated 16-Segment units) are wired in order to provide the response that the rotors provide on a real Enigma machine. They are also used in each setup mode to provide feedback on the setting up of the machine.

The second one shows how each of the 26 keyboard buttons and 10 function keys, the 26 key lamps & the 5 LEDS are all wired.

All LED resistors are 470 Ohms and all Pushbutton resistors are 1KOhm.

Stay tuned for the PCB design file...

We hope you enjoyed our first Instructable!

## Step 10: Prototype Boards

Due to popular demand, we designed & ordered some Printed Circuit Boards. Well, our PCBs are finally in and at first glance, they look beautiful! We have been busy populating & testing one to make sure it performs as good as it looks and more importantly, as well as our proof-of-concept device.

The boards we ordered are almost perfect: they each need a little jumper wire to fix a small design flaw. This small flaw does not affect behavior or functionality and is an easy fix.

With this jumper in place, you can now make your own Enigma Replica much easier & faster than running all wires this instructable shows. So, we are now happy to report that testing is completed & the new boards work just fine!

We are now accepting orders at www.stgeotronics.com & have started shipping.
Pictures of the assembly have been added as Step 11.

Thank You for your overwhelming support & wonderful feedback!

## Step 11: Assembled Kits

This assembly took one evening & you can look at assembly pictures above for an overview of the process.

Thank You for the support & feedback!