You are on page 1of 7

Department of Computer Science

Project Name: Hand Gesture Eye

Name: Amal Sathyan

Roll No: 026

Subject: Artificial Intelligence & Programming Robot


Introduction;
This project is about how to control an 8x8 led matrix with arduino uno and ir
sensor. We’ll be displaying a robot eye on an 8x8 led matrix and control the eye by
hand gesture with the help of an ir sensor.

Required Components:
1. Arduino uno.
2. 8x8 led matrix
3. ir sensor X 3
4. Breadboard.
5. Jumper wires.

Code:
#include<LedControl.h>
//Define IR sensor
int irL = 7;
int irM = 6;
int irR = 5;

//Define 8x8 led matrix


int dataPin = 13;
int csPin = 12;
int clkPin = 11;

//No. of 8x8 led matrix


int noOFdevices = 2;

//Sleep to wokeup
byte sleep[8] = {B00000000, B00000000, B00000000, B00000000, B00000000, B00000000,
B01111110, B00111100};
byte wokeup1[8] = {B00000000, B00000000, B00000000, B00000000, B00000000, B11111111,
B01111110, B00111100};
byte wokeup2[8] = {B00000000, B00000000, B00000000, B00000000, B01111110, B10000001,
B01000010, B00111100};
byte wokeup3[8] = {B00000000, B00000000, B00000000, B01111110, B10000001, B10011001,
B01011010, B00111100};
byte wokeup4[8] = {B00000000, B00000000, B01111110, B10000001, B10011001, B10011001,
B01000010, B00111100};
byte wokeup5[8] = {B00000000, B01111110, B10000001, B10011001, B10011001, B10000001,
B01000010, B00111100};
byte wokeup6[8] = {B00111100, B01000010, B10000001, B10011001, B10011001, B10000001,
B01000010, B00111100};

byte viewright1[8] = {B00111100, B01000010, B10000001, B10001101, B10001101, B10000001,


B01000010, B00111100};
byte viewright2[8] = {B00111100, B01000010, B10000001, B10000111, B10000111, B10000001,
B01000010, B00111100};

byte viewleft1[8] = {B00111100, B01000010, B10000001, B10110001, B10110001, B10000001,


B01000010, B00111100};
byte viewleft2[8] = {B00111100, B01000010, B10000001, B11100001, B11100001, B10000001,
B01000010, B00111100};

int eye_status = 0;
bool activate = false;

LedControl lc = LedControl(dataPin, clkPin, csPin, noOFdevices);

void setup() {
// pt your setup code here, to run once:
Serial.begin(9600);
for (int x = 0; x < noOFdevices; x++)
{
lc.shutdown(x, false); //The MAX72XX is in power-saving mode on startup
lc.setIntensity(x, 8); // Set the brightness to default value
lc.clearDisplay(x); // and clear the display
}
printByte(sleep);
}

void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(irL) == 0 && digitalRead(irM) == 0 && digitalRead(irR) == 0 ) {
eye_status = 1;
delay(500);
}
if (digitalRead(irL) == 1 && digitalRead(irM) == 0 && digitalRead(irR) == 1 ) {
printByte(wokeup1);
delay(100);
printByte(wokeup2);
delay(100);
printByte(wokeup3);
delay(100);
printByte(wokeup4);
delay(100);
printByte(wokeup5);
delay(100);
eye_status = 2;
activate = true;
}
if (digitalRead(irL) == 0 && digitalRead(irM) == 1 && digitalRead(irR) == 1 && activate == true) {
printByte(viewleft1);
delay(100);
eye_status = 3;
}
if (digitalRead(irL) == 1 && digitalRead(irM) == 1 && digitalRead(irR) == 0 && activate == true) {
printByte(viewright1);
delay(100);
eye_status = 4;
}

switch (eye_status) {
case 1:
printByte(sleep);
break;
case 2:
printByte(wokeup6);
delay(100);
break;
case 3:
printByte(viewleft2);
delay(100);
break;
case 4:
printByte(viewright2);
delay(100);
break;
default:
printByte(sleep);
break;
}
}
void printByte(byte character [])
{
int i = 0;
for (i = 0; i < 8; i++)
{
lc.setRow(0, i, character[i]);
lc.setRow(1, i, character[i]);
}
}

Description of hardware used


Arduino UNO:
Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output
pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a
USB connection, a power jack, an ICSP header and a reset button

Breadboard:
A breadboard consists of plastic block holding a matrix of electrical sockets of a size suitable
for gripping thin connecting wire, component wires or the pins of transistors and integrated
circuits (ICs). The sockets are connected inside the board, usually in rows of five sockets.

Jumper wires:
A jump wire (also known as jumper, jumper wire, DuPont wire) is an electrical wire, or group of
them in a cable, with a connector or pin at each end (or sometimes without them – simply
"tinned"), which is normally used to interconnect the components of a breadboard or other
prototype or test circuit

IR sensor:
An infrared sensor (IR sensor) is a radiation-sensitive optoelectronic component with a spectral
sensitivity in the infrared wavelength range 780 nm … 50 µm. IR sensors are now widely used in
motion detectors, which are used in building services to switch on lamps or in alarm systems to
detect unwelcome guests

8x8 Matrix:
an 8×8 LED Matrix consists of 16 pins: 8 Rows and 8 Columns. Usually, the Rows are associated
with the Anodes of the LEDs and the Columns are associated with the Cathodes of the LEDs
Circuit Diagram:

Future scope:
Future Scope
1) Gestures are destined to play an increasingly important role in human-computer interaction in
the future.
2) Area of Hand gesture based computer human interaction is very vast. Hand recognition
system can be useful in many fields like robotics, computer human interaction and so make
hand gesture recognition offline system for real time will be future work to do.

Reference:
Youtube Link: arduino led matrix projects with ir sensor code | arduino matrix

Conclusion:
1) Gestures are expressive, meaningful body motions involving physical movements of the
fingers, hands,arms, head, face, or body with the intent of: 1) conveying meaningful information
2) interacting with the environment.
2) Gesture recognition is an extensively developed technology available designed to identify
human position, action, and manipulation. Gestures are used more and more to facilitate
communication with digital applications because of their expressive nature.
3) Among the various ways of gesture recognition like Hand, Face and Body Gesture
Recognition, Hand Gesture Recognition is efficient technique to recognize human gestures due
to its simple and greater accuracy features.

You might also like