top of page
Search

Infer-red Receiver

  • Writer: VJ
    VJ
  • Jun 24, 2020
  • 3 min read

Updated: Jul 9, 2020


For this project I will make a receiver module that rings a buzzer whenever a remote is pressed (any IR transmitter, like a TV remote). The reason is so my friends and I can play a sort of "infection" on our bikes without having to physically touch each other. This is especially useful because tagging people on bikes is difficult and dangerous. The "infected" person uses a remote to tag other people, and everyone will have one of these receivers. A person will know if they are tagged if their buzzer rings.








Materials Necessary:


x1 Any breadboard

x1 Any Arduino, preferably USB

x1 9V battery

Multiple wires

x1 Zip tie





Hardware:


For this project the hardware is fairly simple. We just need to wire up the IR receiver and buzzer to the Arduino and coordinate the rest in the code. The 9V will be zip tied to the bottom of the breadboard to save space and hassle.


For the wiring, place the Arduino onto the breadboard and wire the 9V to the power rails on one side. From there, wire the 9V to the VIN and GND pins on the breadboard. You can add an optional wire that controls the power connection so you can turn it on and off. then wire the power pin of the buzzer to port D7, and the ground to GND. For the IR receiver, connect the right pin to port D8, the middle to GND, and the left pin to 5V. You can wire the 5V and GND to the other ground and power rails for convenience. I hot glued the 9V wires to the board because they came off very easily, and used a jumper wire to create the connection between the power wire of the 9V and the VIN.




Software:


For this we will be using the Arduino IDE to program the board. We know the IR sensors (input) are connected to D8 and the buzzer (output) is connected to D7. Those are the main and most important elements of this project.


To access the IR receiver click here to download the zip file and add it to your project in the Arduino IDE. To do this just click Sketch on the toolbar and click include Libraries -> add .zip library -> the zip file you downloaded.


#include "IRremote.h"


This line just includes the library we just added so we can access the IR receiver



int receiver = 8;

int buzzer = 7;

IRrecv irrecv(receiver);

decode_results results;



The port values for the receiver and buzzer are declared, as well as the receiver called irrecv along with a few more necessary lines of code.



void setup(){

pinMode(buzzer , OUTPUT);

irrecv.enableIRIn();


}


The setup method just declares the buzzer as output and starts the IR receiver



void loop(){

if (irrecv.decode(&results))

{


digitalWrite(buzzer , HIGH);

delay(1000);

digitalWrite(buzzer , LOW);

delay(500);

irrecv.resume();

}

}


This loop does most of the work, with the if(irrecv.decode(&results)) finding if there is a IR signal, then it turns on the buzzer for one second. The IR receiver is resumed and the loop continues. The reason for the 500 delay is so the same signal doesn't carry through.


Here is the full code:








Finally, after all of the wiring and uploading is complete, we have a mini-module that can receive signals from pretty much any remote in your house. From there the possibilities are endless. You can send texts at the push of a button, or just use the wireless feature with your Arduino projects. There is also a very simple way to decode which button is being pressed. The range isn't perfect, but that is what makes it perfect for my uses, since it makes things a bit challenging for the tagger or infected person. Finally, here is a demo:




This works best later in the day, because sunlight can cause interference outside

 
 
 

Comments


Post: Blog2_Post
bottom of page