Welcome to a new Arduino project. In this tutorial we will see how to build a small Arduino crane controlled with a gamepad-style joystick. The crane moves with servo motors, which makes it a great school project for learning Arduino programming.
Table of contents
Materials used in the Arduino crane project
Below you can find the materials used to build this Arduino crane together with a short description of each one.
If you want to build the project yourself, you can click on the images to visit websites where those materials are available.
Arduino UNO board: It is the brain of the project and controls all of its processes through the code you will find below.
Joystick: By varying two potentiometers, it is possible to know the exact position (X, Y) and use it as a controller.
Servo motors: 5 V motors with a gearbox that provide very precise position control and strong torque for their size.
Protoboard: A board with internally connected holes (pins) that we will use to make the project's electrical connections.
Ice cream sticks: We will use these sticks as the structure that gives shape to the crane.
Components needed to build this Arduino crane
Below you will find a list of all the components used in the crane project so you can go straight to the product pages if you need them.
The ES cart takes you to Amazon Spain and the US cart takes you to the United States Amazon store.
WE DEVELOP YOUR IDEA
Need help with a project?
- Prototyping and MVPs
- Arduino and ESP32
- PCB design
- 3D part design
- Bluetooth connectivity
- Feasibility study
- Cost optimization
- Technical consulting
- Internet of Things
- Patent support
Step-by-step video of the Arduino crane project
If you want to see a much more detailed walkthrough of how to build this robotic crane from start to finish, including an explanation of the code, the video below covers the whole project in a more visual and easier-to-follow way. And if you enjoy this kind of content, do not forget to subscribe.
Arduino wiring diagram to build the crane
One of the most important parts of assembling this crane is connecting the different elements correctly. It is essential that the servo motors are wired properly.
To avoid assembly mistakes or incorrect connections, here is the wiring diagram used in this project. With this wiring, you can use the code at the end of the post without any modification.

Arduino code for the crane
Below you can find the Arduino code developed specifically for this project. The pins used in the code are the same ones shown in the wiring diagram above.
If you want a more detailed explanation of the different parts of the code used in this crane and how it works, we recommend watching the video above.
If you still do not have Arduino installed and need help using or installing the development environment, here is our guide on how to download the Arduino IDE.







//Canal de YouTube -> RobotUNO
//Proyecto: Grua con servomotores
#include <Servo.h>
//Definicion de los servos
Servo servo1;
Servo servo2;
int eje1=90;
int eje2=90;
void setup(){
servo1.attach(7);
servo2.attach(6);
servo1.write(90);
servo2.write(90);
}
void loop(){
//SERVO 1
if (analogRead(0)<200 && eje1<180){
eje1++;
servo1.write(eje1);
}
if (analogRead(0)>700 && eje1>0){
eje1--;
servo1.write(eje1);
}
//SERVO 2
if (analogRead(1)<200 && eje2<180){
eje2++;
servo2.write(eje2);
}
if (analogRead(1)>700 && eje2>0){
eje2--;
servo2.write(eje2);
}
delay(15);
}




