5-DOF Robot arm with wifi-control via Blynk
Team 1: Eerik Alamikkotervo, Aaro Junnikkala, Olli Heikkilä
1. Brief Project description
The goal of this project is to build a 5-DOF Robot arm with wifi-control via Blynk-app. 5-DOF means that the robot arm will have 5 joints, which all have their own servo plus one additional servo for controlling the gripper. Each of the servos will have their own slider control in the blynk app. Additionally we added the possibility to save postions and run them peridiocally. Bonus goal is adding inverse kinematic control that allows controlling the robot arm in x,y,z coordinates. The hearth of this project is a Arduino MKR1010 with built in wifi and bluetooth connectivity. The robot arm body is 3d-printed according to the stl.files offered in the site: https://howtomechatronics.com/tutorials/arduino/diy-arduino-robot-arm-with-smartphone-control/ . The servos are strongly integrated in the design, so identical servos are used.
2. Electromechanical structure (step by step)
1: List of required parts was created
Price in total
Lend for free
Old phone charging cable
5V 2A USB power brick
Old phone charging power brick
Plastic tapping screw 2.5X10
2: The body of the robot arm was 3D printed using stl files provided in Howtomechatronics site: https://howtomechatronics.com/tutorials/arduino/diy-arduino-robot-arm-with-smartphone-control/. Following setting were used for printing (printer Ultimaker 2):
Buil Plate Adhesion
ON, Type: Brim
Instructions for 3d printing with ultimaker printers can be found in this power point tutorial (includes videos).
3: The servos were tested one by one in order to confirm that they work properly before installation.
4: The power cable was created by opening an USB cable and separating the positive (colour: red) and ground (color: black) wire from the data transfer wires. This modified USB cable was then plugged to and 5V 2A power brick. This power module provides power to the MKR1010 board and all the servos. 5V and 2A is required in order to provide enough power to all the servos.
5: The servos were installed to the body and after that body parts were installed together. Necessary screws were provided with the servos, but the quality was so poor that better quality tapping screws had to be purchased. In the picture below the self purchased better quality screw is above the low quality one provided with servos. The grapple was assembled using M3 nuts and bolts that were purschased separately.
6: The robot arm and MKR1010 board were fixed on to a wooden board and all the necessary connections were made in the bread board. The final assembly and circuit diagram are found in the pictures below. The TinderCAD diagram has Arduino UNO in it but in reality it is the MKR1010
3.1. Blynk-app and library
The robot arm is controlled with blynk mobile application. The app talks with blynk servers and blynk serves talk with the MKR1010 board wifi module. The wifi module and phone have to be connected to internet but they don't have to be in the same network because data is routed via blynk serves not straight via local network. Blynk has also developed a designated Blynk library (named Blynk) for connecting and controlling MCU board like MKR1010. This makes it easy to connect the MKR1010 to the blynk servers and send and reseive data from the application.
The blynk application has an graphic interface that allows to place different kinds of controls to the dashboard. We used sliders for moving each of the joint servos (rotation angle 0-180 degrees) and buttons for controlling the gripper (open/closed). We also added buttons for saving two positions and and running them. When SAVE POS -button is pressed all the servo angles are saved to vector and when RUN POS -button is pressed each the servos move to the orientation that was saved in the corresponding vector.
3.2. Smooth servo movements
Controlling the arm was done with Blynk over Wi-Fi. Arduino has ready to use libraries for running Blynk and for controlling the servos. We couldn't use the default servo.h library for controlling the servos because it had such sharp movements that it caused the servos to oscillate in certain postions. The grapple had the biggest problem with oscillation. When the grapple points straight down the resistance for the servo is very small which causes the PID controller of the servo to overdue to the movements and the grapple starts to oscillate. This position is shown in the picture below.
The solution for this probelm was using ServoEasing.h library which operates on top of servo.h library. ServoEasing library is able to make the start and ending of the servo movement smoother by utilising different kinds of easing functions (linear, quadratic, cubic, sine and many more). This allows the servos to have smaller angular acceleration in the start and beginnig compared to using only servo.h library commands. This library has also built in possibility to run all servo at the same time. Unfortunately the small SG90 servos that we used didn't function correctly with that option enabled. The started to do random movements in the middle of the transistion from one postions to an other. After disabling that option everything worked correctly. We suspect that the poor qulaity PID controller on the servo might be the reason for this problem because the bigger servo model diidn't have similar issues.
3.3. Source code
The source code can be downloaded below. Remember to download all necessary libraries before testing the code: Blynk(BlynkSimpleWiFiNINA.h), WiFiNINA.h, ServoEasing.h, Servo.h, SPI.h.
4. The final product
The final product more or less met our expectations. The angles of the servos can be moved individually pretty accurately with sliders. Alternatively servo angles can be saved to the microcontroller's memory and run on command. The robot arm was able to move small objects between two predefined positions as seen in the video. It was a little disappointing that we weren't able to run all the servos at the same time or implement inverse kinematics. For such projects stepper motors would be highly recommended.
5. Improvement ideas and thoughts about the project
3d-printing is a cheap way to make the robot arm body, but it has some downsides. There are gaps between the parts which puts a lot of load to the servo axis and allows the joints to wiggle. Some of the gaps are shown in the picture below. This problem could be partially fixed with more accurate design. The other donwside is the soft nature of plastic. You can only screw a fastener once before the hole becomes loose. Thus we would recommend using aluminiun body which can be purchased quite cheaply
We used really cheap servos in this project. The bigger servo model, MG966R servo, worked well and it could handle the weight of the arm quite easily. The smaller SG90 servo however wasn't very accurate or durable and we would recommend replacing it with a better quality one. If budget allows upgrading to stepper motors is recommended. Stepper motors can hold their position and move smoothly without oscillation that the PID control causes to reqular servos.
We wanted to add inverse kinematics to the robot arm but doing smooth movements even without inverse kinematics turned to be quite challenging with our low quality servos. Thus we weren't able to implement inverse kinematics to our robot arm. For an inverse kinematics project we would recommend aluminium body and stepper motors.