How to build a LEGO printer from the Mindstorms EV3 kit
I decided to build a printer using only the LEGO Mindstorms EV3 31313 set. I’ve seen a lot of attempts on the internet, but the one designed by Ralph Hempel seemed to me as the best.
This video shows the result
Building the printer is a process of a series of steps:
– Assembling the bricks
– Programming the motors
– Inserting the paper roll correctly
– Designing and customizing the letters or drawings to be printed
– Iterations and debugging
I won’t go deep into all the steps in details, only those tricky ones. If you have any ideas, questions or answers, feel free to post them!
Assembling the bricks
The machine is complex, therefore, if you had to build this printer from scratch, this could take some time. Luckily we don’t have to! Building instructions can be found here and downloaded directly to your EV3 programming environment. Ralph has made the instructions consisting of 58 steps, together with Philippe Hurbain, a notorious NTX and Ev3 designer.
Programming the motors
The same procedure goes for this step. The code for the motors is in the same file but it is good to know a little about what it does. The printer consists of three motors. The A-motor moves the pen up and down the y-axis, the B-motor lifts and lowers the pen and the C-motor moves the paper back and forth the x-axis . These three motors all works together at the same time. They have to be perfectly synchronized (though i doubt that it is the case all through…more about that later).
Inserting the paper roll correctly
This step is tricky. If you do this wrong, your letters will come out mirrored or paper will move backwards. There is so many ways this can be done wrong. Hopefully these pictures will help:
Of course you will need a credit card paper roll. If you don’t have a cash register at home, ask in any shop! They have it…and my experience is that they will give it to you for free (or very little charge)
Designing and customizing the letters or drawings to be printed
In the programming environment, remember to define when the pen is lifted and when it is down drawing. Next to the y-coordinate there is a true/false checkbox. True = pen lifted, false = pen down. It will look like this:
And when printed, its gonna look something like this
I wanted to make my own xy-alphabet so that I would be able to write anything but it would take too long, so I just made a bunch of letters so I could write “CODING PIRATES” – the name of my upcoming learn-to-code app and the name of the startup coding club that we will be launching in Copenhagen, Denmark in february 2014. The print looks like this:
Afterwards I wanted to print in a style that was less plotter, more binary and true to how printers work. I wanted it to take one horizontal line at the time. I chose to make the IBM logo and started convert it into coordinates:
I think the printed result was really good:
Iterations and debugging
I discovered a bug when printing “CODING PIRATES”. The letters of the print were curved instead of linear and the bottom of the letters were lower than the top. The pen seemed unable to draw lines that were using y-coordinates lower than 30. Instead it draws a horizontal line. This could be of many reasons. One could be the start position of the pen. Ralph recommended me to position the pen in the far position. But this gives the pen a start position that is approximately the y-coordinate 70 and unable to go lower than y-coordinate 30. If I instead put it in a start position that are closer to the middle (y-coordinate 50) it should be able to cover a wider spectrum. I then tried to make the printer draw a star with 20 edges, the result was really poor.
To test the thesis, this it my predicted outcome of the print of a circle based on the same 20 coordinates from the star with 20 edges. In the upper right corner is the printed outcome of the circle. As you see, the prediction came pretty close.
Also it could be that the x and y-motors aren’t completely synchronized. It looks like the y-motor (the one moving the pen) somehow moves before the x-motor (the one moving the paper).
Finally it could be what happens, when you convert linear movements into circular. The y-motor moves in one dimension but uses a 2×4 liftarm and to ball joints to do the job. When the pen is in the far position and near position and the 2×4 liftarm is stretched, the pen only makes small movements. But when the pen is in a middle position and the 2×4 liftarm is 90° position from the pen, it can make big movements. This picture shows my thesis:
I am not sure if this has been taken into account in the code. The solution could be a piston of some sort?
My next move would be to code the entire alphabet (including common signs) and create a function that recalls the letters, so I won’t have to copy paste the coordinates every time. This way it could almost be like a real printer. I would like it to print four letters in the horizontal lines. This will enable me to print more on less paper.
Ralph Hempel did a fantastic job when he originally designed the plotter. He btw. is a clever and creative guy and interesting to follow. At this moment he is working on putting a Debian Wheezy on the EV3 brick, so that you can program directly to the brick using conventional programming languages and without using the official IDE that he thinks is buggy (And I agree!).