RobArt – Software

The software architecture of RobArt.

Architecture Overview

┌─────────────────────────────────────────────────┐
│             iOS/macOS App                       │
│    (Bluetooth, SVG Editor, Control)             │
└────────────────────┬────────────────────────────┘
                     │ Bluetooth
                     ▼
┌─────────────────────────────────────────────────┐
│             Raspberry Pi                        │
│    (SVG Parsing, Coordination)                  │
└────────────────────┬────────────────────────────┘
                     │ Serial
                     ▼
┌─────────────────────────────────────────────────┐
│              Arduino                            │
│    (AccelStepper, Real-time Control)            │
└─────────────────────────────────────────────────┘

Arduino Firmware

AccelStepper Library

For precise stepper motor control, the AccelStepper library is used:

#include <AccelStepper.h>

AccelStepper stepper1(AccelStepper::DRIVER, STEP_PIN1, DIR_PIN1);
AccelStepper stepper2(AccelStepper::DRIVER, STEP_PIN2, DIR_PIN2);
AccelStepper stepper3(AccelStepper::DRIVER, STEP_PIN3, DIR_PIN3);

void setup() {
    stepper1.setMaxSpeed(1000);
    stepper1.setAcceleration(500);
    // Same for stepper2, stepper3
}

void loop() {
    stepper1.run();
    stepper2.run();
    stepper3.run();
}

Kinematics – Omnidirectional (3 Wheels)

The three wheels are arranged at 120° angles. For movement in x/y direction and rotation ω:

v₁ = vₓ + r·ω
v₂ = -0.5·vₓ + (√3/2)·vᵧ + r·ω
v₃ = -0.5·vₓ - (√3/2)·vᵧ + r·ω

Arduino implementation:

void setVelocity(float vx, float vy, float omega) {
    float v1 = vx + RADIUS * omega;
    float v2 = -0.5 * vx + 0.866 * vy + RADIUS * omega;
    float v3 = -0.5 * vx - 0.866 * vy + RADIUS * omega;
    
    stepper1.setSpeed(v1 * STEPS_PER_MM);
    stepper2.setSpeed(v2 * STEPS_PER_MM);
    stepper3.setSpeed(v3 * STEPS_PER_MM);
}

SVG Path Parsing

Supported Commands

Command Description Parameters
M/m MoveTo (pen up) x, y
L/l LineTo (line) x, y
C/c Cubic Bézier x1, y1, x2, y2, x, y
Q/q Quadratic Bézier x1, y1, x, y
Z/z ClosePath -

Example Path

<path d="M 10 10 L 50 10 L 50 50 L 10 50 Z" />

Creates a square: Start at (10,10), lines to corners, back to start.

G-Code Support

In addition to SVG, RobArt supports G-Code:

G-Code Description
G00 Rapid positioning (pen up)
G01 Linear interpolation (pen down)
G02 Circular arc clockwise
G03 Circular arc counter-clockwise

iOS/macOS App

The companion app provides:

  • Bluetooth Connection – Auto-discovery of RobArt
  • SVG Editor – Create and edit graphics
  • Live Preview – Check drawing before execution
  • Manual Control – Joystick for direct movement
  • Calibration – Wizards for hardware setup

Raspberry Pi Software

The RPi handles:

  1. Bluetooth communication with app
  2. SVG/G-Code parsing and validation
  3. Path optimization (ordering, curve smoothing)
  4. Command transmission to Arduino via Serial

Socket.IO Integration (Optional)

RobArt can alternatively be controlled via the Collab Server:

{
  "type": "draw",
  "path": "M0,0 L100,100 L200,0"
}