Fork Lift Bot by Arduino
As an instructor of robotics in robot center sohag and teaches arduino and made many robot by arduino.
These robots can move forward, backward, turn right and left but I didn’t make any moving mechanisms to do things, such as Push- Pull- Lift- Press - Drop off- Pick up. Like we do with Ev3 kits .
When we teach Ev3 robots , we teach programming and mechanics but not electronics And When we teach arduino , we teach electronics and programming but not mechanics
So I chose to make a fork lift bot by arduino (a lifting attachment and robot base ) and this the first step for making many other moving mechanisms to teach this mechanisms to the kids in my center beside the arduino programming and electronics to combine the three subjects in one project.
For designing the fork lift bot, I used Autodesk Fusion 360.
1- Started by drawing the enclosure sketches and as shown in the picture there are
2 bases ( base1 and base 2 )
4 Down sides
4 Top sides
1 top base
2 T-Shapes
( for laser cutting )
Links ( for 3D printing )
Steps :
1- Drawing the Down side_1 sketch with tabs and T-slots to be assembled by M3 screws and nuts
2- Extruded the sketch to a 2.5D design to make the Down_side1 component.
3- Did three copies to make 3 new component ( down_side2 , 3 , 4 )
4- Gave an appearance to the component and rotate it to be assembled.
5- Assemble the four sides using joints to make sure it will fit correctly.
6- Drawing the Base_1 sketch
7- Extruded the sketch to a 2.5D design to make the Base_1 component.
8- Assemble the 4 sides with the base_1 using joints .
9- Drawing the Base_2 sketch
10- Extruded the sketch to a 2.5D design to make the Base_2 component.
11- Assemble the Base_2 with the 4 down_sides using joints .
12- Drawing the Top_side sketch
13- Extruded the sketch to a 2.5D design to make the Top_side1 component.
14- make three copies to make 3 new component ( Top_side2 ,3 , 4 )
15- Assemble the four Top_sides using joints .
16- Assemble the four Top_sides with the base_2 using joints .
17- Drawing the Top_base sketch
18- Extruded the sketch to make the Top_base component.
19- Assemble the Top_base using joints .
20- insert the M3 screws from Mcmaster-carr
21- insert the nuts from Mcmaster-carr
22- Assemble the screws and nuts in the T-slots
23- Draw arm1 skitch ( Link )
17- Extruded the sketch to make the arm1 component.
23- Draw Link1 skitch
24- Extruded the sketch to make the Link1 component.
25- Draw T- Link skitch
26- Extruded the sketch to make the T-Link component and make 4 holes to assemble with the other links by screws and nuts.
27- Assemple the arm1 and link with movable joint.
28- make another arm and another link and assemble them.
29- Download the Arduino Uno step file from GrabCad site and uplode it to fusion 360.
30- insert Arduino Uno and mounting it to it's place place.
31- make a projection of Arduino in the base1 side and make extrude cut for the holes which i want to insert screws and nuts to assemble the Arduino.
33- by the same steps i insert the motor driver , Ultrasonic sensor, and mini bread board .
34- by the same steps i insert the 2 Gear motors.
35- by the same steps i insert the 2 servo motors , Hc-05 Bluetooth , and 9V Battery ( Green Box in the image ) .
36- Assemble the Links with the 2 servo motors.
37- by the same steps i insert the 2 Wheels and assemble it with the 2 gear motor.
38- Draw Carry1 sketch
39- Extruded the sketch to make the carry1 component.
40- Draw Carry2 sketch
41- Extruded the sketch to make the carry2 component.
42- Make another copy of Carry2 component
43- assemble the three component to make the Carry base.
44- image for the final fusion design.
45- another image for the final fusion design.
Steps for laser cutting :
1- Did a projection for each component to a new sketch to get the updated final holes and edits after mounting the components.
2- Exported the new sketched to DXF files.
For Fabrication I used:
Morn MT3050D CO2 Laser Cutter
3mm plywood
LaserWork (Software)
On Laser works software
1- import the DXF files to organize them together on each sheet (30x50 cm) .
I organize the files in 2 sheets and saved the two RLD files for the Laser Cutter.
image for the first RLD file
image for the second RLD file
On the Laser cutting machine:
Import my *.rld design to Laser Works program from a flash memory and Adjust speed 15 and power 70 for cut and Adjust speed 300 and power 25 for second layer to draw the lines in blue .
look for Preview to insure the design is fine and download G-code file to the machine and rename it (short name).
Put a wood sheet and tip it to insure it in a good position.
Use the arrow keys to Move the machine head to the top-left corner of the machine and press Origin Button.
Open my file by press arrow buttons and select memory file tab
Select the name of my file
Select Track Frame the machine moved like it’s cutting a rectangular piece of wood that can contain my design size but without emitting a laser.
Select Working time preview to Calculate the estimated working time for my design to report for the lap specialist
Select run to fabricate.
image for the first sheet after fabrication
Fabrication time : 11 minutes
image for the second sheet after fabrication
Fabrication time : 7.5 minutes
Video For Laser Cutter during process
After few days i did another fabrication because i edit some sketches and modify some component because The servo motors needs a spaces bigger than its holes and i do some changes and holes in another component and the base2.
and i made the same steps to fabricate the new sheet.
image for the third sheet after fabrication
Fabrication time : 6.5 minutes
Steps for 3D Printing :
In Fusion 360 program I Saved the parts that will be 3d printed as STL files.
Open the files in Ultimaker Cura program.
Choose the printer ( PRUSA i3 MK2 ) and the material ( PLA).
Recheck for setting ( profile 0.3 - infill 20% - Uncheck support - Uncheck adhesion ).
Slice the model after slicing the model ( it take time 3h 23minutes and take 49gram .
Export the file in .gcode format and rename it (Links_3h_23min_49gram_PLA_gray.gcode).
Put the file on a Flash memory.
Insert the memory card in the 3D printer
Press the control knob to access the Main Menu. Then Select Print from SD and select the file Name to start printing
image for cura program
image the screen of 3D printer
image for 3D printer during fabrication
image Links Parts after fabrication
The electronics circuit is illustrated by using TinkerCad and edit with paint program to add motor driver and Bluetooth and then implemented using real components.
The project consists of two input which are the mobile application commands that are sent through the Bluetooth module or the reads from the Ultrasonic sensor and then it preforms a smart action which is the motion in different directions and lift or lower the arms of the bot according to the instruction as it is programmed. The arduino acts as the brain of the whole project as it has the microcontroller.
Components list:
Inputs component :
Ultrasonic Sensor module : ( measures the distance of a target object )
Bluetooth HC-06 Module :
( to communicate the Arduino with mobile Bluetooth and receive data from mobile application )
Outputs (action Component ):
Two DC Gearbox Motors
( to move the bot forward and backward and turn right and left )
Two Servo Motors
( to lift and lower the arms of the bot )
Others
Arduino Uno ( Microcontroller or the brain )
Mini breadboard ( to wire the component together )
H-Bridge module ( to control the two gears motors )
jumper wires (male-male, male-female)
adapter connector (female) (to connect the adapter or the battery )
7.4 V Battery.(1000 MAH Lithium Polymer battery rechargeable ) to power the circuit.
I used 7.4 V Battery.(1000 MAH Lithium Polymer battery rechargeable ) to power the circuit because the fork lift bot move from place to another so it can't connect with adapter.
the driver , 2 servo motor and the Arduino are connected in parallel with the battery.
each of Pervious components are powered by about 5 v and for the driver it needs from 5 to 9 v to operate, so we used the battery to power the arduino, the arduino itself has a voltage regulator so it will be powered by the voltage needed and from the Vin pin the same voltage entered from the battery outgoes and that is exactly what we need for the driver so we will connect the 12 v pin of the driver to it.
Ultrasonic sensor and the Bluetooth module operates with 5v so we will connect it to the 5v pin in the arduino uno board.
Recharge the 7.4 battery with its charger and until the 3LEDs becomes Green.
Test the volt of the battery after recharging it
Arduino IDE program to write the c code for Arduino
Bluetooth RC Controller app.
to test connection and control
the fork lift bot
MIT app Inventor program
to create an application on the mobile to control the Bot
Bluetooth RC Controller app.
Download and install the app. in my phone then open it and go to setting to Know what character the program send when i press in its buttons and i Know that :
( upper arrow ) -->"F"
( Down arrow ) --> "B"
( left arrow ) --> "L"
( Right arrow ) --> "R"
( front light button ) --> "W"
( back light button ) --> "U"
( sound button ) --> "P"
and I used this characters in the Arduino code .
Code of Bluetooth Car by Arduino IDE :
I begin with code of Bluetooth Car to move the fork lift bot in different direction according to commands that are sent through the Bluetooth module from the mobile application.
First, I started by
Defining the pins 4, 2, 8 and 7 and gave for each pin a name ( IN1 , IN2 , IN3 , IN4 ) for more readability of the code.
Defined a global variable which is "reading" and gave it the a data type "char" as it is going to store letters.
Then inside the void setup:
Using Serial.begin we intialise the communication between the arduino and the bluetooth module.
Set the mode of each pin using pinMode, here all the pins (IN1 , IN2, IN3, IN4) are output pins.
After that, I started to create some functions that I will call them inside the void loop.
And for each direction I started to create a function
The Moving command is done by giving the one of the pins high and the other low while the stopping command is done by giving the 2 pins low.
void forward()
I gave for one of the pins high voltage and the other low voltage so that motion occurs,
I selected which of the pins should take the high and the other low according to the
wiring of the two motors with the motor driver
void backward()
The same was done in the backward() function but by reversing the high and low commands so that the motors will rotate in the opposite directions.
void left() and void right()
For the left direction function I stopped the motion of motor on the left side of the bot and allowed the right side motor only to move.
For the right direction I reversed the command were the right is stopped and the left is moving.
void stopp ()
The stopping command is done by giving the four pins Low.
void loop()
inside the void loop we called the functions as long as there is an input coming from the Bluetooth.
I started first by reading the value coming from the mobile application through the Bluetooth module and saving this value inside the variable "reading" that we created in a previous step, then by checking this value using the if condition, we are expecting to receive any of 5 characters (F, B ,S , L, R) for each of them we will call one of the functions we once created to move the fork
lift bot in a certain direction where:
F -> Forward direction movement
B -> Backward direction movement
S -> Stop movement
R-> Right direction movement
L-> Left direction movement
And if nothing of this values is received, it will call the function stop() to stop the motion.
Link to the Bluetooth Test code
and this the flowchart for the void loop code created online by the site ;
Code to test the servo motors :
Write code to test the servo motors to lift and lower the arms of the bot according to commands that are sent through the Bluetooth module from the mobile application.
i started with include (insert) the servo library to the code
Defining two servos by give two name servo_1 and Servo_2
Defined a global variable which is "pos" and gave it the a data type "int" as it is going to store numbers for the positions of servo motors.
Defined a global variable which is "reading" and gave it the a data type "char" as it is going to store letters.
Then inside the void setup:
Using Serial.begin we intialise the communication between the arduino and the bluetooth module.
servo1.attach(5) servo1.attach(6)
Set the pins 5 , 6 which attached with servo motors.
3- servo_1.write(0);
servo_2.write(45);
give the start plosion to the servo motors to start from it .
After that, I started to create functions that I will call them inside the void loop.
void lift()
to make the two servo motor lift the arms I Make a for loop from 0 degrees to 50 degrees in steps of 1 degree then tell servo_1 to go to position in variable 'pos'
and tell servo_2 to go to position in variable '50-position' and waits 15ms and repeat this loop until the servo_1 goes to 50 degree and servo_2 goes to 0 degree because the servos in opposite direction.
void lower()
The same was done in the lift function but by giving the steps a negative value to reverse the lift movement.
void loop()
inside the void loop we called the functions as long as there is an input coming from the Bluetooth.
I started first by reading the value coming from the mobile application through the Bluetooth module and saving this value inside the variable "reading" that we created in a previous step, then by checking this value using the if condition, we are expecting to receive any of 2 characters (W, U) for each of them we will call one of the functions we once created to move the arms.
W -> Lift the arms.
U -> lower the arms.
And if nothing of this values is received, it will do noting.
integrate the first code with the second code to make the minimum feature code
Code of Ultrasonic ( complete feature code ):
added this code to the minimum feature code
1- Defining the pin 3 as trigpin and 11 as echopin .
2- Defined a 2 global variable which are "duration" and "distance" and gave it the a data type "Long" as it is going to store long numbers.
"duration " store the time of sound wave it takes to echo to the Ultrasonic sensor.
"distance" store the distance after calculating it.
3- defining the mode for trig as OUTPUT.
and echo as INPUT.
4- do the process of calculating the distance by give the trigpin LOW for 2milsecond then HIGH to 10milesecond then LOW and that to emit the sound wave then receive the echo by the code pulseIn and restore the time it takes to echo in the duration variable.
speed of the sound wave = 0.0343
distance = Speed * time
time = duration / 2
then the distance = (duration/2)*0.0343
calculating the distance and store it.
if the Arduino receive a character "V" from the Bluetooth then chick the distance
while the distance >= 40 cm --> call the function forward to make the bot moves forward until the distance becomes <= 40
the bot will do these steps:
1-stop
2- move forward for 0.8 second then stop
4- lift it's arms
5- move back for 1 second then stop
6- move right for 1.5 second then stop
7- move forward for 3 second then stop
8- lower it's arms
9- move back for 1 second
then i use "break" to break the loop and do the pervious steps one time only and go to original code to receive another letter from Bluetooth and continue the main process.
MIT App inventor
download and install the MIT App inventor on the computer and run its server the open it by write : localhost:8888 in the explorer.
create New project .
Design the Screen 1 and add the following :
label1 : Fork Lift Bot
Image1 :
upload forklift image
List Picker1 :
connect to the bot
show me the named of Bluetooth names if i click on it to connect to a specific Bluetooth.
Button1 : upper arrow
Button2 : Down arrow
Button3 : left arrow
Button4 : Right arrow
Button5 : Pause arrow
Button6 : High arrow
Button7 : Low arrow
Button8 : Ultrasonic arrow
I used this buttons to send data to the Arduino Via Bluetooth according the following code
When press of the (Connect to the bot)
a list of Bluetooth names appear in another screen to shows the Bluetooth mane you want to connect and after picking one of them the mobile connect to it and if the connection occurs the button becomes green and the text ( Connected ) appear.
if not the button becomes Red and the text ( Not Connected ) appear.
when the connection occurs i can press any button from the following buttons and it will send a character to the Arduino via Bluetooth :
( upper arrow ) -->"F"
( Down arrow ) --> "B"
( left arrow ) --> "L"
( Right arrow ) --> "R"
( Pause arrow ) --> "S"
( High arrow ) --> "W"
( Low arrow ) --> "U"
( Ultrasonic image ) --> "V"
and the Arduino receive this characters and make an action as we explained in the pervious arduino IDE code .
after that i built the apk file and copy it to my phone then install the app and run it to test the code with Arduino code .
Steps for integrate the project’s modules together:
1- Assemble the two costar Wheels , two yellow motors and wheels in the bottom face of base_1 with screws and nuts.
2-Assemble the 4 down_sides in the upper face of base1. and assemble the mini bread board and Ultrasonic sensor.
3- Assemble the motor driver and Arduino Uno and wire the circuit of the driver with two yellow motors and Arduino and ultrasonic sensor.
4- test the Bluetooth code and functionality of the two yellow motors and motor driver
uploading the code in the Arduino by usb cable
Download Bluetooth RC controller program in my mobile phone.
activate the Bluetooth in the mobile.
Pair the HC-06 Bluetooth module with my mobile.
open the program and connect it with the Hc-06 module .
use the program to send characters ( F,B,S,R,L) to the Arduino to control the moving of the fork lift bot .
and it works fine as shown in the next video.
5-Assemble the 4 Top_sides with each other and assemble the two servo motor with screws.
6-Assemble the 4 Top_sides with base2 with screws and nuts.
7- test the servo code and the functionality of the two servo motors
uploading the code in the Arduino by usb cable
use the Bluetooth RC controller program to send characters ( W , U ) to the Arduino to control the moving of the arms of fork lift bot .
and it works fine as shown in the next video.
8- Assemble the Servo motors with its horn and the arms by small screws.
9-Assemble the arms and Links by screws and nuts.
10- Assemble base1 and base 2 after wiring the electronic component and the battery with tester in the upper part.
11-Assemble all parts by screws and nuts.
12- Download test code for servo motor By usb cable and test the functionality of the two servo motors with the links and shown in the next video.
recaching the battery and connect it with it's tester and it's on/off switch and connect the the other side of the switch to the female adapter connector and but them in the upper part of the pot and close the top base with screws and nuts.
13- test the Bluetooth and servo code with each other.
integrate the first code with the second code.
insert the battery in the upper part after charging it .
uploading the code in the Arduino by usb cable
use the Bluetooth RC controller program to send characters ( F, B, S, L, R , W , U ) to the Arduino to control the moving of the bot with moving of the arms
and it works fine as shown in the next video.
14- test the minimum feature code with app inventor code
uploading the minmum feature code in the Arduino by usb cable
use my apk program made by app inventor program to send characters ( F, B, S, L, R , W , U ) to the Arduino to control the moving of the bot with moving of the arms
and it works fine as shown in the next video.
15- test the complete feature code with app inventor code
uploading the complete feature code in the Arduino by usb cable
use my apk program made by app inventor program to send character ( V ) to the Arduino to make the preprogramed code and do automatic actions (without remote control ) and move an object to another place if the object in a distance less than 40cm from the Ultrasonic sensor.
and it works fine as shown in the next video.
A- when i had a problem with the code of servo motors which the pins 9,10 deactivate when include servo motor library in our code and i didn't understand why?
Mohamed Tarek helps me to understand the issue by sending me this link which explain the issue .
https://www.arduino.cc/en/Reference/Servo
A- in the Fabrication of the parts by laser cutter Amani Ayman helped me in the process of laser cutting and insure every thing is right before the fabrication and when the servo motors didn't fit in its holes she helped me to redesign the holes and refabricate the modified sketches.
the fab lab specialist helped me in 3D printing process and replace the filament when it finished and after the fabrication of the links by 3D printer and it's not completed due to error in the 3D printer.
He and Amani Ayman asked me to refabricate the links if i want but i hadn't the time to did that but thanks for them to ask that.
and i decide to use the printed links as it is and it works fine until now.
When i integrated the servo code with Bluetooth code i had this problem :
1- The DC motors are connected to port 5,6 for motor 1 and port 9,10 for motor 2.
The code is working fine to go forward and backward and left and right .
At this stage I want to connect a servo motor , which I connected to port 13, to the 5 volt and to ground, and here is the issue:
only one DC motor and servo are moving, but the second DC motor is stuck!
I notice that if I remove from the void setup() the command servo_motor.attach(13); both DC motors are running.
but i want to move the servo and both DC motors.
and after asking for help in slack community troubleshooting and after many researches in the internet i found the solution in this site
https://stackoverflow.com/questions/65291278/arduino-servo-and-dc-motor-not-working-properly
the solution :
i found the issue is on the library servo.h , when in use on arduino uno it deactivate pin 9/10.. exacly where i have the motor connected
– Damiano Miazzi Dec 15, 2020 at 8:15
and after replace the pins from 9,10 to 7,8 the 2 Dc motor and servo motor are moving and the problem solved .
Control the fork Lift bot by hand tilted ( tilt sensor or Gyroscope Sensor , Arduino Nano and another Bluetooth )
use another motors ( steeper motors ) to make the movement of the bot more accurate.
Use Omni wheels