Telegraph Machine and Printer

One project that had been on my to do list for a long time was to build a working printer using a single LEGO Mindstorms EV3 kit (31313). In addition to having basic printing capabilities, I also wanted an easy way to tell it what to print on the fly, without having to manually change the program. For that I added a touch sensor, essentially turning it into a telegraph machine, so that you can tap out a sequence of letters using Morse Code which it will then print.

I put together building instructions for it, which you can find along with the program file and more detailed information about how it works, down below.

The printer is designed as a plotter, using a gel pen mounted on a carriage to deposit ink on the paper. It can accommodate standard sheets of letter paper cut in half. I posted a video a couple of months ago explaining how the printer works in detail, which you can watch here.

I hope to explore different ways of sending information to the EV3 unit to print, but the first step was to program it to print text on demand. The advantage of using Morse Code is that it is an extremely simple and effective way of communicating textual information, that requires only a single touch sensor to implement. In this video you can see the telegraph machine in action.

Building Instructions

Here are the building instructions and program file for the printer/telegraph machine. If you build your own, be sure to read the detailed instructions below on how to configure it and get it working correctly.


Building Guide

PDF File

Digital Model Files

LDraw File

Wiring Instructions

Motor Ports

A – the large motor that moves the pen from side to side
B – the large motor driving the paper feed wheels
C – the medium motor in the back that lifts the pen assembly up and down

Sensor Ports

1 – the touch sensor used to encode the Morse code sequence
4 – the color sensor underneath the printer

Pen Calibration

Before doing any printing, you will want to calibrate the height of the pen by following these steps.

  • Insert the pen into the pen holder. The pen should be positioned so that when the pen holder assembly is at its lowest position (the default position in the instructions), the tip of the pen is approximately just below the level of the paper.
  • Manually slide the pen holder horizontally until the pen is roughly centered in the printer (if it isn’t already).
  • Manually set the pen holder assembly to its highest possible position. To easily do this, disengage the 24 tooth gear from the worm gear by sliding it to the side along its axle. Raise the pen assembly, then slide the 24 tooth gear back to re-engage the worm gear.
  • Run the Calibrate program on the EV3 unit. The pen will lower and start moving continuously from side to side above the page.
  • Press the down button on the EV3 to lower the pen a little. Repeat pressing the down button until the pen lowers enough to touch the paper and start depositing ink.
  • Press the center button on the EV3 to indicate that the pen is at the desired printing height. After its next full pass, the pen holder assembly will return to the raised position and the program will end.


The main printing program to run is called Printer. It will wait for the user to enter Morse Code sequences and print the corresponding letters that are encoded. If a sheet of paper is not already in the printer, it will first operate the paper feed motors to pull a sheet into the printer until it covers the color sensor.

Once the paper is fed into the printer, you can start tapping out Morse Code on the touch sensor. Make sure dots are really quick taps on the touch sensor, and dashes are held down for a little while. If you correctly tap out the Morse Code for a letter, it will display the letter on the EV3 display before printing it. If it doesn’t recognize a sequence, it will issue an error beep and the EV3 light will turn orange. Currently, it only understand the codes for the basic Latin alphabet, which you can find many places online (or you can reference the image of the code book I made below).

Don’t be discouraged if you have trouble getting it to recognize letters. It might take awhile to get used to the timing. Practice with simple letters like E, T, S and O before moving to letters with more complicated sequences.

I’ve programmed it so it isn’t a strict implementation of Morse Code timing, so that it is a bit more friendly for novices. As such, I have also added two additional codes to explicitly add a space and start a new line.

Space: . – . – (dot dash dot dash)
New Line: – – – – (dash dash dash dash)

You don’t have to wait for the printer to print a letter before tapping out the sequence for another letter. In fact, you can get well ahead of the printer if you are fast enough, just make sure you pause long enough between each letter. The program keeps a queue of all the letters that have been encoded and will eventually print them all.

Important! To stop the program, press the center button on the EV3. It will return the pen to the raised position and feed the printed sheet of paper out. If you just cancel the program like you would normally, you will have to reset the pen position manually and probably have to re-calibrate it.

Printing a Test Page

If you want to print a full test page like I did in the printer video, you can run the PrintTestPage program.

Program Overview

If you poke around the program you will notice it is fairly complex, and there are a lot of MyBlocks. Most of these are documented via comments within them, but you may be asking ‘Where do I start?’. The main programs are a good place to start, as you will see the high level MyBlocks that they use to operate the program.

Aside from the main programs, there are a few MyBlocks of particular interest. The ReadCode and TranslateCode MyBlocks are used to read the sequence of button presses from the touch sensor and translate the Morse Code into a letter index. The letter index is then added to the letter queue to be processed.

The ProcessQueue MyBlock will continuously wait for and process letters added to the letter queue by the encoding MyBlocks. As it processes each letter, it will call the corresponding letter MyBlock to print it.

Wireless Telegraph

If you happen to have 2 Mindstorms units, you can set one up with the touch sensor as the transmitter, and one connected to the printer as the receiver,. The transmitter can then send the text sequence to the receiver wirelessly using Bluetooth.

To do this, you will first need to configure the 2 EV3 units so they can communicate via Bluetooth. To do that follow these steps.

On the EV3 unit being used as the transmitter.

  • Go to the settings page, select Brick Name and name the brick TRANSMIT.
  • Go into the Bluetooth settings and make sure ‘Visibility’ and ‘Bluetooth’ are checked.

On the EV3 unit connected to the printer.

  • Go to the settings page, select Brick Name and name the brick RECEIVER.
  • Go into the Bluetooth settings, make sure ‘Visibility’ and ‘Bluetooth’ are checked.
  • Select ‘Connections’ and select ‘Search’. It should find the TRANSMIT brick. Select it.

On the EV3 brick configured as the transmitter, run the Transmitter Program. On the EV3 brick connected to the printer, run the Printer program.