A 4-DOF belt-driven robotic arm running on an Arduino Mega 2560 + RAMPS 1.4 shield, with three NEMA17 + A4988 joints and a 28BYJ-48 (or servo) gripper. The shoulder uses a parallel linkage, so the heavy motors stay at the base and the printed parts don't have to carry them.
📺 It in motion: https://youtu.be/T5URUtJ1Zg4
Mechanical build, BOM, printable parts and step-by-step assembly live with the project on Printables / the maker portal. This repo is just the firmware.
robotArm_v0.81/
├── robotArm_v0.81.ino ← main sketch (open this in the Arduino IDE)
├── config.h ← board + feature selection (gripper, controller, axes)
├── pinout/
│ ├── pinout.h ← default pin map (Arduino Mega + RAMPS 1.4)
│ ├── pinout_uno.h ← Uno variant
│ └── pinout_wemosD1R32.h← Wemos D1 R32 / ESP32 variant
├── config_esp32.h ← ESP32 build overrides
├── RampsStepper.{h,cpp} ← stepper wrapper for A4988 on RAMPS
├── endstop.{h,cpp} ← homing
├── byj_gripper.{h,cpp} ← 28BYJ-48 + ULN2003 gripper driver
├── servo_gripper.{h,cpp} ← alternative hobby-servo gripper
├── controller_ps4.{h,cpp} ← optional PS4 manual controller
├── controller_wiimote.{h,cpp} ← optional Wiimote manual controller
├── command.{h,cpp} ← serial command parser
├── queue.h ← move queue
├── interpolation.{h,cpp} ← linear interpolation between target poses
├── robotGeometry.{h,cpp} ← inverse kinematics for this arm
├── fanControl.{h,cpp} ← 12 V cooling fan
└── logger.{h,cpp} ← serial logger
config.h_samples/ ← reference configs (incl. upstream ftobler config)
| Part | Default |
|---|---|
| MCU | Arduino Mega 2560 |
| Driver shield | RAMPS 1.4 |
| Joint motors | 3× NEMA17 + A4988 (X / Y / Z = base / shoulder / elbow) |
| Gripper | 28BYJ-48 + ULN2003 (default) — or hobby servo, see config.h |
| Homing | 3× limit switches (one per stepper joint) |
| PSU | 12 V / 4 A via 2.1 mm DC jack |
| Cooling | 12 V 5010 fan |
The Uno and ESP32 (Wemos D1 R32) pinouts are checked-in but the Mega + RAMPS combination is the supported reference build.
Authoritative pin map:
robotArm_v0.81/pinout/pinout.hfor Mega/RAMPS, andpinout_uno.h/pinout_wemosD1R32.hfor the alternative boards.TODO (maintainer): hoist the X/Y/Z/E step+dir+enable pins, the three endstop pins, the gripper pins and the fan pin into a table here so visitors don't have to open the header.
- Install the Arduino IDE 1.8.x or 2.x.
- Tools → Board → Arduino Mega 2560.
- Open
robotArm_v0.81/robotArm_v0.81.ino. - Install the libraries the sketch
#includes through Tools → Manage Libraries…- TODO (maintainer): list the exact libraries here once verified against the
#includelines in the .ino — likely candidates given the file layout:AccelStepper,Servo, and (only if you enable that controller)PS4Controller/ a Wiichuck library. Do not install controller libs you don't use.
- TODO (maintainer): list the exact libraries here once verified against the
- Connect the Mega over USB, pick the right port, and Upload.
Open robotArm_v0.81/config.h and pick:
- Board / pinout — uncomment the matching pinout include
- Gripper — 28BYJ-48 stepper or hobby servo (mutually exclusive)
- Manual controller — none / PS4 / Wiimote (optional; the arm also works headless over serial)
- Axis direction flips and steps-per-degree — match these to your microstepping jumpers on the RAMPS board
The
config.h_samples/folder has reference configs you can diff against if your build behaves oddly.
After flashing, open the Serial Monitor at the baud rate set in the sketch (TODO: confirm — Serial.begin(...) in robotArm_v0.81.ino).
The firmware accepts a queued command stream parsed by command.cpp — see that file for the exact syntax it understands. The queue.h + interpolation.cpp pair suggests G-code-style buffered moves with linear interpolation between targets, but please confirm against command.cpp before relying on specifics.
If you wired up a PS4 pad or a Wiimote and enabled it in config.h, the arm can also be jogged manually — pairing instructions live in the relevant controller_*.cpp.
On startup the firmware drives each motorised joint toward its limit switch. Make sure all three switches are wired and triggering before you power up — an un-homed axis with a missing endstop will crash into the frame.
- Sketch won't compile, complaining about a missing library — check the
#includelines at the top ofrobotArm_v0.81.inoand thecontroller_*.hfiles; install whatever's missing through the Library Manager. - Steppers buzz but don't turn — A4988 Vref not set, or microstepping jumpers under the drivers don't match
config.h. Set Vref to ~0.7 V for a NEMA17 first, then tune. - Joint runs the wrong way — flip its
INVERT_*flag inconfig.h(or swap one coil pair on the motor connector). - Endstop never triggers / triggers permanently — RAMPS endstop headers are 3-pin (S / – / +); a swapped connector latches the input. Test with a multimeter in continuity mode.
- Gripper stepper just hums — 28BYJ-48 coil order on the ULN2003 is
IN1-IN2-IN3-IN4; getting the order wrong gives vibration without rotation.
This codebase shares structure with ftobler/robotArm (see config.h_samples/config_sample_V0.61/ftobler_original/). If this repo is derived from that project, the upstream license applies — TODO (maintainer): confirm the lineage and add a proper attribution + matching LICENSE file.
TODO (maintainer): commit a
LICENSEfile. If this is derived from ftobler/robotArm it inherits GPL-2.0; if it's an independent rewrite, pick one (MIT / GPL-3.0 / CC-BY-NC-SA for the docs, etc.) and reference it here.