Introduction: Ball Following Robo
This is a wearable gesture interface that augments the physical world around us with digital information through the use of natural hand gestures to interact with that information.
REQUIREMENTS:
1. you need this thing prior than making this project
i. MATLAB (please install before you begin )
ii.camera { if you have laptop ,its inbuilt web-cam will work}
iii.DC motor (2 pc.)
iv.chassis (body of your bot on which all the stuff will be assembled )
v. 9v battery (you can use pencile cell battery )
vi.screw driver and some bolts just for further modification.
vii. L239d Motor driver (From micro controller we can not connect a motor directly because micro controller can not give sufficient current to drive the DC motors. Motor driver is a current enhancing device, it can also be act as Switching Device.)
2. if you do not know how MATLAB work no problem the code are easy , just pay attention to my instructions .
3. AND MOST IMPORTANT U'R INTREST.
REQUIREMENTS:
1. you need this thing prior than making this project
i. MATLAB (please install before you begin )
ii.camera { if you have laptop ,its inbuilt web-cam will work}
iii.DC motor (2 pc.)
iv.chassis (body of your bot on which all the stuff will be assembled )
v. 9v battery (you can use pencile cell battery )
vi.screw driver and some bolts just for further modification.
vii. L239d Motor driver (From micro controller we can not connect a motor directly because micro controller can not give sufficient current to drive the DC motors. Motor driver is a current enhancing device, it can also be act as Switching Device.)
2. if you do not know how MATLAB work no problem the code are easy , just pay attention to my instructions .
3. AND MOST IMPORTANT U'R INTREST.
Attachments
Step 1: Arduino Circuit Board Specification
micro-controller -ATMEL ATmega 8
operating voltage -5v
input voltage -6v -20 v
digital i/o pins - 14 out of which 6 provide PWM
analog input pins- 8
DC current per I/O pin -40 mA
Flash memory -8 kb
SRAM -1 Kb
EEPROM -512 Bytes
clock speed 16 MHz
USB -UART converter
LED'S
USB /EXT input voltage
5v output supply pins -3
3.3 v output supply pins -1
(I have purchased ATmega8 ICs with the Arduino boot-loader pre-burned.)
operating voltage -5v
input voltage -6v -20 v
digital i/o pins - 14 out of which 6 provide PWM
analog input pins- 8
DC current per I/O pin -40 mA
Flash memory -8 kb
SRAM -1 Kb
EEPROM -512 Bytes
clock speed 16 MHz
USB -UART converter
LED'S
USB /EXT input voltage
5v output supply pins -3
3.3 v output supply pins -1
(I have purchased ATmega8 ICs with the Arduino boot-loader pre-burned.)
Step 2: Installation of Drivers
1. connect your arduino board to your pc using USB cable .
2. switch on the board by pressing power button .
3.go to my computer , press right click you will notice an icon indicating ''MANAGE'' and go to manage.
4. you will be directed to computer management where you have to press on ''+ OTHER DEVICE'' from the '' DEVICE MANEGER .
5. like wise u will see some what written as your SILICON LAB CPXXX USB to UART bridge CONTROLLER .
6. then right click on it - UPDATE DRIVER SOFTWARE ,and browse to current location and u'r driver updation is completed .
Now go to the the arduino application.
Now go to tools .
than 'board'
than 'ATmega 8'
Than carefully see in tools you have to select your current 'serial port' (COM XXX)
now run the command .
than press serial monitor for providing the command.
2. switch on the board by pressing power button .
3.go to my computer , press right click you will notice an icon indicating ''MANAGE'' and go to manage.
4. you will be directed to computer management where you have to press on ''+ OTHER DEVICE'' from the '' DEVICE MANEGER .
5. like wise u will see some what written as your SILICON LAB CPXXX USB to UART bridge CONTROLLER .
6. then right click on it - UPDATE DRIVER SOFTWARE ,and browse to current location and u'r driver updation is completed .
Now go to the the arduino application.
Now go to tools .
than 'board'
than 'ATmega 8'
Than carefully see in tools you have to select your current 'serial port' (COM XXX)
now run the command .
than press serial monitor for providing the command.
Step 3: Making the Motor Driver
Let me give you some info about L239d motor driver specifications and working.
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.
As shown in figure below -
connect your motors input to in M2 - OUT PIN ,
In M2 -IN PIN connect the data pins from the arduino board ( pins 10 to 13),
and finally place a voltage source to the power port as shown (+ & -)
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers since they take a low-current control signal and provide a higher-current signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation, two DC motors can be driven simultaneously, both in forward and reverse direction. The motor operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start operating. When an enable input is high, the associated driver gets enabled. As a result, the outputs become active and work in phase with their inputs. Similarly, when the enable input is low, that driver is disabled, and their outputs are off and in the high-impedance state.
As shown in figure below -
connect your motors input to in M2 - OUT PIN ,
In M2 -IN PIN connect the data pins from the arduino board ( pins 10 to 13),
and finally place a voltage source to the power port as shown (+ & -)
Step 4: Moving Bot Using Arduino Programming
Ok now this is the programming part which you have to do it in arduino
int inbyte = 0; // incoming serial byte
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
establishContact(); // send a byte to establish contact until receiver responds
}
void loop()
{
// if we get a valid byte, read analog ins:
if (Serial.available() > 0) {
// get incoming byte:
inbyte = Serial.read();
if (inbyte=='R')
{
Serial.println('R');
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
}
else if (inbyte == 'L')
{
Serial.println('L');
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if (inbyte=='F')
{
Serial.println('F');
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if (inbyte=='B')
{
Serial.println('B');
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
}
else
{digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
}
}
}
void establishContact() {
while (Serial.available() <= 0) {
Serial.print('A'); // send a capital A
delay(300);
}
}
int inbyte = 0; // incoming serial byte
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
establishContact(); // send a byte to establish contact until receiver responds
}
void loop()
{
// if we get a valid byte, read analog ins:
if (Serial.available() > 0) {
// get incoming byte:
inbyte = Serial.read();
if (inbyte=='R')
{
Serial.println('R');
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
}
else if (inbyte == 'L')
{
Serial.println('L');
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if (inbyte=='F')
{
Serial.println('F');
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
}
else if (inbyte=='B')
{
Serial.println('B');
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(11,LOW);
digitalWrite(10,HIGH);
}
else
{digitalWrite(13,HIGH);
digitalWrite(12,HIGH);
digitalWrite(11,HIGH);
digitalWrite(10,HIGH);
}
}
}
void establishContact() {
while (Serial.available() <= 0) {
Serial.print('A'); // send a capital A
delay(300);
}
}
Step 5: MATLAB the Final Stage
Here are the codes which have to run in MATLAB .
1.clc (clear screen)
2.imaghwinfo
3.imaqhwifo('winvideo')
4.imaqhwinfo('winvideo',1)
5.v=videoinput('winvideo',1)
6.preview(v)
7.a=getsnapshot(v);
8.imshow(a)
9.b=ycbr2rgb(a)
10.imshow(b)
11.R=b(;,;,1);G=b(;,;,2);B=b(;,;,3);
12.impixel(b)
13.c=G>220;
14.MOTOR CONTROL
Ok let me give you a short explanation . starting with the code which describe the image of ball by using of camera,then we take the port in which the camera is going to click the pic. now you will see that camera starts running now by clicking enter button (a=getsnapshot(v);) a image will be produced with negative output ,after this we are changing the negative image to orignal one .now we have to saturate the image to black n white for that click on the ball the better image processing we have to change the code of color of the ball as shown above we had an green color ball so we have chosen (c=G>220;) ,No problem if you are using an white ball or a red .just adjust the saturation value to the nearest to perfection .finally to run press motor control.and then the game begins, place u'r ball in-front of the camera and move left or right ,up or down it will just act as a gesture control bot ,use L,R,F,B as commands and press any other key other than the four to stop.
some pics have been uploaded for u'r better convenience.
1.clc (clear screen)
2.imaghwinfo
3.imaqhwifo('winvideo')
4.imaqhwinfo('winvideo',1)
5.v=videoinput('winvideo',1)
6.preview(v)
7.a=getsnapshot(v);
8.imshow(a)
9.b=ycbr2rgb(a)
10.imshow(b)
11.R=b(;,;,1);G=b(;,;,2);B=b(;,;,3);
12.impixel(b)
13.c=G>220;
14.MOTOR CONTROL
Ok let me give you a short explanation . starting with the code which describe the image of ball by using of camera,then we take the port in which the camera is going to click the pic. now you will see that camera starts running now by clicking enter button (a=getsnapshot(v);) a image will be produced with negative output ,after this we are changing the negative image to orignal one .now we have to saturate the image to black n white for that click on the ball the better image processing we have to change the code of color of the ball as shown above we had an green color ball so we have chosen (c=G>220;) ,No problem if you are using an white ball or a red .just adjust the saturation value to the nearest to perfection .finally to run press motor control.and then the game begins, place u'r ball in-front of the camera and move left or right ,up or down it will just act as a gesture control bot ,use L,R,F,B as commands and press any other key other than the four to stop.
some pics have been uploaded for u'r better convenience.