Enigma-E + Raspberry Pi = Enigma Pi

This is a follow-on from my previous post on building the Enigma-E (an electronic version of the Naval Enigma)

Huh. Turns out the Enigma-E can send its stream of cyphertext via a very simple RS232 port on the PCB. Now, what small little device could have fun with that I wonder?

Here’s the idea: Add a Raspberry Pi inside the case of the Enigma-E and create the world’s first Internet-enabled Enigma machine.

So, here’s what we’re starting with; an Enigma-E fully constructed and tested. The cable connected at the front is the current RS232 link.

I needed to get the Raspberry Pi talking to the Enigma-E over RS232. I decided to use an off-the-shelf USB-to-serial adaptor to do this for reasons that will become apparent. Thankfully, Maplin’s stock-item uses a well-supported chipset (PL2303) which the Pi is more than happy with. Plugged it in and there was the new device in /dev. A quick test in the command-line proved the Pi could happily talk to the Enigma-E.

Next, how to get the Raspberry Pi talking to the outside world? I wanted it to be as wireless as possible. Fortunately, Maplin saved the day again with the Edimax N150 Nano USB Wi-Fi adaptor. It’s tiny and supported by the Pi after a firmware update. Instructions on getting all this going are easily found on that Internet thing. A bit of fiddling around and I had a good reliable wifi connection running.

If the Raspberry Pi is going to be inside the Enigma-E’s box, how am I  going to talk to it if can’t get a wifi connection? There’s not a lot of space inside the box and on the front board, so I was reluctant to start making holes for HDMI and USB. Using a little circuit I had previously built, I had a solution. On the first build I had wired up the E’s RS232 terminals to a 3.5″ socket in the front plugboard. This was removed and in place went a hook-up to a logic-level conversion circuit that allows an additional RS232 connection to the low-voltage UART connection on the Raspberry Pi’s GPIO. I’ve covered how to build this circuit in a previous post. RS232 on a Raspberry Pi

Final challenge: Power. The Raspberry Pi needs a nice stable 5V but the Enigma-E needs a minimum 6V. Luckily, it’s also happy with 12V. So, get a cheap (but reputable) car USB power adaptor and gut it. Some drastic shortening of the cables later and we have a tiny 12V-5V convertor on board. I wired this up to the external power input for the Enigma, added a 12V supply and bingo, both devices happily powered up.

A final bit of securing of all the bits into the box, some very careful assembly (and an improved lampboard cover) and I’m done.

Oh, one more thing, we need some logos in a cheap-printed-WWII-style.

Now onto software. A simple PHP script monitors the Pi -> Enigma serial port. Anything coming in is then broadcast as a HTTP request to my server, which receives the request and stores it. When demonstrating the Enigma Pi, a page on the main web site retrieves the store and displays the cyphertext coming in live with some morse audio for good measure.

Thing is, in true software developer yak-shaving fashion, I wanted the person seeing the signal coming in to be able to decrypt it on the web site. I found a couple of Enigma M4 simulators but none were quite up to the mark. So, obviously, I had to build my own. 🙂

It’s taken a few weeks, but it’s done. A fully-functional Enigma M4 written entirely in JavaScript that can be used to send and receive encrypted messages to the Enigma-E.

Well, I’ve come this far, may as well go the whole hog. See, there’s only one Enigma-E, and that’s no fun if you don’t have it with you to play with. As I had developed the site this far, I decided to add the ability to send and receive messages using only the virtual Enigmas and email. I figured this may be useful is demonstrating how Enigma works, especially to younger visitors to Bletchley Park. The result is enigmav.com – The Virtual Enigma.

The site requires a modern browser (support for HTML5) so IE9 or above as well as recent builds of Firefox, Safari and Chrome all work nicely. Do try it out and let me know what you think.

The worst bit? This project has given me another idea. Maybe next year. :S

Send and receive Enigma messages at enigmav.com





4 thoughts on “Enigma-E + Raspberry Pi = Enigma Pi

Comments are closed.