Embedded Systems B.Tech/B.E Advanced

Autonomous Handwriting Robot

[Fall 2025] This project features an autonomous handwriting robot that produces physically written block letters using an embedded microcontroller system. We designed and implemented a robot that generates X–Y motion trajectories and precisely controls multiple motors to produce consistent, legible handwritten output on paper. The project was motivated by an interest in bridging digital automation with physical motion, and it provided hands-on experience with real-time embedded control, motion f

  • Suitable forB.Tech/B.E Embedded Systems students
  • Build time4-6 weeks
  • LevelAdvanced
  • Available atAjvika Labs, Kakinada

About this project

Project Introduction
This project features an autonomous handwriting robot that produces physically written block letters using an embedded microcontroller system. We designed and implemented a robot that generates X–Y motion trajectories and precisely controls multiple motors to produce consistent, legible handwritten output on paper. The project was motivated by an interest in bridging digital automation with physical motion, and it provided hands-on experience with real-time embedded control, motion filtering, and mechatronic system integration in a human-centered application.
High Level Design
Rationale and Sources of Project Idea
The idea for this project originated from an interest in robotic arm systems and plotters, combined with our interest in building a mechanism that demonstrates how software-defined motion translates into physical behavior. Unlike traditional Cartesian plotters, this system mimics a simplified human arm with rotational joints, making it a more intuitive platform for studying servo-based motion control.
Background Math
Implemented Design.
Our design relies on empirically tuned angular trajectories for each servo. Trigonometric functions such as sine and cosine are used to generate circular and arc-based strokes, while linear interpolation and incremental stepping are used for straight lines and diagonals. Motion smoothness is enforced by limiting angular step size and introducing fixed delays between servo updates.
Discrete-time servo stepping:
\( \theta_{k+1} = \theta_k + \Delta \theta \)
\( \Delta \theta = \text{clip}(\theta_\text{target} - \theta_k, \pm \theta_\text{max}) \)
Servo motion is implemented in discrete time by incrementally stepping the current angle toward a target angle. The maximum step size is limited to enforce smooth motion and reduce mechanical oscillation.
Circular and arc-based letter strokes are generated parametrically using sine and cosine functions. Incrementing the parameter angle in small steps produces smooth curved motion when mapped to servo trajectories.
Inverse kinematics (IK).
IK was our initially intended approach to arm movement. Appendix C uses the following math exactly in its IK function to integrate a coordinate system with the arm. IK describes the mathematical process of computing the joint angles require for a robotic arm to place its end effector at a desired position in Cartesian space. For this project, the robot can be modeled as a two-link planar arm with rigid links of lengths \(L_1\) and \(L_2\), connected by rotational joints. The base of the arm is fixed, and the pen tip position is defined by coordinates \((x, y)\) on the writing surface.
Given a target point \((x, y)\), the distance from the base of the arm to the pen tip is
\[r = \sqrt{x^2 + y^2}\]
Using this distance, the elbow joint angle \(\theta_2\) can be computed using the law of cosines applied to the triangle formed by the two arm links and the line to the target point:
\[\cos(\theta_2) = \frac{r^2 - L_1^2 - L_2^2}{2 L_1 L_2}\]
This equation yields two possible solutions corresponding to the elbow-up and elbow-down configurations of the arm. To ensure predictable motion and avoid sudden configuration changes, a single consistent configuration would be selected during operation.
Once \(\theta_2\) is known, the shoulder angle \(\theta_1\) can be computed by decomposing the geometry into two angles. The angle from the base to the target point is
\[\phi = \tan^{-1}\left(\frac{y}{x}\right)\]
The internal angle between the first arm link and the line to the target point is
\[\psi = \tan^{-1}\left(\frac{L_2 \sin(\theta_2)}{L_1 + L_2 \cos(\theta_2)}\right)\]
The shoulder joint angle is then given by
\[\theta_1 = \phi - \psi\]
Together, \(\theta_1\) and \(\theta_2\) fully define the arm configuration required to reach a given point on the page. In practice, inverse kinematics must be computed repeatedly for closely spaced points along a trajectory to ensure smooth motion.
Although this inverse kinematics formulation was explored, mechanical backlash, limited servo resolution, and imperfect link geometry made precise positioning unreliable. As a result, the final implementation implemented the above method of tuned angular trajectories that produced more consistent handwriting results on the physical hardware.
Logical Structure
At the lowest level, the system generates PWM signals using RP2040 hardware peripherals to control servo motors. These signals are abstracted into smooth motion primitives such as straight lines and arcs by gradually stepping servo angles toward target values. Individual letters are constructed from sequences of these primitives, and higher-level routines sequence letters into complete words.
Figure 1: High Level Code Overview.
Hardware/Software Tradeoffs
Servo motors were selected for their simplicity, low cost, and ease of integration. This choice sacrifices absolute positional accuracy and repeatability compared to stepper motors or closed-loop systems. Open-loop control was used instead of encoders or feedback sensors, reducing hardware complexity while increasing reliance on software-based motion smoothing and calibration.
Relevant IP Considerations
Handwriting robots and plotting mechanisms are well-established concepts with many existing patents and open-source implementations. This project does not attempt to replicate any proprietary mechanism and is intended strictly for educational use.
Program and Hardware Design
Program Details
PWM
Each MG90S servo expects a pulse between 500 µs (0°) and 2500 µs (180°) at a period of 20 ms (50 Hz). Using the RP2040's hardware PWM modules, we configured each GPIO pin connected to a servo as a PWM output:
Clock Configuration:
125 MHz system clock divided by 125 → 1 MHz PWM clock, giving 1 µs resolution.
Wrap Value:
PWM wrap set to 20000 → 20 ms period (50 Hz).
Channel Output:
\( \text{pulse width (µs)} = 500 + \frac{\text{angle}}{180} \cdot 2000 \)
This was done in the following functions:
setup_servo(uint pin):
Configures a given GPIO pin for PWN to control a servo; Sets PWN frequency, resolution, and enables the channel
set_servo_angle(unit pin, float target_angle, float step_delay_ms, float step_size)
: Moves a specified servo to a target angle gradually for smooth motion; Updates PWM pulse width in small increments with delays to avoid jerky movements
Smooth Motion Algorithm
Rather than moving servos directly to a target angle (which causes jitter), the firmware implements incremental stepping:
Current angles stored in static variables.
Servo is stepped in small increments (e.g., 1°) with fixed delays (10–20 ms) between updates.
Testing and Initialization
Servo sweep test: 0° → 180° → 0° to confirm PWM configuration.
Oscilloscope verification: Measured PWM pulse widths at each GPIO to ensure accurate and consistent timing.
Handwriting Primitives
v_line()
h_line()
: straight strokes.
diag_left()
diag_right()
: diagonal strokes.
circle()
arc()
: curved motions using sine/cosine for base/elbow angles.
pen_up()
pen_down()
: control vertical motion.
Utility Functions
default_pos():
Resets all servos to a deafult "home" position (base at 90 degrees, elbow and shoulder at 0 degrees)
pause_short():
Pauses execution for 200 ms
pause_long():
Pauses execution for 500 ms
Hardware Details
The mechanical system was constructed using parts from a craft robotic car kit with a claw arm, modified for handwriting purposes. A custom 3D-printed base clamps the system to a table and houses the base rotation servo. Two additional servos control the shoulder and elbow joints, enabling vertical motion. The writing instrument is held using a modified binder clip attached to the end effector. The design can be replicated using commonly available components and does not require custom PCBs.
Figure 2: Arm Parts Labeled
Electrical and Wiring Details:
Servo Power:
All three MG90S servos were powered directly from the RP2040’s 3.3 V output. This is below the recommended operating voltage (4.8–6 V), causing intermittent or weak motion, especially when multiple servos move simultaneously.
Ground Connections:
Servo grounds and RP2040 ground are connected together to provide a common reference for reliable PWM signaling.
PWM Timing:
PWM outputs are generated by the RP2040’s hardware PWM modules at a 1 MHz clock. Each servo expects a pulse width from 500 µs (0°) to 2500 µs (180°) at a 20 ms period (50 Hz).
Signal Considerations:
The 3.3 V logic level is marginal for full servo reliability. Incremental angle stepping and careful testing of individual letters were used to mitigate this issue.
Figure 3: Wiring Diagram
Figure 4: Base CAD
GPIO Connections
Component
GPIO Pin
Description
Base Servo

Controls rotation of base joint
Shoulder Servo

Controls shoulder joint (vertical movement)
Elbow Servo

Controls elbow joint (vertical motion of pen)
Things That Did Not Work
Inverse Kinematics Attempt
Initially, we attempted to implement full inverse kinematics (IK) to calculate the precise angles for the base, shoulder, and elbow servos to reach arbitrary X–Y positions on the paper. However, due to mechanical backlash, imperfect link lengths, and the low resolution of hobby servos, the IK approach was unreliable. The robot frequently overshot or undershot the intended positions, producing illegible results. Consequently, we abandoned formal IK in favor of empirically tuned angular trajectories for each letter stroke.
Servo Control Issues
During early testing, powering the servos together did not cause issues. However, after assembling the full robot, we often observed that servo motors would fail to respond unless their wires were held in certain positions. This wire sensitivity was likely caused by insufficient voltage: the RP2040 outputs 3.3 V logic signals, which are marginal for driving three hobby servos simultaneously. Sometimes the servos moved reliably, but other times they were inoperative, leading to failed letter

Technologies used

RP2040CPWMLEDBLERFIRMotorServoStepperIMU

Hardware components

  • RP2040
  • servo motor
  • stepper motor
  • IMU

Software & tools

  • C
  • Arduino IDE

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.