Electronics Lab
Electronics Lab
From Vehicle
UNIVERSITY OF DELHI
SUBMITTED BY:
We hereby declare that the project entitled “Hand Gesture based Robotic
Vehicle & Robotic Arm to pick and place the objects from vehicle” is based on
our work carried out during the course (January 2020 to May 2020) in Masters
in Physics submitted at the Department of Physics and Astrophysics, University
of Delhi. We assert that the conclusions drawn and work done are an outcome
of our work. The work has not been submitted to any other Institution for any
other degree/ certificate in this University or any other University.
Whenever we have used theoretical analysis and text from other sources, we
have given due credit to them and giving their details in the references.
Date:
ACKNOWLEDGEMENT
We would also like to thank our lab assistants for their generous attitude and
friendly behaviour.
We would also like to thanks Solid lab attendant for giving access to various
instrumentation.
At last, we would thank each other as fellow lab-mates, for the stimulating
discussions for the completion of the project within limited time.
INTRODUCTION
Our objective for this project was to design Hand Gesture based Robotic
Vehicle & Robotic Arm to pick and place the objects from Vehicle.
Word robot was coined by a Czech novelist Karel Capek in 1920. Robot in
Czech is a word for worker or servant. In another words, it can be defined as
any automatically operated machine that replaces human effort.
Here, an effort has been made to developed a hand gesture based robotic car and
a robotic arm which will pick and place the objects from the car. The robotic car
is operated and controlled wirelessly with the help of hand gestures which
transmits signals to the car through an auto device which is fixed on the gloves
or can say that the user just needs to carry a gesture device which in our case is
transmitter section. The car moves and acts in the manner depending on the
gestures made by the fingers and hand from a distance. The car can move in
forward, backward direction according to our hand’s orientation. The robotic
arm which is mounted on the car, can pick the objects from ground and can
place it in the car, this signature is followed according to the movements of
fingers and hand. It is basically servo controlled robotics system.
Hand gesture based robotic vehicle mainly benefits in the condition where
disabled persons can’t derive the vehicle itself, in this condition they can move
the vehicle in the direction they want to go with the help of the hand gestures.
And the Robotic arm mainly benefits for places where there is a need to pick an
object and place it to some other place safely. If the object is being picked by
the human, there is a risk of damage to the object which is avoided by this
system.
Robotic Glove: It consists MPU 6050, Flex sensor, RF Module 433 MHz transmitter, Arduino Nano
Robotic Vehicle: It consists DC Motors, Servo Motors, RF Module 433 MHz receiver, Arduino Uno
APPLICATIONS:
Arduino Uno
Arduino Nano
MPU6050 (Gyroscope + Accelerometer + Temperature) Sensor Module
Flex Sensor
Servo Motor
RF Module 433 MHz Transmitter-Receiver pair
DC motors
ARDUINO UNO
Pins description:
Pin type Pin name Details
Power Vin, 3.3V, 5V,GND Vin: Input voltage to Arduino when
using an external power source.
5V: Regulated power supply used to
power microcontroller and other
components on the board.
3.3V: 3.3V supply generated by on-
board voltage regulator. Maximum
current drawn is 50mA.
GND: ground pins.
Reset Reset Resets the microcontroller
Analog pins A0-A5 Used to provide analog input in the
range of 0-5V.
Input/ Digital pins 0-13 Can be used as input or ouput pins.
Output pins
Serial 0(Rx), 1(Tx) Used to receive and transmit TTL
serial data.
External 2,3 To trigger an interrupt
Interrupts
PWM 3,5,6,9,11 Provides 8-bit PWM output.
SPI 10(SS), 11(MOSI), Used for SPI communication.
12(MISO) and
13(SCK)
Inbuilt LED 13 To turn on the inbuilt LED
TWI A4 (SDA), A5(SCA) Used for TWI communication.
AREF AREF To provide the reference voltage for
input voltage.
Arduino Nano has total 30 pins of which 14 are digital input and output
pins (6 are PWM), 8 analog pins, 2 GND pins, 2 RESET and remaining
pins for 5V, 3V, Vin and REF.
Flex is basically a strip of carbon material having metal pads inside it. It is a
sensor which measures the amount of bending or deflection. When the strip is
bend or deflect then the resistance of this flex sensor is changed therefore it is
also called bend sensor.
This resistance was calibrated and converted into angles and further used for
the grabbing purpose in the Robotic Arm.
This sensor works on the principle of bending. As the sensor is flexed, the
resistance across the sensor increases. It means when the strip is bend then its
resistance is changed which can be measured with the help of controller. This
change will depend upon the surface linearity or can say depend upon the
amount of bending done.
The following figure shows the change in resistance with respect to different
angles:
Flex sensor is a two terminal device. The flex sensor does not have polarized
terminals like diode. So there is no positive and negative.
For measuring bend, flex sensor is used with type of controller such as
microcontroller or Arduino etc. Here we are discussing how we can interface it
with Arduino board. For interfacing with Arduino board this sensor is powered
up with Arduino board. When it is connected with Arduino board then its pin1
is connected to +5V Arduino board pin through 100K ohm resistor and pin 2 is
directly connected to Arduino ground pin. Similarly, a wire is connected
between the centre point of 100k ohm resistor and flex sensor to Arduino board
A0 pin. For check purposes, a led is connected to the PWM on Arduino board
as shown in figure
MPU6050 (GYROSCOPE + ACCELEROMETER + TEMPERATURE)
SENSOR MODULE
RF modules are 433 MHz RF transmitter and receiver modules that are used to
transmit and receive the infrared waves.
To understand its basic principle firstly we have to know about its internal
structure. It mainly contains a DC motor, a gear system, a position sensor and a
control circuit.
DC MOTORS
1.Robotic vehicle:
All these wires of motors and servo motor are connected to Arduino UNO with
RF receiver , which is placed in between space of front and back wheels.
2. Robotic Arm:
Now , to make space to put whole robotic arm(or the base of robotic arm) on
vehicle , we took same electric switch board of same dimension and to hold it
with the base of car, we use 4 long boults.
To move arm to left or right , we took small board which is connected by base
of robotic arm by heavy servo motor.
So to make arm, we use electric rectangular shape fitting pipes. Firstly we took
a piece of pipe and it is inclined with movable base with the help of nail and a
servo motor in its end to move our arm up and down (as shown in figure)
Now to make next part , we use same type of pipe whose one end is connected
to servo motor’s shaft.
And to pick and drop the objects we make a handle which is made up of hard-
cardboard which has two arms and each arm is connected with individual servo
motor and we will give same input to both servo motors so that both arms is in
synchronisation .
Firstly, we will start with working of robotic vehicle. The heart behind the
working of this vehicle is MPU6050.
Now, we got the different values of pitch and roll for different orientations of
our hand and our next task is to transmit these value to vehicle which is done
by RF module transmitter-receiver pair. The transmitting part is given below :
In receiver part , we use roll values as input to two dc motors which is
connected to backward wheels of vehicle and pitch value as an input to a servo
motor ,which is connected to front two wheels of vehicle so that we can rotate
our vehicle in left-right direction. Block diagram for receiver part is given
below :
NOTE : This is the original picture of the base of robotic vehicle which is
made by us.
Now, our next task is to operate robotic arm which is placed on our vehicle. We
will use our second hand to operate the robotic arm . This time we will use
MPU6050 which control the motion of our robotic arm , a flex sensor which is
used to close and open the grip of handle of robotic arm , RF module
transmitter-receiver pair to send data form hand to arm and of course, arduino
nano at both, transmitting and receiving part.
NOTE:
This is the original picture of our robotic
arm mounted on our robotic vehicle
which is constructed by us.
OUR ROBOTIC ARM
In receiver part , we used a heavy servo motor(Tower Pro MG995) ,on which
we put whole base of robotic arm so that our robotic arm can move in left or
right, one light servo motor(Tower Pro SG90 ,let’s say it servo 1) to move our
robotic arm up – down and 2 more light servo motor( same, Tower Pro SG90 ,
let’s say it servo 2 and servo 3) , to make a handle of robotic arm to pick and
drop the things.
So,we will give roll values to servo 1 and pitch values to heavy servo motor and
value from flex sensor , will uses for servo 2 and servo 3.
In the programming , we set only two values of flex sensor : one is to open the
handle and second one is to close it.
In normal position, it is in closed state.
With all the hardware connected together, it all comes down to coding with the
task to make sure all the hardware pieces are interfaced properly and work as a
unit to perform the task they are supposed to. As Arduino is the microcontroller
used in the project both at the transmitter and receiver section, it is the heart of
the whole project and the programming is thus written, executed and uploaded
to use in the project using the official Arduino Interactive Development
Environment (IDE).
THE VEHICLE
TRANSMITTER SECTION:
The transmitter section for both the vehicle and the robotic arm perform almost
in the same way. As both of them use the MPU6050 Accelerometer-Gyroscope
sensor along with the RF Transmitter to transmit data, one of the initial tasks at
hand is to make sure both these devices are connected properly to the Arduino
following all the correct protocols. Let’s analyse the code part by part:
//Transmitter
#include<Wire.h>
#include <RH_ASK.h>
#include <SPI.h>
The Serial Peripheral Interface (SPI) Library, although not directly used in the
program, is essential for the synchronous serial data protocol used by
microcontrollers for communicating with one or more peripheral devices
quickly over short distances.
RH_ASK driver;
float roll,pitch;
const int MPU6050_addr=0x68;
int Angle[2];
float AccX,AccY,AccZ,Temp,GyroX,GyroY,GyroZ;
void setup()
{ Wire.begin();
Wire.beginTransmission(MPU6050_addr);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
}
In the setup() section, we initialise our transmission procedure. This is done first
by calling the begin()function from the Wire library. Then as per the defined
protocols we first feed the MPU6050’s address and then wake up the 0x6B
register, which is essential to start transmission.
The Wire.endTransmission(true)just makes sure that the transmission is started
from the beginning when the due protocols are done with. In the last line, the if
(!driver.init()) just make sure if the RF transmitter is working properly and
displays the message if it is not. With the communication setup and everything
working, it is time to collect and transmit data.
void loop()
{
Wire.beginTransmission(MPU6050_addr);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU6050_addr,14,true);
float Acc[] = {0,0,0};
The code in the loop() part is executed over and over, and must contain the task
we want to perform. Once we feed the feed the MPU6050’s address, we begin
the data retrieval from the 0x3B register, which actually stores the acceleration
along the x direction. The MPU6050 Accelerometer-Gyroscope gives seven
values at a time. They are: Acceleration along the x, y, z axis, the temperature
and Angular velocity along the x, y, z axis, stored in the register in the same
order, with each value occupying 16 bits or 2 bytes. The
Wire.requestFrom(MPU6050_addr,14,true) function asks the MPU6050 sensor
to send data, beginning from the register mentioned earlier (0x3B) and stopping
after 2X7=14 bytes.
Acc[0]=Wire.read()<<8|Wire.read();
Acc[1]=Wire.read()<<8|Wire.read();
Acc[2]=Wire.read()<<8|Wire.read();
Temp=Wire.read()<<8|Wire.read();
GyroX=Wire.read()<<8|Wire.read();
GyroY=Wire.read()<<8|Wire.read();
GyroZ=Wire.read()<<8|Wire.read();
Once the transmission begins, we need to store the incoming data into variables.
The data is transferred to Arduino byte by byte but every value is of two byte
and we need to merge those incoming bytes to make sense of the data. This is
done using the lines of code above.
As soon as data is received by using Wire.read(), the operator <<8 shifts the
data by 8 bits on the left-hand side. After the function Wire.read() reads the next
8 bits and the | operator makes sure the two of them are merged to form the
required 16 bit data.
The array Acc stores the acceleration along the x, y and z direction. Other
values are also stored (just to check if the data transfer is working smoothly) but
are not used further in the program.
Angle[0]=int(round(roll));
Angle[1]=int(round(pitch));
The raw data that we receive is in the for of a number ranging from 0 to 16383
(216-1) as it is 16-bit data. But in order to covert that into angular tilt, we need to
convert it into the respective g (acceleration due to gravity) values, which varies
from 0 to 1 g in magnitude. So, we divide the data we receive by 16383 to do
so. Then, these values are substituted in the formula for roll and pitch as
discussed earlier. Finally, the roll and pitch are transferred to a new array called
Angle.
With the data ready, it is time to transmit it. The driver.send(() function sends
the data over the RF transmitter. uint8_t * makes sure that the data is of the
format as required by the transmitter. 2X2=4 is the size of the total data being
transmitted i.e. the Angle array.
The driver.waitPacketSent() makes sure the data packets are delivered properly
and a delay is introduced so all the processes run smoothly.
RECEIVER SECTION
//Receiver
#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile
#include <Servo.h>
RH_ASK driver;
int motor=5;
int spd=0;
int Angle[2];
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
The RH_ASK objects helps in retrieving data from the receiver. The myservo
object of Servo class is for the movement of servo motor. The rest of the
variables store the data and the pins at which the motors are attached to.
void setup()
{
Serial.begin(9600); // Debugging only
myservo.attach(10); // attaches the servo on pin 9 to the servo object
if (!driver.init())
Serial.println("init failed");
}
The setup() section just checks if we are receiving data from the RF receiver
properly or not.
void loop()
{
uint8_t buf[4];
uint8_t buflen = sizeof(buf);
int j=0;
int rtdata[10];
int data[2];
if (driver.recv(buf, &buflen)) // Non-blocking
We define an array buf to initially store the incoming data. The driver.recv()
takes care of that But this data will be of the uint8_t format and needs to be
converted into int before proceeding.
memcpy(rtdata,buf,sizeof(buf));
for(byte i=0;i<2;i++)
data[j++]=rtdata[i];
The above lines of code take care of that. First, we copy the data from buf to an
array called rtdata. Then, in the loop we move from one byte of rtdata to the
next and store those in data array. This is effective because instead of moving
from one data location to next, we shift byte by byte by declaring the variable i
of type byte in the loop initialiser. The j index takes care of the data array. Now
we have our angles in the array data.
if(data[0]>60){
spd=255;
analogWrite(motor,spd);
}
else if(data[0]<-60){
spd=0;
analogWrite(motor,spd); }
The element data[0] contains the angle related to the upward/downward
motion of the hand i.e. the roll. They will control the speed of the DC motors.
Both the DC motors are connected to pin defined by the variable motor(=5).
The function helps control the speed of the motors by employing the use of
PWM present on the Arduino board. This is the reason pin 5 was used here as it
is one of the PWM pins. As per our predefined values, if the angle is over 60°,
the vehicle reaches top speed instantly. This is done by spd variable attaining its
maximum value which is 255. Similarly is the angle is below -60°, the vehicle
instantly comes to halt, i.e. it works as a break system for instantly stopping the
vehicle.
Now, the two extreme scenarios out of the way, we need to define how the
vehicle accelerates and slows down.
else if(data[0]>7)
{ if(spd>250)
spd=255;
else
spd+=int(data[0]/5);
analogWrite(motor,spd);
}
else if(data[0]<-7)
{ if(spd<5)
spd=0;
else
spd+=int(data[0]/5);
analogWrite(motor,spd);
}
If the angle is in the range of 7° to 60°, the vehicle accelerates by the rate that
depends on the value of the angle divided by a scale factor which on limited
testing, 5 was found to be the best fit. The line spd+=int(data[0]/5) takes care of
that. The same is true if the angle is between 7° and 60° downwards, here the
only difference is that the vehicle decelerates at that rate.
It is the job of the coder to keep into account every scenario that might happen
in the real world. There may be a case where while increasing the speed
gradually, the speed exceeds its top limit which is 255. The first conditional
block if(spd>250) takes care of that. Same is taken care if the speed is trying to
go below 0 that is meaningless.
else{
spd=0;
analogWrite(motor,spd);
}
The idea of keeping the angle range from 7° to 60° was to make sure the vehicle
doesn not move with very small movements of the hand. That will lead to
instability. So, the vehicle should stay at rest if none of the aforementioned
conditions are met. The last else block takes care of that. It makes sure that the
hand needs to be continuously tilted in the upward/downward direction to
accelerate/decelerate the vehicle. After controlling the speed of the vehicle, it is
time to discuss the turning.
if(data[1]>30)
myservo.write(180); // tell servo to go to position
//in variable 'pos'
else if(data[1]<-30)
myservo.write(0);
else
myservo.write(90);
}
The pitch or the left/right motion of the hand is stored in the element data[1].
Here, a singular motion will define the turning. As per the construction, the
default position of the servomotor is 90°. If the pitch is over 30°, the motor
instantly shifts to 180° turning the front wheels in the right direction. Something
similar happens if the angle is over 30° in the other direction, the result here is
the motor moving to 0° turning the vehicle left. If the hand is inbetween the two
positons, the motor stays at its default position and vehicle goes on in a straight
line.
THE ROBOTIC ARM
TRANSMITTER SECTION:
The transmitter section of the robotic arm is pretty similar to the vehicle, the
only difference here being the existence of an extra value in the form of the data
from the flex sensor which controls the robotic gripper.
//Transmitter
#include<Wire.h>
#include <RH_ASK.h>
#include <SPI.h> // Not actually used but needed to compile
So, just like the transmitter section for the vehicle, the transmitter for the robotic
arm also makes use of the RadioHead (RH_ASK) library for the wireless
transmission of data and the Wire Library is used to obtain the data from the
MPU6050 Accelerometer-Gyroscope. The only difference here being that
instead of using just the MPU6050 sensor to convert physical actions into
electronic signals, a combination of actions defined by an MPU6050 sensor and
flex sensors are used. The MPU6050 sensor works in the same fashion as in the
case of the vehicle but here it is used to control the movement of the Robotic
arm at the joints. The defined values for the MPU6050 variables will make sure
how and when the arm mover left-right or up-down, which is essential when it
comes to picking up/dropping objects. The picking/dropping action is achieved
by the gripper at the end of the arm, whose movement is controlled by the Flex
sensor.
RH_ASK driver;
float roll,pitch;
const int MPU6050_addr=0x68;
int Data[3];
float AccX,AccY,AccZ,Temp,GyroX,GyroY,GyroZ;
int flex=0;
int flexPin = A0;
As the code reflects, in order to accommodate the data from the felex sensor, an
extra element is added to the data array and the analog pin (A0) to which the
flex sensor is connectd is defined.
void setup()
{ Wire.begin();
Wire.beginTransmission(MPU6050_addr);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
Serial.begin(9600); // Debugging only
if (!driver.init())
Serial.println("init failed");
}
void loop()
{
Wire.beginTransmission(MPU6050_addr);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU6050_addr,14,true);
float Acc[] = {0,0,0};
Acc[0]=Wire.read()<<8|Wire.read();
Acc[1]=Wire.read()<<8|Wire.read();
Acc[2]=Wire.read()<<8|Wire.read();
Temp=Wire.read()<<8|Wire.read();
GyroX=Wire.read()<<8|Wire.read();
GyroY=Wire.read()<<8|Wire.read();
GyroZ=Wire.read()<<8|Wire.read();
As expected, the code and its working till the extraction of data from the
MPU6050 sensor is exactly the same as shown above. The only difference will
come when we get the data from the flex sensor.
flex=analogRead(flexPin);
This single line of code performs that function. As described in the Working
section, the flex sensor simply works as a voltage divider. Ideally, it can have a
value of 0-5 V depending on how much it’s being bent. The function
analogRead() reads this value and convert this into a number ranging from 0 to
1023(10 bit).
Data[0]=int(round(roll));
Data[1]=int(round(pitch));
Data[2]=flex;
driver.send((uint8_t *)Data, 6);
driver.waitPacketSent();
delay(2500);
}
The rest of the code just involves writing the roll, pitch and flex data to first,
second and third element of the array data respectively and then transmitting the
data over the transmitter just like the vehicle. (Note the use of 6 instead of 4 in
the driver.send() function because there are 3 elements to transmit instead of 2).
RECEIVER SECTION:
Once the variables for the movements are transmitted, they are received and
converted into their corresponding angular values that are fed to the servo
motors at the joints and the gripper. The rotations of the servo motors facilitate
the arm and gripper movement and can be employed as an efficient object
picker/dropper and when combined with the vehicle, it adds a new dimension to
the applicability of the arm making sure that it is not fixed at a single location
and can be used for mobile applications as well.
//Receiver
#include <RH_ASK.h>
#include <SPI.h> // Not actualy used but needed to compile
#include <Servo.h>
RH_ASK driver;
int Data[3];
Servo myservo1; // create servo objects to control a servo
Servo myservo2;
Servo myservo3;
Servo myservo4;
int pos1 = 0; // variables to store the servo position
int pos2 = 0;
The only difference from the vehicle here is the fact that we will be controlling
four servo motors with the data we receive which are described in the Working
section and in the figure below as well. We will call the four motors as 1,2,3
and 4 according to this figure. To handle that four objects of the class Servo are
declared.
void setup()
{
Serial.begin(9600); // Debugging only
myservo1.attach(5); // attaches the servo on pin 9 to the servo object
myservo2.attach(9);
myservo3.attach(10);
myservo4.attach(11);
if (!driver.init())
Serial.println("init failed");
}
The Servo motors are connected to four different PWM pins as described by the
attach() function in the setup().
void loop()
{
uint8_t buf[6];
uint8_t buflen = sizeof(buf);
int j=0;
int rtdata[10];
int data[3];
if (driver.recv(buf, &buflen)) // Non-blocking
{
int i;
// Message with a good checksum received, dump it.
//Serial.println("Message:\n");
//for(j=0;j<buflen;j++)
//Serial.println(buf[j]);
}
Serial.println("Data:");
memcpy(rtdata,buf,sizeof(buf));
for(byte i=0;i<3;i++)
data[j++]=rtdata[i];
The process followed till the extraction of data from the receiver and its
conversion into meaningful form is exactly the same as that in the case of the
vehicle, only difference being here we have an extra value coming from the flex
sensor. The change will come in how we use the values we are receiving to
define the position of the motors and the movement of the arm and gripper.
if(data[0]>60){
pos2=180;
myservo2.write(pos2);
}
else if(data[0]<-60){
pos2=0;
myservo2.write(pos2);
}
else if(data[0]>7)
{ if(pos2>170)
pos2=180;
else
pos2+=int(data[0]/5);
myservo2.write(pos2);
}
else if(data[0]<-7)
{ if(pos2<5)
pos2=0;
else
pos2+=int(data[0]/5);
myservo2.write(pos2);
}
else{
myservo2.write(pos2);
}
First let’s discuss the way in which the movement of motor 2 is defined. It is
pretty similar to how we handled the speed in case of the vehicle. We will use
the roll i.e. the upward/downward motion of the hand to control this motor. The
extreme positions of the motor are 180° (straight up) and 0° (straight down) and
this will happen only when the hand controlling the arm is 60° in the upward or
downward direction. Again, if the angle is between 7° and 60° in either
direction, the motor and thus the joint of the arm will move in that direction by
a factor of the angle divided by the scale factor defined by the line. Finally, if
the hand is not in upward/downward motion, the joint will stay at its last
recorded position.
All these movements of motor 2 will make sure the joint of the arm will move
up and down and can help picking up or dropping objects from the ground or at
a height.
if(data[1]>60){
pos1=180;
myservo1.write(pos1);
}
else if(data[1]<-60){
pos1=0;
myservo1.write(pos1);
}
else if(data[1]>7)
{ if(pos1>170)
pos1=180;
else
pos1+=int(data[1]/5);
myservo1.write(pos1);
}
else if(data[1]<-7)
{ if(pos1<5)
pos1=0;
else
pos1+=int(data[1]/5);
myservo1.write(pos1);
}
else{
myservo1.write(pos1);
}
Motor 2 only takes care of making sure that the arm reaches Infront of the
vehicle, but what if we want to pick up/drop the objects on the sides of the
vehicle. Motor 1 takes care of that. It’s movement is defined by the pitch or the
left/right tilt of the hand. It works in exactly the same way as Motor 2, just the
upward downward motion of the arm at joint 2 is replaced by right and left
movement of the arm at joint 1. Also, a motor that produces more torque and
can handle larger weights is used at joint 1 as it is the base of the entire arm.
if(data[2]>700)
{myservo3.write(180);
myservo4.write(0);
}
else
{
myservo3.write(90);
myservo4.write(90);
}
}
The motors 3 and 4 work together to open and close the gripper so that the arm
can pick up or drop the object. Its movement completely depends on the
bending of the flex sensor. As the flex sensor is bent more, its resistance and
hence voltage drop across it increases. We define if the value is over 3.42 V
(5*700/1023), the gripper should close. To close the gripper, the motors should
move in the opposite direction according to our construction. Thus, one of them
(motor 3) moves to 180° and the other (motor 4) in the opposite direction to 0°.
It should be noted that the default position of both the motors when the gripper
is open is 90° and it will stay so if the voltage across flex sensor is below 3.42V.
Combining all these snippets of code and uploading them to the Arduinos
handling receiver and transmitter portions for the vehicle and robotic arm, they
have the capacity to work in harmony as an efficient wireless, low-cost, mobile
pick-up and drop machine.
(Note: All the codes above can be found in their entirety in the Appendix section
of the report)