Skip to main content
Version: ACS CC

Crane Controller

Mini crane system using Raspberry Pi Pico 2W.

info

Author: Stanciu Vlad-Mihai
GitHub Project Link: https://github.com/UPB-PMRust-Students/proiect-StanciuVlad1


Description

The project consists of a mini crane built using a Raspberry Pi Pico 2W, capable of:

  • Rotating the crane arm left and right using a servo motor (SG90) controlled by a joystick.
  • Raising and lowering the load using a stepper motor (28BYJ-48 + ULN2003 driver).
  • Managing multiple motors asynchronously using Rust and Embassy.
  • Controlling the servo motor via a biaxial joystick for precise horizontal and vertical movements.
  • Being powered independently by external 9V batteries to avoid overloading the controller.

This setup simulates the mechanical behavior of a real crane, combining both rotation and lifting functionalities.


Motivation

I wanted to build a mechanical system that combines precise motion control and hardware interaction through an embedded controller.
The project allows practice with PWM signals, motor driving, and simple automation using Rust on the Raspberry Pi Pico.


Architecture

The Raspberry Pi Pico 2W acts as the brain of the system:

  • Joystick: Sends analog signals to control the SG90 servo motor, rotating the crane arm horizontally (left/right).
  • SG90 Servo Motor: Moves the crane arm based on joystick input, using PWM on GPIO 14.
  • 28BYJ-48 Stepper Motor + ULN2003 Driver: Raises or lowers the load using a wound cable or string.
  • Push Buttons (GPIO 16 & 17): Used to command the stepper motor to rotate clockwise or counter-clockwise.
  • Stabilized 12V Power Supply: Provides external power to the motors, protecting the Pico from overload.
  • Header Pins and Breadboard: Simplify prototyping and electrical connections.
  • Common Ground: Ensures reliable signal references across all components.

Data flow:

  • The joystick's VRx and VRy outputs are read via GPIO 27 and GPIO 26.
  • Movement of the joystick determines whether the servo should rotate left or right.
  • PWM is used to set the servo's position accordingly.
  • Pressing either of the two buttons controls the direction of the stepper motor rotation via the ULN2003 driver board.

Block Scheme

diagram

Log

Week 5 – 11 May

Wired all components to the Raspberry Pi Pico and wrote individual mock-up test code for each component to verify functionality (joystick, servo motor, stepper motor with driver, and push buttons).

Week 12 – 18 May

Integrated the joystick with the servo motor through custom control code, allowing directional rotation of the crane arm. Also started basic physical construction of the crane using cardboard to create a preliminary structure.

Week 19 – 25 May

Completed the physical structure of the crane using cardboard, ensuring stability and accessibility to all components. Successfully integrated all hardware elements — joystick, servo motor, stepper motor with ULN2003 driver, and control buttons — under the final unified control code. The system now allows simultaneous and responsive control of both the crane arm (servo) and vertical lift (stepper) based on user input.

Components

ComponentPurposeDetails
Raspberry Pi Pico 2WMain controllerRuns firmware and manages motor control logic
Joystick XY ModuleInput deviceSends analog signals to control servo direction (GPIO 27 & GPIO 26)
Micro Servomotor SG90Arm rotationRotates the crane arm left/right via PWM (GPIO 14)
28BYJ-48 Stepper Motor + ULN2003 DriverLoad liftingRaises or lowers the crane's load with button input
Push Buttons (×2)Stepper controlOne button per rotation direction (GPIO 16 and 17)
12V Stabilized Power AdapterExternal motor powerProvides stable supply to servo and stepper motors
Header Pins (2x40p)WiringEnables clean prototyping and secure connections

Hardware Overview

  • The joystick is powered by an external 5V source and shares a common ground with the rest of the components.
  • Its analog outputs, VRx and VRy, are connected to GPIO 27 and GPIO 26 on the Raspberry Pi Pico.
  • The direction in which the joystick is moved is determined by reading these analog values.
  • Based on the joystick input, the Pico adjusts the position of the SG90 servo motor via PWM output on GPIO 14.
  • The stepper motor receives its control signals from the Pico through a ULN2003 driver board.
  • Its rotation direction is selected using two push buttons, connected to GPIO 16 and GPIO 17, both tied to a common ground.
  • All motors (servo and stepper) are powered by an external 5V supply to ensure stability and avoid overloading the Pico.
  • A shared ground connection is used across all components to maintain proper signal reference.
  • Breadboards and male header pins facilitate organized prototyping and signal routing.

Photos

diagram
diagram
diagram
diagram


Schematics

diagram

Bill of Materials

Product CodeDeviceUsagePrice
5056561803975Raspberry Pi Pico 2WMain controller39,66 lei
-Joystick XY ModuleJoystick directional control8,00 lei (aprox.)
-Micro Servomotor SG90 180°Arm rotation (controlled by joystick)14,00 lei
-Stepper Motor 28BYJ-48 + Driver ULN2003Load lift system18,00 lei (aprox.)
642646200263512V 1A Power Supply AdapterMotor power supply18,99 lei
-Push Button ×2Stepper motor control1,00 lei × 2 = 2,00 lei

Software

LibraryDescriptionUsage
embassy-rpRP2040 HALAsync control of GPIO, PWM for servo, ADC for joystick, timers
embedded-halHAL Traits (sync)Generic GPIO and PWM abstraction for portability and compatibility
defmt + defmt-rttLogging FrameworkReal-time embedded logging over RTT
panic-probePanic HandlerDiagnostic panic messages compatible with defmt
fixedFixed-point arithmeticUsed to accurately configure the PWM divider
embassy-timeAsync TimersPrecise non-blocking delays for servo and stepper control