Arduino IR remote

Simple Arduino Project : IR Remote

Introduction

Making an arduino based IR remote is fairly simple thanks to the IR library.it enables us to :

  1. Detect and Read IR Signal
  2. Decode It
  3. Send Ir Signal




which is all we need for an infrared remote as we will be sending a coded message to be able to identify each button.

this project has many applications other than duplicating a TV or radio IR remote but can be used to activate or trigger anything with an IR receiver up to 10 meters away.

Principle :

the IR light that an IR led cant be seeing with a human eye ( you can use a camera to see it) but IR receivers can.the arduino using the PWM function will blink the led at a certain frequency which is picked up by the TSOP Ir receiver which can interpret those bursts of IR light into data.

Code:

IR Library Download Link :

the first code i used is the IRrecdemo and IRrecvDumpv2 included in the arduino IR library.how can read the IR signal of remotes and decode it .

IR Emitter code :

#include <IRremote.h>

IRsend irsend;

const int switch1 = 4;
 const int switch2 = 5;
 const int switch3 = 6;
 void setup() {
 pinMode(switch1, INPUT_PULLUP);
 pinMode(switch2, INPUT_PULLUP);
 pinMode(switch3, INPUT_PULLUP);

}

void loop() {

if (digitalRead(switch1) == LOW){
 delay(50);
 irsend.sendNEC(0xE0E020DF, 32);}

if (digitalRead(switch2) == LOW){
 delay(50);
 irsend.sendNEC(0xE0E0A05F, 32);}

if (digitalRead(switch3) == LOW){
 delay(50);
 irsend.sendNEC(0xE0E0609F, 32);}

}

 

IR Receiver code :

#include <IRremote.h> // IR library
 const int RECV_PIN = 11; // TSOP IR Receiver Data PIN

const int switch1 = 2; //Switch or led's to be activated OUTPUTS
 const int switch2 = 3;
 const int switch3 = 4;

IRrecv irrecv(RECV_PIN);
 decode_results results;

void setup() {

irrecv.enableIRIn();
 pinMode(switch1, OUTPUT);
 pinMode(switch2, OUTPUT);
 pinMode(switch3, OUTPUT);
 }

void loop() {
 if (irrecv.decode(&results)) { // Receiving IR Signal and decoding it

irrecv.resume();
 }

if (results.value == 0xE0E020DF) {
 digitalWrite(switch1, HIGH);
 delay(200);
 digitalWrite(switch1, LOW);
 results.value = 0x00000000;
 }

if (results.value == 0xE0E0A05F) {
 digitalWrite(switch2, HIGH);
 delay(200);
 digitalWrite(switch2, LOW);
 results.value = 0x00000000;
 }
 if (results.value == 0xE0E0609F) {
 digitalWrite(switch3, HIGH);
 delay(200);
 digitalWrite(switch3, LOW);
 results.value = 0x00000000;
 }

}



Circuit

Simple LED POV Display

DIY Arduino POV

How to Make A DIY Arduino POV LED Display With 8 LED’s and an arduino using a drill to make it rotate

DIY Led POV



Introduction

What is Persistence of Vision?

Persistence of vision is a kind of optical illusion whereby multiple discrete images blend into a single image in the human mind giving the impression of an animation like any .GIF animated image you see

we will use this trick to make a DIY Arduino LED POV

[social_warfare]

How does it work ?

we will be drawing letters in two dimensions using 8 led’s with the Y axis we have the led row and the X axis is moving so by blinking the led is a certain pattern letters and words will show.

to draw the letter B we will be flashing the led’s in 5 simultaneous raws making a matrix of 8×5 like the image on the right and the code in the arduino will be B[] = {1,1,1,1,1,1,1,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 0,1,1,0,1,1,1,0};

Making The DIY Arduino POV

Parts Needed :

  • one small piece of plastic to hold the LED’s
  • an arduino board
  • 8 LED’s and 240Ω resistors
  • a 9V Battery and Some wires
  • a Rotary thing to make it spin Like a Fan but i used my drill

Follow the instructions it video you will also need to upload the code to arduino and use the schematic below :

One thing more use the last loop in the code to print the letters or numbers you want and tweak Letter Space and Dot-time in the code for the best settings cause it is different for the rotation speed your chosen as fast you go as much you can write

 

 


The Arduino Code To Upload :

int NUMBER9[]={1,1,1,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,1,1,1,1,1,1,1};
 int NUMBER8[]={0,1,1,0,1,1,1,0, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 1,0,0,1,0,0,0,1, 0,1,1,0,1,1,1,0};
 int NUMBER7[]={1,0,0,0,0,0,0,0, 1,0,0,0,1,0,0,0, 1,0,0,0,1,0,0,0, 1,0,0,1,1,1,1,1, 1,1,1,0,1,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ting the ports of the leds to OUTPUT
 for( int i = 2; i<10 ;i++ )
 { pinMode(i, OUTPUT);
 }

// defining the space between the letters (ms)
 letterSpace = 2;
 // defining the time dots appear (ms)
 dotTime =1;
}
 void printLetter(int letter[])
 {
 int y;
// printing the first y row of the letter
 for (y=0; y<8; y++)
 {
 digitalWrite(y+2, letter[y]);
 }
 delay(dotTime);
// printing the second y row of the letter
 for (y=0; y<8; y++)
 {
 digitalWrite(y+2, letter[y+8]);
 }
 delay(dotTime);
// printing the third y row of the letter
 for (y=0; y<8; y++)
 {
 digitalWrite(y+2, letter[y+16]);
 }
 delay(dotTime);
 for(y = 0; y<8; y++) {
 digitalWrite(y+2, letter[y+24]);
 }
 delay(dotTime);
for(y = 0; y<8; y++) {
 digitalWrite(y+2, letter[y+32]);
 }
 delay(dotTime);
 // printing the sspace between the letters
 for (y=0; y<8; y++)
 {
 digitalWrite(y+2, 0);
 }
 delay(letterSpace);
 }
 void loop()//write here =) enjoy subscribe to my channel if you like the project
 {
 printLetter (T);
 printLetter (U);
 printLetter (N);
 printLetter (M);
 printLetter (A);
 printLetter (K);
 printLetter (E);
 printLetter (R);
 printLetter (_);
}

The Schematic :

Pov circuit - Copie