Here I am presenting one more LED chaser. As the title suggests, it’s not just simple microcontroller-based LED chaser but its IR remote controlled LED chaser. Means the LED chasing effects can be changed by remote control. Not only that but the blinking rate of LEDs can be also increased or decreased to make chasing effect faster or slower using a remote.
The project given here demonstrates how to generate a different chasing effect on different colour LEDs using IR remote (like TV, DVD, AC, STB etc) with the help of Arduino. Also, it varies the speed of chasing effect using a remote. The project uses a normal set top box (STB) IR remote, TSOP IR sensor, different colour LEDs (red, green, blue, yellow, white) and an Arduino UNO board. Anyone can use any type of IR remote. Just he has to change the remote codes in the Arduino sketch (program) for the remote. This procedure is also described here while explaining the operation. So let us see how this is done. First, see the circuit diagram followed by its description and operation.
CIRCUIT DESCRIPTION
As shown in the figure, there are very few components in a circuit like different colour LEDs, resistors, IR sensor TSOP1738 and the main is the Arduino UNO board.
• The sensor TSOP1738 has 3 terminals (1) Vcc (2) Gnd and (3) output. Its Vcc terminal is given 5 V from board and Gnd terminal is connected to the ground of board. Sensor output is connected digital input pin 2 and 3 of arduino board. Pin 2 of Arduino board is used as interrupt pin and pin 3 is used to receive IR remote code. When the code is received by sensor pin 2 generates an interrupt.
• Digital pins 4 to 13 of the board are connected to anodes of different colour LEDs through current limiting resistors of 470Ω. The cathodes of all LEDs are shorted to board ground.
• The stepper motor and ULN2003A chip is given external 5 V supply
Here is the snap of circuit arrangement.
Fig. 1: Prototype of Arduino based IR Remote Controlled LED Chaser
CIRCUIT OPERATION
First, we have to decide, which are the different buttons of IR remote, that we will use to generate different chasing effects and vary its speed. We want to perform following actions -:
1. Generate 5 different types of chasing effects. Like generate 1st effect when button 1 is pressed and likewise
2. Increase/decrease chasing effect speed
I have used set-top box (STB) remote that has many buttons like 0-9 digit buttons, volume control buttons, channel up/down buttons, arrow key buttons etc. From all these buttons I have selected following 7 buttons for different operations.
Fig. 2: Table listing Remote control buttons and respective LED effects
That means when any digit button between 1 to 5 is pressed, the LEDs start displaying different chasing effect. The volume up button will decrease LED blinking delay so chasing effect speed becomes faster and volume down button will increase LED blinking delay so chasing effect speed becomes slower.
After deciding the buttons next is to decode the codes of these buttons. As we know when any button is pressed from remote, it will send one code and based on this code the action is performed. So to decode these codes I have used IRremote library for arduino, readily available on the internet.
So download the library and use the example to decode the codes of remote buttons. Upload the program into arduino microcontroller and connect IR sensor as shown in the figure. Now point the remote control towards IR sensor and press the button. Open serial monitor and you can observe the code of pressed button in form of numbers. Note down the codes of required buttons like I have noted the codes as per the following table -:
Fig. 3: Table listing Remote control buttons and respective IR codes
In the arduino sketch above codes are used corresponding to button pressed to perform an action as per the previous table. Now let us see the actual operation.
There are five different chasing effects.
Effect 1: one by one all LEDs will turn ON from left to right and again they will be turned OFF from right to left.
Effect 2: one by one all LEDs will blink from left to right and again from right to left
Effect 3: two LEDs at a time will blink from left to right and again from right to left
Effect 4 – Water Fall: one by one LEDs will turn ON from both ends and reaches to center and then turns OFF from center to both ends. This kind of effect looks like a waterfall.
Effect 5 – Fountain: one by one LEDs will turn ON from the centre and reaches to both ends and then turns OFF from both ends to again center. This kind of effect looks like fountain
• The arduino board is given supply through USB
• Initially, LEDs are OFF the message is displayed on a serial monitor of arduino IDE as “IR remote controlled LED chaser”. The Arduino will wait for an interrupt from IR sensor
• Now when digit 1 button is pressed from remote, IR sensor receives code and pin 2 generates interrupt
• The Arduino jumps to ISR (interrupt service routine) and decodes the code for pressed button
• When it gets code for button 1 it will start generating chasing effect 1 on LEDs and again waits for any new button pressed from remote
• Similarly, when any of the digit buttons is pressed the Arduino will decode and get the code from ISR and start generating any of the 5 chasing effects
• When volume up button is pressed, the delay applied between LED blinking is decreased. So LED blinks at faster rate – that means chasing effect speed increases and the message is displayed on serial monitor as “blinking speed increased”
• Similarly, when volume down button is pressed, the delay applied between LED blinking is increased. So LED blinks at slower rate and the message is displayed on serial monitor as “blinking speed decreased”
• After increasing or decreasing the speed again when any button 1 to 5 is pressed the chasing effect becomes slower or faster
• The LED blinking delay is changed in step of 25 mili seconds (ms) from 50 ms to 200 ms
SOFTWARE PROGRAM
Complete functionality of project is because of the program downloaded into arduino board microcontroller ATMega328. The program is the soul of the project. The program (also known as sketch) is written and compiled in arduino IDE software tool. And it is burned (embedded) into ATMega328 using built in software programmer tool AVRISP MK-II through the USB port.
Project Source Code
###
#include <IRremote.h> int IRpin = 3; // pin for the IR sensor int intr_pin = 2; int del = 100; IRrecv irrecv(IRpin); decode_results results; unsigned long int recv_code,prev_code; void setup() { int i; Serial.begin(9600); Serial.println("IR remote control LED chaser"); for(i=4;i<=13;i++) { pinMode(i,OUTPUT); digitalWrite(i,LOW); } irrecv.enableIRIn(); // Start the receiver attachInterrupt(digitalPinToInterrupt(intr_pin), receive_code, CHANGE); } void loop() { if(results.value==2210) { effect1(); irrecv.resume(); } if(results.value==6308) { effect1(); irrecv.resume(); } if(results.value==2215) { effect3(); irrecv.resume(); } if(results.value==6312) { effect4(); irrecv.resume(); } if(results.value==2219) { effect5(); irrecv.resume(); } if((recv_code==6338) || (recv_code==2242)) { Serial.println("blinking speed increase"); if(del>50) del-=25; irrecv.resume(); while(!(irrecv.decode(&results))); } if((recv_code==6292) || (recv_code==2196)) { Serial.println("blinking speed decrease"); if(del<200) del+=25; irrecv.resume(); while(!(irrecv.decode(&results))); } delay(200); irrecv.resume(); } void receive_code() { if(irrecv.decode(&results)) { if(recv_code != results.value) { Serial.print("received code "); Serial.println(results.value); recv_code = results.value; } } } void effect1() { int x; for(x=3;x<13;x++) { digitalWrite(x,HIGH); delay(del); } delay(del); for(x=3;x<13;x++) { digitalWrite(x,LOW); delay(del); } } void effect2() { int x; for(x=3;x<13;x++) { digitalWrite(x,HIGH); delay(del); digitalWrite(x,LOW); } delay(del); for(x=12;x>3;x--) { digitalWrite(x,HIGH); delay(del); digitalWrite(x,LOW); } } void effect3() { int x; for(x=3;x<12;x++) { digitalWrite(x,HIGH); digitalWrite(x+1,HIGH); delay(del); digitalWrite(x,LOW); digitalWrite(x+1,LOW); } delay(del); for(x=12;x>4;x--) { digitalWrite(x,HIGH); digitalWrite(x-1,HIGH); delay(del); digitalWrite(x,LOW); digitalWrite(x-1,LOW); } } void effect4() { int x; for(x=3;x<=8;x++) { digitalWrite(x,HIGH); digitalWrite(15-x,HIGH); delay(del); } delay(del); for(x=8;x>=3;x--) { digitalWrite(x,LOW); digitalWrite(15-x,LOW); } } void effect5() { int x; for(x=8;x>=3;x--) { digitalWrite(x,HIGH); digitalWrite(15-x,HIGH); delay(del); } delay(del); for(x=3;x<=8;x++) { digitalWrite(x,LOW); digitalWrite(15-x,LOW); } }###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.