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.

Instructions

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.

Printing

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.

24 thoughts on “Telegraph Machine and Printer

  1. Oh, and it also did not lift or lower the pen and move to the left(also the pen)

  2. Hi! Jason! i’m a big fan of yours and i saw this lego mindstorms printer on youtube and so i built it.(somehow i can build it out of the lego mindstorms education set + some parts.)so anyway, i had a few problems with it.i ran the printer program, and it fed the paper in.Then i tapped in the letter “o”,and it did nothing! i checked the wiring and it STILL DID NOT WORK! would someone tell me why???????????

  3. What type of paper did you use? I tried using regular printer paper, but it didn’t fit.

  4. I am trying to add my own letters to the printer and when I look in the my blocks I don’t know what seg4 seg3 seg2 means can someone tell me? It would be much appreciated

  5. 펜을 들어올리는 모터가 이상해요.

  6. Can we somehow make this printer from EV3 Education Set. The small wheels below the assembly of pen holder, which helps the pen holder to slide, is not available in Education Set. It has only wheel hub and not the tyres above it. If you could guide please.

    • Unfortunately, I don’t have the education version of the set, so I’m not sure how easy it would be to recreate something like this with it.

    • Try putting in the Technic Gear 12 Tooth Double Bevel instead. It worked for me.

    • i solved your problem!you just need to buy some other parts for the missing ones

  7. i have a problem the motor that lifts the pen doesnt actually lift it can i change the power and rotation of it in the program and how?

  8. Hi Jason, I’m a big fan of your’s, and would you post the instructions for the telegraph key?

    Thanks

    • Thanks! Unfortunately I’m on vacation for the summer, but I’ll see what I can do when I get back.

  9. Does this use additional parts(Besides the gel pin) outside of the ev3 home edition kit? I want to make one myself but I only have the home kit.

    • All the pieces you need to make it are in the Home kit (other then the pen and paper).

  10. Awesome! Your test page should start with the quick red fox “jumps”, not “jumped” in order for the sentence to have the letter ‘s’ 🙂

  11. When I run the program it prints horizontally and backwards…. can anyone explain the to me?

  12. Never mind,
    I found out that one of my wires was broken and had to replace it with another.
    Thanks anyway! 😀

  13. Hi Jason,
    I love your work on YouTube, and I wanted to build your Lego Mindstorms Ev3 Printer. So I did but once I finished building it using your instructions and copied the program that you wrote on to the Ev3 brick, and ran it, it didn’t fully work. I ran the “Printer” program and put in the paper. It pulled it in and stopped on top of the Color Sensor. Then I waited for a moment and typed in the letter “S” and it showed up on the brick’s display, and the pen went in to the right position (top left corner) and shot the paper out of the system drawing a long line across the paper. Would it be because I built it incorrectly or would it be your program? If you could help me that would be great.
    Thanks!

Comments are closed.