Introduction: 5 DOF Robotic Arm Control
In this instructable I will show you how to work with 5-DOF robotic arm from DFRobot. Robotic arm can be bought at https://www.dfrobot.com/product-227.html.
If you have any questions or problems you can contact me on my mail:iwx.production@gmail.com.
Visit my channel on Youtube: https://www.youtube.com/channel/UCuS39O01OyPeChjfZm1tnQA
So let's begin.
Step 1: Material
Components for this project were provided by DFRobot.
We will use:
-5 DOF Robotic Arm
-Arduino Uno
-Arduino Uno expansion shield
-push button module
-potenciometer
-Joystick module (2x)
For powering servos I had used:
-adjustable power supply (0 - 30 V). Servos need about 7 V for normal operating.
Step 2: 5 DOF Robotic Arm
About 5 DOF Robotic Arm.
Robotic arm has been covered a variety of fields, including manufacturing industry, medical treatment, security control and other application. It plays as an assistant, an operator or even a work partner, like “Jarvis”!DFLG6DOF is a bionic robotic arm, it consists of six servo motors, corresponding to the arm, elbow, wrist (2 degrees of freedom), five joints and one rotating base in all.
Each joint can move in a certain range, and the base can be rotated about 180 degrees. With 24 channel veyron servo controller, all action can be controlled via PC software, supporting online debug and wireless control. In a word, this is a high cost performance, easy to use robot arm. It is real a good robot demonstration teaching platform and DIY robotic arm.
SPECIFICATION
- Operating Voltage: 4.8 ~ 7.2V
- Maximum load: 500 g
- Operating Current: 3A @ 5V (max)
- Interface type: XH2.54-3P interface
- Length (Assembled): 280 mm
- Height (Assembled): 340 mm
- Weight: 1096 g
It can be bought on DFRobot site.
Step 3: Modules
Joystick Module V2
Module consist of 2 analog outputs for x,y axis and 1 digital output for z axis. It comes with really nice connector cables, with which it can be easily connected to IO Expansion Shield For Arduino(V5).
Specification
- Supply Voltage: 3.3V to 5V
- Interface: Analog x2
- Digital x1
- PH2.0 Interface
- Size:35x39mm
- Weight:15g
PIN LAYOUT:
- Pin X: S——Analog OUT
- Pin Y: S——Analog OUT
- Pin Z: DATA——Digital OUT
IO Expansion Shield for Arduino V7.1
IO Expansion shield is one of the market favourites. Fast robotics prototyping made affordable and simple thanks to this design. Soldering and wiring often become a problem when a bridged connection happens and components break. Increasing time and cost for projects. Often, without this solution and a soldering station, wire cripping tools or soldering station, robot prototyping or electronics DIY becomes a very long term project.
FEATURES
- Compatible with the new Arduino Due
- 3.3V/5V operating voltage select
- Switch for wireless communication & programme
- More Easily recognitive interfaces
- Colorful header for illustrating digital or analog pins
- Immersion gold surface
SPECIFICATION
- Input Voltage 7-12 V
- 4.8 - 6 V, SERVO_PWR, depending on your servo
- Compatible module voltage: 5V/3.3V
- Support interface: I2C, SPI, Xbee (Xbee pro), Bluetooth, APC220.
Step 4: Robot Arm Controller
I have designed holder for two joysticks and one push button. Design is similar to PS or XBOX controller.
On each side is mounted one of joysticks, so you can control it with your thumb. Also there is mounted red push button for "emergency stop".
This three modules are fixed to holder with mounting kit from DFRobot. More can be seen on pictures.
I have attached stl. file if you want to 3D print it.
Attachments
Step 5: Wiring
All the wiring is done on IO Expansion Shield For Arduino(V5). On the right side of expansion shield there are pins which are used for controlling servos (Vcc, GND, data). With this module you can power up to 14 different servos.
Servo connection:
- Servo1 to digital pin 9
- Servo2 to digital pin 8
- Servo3 to digital pin 7
- Servo4 to digital pin 2
- Servo5 to digital pin 5
- Servo6 to digital pin 4
Connection terminal SERVO_PWR is connected directly to adjustable power supply. This terminal is used for powering servos. If you dont provide high enough voltage, servos wont work properly.
Joystick modules
X and Y axis connectors from joystick modules are connected to analog inputs from 0 - 3.
1st module: is used for moving robotic arm up and down
- x axis - analog input 0
- y axis - analog input 1
2nd module: used for claw control (rotation, open and close).
- x axis - analog input 2
- y axis - analog input 3
- z axis - digital input 10
Potentiometer
Potentiometer is used to control roboto arm rotation. It can be rotated for 180°.
Its connected to analog input 4.
Step 6: Code
I have designed two different codes.
Purpose of first code is that, when you move servo to new position with joystick, it stays in that position as long as you are holding joystick in same position. When you release joystick, servo will go back to the position in which it was before you moved joystick. In this program you can choose random home position.
Second code is a bit different, because its purpose is quite opposite as first code. When you move servo to new position, it will stay in that position. So we could say that this code is position maintaining mode. You can choose between fine and quick positioning.
What does fine and quick positiong means? It means that you can choose for how much, will you move servo motor. Servo can be moved for 5° or 15° at once, it depends on how much you push joystick.
Program consist of 6 sub programs:
- Rotation() - we are using map function to convert values from 0 - 1032 to 0 - 180° (used for rotating robotic arm). Value from map function is then writen into variable potencio.
- DSSDown() - used to control first servo (above rotating platform)
- DSSMiddle() - used to control second servo.
- DSSUp() - used to control third servo which moves claw up and down.
- ClawRotation() - used to control claw rotation.
- PushButton() - used to control claw state (opened or closed).