An Enigma Machine Using ESP

by sriramrepaka29 in Circuits > Arduino

440 Views, 0 Favorites, 0 Comments

An Enigma Machine Using ESP

PCB_Enigma.png

I designed an PCB for a functioning enigma machine. I am using an ESP module and Arduino nano. I have also used tactile buttons for the keyboard. We have to encrypt messages and send using the ESP module. I thought it would be fun to send messages using an Enigma machine using tactile buttons.

Supplies

PCB.jpeg
Nano.jpeg
OLED.jpeg
esp.jpg
6x6x8mm-Tactile-Push-Button-Switch-2.jpeg
  1. Arduino Nano
  2. OLED display (Adafruit OLED 128X64)
  3. ESP-12E ESP8266
  4. 6mm X 6mm X 8mm
  5. PCB that I ordered from PCB way

PCB Design

I started by designing a PCB. I designed the PCB in Proteus 8. I decided to Arduino Nano and ESP module. I started by selecting the required parts from the Proteus and made the circuit connections like connecting all PWR and GND pins to each other. Then I started designing the keyboard. A generic keyboard has 104 keys but an Arduino nano has only 20 GPIO pins in total, so it not possible to have one pin for each key. So, I used the matrix method that is I assign all the keys in a matrix of nearest square to the number of keys. For example I am using English keyboard so I need 26 keys for alphabets and 1 key for space and 1 key for "enter" and 1 key for "cancel" and 1 key for "back" so 30 keys in total, for this I will choose a 6X6 matrix as 36 is closest to 30.

Why a matrix? will be a good question to ask. So basically I will all the keys to a common PWR with common GND with Arduino. Then I will connect the other end to 12 pins of the Arduino. Why 12? because 6 rows and 6 columns of the matrix. So imagine a 6X6 grid with all switches interconnected as well as connected to power, so when I press a key 2 lines will get power one in a row and one in a column.

Let us say I connected all rows to D1, D2, D3, D4, D5, D6 pins and all columns to D7, D8, D9, D10, D11, D12 pins of Arduino nano. Now let us say connected all the keys/switches in 6X6 grid and connect them to PWR and If I press 2nd key in 2nd row then the like connected to D2 and D8 will read HIGH in Arduino. Pressing(Turning on) that particular switch will complete the circuit and the corresponding 2 lines will have current flowing in them rest others will have no current.


for detailed explanation : http://blog.komar.be/how-to-make-a-keyboard-the-matrix/


So after I downloaded the button library in Proteus I connected them accordingly and moved them to the desired connection. I decided to add a D-Pad and more keys for space-bar, I also added a J2 connector for simplicity .I then started the PCB design in Proteus itself. I stated with placing Arduino nano and ESP modules such that I micro USB aligns with any one side of the PCB so that it will be easy to connect. Finally I decided on the keyboard layout looks like most of the generic key boards.


If you want to order the same PCB dump these files in PCB way and directly order.

Link : https://drive.google.com/drive/folders/1weelv5yNeUAWkTz3LHP3tasv7DVgOTZE?usp=sharing


Soldering on to PCB

After I received the parts I started by soldering them and started by checking if the buttons were working fine. I first connected the J2 connector and gave power and check the components by placing then in their respective holes. I then went on and added the Arduino and ESP module.

Keys for Buttons

I used 3D builder in windows to design buttons that would look like they were from a typewriter. I will attach and discuss about them in a new project. Please wait and check them out.

Code

There are many GIT hub codes available for this enigma encryption and they are very easy to use and understand.


Few of them.

https://github.com/mjculross/Enigma_Visual_Simulator

https://github.com/Menyiques/Enigma

https://github.com/arduinoenigma/ArduinoEnigmaEngineAndUhr