We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

A Python-powered pantographic plotter

00:00

Formal Metadata

Title
A Python-powered pantographic plotter
Subtitle
A Python-powered drawing machine
Alternative Title
The world's cheapest, simplest plotter: A Python-powered drawing machine
Title of Series
Number of Parts
118
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
I present an ultra-cheap (total cost of materials :€12.50) plotter that can be built with minimal skills. At its heart is a Raspberry Pi Zero and some relatively custom software, driving three servo motors. The mechanical hardware can be built from nothing but stiff card, a ball-point pen and some glue. The only tools required are a ruler, a sharp knife, a screwdriver and something to make holes in the card. Almost everything required can be found in a desk or kitchen drawer. The entire device can be built with no special skills in about an hour (and much of that time will be spent getting the glue off the kitchen table before you get in trouble). It can also function as the world's most inconvenient camera: take a photo using the Raspberry Pi's camera, convert it into lines, and draw it. This is fun, but it's much more than that. There are barriers of skill, expense and materials around robotics. This project comes with me to African PyCons, and makes it possible for programmers to explore Python-based robotics, however limited their resources. The tools and complete kit of materials to build several plotters can be carried in a small box. The plotter code is published on GitHub: https://github.com/evildmp/PantoGraph. The code for converting bitmaps to cartesian vectors is at https://github.com/evildmp/linedraw/. I expect this to appeal to anyone who is interested in the idea of Python-driven robotics but is put off by the cost and complexity of hardware required actually to achieve something. It will be particularly of interest to people involved in education, or who'd like to explore Python with young people. The code, mathematics and especially the hardware in this project are all simple. The code resists the temptation to abstraction, and makes a point of breaking operations down into steps that are as easy as possible to follow. The project shows that doing things with robotics isn't just for people with well-equipped workshops and the engineering skills to use them.
Keywords
20
58
PantographPlotterPersonal digital assistantProjective planeComputer programmingMereologySpacetimeHacker (term)Universe (mathematics)VideoconferencingProcess (computing)Event horizonHydraulic motorMathematicsRegular graphComputing platformBitSoftware developerCore dumpPentagonWave packetPoint cloudArmLattice (order)PlotterInformationPantographMultiplication signVolume (thermodynamics)TriangleWeb 2.0Flow separationMechanism designSoftwareConnected spaceKeyboard shortcutComputer hardwareIterationRevision controlRoboticsCASE <Informatik>TrigonometryPower (physics)Musical ensembleAsynchronous Transfer ModeFrame problemException handlingComputer animation
MathematicsAngleVertical directionDegree (graph theory)PlastikkarteTrigonometryTotal S.A.TriangleStudent's t-testHydraulic motorServer (computing)Computer animation
PlastikkartePlastikkarteHydraulic motorSoftware development kitMereologySlide ruleDampingTable (information)Arithmetic progressionVirtual machineRepository (publishing)CodeProcess (computing)Lecture/ConferenceComputer animation
Hydraulic motorComputer hardwarePantographSoftwareWeightTouchscreenComputer animationEngineering drawing
WeightBitPressureMotion captureHydraulic motorSoftwareOpen setGame controllerEngineering drawingComputer animation
PlotterComputer hardwarePoisson-KlammerRadical (chemistry)Keyboard shortcutPlot (narrative)Computer animation
PlanningMoment (mathematics)PlotterFunction (mathematics)Point (geometry)Line (geometry)Hydraulic motorTouchscreenRaster graphicsBitLibrary (computing)BuildingPantographVideoconferencingRotationNumerical analysisCurveShift operatorPosition operatorGame controllerMetreDigital photographyCrash (computing)Personal identification numberWhiteboardType theoryComputer animation
LoginPhysical systemComputer fileLocal ringAddress spaceComputer programCone penetration testSource codeDefault (computer science)Data typeInformationActive contour modelSoftwarePantographDistribution (mathematics)Term (mathematics)Open sourcePentagramModule (mathematics)outputLine (geometry)Directory serviceMedical imagingProgrammer (hardware)Active contour modelComputer animation
Active contour modelPoint (geometry)SequenceSource codeData typeModule (mathematics)Error messageComputer-generated imageryComputer fileInformationMultiplication signPlotterMusical ensembleFunction (mathematics)Disk read-and-write headComputer animation
Graph (mathematics)PantographComputer filePlot (narrative)BuildingModule (mathematics)Directory serviceElectronic signatureTriangleInformationQuicksortStaff (military)Plot (narrative)Medical imagingComputer fileFerry CorstenLetterpress printingGodLine (geometry)Computer animationSource codeJSON
Moment (mathematics)Position operatorAngleBroadcasting (networking)Line (geometry)Plot (narrative)BitVideoconferencing2 (number)Group actionComputer animation
Multiplication signArithmetic meanPiComputer animationLecture/Conference
TriangleCAN busBuildingArithmetic progressionHydraulic motorArmPantographMathematicsMultiplication signSoftware development kitMereologySet theoryNumerical analysisLine (geometry)ResultantLecture/ConferenceComputer animation
Hydraulic motorMultiplication signLecture/Conference
Hydraulic motorBitVolume (thermodynamics)Power (physics)OscillationMaterialization (paranormal)Lecture/ConferenceComputer animation
Multiplication signServer (computing)1 (number)Lecture/Conference
Lecture/Conference
Transcript: English(auto-generated)
first of all I apologize for the delay I tested my hardware and software last night before I went to bed and this morning after breakfast before packing it all up so of course as soon as I plugged it in here it refused to work
as it normally does and that's what you get for not just doing live demonstrations or worse live demonstrations with hardware but live demonstrations with home-built hardware that's held together with rubber bands and so I think the actual problem is my macbook that the networking between the
macbook and the Raspberry Pi is not working as it should it should you should be able to connect them via a USB cable and the Raspberry Pi will go into a certain mode and will be available to the to the well in this case to a macbook that's as well as providing power is also connecting to it
with a network connection so this means I'm have to do a bit of swapping typing on an unfamiliar keyboard there might still be a problem with the pie and so we might have some other troubles as well but I feel you're probably on my side rather than against me not like that keynote speaker yesterday where
some people were rather unkind so this is me I'm Daniela that's what I like on television and as you can see I am Python software and I work at I tell can we turn the volume down a little bit because I'm getting it rather loud in my ear thank you I work at Devio we have a web cloud
hosting platform built in Python and Django and for Python and Django developers but we also host other things so please come and talk to me if you want to talk about Docker or Django or deployment or any of those things
I'm a core developer of the Django project itself and an ex-vice president of the Django Software Foundation which is not really actually as grand as it sounds although I go to a lot of these events it's part of my job so I'm really fortunate to have a job in which I go to events all over the
I love going to these events I love meeting people and what happens at these events is this kind of valuable friendly magic of euro pythons and pythons and after all these conferences I still enjoy coming to them but this magic works hardest on the people who are new to their careers or
to Python or to programming or even in places where Python and programming are quite new as industries so for the people who aren't yet confident who aren't yet sure whether this is for them who aren't sure of their
future success there's something really brilliant going on in these events and I see it particularly in my African travel so I'm amazingly fortunate to be able to do some of these things as part of my job I've been involved in Python Namibia since 2015 we've held five editions and from that have come
several others there's also a regular PyCon in South Africa but that's can run under its own steam so we've got if you saw yesterday in the lightning talks I mentioned that we're holding PyCon Africa in August this year these are some of my friends from Namibia the organizing part of the organizing
team of PyCon Namibia there's PyCon Africa if you want to know about that come and talk to me and as I mentioned we have opened a fundraising campaign just to try and get a little bit more money into our financial assistance program you can well you probably know where to find me here but you can also find me online so when I go to conferences for
example in Namibia and one of the things people are in people are interested in is robotics and there are all kinds of robotics projects you can
do with Python you can find out a lot of information about them and they look really good but they all seem to involve things like 3d printers and laser cutters and hack spaces and university laboratories and so on and most people don't have that kind of thing so I wondered if I could build a
pen plotter this is an axial pen plotter where the pens move on on two axes so the challenge that I set myself was what is the cheapest and simplest pen plotter that could possibly be made well you'll have I've got a camera here so I can also show you some more video but here it is
here's the one of the first iterations of it what can you see there you can see it uses a ballpoint pen for the drawing in the hinges it uses the part of the tube of a ballpoint pen and those are some wooden sticks I found here's another version I found it's a good way to get your talks accepted a
conference if you you know flatter them by printing out their logo with your robot those are some rather nice servos that I blew up so I don't have those this is how the pen lifts up and down you can see there's a uses the
arm of the servo to do that and I had to call in to play all my high school mathematics which is from a very long time ago because I'm older than you think I am and so I had to relearn a certain amount of trigonometry and this is how it how it works it's a pantograph which is the
same kind of mechanism that's used on a tram to lift the not on a tram on a train to lift the connector up to the to the wires so we have two motors at the top that that rotate and there are two there's a yellow and red driving
arm and a green and a blue following arm so it forms a pentagon there are there are five sides because you've got to account for the space between the two motors so two motors four arms five sides and then when you're doing the maths for this after a while the whole world seems to be composed of triangles it's remarkable and and this is the mathematics you don't need
to worry too much about that because this is intended as an educational thing it's actually broken down as much as I could possibly break it down so you can see that as long as you're able to break down a shape into triangles you can do this with fairly simple trigonometry so the the bill of
materials this is crucial because say a Namibian student does not have a 3d printer or something like that that was bought on a whim the total bill of materials a Raspberry Pi Zero for five dollars three server motors for about
three dollars each some stiff card some wood glue which you need to buy and a ballpoint pen which you can probably steal from somewhere and then the tools are very simple you need something to make some holes with you need a knife to cut the card a small screwdriver a first-aid kit and to
avoid getting into domestic trouble then I recommend having a damp cloth white wood glue off the table when you finish because it saves it helps so there's a very incomplete in progress github repository for the code that I've written for this I'll show it again afterwards but it is very incomplete and
I not doing a very good job at updating it right so that was the the slides part now I want to show you what the machine looks like so if I switch over to this and with this magic camera with a delay apparently or maybe
not a delay maybe it's not working at all now that Martin came and showed us how to set this up and get it going I'm gonna just oh well that is quite a delay I know there we are I think that's so you can't see it why can't
because I've got to do that yes okay so this is really difficult with a delay can I make this full screen well probably I can make it full screen but
you know I'm pushing my luck here with hardware and software so this is the this is the pantograph so we've got hell's bells there really is a delay there maybe it seems to stop okay well you can see that so you can
see the two motors and the forearms you can see a weight on top of the of the pen to hold it down because it needs a bit of pressure to keep it drawing on the paper and there's the well this is not actually tremendously useful now that it's stopped doing that what is going on and I'm gonna just try
that again so I need to open capture device that's it and I assume I need to
okay this is not the most terribly reliable thing oh there we are so what we have here are the two motors we have a Raspberry Pi zero all the
software's running on that I've got a little wiring loom that I sold it together to make it easier and here is the and it stopped again and there is the the the control for the pen so let me just leave that there Ben could I have a helper pleased with the camera I'm going to try doing some now
this is going to be really difficult because I'm gonna be typing blind into a terminal because we had that hardware issue so I'm just going to show you the plot of moving its pen up and down PG dot pen dot down now for the
gentleman who lent me this keyword can you show me where the brackets are please no no what do you call them braces parentheses parentheses yes yes
yes yes yes good you opened and closed them okay so if I've done the right thing oh there you are do you see the pen oh you haven't seen the pen has moved but the video hasn't oh yeah there you are okay okay so good and I
can do PG for pantograph dot pen dot up I can you show me again with shift shift oh my goodness okay like so yeah and that will I mistype something there so that's PG dot pen do you know what's going to mmm well
then we can't have both can we yes my god and in the 1970s there's a
number two of a DC-10 exploded and severed a number of the hydraulic lines and the only way they had left they discovered a new way to fly a DC-10 which was through asymmetric thrust of the remaining of the two engines they could control because they could barely control anything else and the captain called in other pilots who happened to be on the plane and there
was a team of them in the cockpit and they basically invented a new way of flying so he stepped back from the controls completely and they managed to land the plane at Sioux City you probably have heard of this terrible accident at the very last moment there was a downdraft or a gust of
wind and the plane actually somersaulted but they saved most of the lives of the people on that plane so this is not as as heroic but I'm very grateful that we've got some pilots on board so PG do PG dot pen dot
up and then the parentheses hey there you are okay now wait so I'm going to switch back to this here and I'm going to show you how how it well Ben perhaps you can shine the camera on one of those so you can paint draw little
pictures like like so oh I've got them on here I can show you what what they what they look like and you can come around and have a look any minute I'll be on the screen yeah so there you are so this is this is the kind of output we can get oh it makes me look like a narcissist that is pictures of me do this picture instead there you are so there's a little boy held
a teddy bear or a rabbit as you can see it's a very accurate pen plotter but I think it has a kind of charm through its wiggly lines now it's a little bit you have to understand to draw a straight line with an axial plotter is
very easy you just move the pen down one of the axes on this the only movement that I have is is rotation so if my point my XY point is over here and my the end of my line is over there another XY point I want to draw a straight line between them but if I make the motors go from the position
they need to be at for that point to the position they need to be at for that point what I'll get it's not a straight line but I'll get a curve because the motion of the motors is rotary so every line I get I have to
break it down into lots of small pieces so I break it down into tenths of one tenth of a millimeter you know as if I'm gonna make that kind of accuracy but that's what I do so every line has to be broken into many many smaller lines so that we can get a straight line and so with a little bit
of confusion here because everything is in the wrong place due to the little panic I had earlier so I adapted a library that I found let me make this a library that I found called line draw that vectorizes bitmaps and I
adapted it to give me some JSON output that I can feed into the plotter so for example this morning I just before I came into the building I took this photograph and line draw I'm going to run it on my Mac I could run it on the Raspberry Pi but the reason that I don't is that it uses numpy and open
CV so although it does work it is rather slow so am I in the I'm not in the right directory where am I okay so what I've got I've got that crane image and
line so I'm going to take some input can you see that well enough I hope yeah
there's the crane JPEG I'm going to put it out as a JSON I'm not going to draw hatches I'm not going to fill in the image it makes it faster and I'm going to simplify the contours so I'll show you if I make this if I simplify
I'm such a bad programmer I always do it from him I always do that because I like it so I'm going to simplify the contours a lot so it only makes 28 strokes for the whole thing and that's going to be looking like that okay
that's the rendition of that but if I did it without any simplification it will do it reasonably quickly and give me a reasonably accurate output so has it
finished yet there you are so that's what I'm going to send to the plotter and that is just some JSON as you can see it looks exactly like the crane doesn't it so I earlier I sent that over to the Raspberry Pi and I think
we'll go head over you're good at typing aren't you and so I've got to be I've got to remember now it's um yes let's switch this to this do this
that's probably better and then we can always switch back to the camera afterwards okay so actually if you just go up that will be here's one I made earlier if it's remembered the command I was experimenting with some stuff there we are just can you instead of no don't make it plot me make
it plot the crane dot Jason please okay and now there go ahead fire oh okay
can you exit from there let's have a look at the you where we're in the right place there is no crane there okay that's okay never mind we'll print another image instead let's okay go back into Python and can you do from
pantograph sorry from oh god yeah okay let's go find the from p.g.m. plus and I wanted to show you some the calibration routines so that makes this
more accurate but never mind that for now we'll have to do something else let's plot my little nephew Oscar so he was okay okay let's just okay let's say so PG dot plot underscore file oh no yes correct sorry quote some
parentheses quotes and other quotes yep and it's EP 19 dot Jason and this is the logo of euro Python let's try that okay I will but let's let's just
let's get let this go so you can see it's gonna take a while go ahead yeah great so you can see it's yeah I'm going to so you can see it's what is it's looping all over the lines in that Jason and now you'll get the delayed
action over here I think this is what they use on live broadcasts when they think somebody might do something obscene in the audience and they've got three seconds in which to we need the camera don't we and don't worry I'm going to start that again we're not having too much luck with the
camera Martin would you know sorry we're trying to get the video but it's it's very laggy this is see there's another pilot coming to help us this is a go ahead yes see okay yep okay and would it show live okay oh okay
yeah let's get a better angle that's let's make that bigger so can you get
a better angle Ben so that we can see and now what I normally have to do it's drawing normally I I rub the pen a little bit to prime it but you can see that it's so it's not very fast but it does plot as you can see it's
tracing out its wiggly line let's see if we can capture it from there and it's drawing a long line right now and the moment you see the pen is in the down position when it's finished this line that servo will twitch and will
lift the pen there you are this is going up and now can you see that well enough from where you're sitting yeah so it's pretty simple I mean that's really the whole of it and I'm kind of running out of time now so I think we've thank you very much we've landed thank you welcome
safely means come and have a look at this afterwards and maybe you've got some ideas about how to make Mac books and Raspberry Pis talk more reliably when they're at conferences and not just before breakfast I can probably leave this there so it's still still drawing and I just want to
quickly go back and finish off here so I'm always it's a work in progress I want to make this better I've got another design now which I think will be much simpler and this is going to instead of having a pantograph will just have two arms still the same number of motors one two and three this
will have better reach I think it will be simpler to make I think it will have more mechanical advantage on the motors so I think I'll get better results from this but I haven't actually written the mathematics to to drive that so that's and I think it'll be simpler which is the important
thing because for me that I don't mind that the lines are all quite wiggly on this I think it's just part of the charm so I don't want to make it more precise I want to make it better which means I want to make it simpler and cheaper and easier to build and reproduce because somebody who doesn't have success with it first time is going to give up so I want to be
able to make a kit or a set of instructions that almost anybody can do something with this so I'm going to be sprinting on that perhaps on Saturday another reminder reminder of that please take a look I'd be very grateful and talk to me thank you very much I don't know if we have time for
questions but I think we just about made it we do have time for questions great thank you very much thank you thank you Danilo I think we can let it clutch while we have questions and answers so if you have a question would you mind getting to a microphone I'm Ben
could I ask you to hold the camera again so while it while it's drawing so I can't think and hold a camera at the same time yeah you definitely could
you just need motors powerful enough to to do that and I did have some larger motors that were could draw bigger and were more accurate ironically
I found the cheapest motors sorry the volumes rather loud for me again Danuka could you turn it down a bit for me please and if you use digital servo motors which are faster and stronger more accurate you just get lots of
oscillations because they're trying to constantly correct so this has got lots of dead spots in the movement and that actually absorbs many of the problems that I had with digital motors so cheapo actually work better but with powerful motor with rigid materials yes of course it could be scaled up I wasted
a huge amount of time trying to make those better servos work but I never in the end that the cheap ones worked best if you please come have I mean
if you've got a few minutes and there are no more questions please come and crowd around and have a look at it actually working because you'll get a much better sense of it when you're standing in front of it so and if you think of any questions go ahead yeah yes let's close the session thanks to me thank you very much thank you all and thank you for your patience