Tuesday, April 4, 2017

The MeinEnigma Enigma Machine Kit - Assembly



In this post I'll continue the discussion of the MeinEnigma kit, this time describing my experience in building the kit.

It should be noted that this was for a beta version of the kit. Some changes to the construction method, assembly procedure, and physical parts are planned to be made before the kit goes into general release.

I was the first customer for a beta release of the kit; my unit was serial number 16. As I have a lot of experience building kits and live in the same city (Ottawa, Canada) as the developer, I was a good candidate to try out an early kit and give feedback on it.

This was the hybrid version of the kit, with all through-hole components with the exception of three SMT ICs that need to be soldered.


The kit came in a box with a nice printed label. All parts were included with the exception of batteries.

The PCBs are double-sided with plated-through holes, soldermask, and silkscreen on both sides. The design is somewhat unique in that there are pads for both SMT and through-hole parts.


All the parts come organized in small bags with identifiers on them that match the instructions in the assembly manual. This goes a long way in minimizing any errors in components or needing to identify them.

I made an inventory against the provided parts list and confirmed that all parts were there. The parts are grouped into five sub-assemblies that are built separately (corresponding in most cases to different circuit boards). I separated the parts for each assembly.


One of the reasons this was still considered a beta kit was that the assembly manual was not yet complete. It was in pretty good shape though, with detailed instructions and pictures for all the steps of the construction.

Lamp and Key Board


Construction started with the lamp and key board, the largest PCB but one without too many parts - mostly the 26 keyboard keys and 26 LEDs.

The first step was to install the HT16K33 IC, a 28-pin SMT device. I was a little anxious about this as I have only limited experience with soldering SMT devices by hand. Before installing it I refreshed my memory of SMT soldering techniques by watching some YouTube videos and doing some practice with some SMT parts on a piece of bare copper PCB.

As well as using a temperature controlled soldering iron and small diameter solder, I used some flux paste, applying it to the pads on the board. The initial alignment of the IC is critical. You solder one corner pin, get the chip correctly aligned, then solder the opposite corner. It is important not to proceed with soldering the remaining pins until it is correctly aligned. Soldering the remaining pins should then be quite easy. In the past I have done SMT soldering without paste; I believe the solder paste really helped the solder flow and avoid solder bridges between pins.


I used a digital multimeter in continuity test mode to verify that all the IC pins were making contact with the board and that there were no shorts between pins.

The assembly continued with two diodes and 13 resistors. These were through-hole parts. The SMT version should also be straightforward to solder. Often the biggest challenge with SMT is being able to identify the parts and avoid dropping and losing them.


Next there are 26 keyboard switches and 26 LEDs to install, and then some connectors. The last step is to install the four standoff feet and then assembly of this board is complete.

Encoder Boards


The four wheels, known as rotors, use rotary encoders. Each encoder is installed on a small custom PCB which is later connected to the main board using a four pin connector and a plastic bracket. Each board needs to have the encoder and connector soldered in. They are then set aside until final assembly. This step went smoothly.

Main Board


The main board has the most components. It starts with some through-hole components including fuses, a diode, and resistors. Two DIP ICs are installed using sockets. There are a number of connectors to install, and then an Arduino Nano (or equivalent clone) which is mounted on headers so it can be removed if needed. A sound board is installed, then the DC-DC boost convertor which is on a small PCB.


Other parts installed are a large filter capacitor, four keyswitches, a small speaker and piezo buzzer, the "big red switch", rotary function switch, and the four alphanumeric LED displays.

Construction wraps up with the battery holder and real-time clock module.


You can now complete the mechanical assembly of the main board by installing the standoff feet and assemble the rotors by inserting the wooden disks on the encoders, and then installing each of the four rotors to the main board using a plastic bracket.


Incidently, the four rotors are made from wood and laser cut. This is one of the features that makes the kit a more realistic replica of the original Enigma than some designs that just use buttons.

At this point the two PCBS can be connected using a ribbon cable and the system can be tested. Before doing so, I carefully inspected everything for opens, shorts, and incorrect components or orientation.

Plugboard and Cables


There is still one PCB to be assembled, the plugboard.

It has two more SMT ICs to solder. I wasn't entirely pleased with the job I did on the first IC on the lamp/key board, but I must have improved with practice because these ICs were better aligned. I did have to reflow the solder on some of the pins on the SMT ICs to ensure all were making good connections.

This board also has 26 suppressor diodes, a connector, and 26 banana jacks to install (the latter do not need to be soldered).


The plugboard also includes 10 patch cables. These are assembled by cutting the wire into 30 cm lengths and installing a banana jack on each end. The cloth-covered wire that is supplied is a nice touch and looks similar to the wiring typically used in a real 1940s era Enigma machine.

Final Assembly and Testing


The plugboard physically connects to the lamp/key board using some brackets and electrically connects with a small ribbon cable. This completes the assembly. You are now ready to install batteries and test the unit. The Arduino comes preprogrammed with the software, as well as the microSD card containing the sound files for audio output.

In general, I found that assembly process was straightforward despite the assembly manual not yet being complete.


There was one issue with the LEDs. It seems in the last batch of parts that were received, the manufacturer changed the orientation of the LEDs so that they don't follow the standard convention as indicated by the longer and shorter leads and flat side on the component.

Fortunately it didn't take long to figure this out, and it was relatively easy to unsolder and reinstall the LEDs with the correct orientation. I also had one bad LED which did not work at all.

It seems that there could be a reasonably high failure rate with these LEDs, so Peter Sjoberg will be individually testing all the LEDs shipped in the kits to avoid any problems (as well as correcting the assembly procedure).

Summary


Building this kit was a lot of fun. I took my time, and built it in three sessions of a few hours each, over a weekend.

The kit should be buildable by anyone with a moderate experience in soldering. If you aren't experienced with SMT soldering you could opt for the through-hole version of kit where the SMT parts are already installed.

In a future blog post I'll go over the operation of the MeinEnigma, its features, controls, and examples of how to encrypt and decrypt messages.

References

  1. MeinEnigma website: http://meinenigma.com
  2. MeinEnigma YouTube channel: https://www.youtube.com/channel/UC3s44doR_q1fKQ4ZMUeAlHQ

Monday, April 3, 2017

The MeinEnigma Enigma Machine Kit - Overview


Introduction

I recently had the opportunity to build a beta version of a new kit, the MeinEnigma, a replica of the famous Enigma cipher machine, designed and offered by Peter Sjoberg.

In this, and some future blog posts, I will describe the kit, how it works, assembly of the unit, and the hardware and software behind it.

What Was The Enigma?


The Enigma machines were a series of electro-mechanical encryption devices developed to protect commercial and military communications. Most notably, they were used by Nazi Germany during Word War II.

Due to some weaknesses in the design, as well as procedural flaws in how they were used, the Allied were eventually able to find a way to break the encryption (which had to be done every day as the encryption settings were changed daily), which is believed to have been a significant factor in winning the war. Much of this work was done in England at Bletchley Park by a team that included Alan Turing, someone well known to most computer scientists. This story has been described in many books and documentary films, including the popular 2014 film The Imitation Game.

While as many as 100,000 Enigma machines are believed to have been made, most were destroyed and only a few hundred exist today. An original machine can be worth well over $100,000 and most are in museums. I've personally seen two: one in the Canadian War Museum in Ottawa and another in the Spy Museum in Washington, DC.

That puts a real Enigma machine outside the reach of most collectors or enthusiasts. There are software simulators, but it is more fun to have a device which physically looks and works like the original Enigma machine.

Kit Features


MeinEnigma is an electronic version of an Enigma machine, with a similar size and controls to the original, but using modern electronics rather than mechanical parts to implement the encryption functions.

The design is based around the popular and low-cost Arduino microcontroller, allowing the software to be easily modified by the user. The software is open source and can emulate a number of different models of Enigma machine. As well as the controls on the board, the unit can be controlled through the Arduino's USB serial interface.

It has a similar physical size and controls as the original Enigma machine. It has a 26 alphabetic keys and 26 indicator LEDs as well as four rotatable rotors that are similar to the original Enigma.


It also has a four character alphanumeric LED display with four buttons and a function switch. There is a speaker which is used for sound output, including authentic rotor rotation sounds and speech output for the encoded characters and operating functions.

A buzzer can optionally produce Morse code output (the original encoded Enigma messages were sent by radio using Morse code).

A real-time clock chip with battery backup allows the system to be used as a clock when not in use for encryption.


Like the original Enigma, the front panel features a plugboard with 26 positions and 10 patch cables. It can be powered by 2 AA batteries or from the USB port on the Arduino.


The unit will be sold as a kit that the user assembles. The kit includes all parts and should be buildable by anyone with some basic experience with soldering and identifying components.


It is built on three printed circuit boards (PCBs) that are interconnected by cables.


The kit is planned to be sold in three versions. The SMT version will use all Surface Mount Technology components (with the exception of parts like the Arduino, sound module, and real-time clock). This will require experience with SMD soldering, which is doable by hand using a soldering iron. The TH version will use through-hole components, with three ICs that are only available as SMT parts being already soldered in for you.


A hybrid version be the same as the TH, but the user will need to solder in the three surface mount ICs. This is the version I built. All three versions use the same PCB.

The kit will include several manuals. While this could still change, my understanding is that it will include an Assembly Guide, User's Guide, Enigma History Guide, and a Modification Guide.

Summary


There are some other Enigma kits on the market, or that have been offered in the past. They range from electronic versions like the MeinEnigma, to accurate mechanical replicas of the original Enigmas which can sell for tens of thousands of dollars. I haven't personally tried any of them, but this kit offers a number of advantages and nice features, most notably a design which features a similar size and rotors, keyboard, lamps, and plugboard that resemble the original Enigma machines. The Arduino controller makes it very easy to modify the software. It also has support built in for future expansion and user modifications.

I hope as the number of users of this kit expands, a community will form around it to enhance the software, support each other, and find interesting applications for it.

In the next blog post I plan to cover my experience assembling the kit.

References

1. MeinEnigma website: http://meinenigma.com
2. Source code: https://github.com/lpaseen/meinEnigma
3. Facebook group: https://www.facebook.com/MeinEnigma
4. Wikipedia article: https://en.wikipedia.org/wiki/Enigma_machine

Sunday, February 26, 2017

Building a 68000 Single Board Computer - Revision 2.1

I've now updated the design with some changes that I call revision 2.1. It is in a different github directory from revision 2.0: https://github.com/jefftranter/68000/tree/master/TS2/v2.1

In revision 2.1, the large and hard to obtain MC14411 baud rate generator is replaced by a smaller, simpler circuit using the more easily obtained 74HC4060. The difficult to obtain 25LS2548 chip is replaced by more commonly available parts.

Both circuit changes were tested with the wirewrap prototype and a breadboard.


I've done a new PCB layout and checked it reasonably carefully. I'm confident enough in it that I have ordered some boards from easyeda.com. These will take some time to arrive. I plan to build up one board using the parts from the wirewrap prototype.

Friday, February 10, 2017

Building a 68000 Single Board Computer - PCB Layout

Plot of PCB Layout from Kicad

I spent some time learning how to use Kicad's PCB layout software and created an experimental board layout. I had never laid out a circuit before using CAD software before, so there was some learning curve and I may have made some rookie mistakes. The routing was all done using the FreeRouting software. The resulting layout is quite complex but looks pretty good. It is a double-sized board, and based on the board size, it looks like it would cost about US$200 - US$250 to have three high-quality boards made from a supplier like OSH Park, and less from some manufacturers in China. Before I did that I would probably carefully review the layout a little more.

All files can be found at github.

3D Rendering of PCB Layout from Kicad

Expensive? Well, I just saw a Motorola MEX68KCB MC68000 Educational Computer Board show up on eBay. The minimum bid is US$295. It will be interesting to see if it sells.

Sunday, January 22, 2017

Building a 68000 Single Board Computer - Possible Future Enhancements

I've learned a lot with this TS2 project and done much more with that than I had originally hoped. While I have some more things to work on, I think it is time to put it on the back burner for a while and get back to some other projects.

Looking forward, it might be interesting to do a new revision of the board, which I could call revision 2.x (I called my version 2.0 since it revised the original Teesside design).

Here are some thoughts on some possible changes and features in a new version.

Printed Circuit Board Layout

A printed circuit board would make it much easier and faster to assemble than the wirewrap prototype. Professionally manufactured PCBs that are double-sided (or more), silkscreened, and solder masked can be obtained very inexpensively now from a number of vendors. Since the design is now in a CAD system (kicad) which has a PCB layout facility, it should not be too much effort to lay out a board. I've never used kicad for PCB layout or even laid out other than very simple single-sided boards, so this would be a good learning experience. Now that the design is proven, the risk of a PCB layout should be quite low.

Replace Baud Rate Generator With Fixed Clock Oscillator/Counter

The Motorola MC14411 baud rate generator chip used in the current design is a little difficult to obtain and overkill if only one baud rate is ever used. Newer UART chips have on-chip baud rate generators, but assuming the design stayed with the 6850 to remain software compatible, a baud rate generator could be created with simpler and more easily obtained circuitry. This link, for example, shows how to do it with a 74HC4060 and the existing 1.8432 MHz crystal.

Support Higher Baud Rates (Through Jumpers or Software)

It would be desirable to be able to run the serial port at baud rates higher than 9600, when downloading programs for example. A new baud rate generator circuit would allow this, since the 6850 can run at higher rates given a suitable clock.

Add One Or Two PIA, VIA, or PIT Chips

A parallel port would allow controlling hardware. This could be the Motorola 6820 or 6821, the more powerful MOS Technology 6520 or 6522 VIA, or the Motorola 68210 Parallel Interface/Timer (PIT) which was present in the Motorola ECB.

Optionally Support Line Drivers/Receivers For True RS-232 Serial Ports

True serial ports might be desirable for some users, so the line driver/receiver circuitry from the original TS2 could be included as an option. This could be simplified by using a chip like the MAX232 which does not require +/12V supplies.It might also be useful to support hardware handshaking with RTS/CTS, which currently do not connect through to the FTDI connectors.

Add Connectors For External Parallel I/O, Interrupts, Etc.

A connector for some external signals would be useful if there was a parallel port. The interrupt lines could also be available here.

Replace 25LS2548 Chip

The 25LS2548 decoder chip is quite hard to obtain and may be an impediment to people who want to reproduce the circuit. This could be replaced by more commonly available chips. Probably a 74LS138 decoder plus a 74LS06 open collector driver and maybe and another gate or two.

On-board 5 Volt Power Regulator

To allow running off of unregulated power, an on-board 5 volt regulator could be added, either a 78L05 series regulator or a more modern buck converter.

Add an LED Display

A seven segment LED display would be useful for diagnostics and other purposes. This could be driven from a PIA (if present) or with dedicated circuitry (see the Clements book p.649 for a possible approach to drive a 7 segment LED).

Prototype Area

If there is room on the PCB, an area with a grid of 0.1" holes could be provided for prototyping.

Support Either RAM or EPROM/EEPROM In All Sockets

With a few changes, the design could support either RAM or EPROM/EEPROM chips on any of the memory sockets (the boot code would need to be in ROM). This would allow, for example, 48K or RAM for users who only needed 16K of ROM). It might also be handy to optionally (via a jumper) allow the EEPROM devices to be written to.

Support Larger RAM and ROM Chips

Larger RAM and ROM chips (e.g. 27128, 27256, etc.) are available and could be supported to allow more memory. This would impact the memory map and address decoding circuitry and make it more complex. Given more RAM, the board could potentially run a stripped down version of an operating system such as Linux or Minix.

Mass Storage for File System

To run a "real" operating like Linux would require some form of mass storage for the file system. This could be done with some flash memory and some suitable interface, maybe using an SD card interface intended for Arduinos. This is probably more of a version 3.x feature (at which point maybe I could add video, a real-time clock, Ethernet, etc.)

Saturday, January 21, 2017

Building a 68000 Single Board Computer - Books


While there are many excellent web resources on the 68000 microprocessor, this is something of a nostalgia project and printed books still have a lot of appeal. I'd like to mention a few books on the 68000 that I own and have found useful.

Microprocessor Systems Design 68000 Hardware, Software, and Interfacing, Third Edition, by Alan Clements


This is the book that the TS2 design is described in. At almost 1000 pages, it has full coverage of hardware and software for the 68000 series up to and including the 68030. Everything is presenting in logical manner with many diagrams. If you are more interested only in the software side, you can skip the relevant sections. It came with a CD-ROM that includes a number of tools including a 68000 cross-assembler and simulator.

An Introduction to 68000 Assembly Language, by R.A. & J.W. Penfold


This little book represents the opposite end of the spectrum. Aimed at people who might have owned a 68000-based microcomputer like an Apple Macintosh, Commodore Amiga, Atari ST, or Sinclair QL, if presents the basic of 68000 assembly language programming. In it's 100 or so pages it covers the basic programming model, instructions, and address modes and give a few program examples Nothing is specific to a particular computer. It doesn't go into a lot of depth, but meets the goal of a small pocket-sized book that was inexpensive (British Pounds 2.95 at the time).

68000 Assembly Language Programming, Second Edition, Lance A. Leventhal, Doug Hawkins, Gerry Kane, and William D. Cramer.


This book was the 68000 version of a very popular series of books by Osborne that covers assembly language programming (I also have the 6502 version). At almost 500 pages, it provides extensive coverage of the 68000 including architecture, instructions and addressing modes. It includes many diagrams and dozens of detailed basic and advanced code examples. This edition also covers the 68010 and 68020.


On the hardware side I also referred to my Engineer's Notebooks by Forrest M. Mims III to refresh my knowledge on TTL gates and best design practices.

Friday, January 20, 2017

Building a 68000 Single Board Computer - Another Forth



I found another Forth implementation for the 68000 here. This one was distributed by Albert van der Horst from a Forth group in Holland. Unlike eForth that I described in my last blog post, this one
is compatible with the fig-FORTH standard.

It comes with default I/O routines to use a 6850 UART address $10040 (presumably the Motorola ECB), the same as my TS2.

I was able to build it with the VASM assembler with one trivial change. Loading it onto the TS2 over the serial port, it came up and seems to work fine.

Here is a sample session:

TUTOR  1.3 > GO 3648
PHYSICAL ADDRESS=00003648

68000 fig-FORTH V1.0 
1 2 3 4    OK
. 4    OK
+    OK
. 5    OK
* . 1    OK
." HELLO, WORLD! " HELLO, WORLD!    OK

( LARGE LETTER-F)    OK
: STAR 42 EMIT ;    OK
: STARS 0 DO STAR LOOP ;    OK
: MARGIN CR 30 SPACES ;    OK
: BLIP MARGIN STAR ;    OK
: BAR MARGIN 5 STARS ;    OK
: F BAR BLIP BAR BLIP BLIP CR ;    OK


                              *****
                              *
                              *****
                              *
                              *
   OK

I think it's time to dig out my old copy of Starting Forth by Leo Brodie and refresh my knowledge of this programming language.