Saturday, April 8, 2017

The MeinEnigma Enigma Machine Kit - Software



In this blog post I'll discuss the software in the MeinEnigma. The controller used is the popular low-cost and easy to program Arduino series of microcontrollers. It uses an Arduino Nano, or an equivalent clone.
Software for the Arduino platform is written in a modified (slightly simplified) version of the C++ programming language, typically using the Arduino Integrated Development Environment (IDE), running on a desktop computer. The source code is compiled to ARM machine code and then downloaded to the Arduino board, usually over a USB serial port. Once on the Arduino, it resides in non-volatile EEPROM, so the program is not lost when the Arduino is powered down.


To program the MeinEnigma, you'll need to download and install the Arduino IDE on a desktop computer. Connect your computer to the Arduino Nano on the MeinEnigma using a USB cable. The MeinEnigma can be powered by the USB port, or you can leave the batteries in, if present.


Once the IDE is installed, you can easily run build, transfer, and run Arduino programs on the MeinEnigma. Most beginners start with the example program that will flash the LED built into the Arduino. Be sure to configure the IDE for the correct serial port on your computer and for an Arduino Nano. Note that running a program from the IDE will overwrite the existing MeinEnigma code on the Arduino.

To build the MeinEnigma software, download the source code from the github site (see the References section at the end of the blog post). It also has dependencies on some third party libraries that you will need to obtain and install. Check the notes in the MeinEnigma source code. At the time of writing the dependencies were an HT16K33 driver and AltSoftSerial library.

If the IDE and third party code is correctly configured, you will be able to compile the MeinEnigma code, transfer it to the Arduino, and run it.

The MeinEnigma code is quite large, currently about 4600 lines of code, and takes most of the available EEPROM space on the Arduino Nano.

There are a number of configurable options in the code to enable and disable features using DEFINEs. The application generally handles any missing hardware and will even run standalone on a standard Arduino.

As well as the Arduino code, the sound files that are played (mostly for voice messages) are stored on the MicroSD card as MP3 files. The Arduino does not have direct access to these files, but it can control the sound board and instruct it to play files. You can insert the MicroSD card in a desktop computer (using a suitable adapter to SD or USB) and modify them if desired. You can study the source code to understand which sound files are used for specific sounds.

Once you have the code running, you can make changes to customize it yourself. If you have a useful feature or bug fix, you can request to contribute it back to the official code using a git "pull request".

Here are a few possible things you could try to modify:

  • change the sound files for a different voice or language
  • change the startup message on the LEDs
  • add support for another model of Enigma

References


  1. MeinEnigma website: http://meinenigma.com
  2. Source code: https://github.com/lpaseen/meinEnigma
  3. Arduino software downloads: https://www.arduino.cc/en/main/software
  4. HT16K33 Arduino code: https://github.com/lpaseen/ht16k33
  5. AltSoftSerial Arduino library: https://github.com/PaulStoffregen/AltSoftSerial

No comments: