Scribing Robot

Writing on a whiteboard with stepper motors

Similar projects worth following
This is a scribing robot totally designed by myself. It uses 2 accurate stepper motors for elbow and shoulder. The wrist is made with a simple servo. The robot can use 2 tools : one pen and one eraser at the opposite of the pen. The font is a vector font 100% homemade. The robot writes from ASCII files. All design files (code) are provided, it is open source.
Mbed repository :

The detailed description in inside 5 blog posts, 5 chapters:

1) Mechanics

2) Electronics

3) The font

4) Software - code

5) More pictures


source code for scribing robot

plain - 38.30 kB - 04/22/2018 at 14:08


  • 5) Other pictures

    f4hdk04/22/2018 at 14:21 0 comments

  • 4) Software

    f4hdk04/22/2018 at 13:53 1 comment

    All the source code is available for free at the start page or on Mbed site.

    The 2D movements are made at constant speed.

    Description of algorithm, from the bottom low level tasks to upper level tasks.

    clk_stepper :

    Pulses for stepper motor controllers are generated with interrupts. The function inside interrupts makes 3 things : it pulses the pulse output of the appropriate stepper motor controller; it updates the angular position of each motor (at each step); and it sets a timer for the next pulse interrupt, according to period requested by higher level task

    setpos_ang :

    it computes the period of pulses and direction of each stepper motor, with angle consign, and delay. These movements are executed at constant angular position. For most of the movements, this function is only used for very short distances : 1mm.

    goto_2D_short :

    contains the reverse kinematics algorithm. For each 2D position (X, Y), it computes the angular position of each articulation.

    Goto_2D_line and circle_2D :

    decomposes the segment or arc requested into small segments of 1mm

    print_single_char :

    for just one character, it reads its font definition, prints the character at the current character position with goto_2D_line and circle_2D, and update the next character position.

    print_string :

    prints a character string, and manages line return (without word cut), and line clearing.

  • 3) The font

    f4hdk04/22/2018 at 13:22 0 comments

    The font is a custom vector font. It is designed by myself.

    Each character is made of one or several segments and/or arcs. The font is directly inside the source code. The code is available at the start page. It should be easily ported to another microcontroller.

    The font definition format is also specific. Each character is defined with a series of one or several instructions. Each instruction can be followed by 1 or several parameter bytes.

    X and Y positions refer to a 16x16 grid which contains the character.

    Instruction list:

    2 : line up.

    Starts from current position and moves to position X, Y, with pen up

    Arguments :

    • X target position
    • Y target position

    3 : line down.

    Starts from current position and moves to position X, Y, with pen down.

    Arguments :

    • X target position
    • Y target position

    4 : arc/circle.

    Writes a circle or arc

    Arguments :

    • X and Y : position of the circle center
    • Circle radius
    • Angle at the beginning
    • angle at the end

    5 : end of the character

    Arguments :

    • width of the character.

    6 : point at position


    • X
    • Y

    The font is designed by hand. 

  • 2) Electronics

    f4hdk04/22/2018 at 13:22 0 comments

    The electronic part of this project is quite simple.

    • One Mbed microcontroller board, with LPC1789 (ARM Cortex M3)
    • 2 x stepper motor controller boards “easy driver” from Sparkfun, equipped with A3967
    • A 5V switching regulator (for both wrist servo and microcontroller)
    • One potentiometer which value is read by microcontroller. The user can tune the movement speed with it.
    • One servo output for the wrist (servo signal is directly generated by GPIO from Mbed)
    • 2 digital inputs for the end-stroke micro switch (needed because stepper motors do not know their absolute position)

    The board I use is wire-wrapped, but you can use another solution.

    Wiring Diagram


    The stepper motor controllers are quite powerful. For just a few dollars, you can have lots of features inside : bi-polar motor compatible, with H-bridge inside, without the need of freewheeling diodes, and optimised for thermal dissipation, with current regulation, and last but not least micro-steps. This greatly reduces the amount of code and the amount of electronic components, compared to stepper motor controllers which were available in the 90s.  

    The robot is powered with 24V, even if the motors are 12V. We can do it because the stepper motor controllers regulate the current they inject inside the motors. Higher voltage is necessary if you want to use stepper motors at quite high speeds.

  • 1) Mechanics

    f4hdk04/22/2018 at 13:14 0 comments


    The 2 main articulations (shoulder and elbow) are equipped with stepper motors. The transmission uses toothed belts and their pulleys.

    These 2 articulations are very rigid. They are made with 3mm aluminium sheet, and braces made with cylindrical aluminium sections.

    The articulations use ball bearing, exactly the same than these used on Lynxmotion articulations : 3mm inside and 8mm outside.

    The gear ratio is 4.4 for both elbow and shoulder : 10 teeth on motor side, and 44 teeth on articulation side. The 2 motors are at fixed position, on the elbow. The goal is to limit inertia of the arm. Stepper motors are quite heavy compared to their torque.

    To achieve this, the motor for the elbow is located on the axe of the shoulder. Therefore, the distance between shoulder and elbow articulations is determined by standard toothed belt lengths. All the dimensions are deduced from that.

    Each of the 2 articulations (shoulder and elbow) allows more than 270° of travel. Therefore, we can reverse the shoulder like most SCARA robots. The goal is to use 2 different tools (pen and eraser) at each end of the pen and reach all the working area with these 2 tools. 

    The forearm and the wrist is made with lighter pieces, from Lynxmotion.
    We can tolerate more flexibility for these parts. And this part of the arm contributes a lot to inertia; therefore, we want to have lighter pieces.

    The length of the forearm and the arm is exactly the same. For forearm, this length is the distance between elbow and tool. This greatly simplifies the reverse kinematics. Warning, the length of the forearm is measured between the elbow and the pen tip (not between elbow and wrist).


    The wrist is made with a standard RC servo. This articulation does not require good precision or high torque, unlike elbow and shoulder. I have just added a Lynxmotion parts to reinforce this articulation, and mainly a ball bearing at the back of the servo, in order to limit clearance.

    The wrist has 2 functions :

    • it can lift or lower the pen
    • It can switch the tool between pen and eraser

View all 5 project logs

Enjoy this project?


Discussions wrote 05/09/2023 at 12:15 point

Thank You so much for given the helpful and informative maths blog. Please explain further about trigonometry and maths formulas.

  Are you sure? yes | no

Douglas.pearless wrote 05/03/2018 at 00:22 point

Could you please explain the maths behind the arm mechanism? :-)

  Are you sure? yes | no

f4hdk wrote 05/03/2018 at 17:02 point

Thank you for the suggestion. I will add a blog post about the math part. Just a little bit of trigonometry. ;-)

  Are you sure? yes | no

Mike Szczys wrote 04/24/2018 at 18:08 point

Wow, great work on this. The built is exquisite and the documentation too! The demo video is a delight to see (and hear). I hope you're taking this on the road to show off in person? People are going to love it! Any events in the near future?

  Are you sure? yes | no

Jan wrote 04/24/2018 at 20:39 point

That mechanism and range of motion is incredible. First seconds in I thought you gonna play a melody with it! It's much more accurate than I thought.

  Are you sure? yes | no

f4hdk wrote 04/26/2018 at 04:38 point

Thank you Mike, thank you Jan for your feedback. I will try to bring this robot to a local event. Perhaps Paris Maker Faire.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates