Tim's Electronic Pantograph [2D]




Introduction: Tim's Electronic Pantograph [2D]

About: Retired due to health. Oldish. My background is in Structural Engineering. Also smith of many trade's. The majority of my project will be what can be made sat in a chair within arms reach, on a plotter or 3D p…

This is part two of my Hall-Effect Sensor Trilogy.

It is best to read the first part if you haven't first:

In this instructable I will be using two 49E Sensors, each with two magnets in the same way I used them with the Dividers.

A 3D Printer is needed for this one, as the accuracy of construction is definitely a key element.

I will be using an Arduino NANO as before with an LCD to show coordinates, but to do something practical with the output an application is required to give a graphical representation of the data.

  • I have made an application to do this.

This project requires:

  • The basic understanding of the Arduino Platform.
  • For recreating the trace, some knowledge G-Code.


Two 49E Linear Hall-Effect Sensor.

Four Neodymium Magnets. Width: 5mm, Depth: 5mm, Height: 2mm. (North/South is in the 2mm direction)

A tool to find the poles of the magnets. I used my phone with an application.

Arduino NANO.

1602 Display with an I2C Interface. (PCF8575 Adapter)


Push Button 6mm x 6mm x 5mm Through hole.

Two 8mm diameter rods x 171mm long.

Several M1.7x6mm Self Tapping Screws.

  • All screws used are this size.

3mm diameter rod. 30mm long.

  • To make a stylus.
  • Can be steel, brass, aluminium, or similar hard wearing material.

A sheet of 3mm Hardboard.

  • I used what I had which was 285mm X 380mm.
  • This will be the minimum size needed.
  • Any type of stiff board would do.

Some Glue, I use UV resin.

3D Printer is required to print the parts for the Pantograph.

  • Attached are the STL Files.
  • The Electics_Mount_No_Fillest.stl is not to my standard as there is a 25 Mb limit.

Step 1: A Pantograph

I have called this an Electronic Pantograph, but first I better just show what a normal pantograph looks like so we are all on the same page. (Not the ones on top of trains)

Put simply:

  • It is a device for copying lines on a flat surface using parallel rods pivoted at set points.
  • By adjusting where the rods are pivoted the scale of the copied lines can be altered.

As I am making an Electronic Pantograph we only need two rods and record there position electronically.

The recorded positions can then be used to electronically draw the copied lines at any scale we want.

Step 2: Magnet Orientation

Magnet orientation is as show in the sketches.

  • As a rule, North Pole should point in the direction of the Rod attached to the Magnet Holder.
  • As before with my Dividers, I used an application on my phone to find the magnets poles.

It is best to fit the Magnets before fitting any of the other parts together first.

  • Before fitting, check that the magnets fit in the groove, there is an overlap that may need fettling after printing.

This time because the Magnets are so close together, I have made the Magnet Holders spreadable, to aid construction.

Once the Magnet Holders are in place over the pivot piece, the loose ends of the Magnet Holders are clamped together using a small screw.

You may want to spin the parts around each other to bed in the assemblies, to get a good smooth fit.

Step 3: Stops

Stops need fitting to the Pivots.

Both Arm Stops are the same, each are held in place using two screws.

  • The Stops have curly shape to the top of them, take note to which way around they are in the sketches.
  • The Stops must be fitted the correct way around.

Step 4: Rods

I made the Rods from 8mm diameter Bamboo Rods.

  • Anything with an 6mm diameter will do, you need to be able to drill it so it can be fixed in place with M1.7 x 6mm self taping screws.
  • The rods need to be exactly 171mm Long.

The rods need to be seated firmly into the Magnet Holders, and fixed in place using two screws.

  • I drilled the 1.2mm diameter pilot holes for the screws in the Bamboo Rods once I had rods in place.

Step 5: The Board

The sketches show the dimensions of the board.

  • The overall size may seem odd, it's the size of a piece of hardboard I had. :)
  • It also shows the work area, the area that is usable.
  • The holes for the triangular bracket may be a bit difficult to mark out for drilling, I would leave these three hole until you have fitted the top part of the First Arm Support and drill the holes where it lands.

All holes are 1.2mm diameter to take M1.7 x 6mm self tapping screws.

The overall size of the board does not need to be the same, as long as all the holes and work area all relate to each other dimensionally.

I also have drawn the Work Area on the board for reference.

A Calibration Cross will be required later, easiest to mark it now.

I have attached a DXF file of the board as well.

Step 6: Fit First Arm

Fit the First Arm to the Board using four screws.

Step 7: Fit First Arm Support

Fit the First Arm Support to the Board using four screws in the top part.

If you found it difficult to mark out the three holes for the lower part, you can drill the pilots now after fixing it in place with the top screws.

Fit the remaining three screws.

Step 8: Fit the Second Arm to the First Arm

The Second Arm needs to be seated firmly onto the Rod of the First Arm and then fixed in place using two screws.

  • I waited to have the Second Arm in place before drilling the pilot holes for the screws.
  • I have made a little Height Checker to place under the end of the Second Arm Rod, to ensure it is level.
  • It is best to have the Second Arm set at 90 degrees to the First Arm when fitting.

Step 9: Stylus

I have made the Stylus from metal round bar.

  • It doesn't matter what metal you use, what ever you have and can work with.
  • The diameter of the bar needs to be 3mm.
  • The overall length is 30mm.
  • It has a flat at the top, the dimensions of this is not critical. I is there so a screw can be set to stop it falling out, but able to move slightly up and down. It moves up and down to activate a switch.

Step 10: Stylus Head

Slide the Stylus into the Stylus Holder with the flat facing forward.

  • Hold the Stylus in place with a screw from the front.
  • Do not make it to tight, the screw just needs to be in far enough to stop the Stylus falling out.

Place the 6x6 Switch in the top of the Stylus Holder.

  • Fix the switch in place with the Stylus Cap.
  • Hold the Stylus Cap in place with a screw.

Step 11: Fit Stylus Holder to the End of Second Arm

The Stylus Holder needs to be seated firmly onto the Rod of the Second Arm and then fixed in place using two screws.

  • I waited to have the Stylus Holder in place before drilling the pilot holes for the screws.
  • Make sure the Stylus Head is positioned vertically before fitting the screws.

Step 12: The Circuit

I have done the Circuit in Fritzing.

I have done the cabling on mine with FFC (Flexible Flat Cable).

  • I think it looks cool using FFC.
  • Also I have a lot of it from old salvaged printers and flat bed scanners.
  • The clips I have made are for holding FFC.

Other cables I use on projects is 3 and 4 way flat servo cable.

  • If it is just for data then I use 32 SWG cable.

A note about the button in the circuit.

  • I am using an Arduino NANO breakout board, it has rows of Power, Ground and Data pins.
  • In the code I am putting interrupts on the Button pin on A3 and A0, A1 and A2 for future.
  • I prefer a de-bounce circuit, rather than using code to handle it, using code just slows things down.
  • So I have made a little adapter I use when using this type of breakout board.

The RC circuit is needed for the button to work.

Fritzing attached and PDF versions.

Step 13: Fitting the Sensors

I have made a little Depth Checker to ensure the Sensors are in the correct position when fitted.

  • The Depth Checker has a notch for the Base Pivot Sensor.
  • The Depth Checker goes all the way to the top for the First Arm Pivot Sensor.
  • The holes in the Pivots are shaped to show orientation of the Sensors.
  • I put a little glue where the pins push through to hold the Sensor in place.

Step 14: Using FFC

If you use FFC (Flexible Flat Cable) like me.

  • Don't try to solder to the end tabs.
  • It is best to cut off the end tabs and split the wires using scissors.
  • If you hold the ends of the wires against your soldering iron for a little while the plastic insulation will burn back/away from the copper wire for you to solder.
  • Plenty of flux helps.
  • The FFC is not as fragile as yo may think.

My FFC was a little short to reach the Arduino NANO so I just extended it with some normal cable.

  • I use a FFC wire for each connection to the Switch and Sensors.
  • I joined the Power and Ground wires together when I added the extension.

Step 15: Arduino Mount

I made a small frame to mount the Arduino and LCD.

  • As I have said, I am using NANO UNO Breakout Shield, so the mount is made for the type I have.
  • I know from experience some boards are slightly different, but as long as it has the UNO holes it should fit.
  • The UNO will fit, but if you want to use the UNO, code will need to be changed. The UNO does not have pins A6 and A7.

All screws used are M1.7 x 6mm long.

  • I have done an STL file for washers if you need them.

Step 16: The Code

I assume that if you have an Arduino NANO you have experimented with it and have been to Arduino.cc site to learn things about it.

If this is your first time using a Device with the Arduino Architecture, then first go here: Arduino IDE 2 Tutorials

  • Here you can download the Arduino IDE and there are tutorials from the very people who created Arduino.
  • The tutorial show how to upload a sketch to a device.

Below is the code.

  • I have attached the Sketch "Tims_Electronic_Pantograph.ino" so you can download it.
  • When you download the Sketch, you need to put it in a folder with the same name without the ".ino".

Step 17: Calibration [DEBUG Mode]

There are a few steps to Calibrate the Pantograph.

The first step is to load the code to the NANO in DEBUG mode.

  • We do this by making sure line 29 #define BEBUG is uncommented.
#define DEBUG								//	Activates Debug Serial Printing. (Comment out to turn off DBUG)
  • Also at this point we need to make sure the Bios for the Angles are set to 0 (zero).
  • Set ANGLE_BIOS_01 and ANGLE_BIOS_02 values to 0 (zero)
#define ANGLE_BIOS_01	1.4107		//	Angle correction at calibration point, after by NANO correction.
#define ANGLE_BIOS_02	1.5719		//	Angle correction at calibration point, after by NANO correction.
  • Make sure the code is correct and upload it to the NANO.
  • Start the "Serial Monitor" in the Arduino IDE.
  • Values of the Sensors should be being sent to the "Serial Monitor"
  • Also it should say DEBUG in the top right of the LCD.

Step 18: Calibration [First Pass]

When taking readings, move the arms all the way to the stops.

If the Values of the Sensors are the wrong way around Large-Small. Then the magnet orientation is the wrong way around.

Small Value of hall-effect sensor 1 at 45 angle.

  • Move 1st Arm Up to the Right with stop on.
  • Enter the value at the line for: #define CAL_HALL_45D_01 (Change value 232)
#define CAL_HALL_45D_01		232		//	Small Value of hall-effect sensor 1 at 45 angle. Move 1st Arm Up to the Right with stop on.

Large Value of hall-effect sensor 1 at 135 angle.

  • Move 1st Arm Down to Bottom Left with stop on.
  • Enter the value at the line for: #define CAL_HALL_135D_01 (Change value 835)
#define CAL_HALL_135D_01		835		//	Large Value of hall-effect sensor 1 at 135 angle. Move 1st Arm Down to Bottom Left with stop on.

Small Value of hall-effect sensor 2 at 45 angle.

  • Move away from 1st Arm with stop on.
  • Enter the value at the line for: #define CAL_HALL_45D_02 (Change value 258)
#define CAL_HALL_45D_02			258		//	Small Value of hall-effect sensor 2 at 45 angle. Move away from 1st Arm with stop on.

Large Value of hall-effect sensor 2 at 135 angle.

  • Move close to 1st Arm with stop on.
  • Enter the value at the line for: #define CAL_HALL_135D_02 (Change value 825)
#define CAL_HALL_135D_02		825		//	Large Value of hall-effect sensor 2 at 135 angle. Move close to 1st Arm with stop on.


After changing the values, upload the code again to the Arduino NANO before the next step.

Step 19: Calibration [Second Pass]

We can now use the values the NANO calculates for the 0 (zero) and 180 degree positions.

Small Value of Calculated hall-effect sensor 1 at 0 angle.

  • Enter the value at the line for: #define CAL_HALL_0D_01 to the value given for: Sensor 1 Calculated 0 value: 113.36
  • Your value will be different. (Change value 107)
#define CAL_HALL_0D_01			107		//	Value created by NANO.

Large Value of Calculated hall-effect sensor 1 at 180 angle.

  • Enter the value at the line for: #define CAL_HALL_180D_01 to the value given for: Sensor 1 Calculated 180 value: 957.64
  • Your value will be different. (Change value 690)
#define CAL_HALL_180D_01			690		//	Value created by NANO.

Small Value of Calculated hall-effect sensor 2 at 0 angle.

  • Enter the value at the line for: #define CAL_HALL_0D_01 to the value given for: Sensor 2 Calculated 0 value: 140.57
  • Your value will be different. (Change value 140)
#define CAL_HALL_0D_02			140		//	Value created by NANO.

Small Value of Calculated hall-effect sensor 2 at 180 angle.

  • Enter the value at the line for: #define CAL_HALL_180D_01 to the value given for: Sensor 2 Calculated 180 value: 942.43
  • Your value will be different. (Change value 942)
#define CAL_HALL_180D_02			942		//	Value created by NANO.


After changing the values, upload the code again to the Arduino NANO before the next step.

Step 20: Calibration [Third Pass]

For this the Stylus needs to be positioned on the Calibration Cross drawn on the board.

  • This should set both Arms at 90 degree position.

Calculated Angle Values

  • In the Serial Monitor, both Angle Values: Hall_Angle_01 and Hall_Angle_02 should have values of 90.
  • If they don't then the ANGLE_BIOS_01 and ANGLE_BIOS_02 need to be changed to a value when added to what is shown in the Serial Monitor, makes the value 90.
  • So we take away the value in the Serial Monitor from 90.
  • If this gives a negative value, then a negative value is put in the code.


Serial Monitor shows 90.245

  • 90 - 90.245 = -0.245
#define ANGLE_BIOS_01		-0.245			//	Angle correction at calibration point, after by NANO correction.

Do the same for Angle 2.

We should be all good to go.

  • We just need to put the Arduino NANO in use mode.

Step 21: Calibration [Finish]

When we have done calibration we need to set the Arduino NANO into use mode.

  • This is because we now want it to just send data about the state of the Stylus through the Serial cable.
  • If we use normal text to send the data it would take to long.
  • All we need to do is send values as bytes.

In the code comment out BEBUG.

//#define DEBUG										//	Activates Serial Printing. (Comment out to turn off DBUG)

Upload the code to the Arduino NANO.

  • There should no longer be the word BEBUG in the top right corner of the LCD.
  • The Serial Monitor should be receiving what looks like garbage.

Step 22: Why Is the Serial Sending Garbage

This is for those of you who are new to Serial transmission of data.

When you send something through the Serial Port it is sent as bytes.

  • A byte stores an 8-bit unsigned number, from 0 to 255.

How you interpret the 8-bit unsigned number maters.

  • When coding if you assign it as "char" it will be treated an ASCII character.
  • When coding if you assign it as "byte" it will be treated as a number.

ASCII characters are letters, numbers, symbols, shapes and functions that are represented by a number that we use when typing on a computer.

  • If you look at the ASCII (American Standard Code for Information Interchange) Chart you will see all characters have a number
  • The chart only goes up to 127, numbers above this are in what's called the Extended Character Set, which may vary depending on the country/Language spoken.
  • Arduino only uses the standard 127 characters.

So if we want to send X=50, Y=120, Pen=Up

We would send:

Serial.prinln("X=50, Y=120, Pen=Up");

What this actually sends is: 120, 61, 53, 48, 44, 33, 89, 61, 49, 50, 48, 44, 32, 80, 101, 110, 61, 85, 112, 13, 10

  • It sends all that because it is using the ASCII Table.

That is a lot of bytes (21), in computer terms, that takes a long time to send.

  • This is also why writing Text to be printed in Arduino code takes up a lot of memory.

If we use rules we can shorten that to 9 bytes.

Rule 1

  • If we know what we are sending, we know what we are receiving.

There that wasn't that bad :)

Things to remember:

  • We can only send bytes, a byte stores an 8-bit unsigned number, from 0 to 255.
  • This means we can't send negative numbers.
  • This means we can't send numbers bigger than 255.
  • Cannot use fractions, a decimal.

What do we want to send?

  • Is the pen up or down? That's easy, only need 1 bit, 0 or 1.
  • The position in the X direction. Our work area in the X direction is only 240, so we are OK there.
  • The position in the Y direction. Our work area in the Y direction is only 190, so we are OK there.

That's just 3 bytes, I said 9 bytes. why?

  • Well I want the value in the X and Y direction to be to 3 decimal places, we need a way to make a number with 3 decimal places into a whole number.
  • That's easy we multiply it by 1000.
  • Wait, that makes it bigger than 255.
  • We use 3 bytes for the X and Y numbers, using 3 bytes gives us a 24-bit unsigned number, from 0 to 16777215.

So we are up to 7 bytes

  • Well we need to send something to say this is the end of the information.
  • Usually you can get away 1 byte, a character that is in the extended ASCII Character set if where just using the standard 0-127 ASCII characters.
  • But we are not. The bytes we are sending could be anything between 0 and 255.
  • So we use 2 bytes, a pair that will be together one after another.
  • The norm is: Carriage Return (CR) and a Line Feed (LF). 13 and 10. So if 13 followed by 10 comes up we know that's the end of that chunk of data.
  • There is an outside chance if anyone wants to work out the odds, that 13 followed by 10 may happen in the middle of the data, so when we receive we also do a count. from the last 13 followed by 10.

There we go, 9 bytes, and if we ever scale the pantograph up, we can go to a size of 16776 with 3 decimal places.

I mentioned that the first byte is used for pen up and down, this uses only the first bit. There are 7 other bits in that byte we can use.

  • The second bit is used to say if X value is a negative value.
  • The third bit is used to say if Y value is a negative value.

I have put comments in my code to try and help. If you want to learn how it is done.

So if you do the reverse to the garbage that is sent on the Serial Port, you should get the info you need.

  • This is what happens in the application I have written.

Step 23: Software

I have Made an application to give a visual representation of the data collected from Tim's Electronic Pantograph.

Don't try to run the install from within the ZIP File.

Unzip to a place of your choice and run the setup.exe form the un-zipped location.

I have done this It's About Trust. You may want to read before downloading my software and installing it.

Step 24: Lets Copy Something

The video shows it best.

Have the software "Tim's Electronic Pantograph" installed and running on your computer.

Plug in the Tim's Electronic Pantograph [2D] into a USB port on your computer.

In the software select the USB Port you are connected to, set the Baud Rate to 115200 and click connect.

We should be set to go.

Place an image or whatever you want to copy over the work area, fix it so it does not move.

Push down on the Stylus to change from Pen Up and Pen Dawn.

It is best to have the software set to "Auto mode".

The max "Scale" is 3 to 1.

The "Line Length" determines how often it draws a line.

The "Data" window will produce G-Code that can be used with a plotter so you can reproduce what's on the screen.

If you push down on the Stylus so that it is set to pen down, then trace over the image you have, it should reproduce your movements on screen.

Step 25: G-Code


  • If you copy at a larger scale, the plotter will plot at the larger scale.

The G-Code only records G00 (go to) and G01 (Plot) commands.

If you need any special Pen Up or Pen Down command, you will need to insert those commands.

You will also have to insert you initialization commands.

Step 26: What's Next [Spoiler]

I said it was a Trilogy.

  • Next will be something 3D
  • It may be a while though.

As it is taking me more time than I thought.

I thought I would do a spoiler.

  • Don't watch if you want to wait hehe.
  • Spoiler

Last part is done: Tim's Electronic Point Mapper [3D] : 30 Steps (with Pictures) - Instructables

Build a Tool Contest

This is an entry in the
Build a Tool Contest

Be the First to Share


    • Sculpt & Carve Challenge

      Sculpt & Carve Challenge
    • Fabric Challenge

      Fabric Challenge
    • First Time Author Contest

      First Time Author Contest



    4 weeks ago

    When I discovered this "instructable", I was carried with joy, first because the subject interests me a lot, and second, because it is treated admirably.
    I've been looking for a tool like this for a long time.
    I have a project of a device to copy the shape of sections of a model plane.
    The latter is arranged on a longitudinal and rotary axis.
    The "electronic pantograph" as you have it doesn't quite match what I want. Indeed, instead of the Y axis, I need an angle sensor like a Rotary Encoder, or maybe a stepper motor.
    Do you think it would be possible to replace the Y-axis sensor with an angle sensor to reproduce more or less circular shapes, such as the sections of a jet ?

    2020_17_33_11 (1).png

    Reply 4 weeks ago

    I Make projects to to prove a concept for my self, and I do them on a budget you could say. I have used cheap 49E sensors and an Arduino NANO.
    As it stands my device is good for images and drawings that don't need to be too precise. For scaling up a model I think betters sensors and a micro processor with better DAC is required.
    Having said that, you asked: "would be possible to replace the Y-axis sensor with an angle sensor"
    The two sensors are angular/rotary sensors. They work together to produce the X and Y.
    However, I am currently working on part three [3D].
    The 3D version is a learning curve for me, so it may be a while. Its already going through a few iterations.


    Reply 24 days ago

    Merci pour votre réponse.


    4 weeks ago

    A suggestion/wishlist would be a design for a reliable DIY plotter that would take very large drafting paper to plot out small scale items like PDF file designs (1/4" down to 1/32" scaled drawings) and be able to plot those out onto the large paper at FULL SCALE to be able to use those as patterns for all kinds of crafts.

    I like your idea as well! A tool to use for a DIY design to input into a digital format. I saw something like this on the Net, however, what was being used was a very expensive system. On your system, just getting the design into a digital format is a BIG step, after which other tools could be used to refine the drawing if necessary. GREAT JOB!!!!


    Reply 4 weeks ago

    Glad you like it.
    This could easaly be scaled up, but you pay for what you get is a factor.
    I have shown the principles, but, here I am using very cheap sensors.
    As you scale the mechanics, the accuracy of the sensors reading the angles needs to be better.
    That reminds me, I should change my software to scale down also. :)
    I could make the software save it as an image, as you say, once it is digital, you can do anything with it. (I may do something when I have part three finished)


    4 weeks ago

    I don't have a 3D printer so not likely to build one myself but nonetheless, I really enjoyed reading your instructable. The level of detail and the clarity of explanation is fantastic! Thank you!


    4 weeks ago

    Thanks for sharing such a fantastic project, there must have been months of work producing it.
    Have you thought about using it to make gaskets? I often make gaskets for old engines and equipment that the parts are no longer available for, by using a photocopier/scanner and a laser cutter, but it is often not very practical if the gasket is badly damaged to missing to try and stuff an engine part into the scanner. So they have to be drawn with a CAD program which can take hours. I would think your pantograph would be very useful in that application.