A Raspberry Pi robotic arm trades the Arduino’s simplicity for a full Linux computer — which means cameras, computer vision, machine learning and web interfaces. This guide explains when the Pi is the right brain, how to drive servos properly, and how to add vision and remote control.

If you only need the arm to move reliably, the Arduino build is simpler and cheaper. The Pi earns its place when software matters.

Pi vs Arduino: pick the right brain

NeedBest choice
Precise, real-time servo motionArduino / ESP32
Lowest cost and complexityArduino
Camera + computer visionRaspberry Pi
Machine learning / object detectionRaspberry Pi
Web or app controlRaspberry Pi
Best of bothPi brain + Arduino motion controller

Driving servos: use a PCA9685

Don’t drive servos from the Pi’s GPIO — software PWM jitters and the Pi can’t source the current. Add a PCA9685 16-channel PWM driver over I2C plus a separate 5–6V supply (common ground with the Pi). Control it in Python:

from adafruit_servokit import ServoKit
import time

kit = ServoKit(channels=16)          # PCA9685 over I2C

JOINTS = {"base": 0, "shoulder": 1, "elbow": 2, "gripper": 3}

def move(joint, angle):
    kit.servo[JOINTS[joint]].angle = max(0, min(180, angle))

# Simple pick gesture
move("base", 90); time.sleep(0.5)
move("shoulder", 60); move("elbow", 120); time.sleep(0.5)
move("gripper", 30)   # close

Enable I2C with sudo raspi-config and install the library with pip install adafruit-circuitpython-servokit.

Adding camera vision

A Pi Camera or USB webcam plus OpenCV lets the arm see. A typical vision-guided pick:

  1. Capture a frame with OpenCV.
  2. Detect the target (color threshold, contour, or an ML model).
  3. Convert the pixel position to an arm coordinate (a simple calibration maps camera space to arm space).
  4. Use inverse kinematics to compute joint angles for that point.
  5. Move and grip.
import cv2
cap = cv2.VideoCapture(0)
ok, frame = cap.read()
hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (35, 80, 80), (85, 255, 255))  # green object
M = cv2.moments(mask)
if M["m00"] > 0:
    cx, cy = int(M["m10"]/M["m00"]), int(M["m01"]/M["m00"])
    print("object at pixel", cx, cy)   # -> map to arm coords, then IK

Control it from a web browser

Because the Pi runs Linux, you can expose the arm over your network with a tiny Flask app and drive it from your phone:

from flask import Flask, request
from adafruit_servokit import ServoKit
app = Flask(__name__)
kit = ServoKit(channels=16)

@app.route("/move")
def move():
    j = int(request.args["joint"]); a = int(request.args["angle"])
    kit.servo[j].angle = max(0, min(180, a))
    return {"joint": j, "angle": a}

# run: flask --app app run --host 0.0.0.0

Now http://<pi-ip>:5000/move?joint=0&angle=120 moves the arm — wire that to buttons or sliders in a web page for a full remote.

The pro pattern: Pi brain + Arduino muscles

For the smoothest results, let the Pi handle vision and decisions, then send target commands over USB serial to an Arduino that does the real-time servo control. You get the Pi’s software power and the Arduino’s timing reliability.

Where to go next

Pair this with a rigid 3D-printed frame and inverse kinematics for a genuinely capable vision-guided arm.

Frequently asked questions

Should I use a Raspberry Pi or Arduino for a robotic arm?

Use an Arduino (or ESP32) when you mainly need precise, real-time servo control — it's cheaper and rock-solid. Choose a Raspberry Pi when you want a camera, computer vision, machine learning, or a web/app interface. A common pro setup uses a Pi as the brain and an Arduino as a real-time motion controller.

Can a Raspberry Pi control servos directly?

The Pi's GPIO can generate PWM, but software PWM jitters and the Pi can't supply servo current. Use a PCA9685 16-channel PWM driver over I2C with a separate 5–6V servo supply. This gives smooth, hardware-timed control of up to 16 servos.

What can a Raspberry Pi robotic arm do that an Arduino one can't?

Vision-guided pick and place (find an object with a camera, then grab it), voice or app control, logging and dashboards, and running ML models. The Pi runs full Linux and Python, so it connects the arm to the wider software world.