Download IRReceive - TH Robot

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Valve RF amplifier wikipedia , lookup

Radio transmitter design wikipedia , lookup

Integrated circuit wikipedia , lookup

Immunity-aware programming wikipedia , lookup

RLC circuit wikipedia , lookup

Opto-isolator wikipedia , lookup

Regenerative circuit wikipedia , lookup

Surface-mount technology wikipedia , lookup

Index of electronics articles wikipedia , lookup

Remote control wikipedia , lookup

Transcript
Arduino-Infrared receiving module
Experimental Summary
This is a novel ultra-thin 38K universal infrared remote controller, using the NEC
code format, mainly used in car MP3, foot bath, lighting equipment, digital photo
frame, microcontroller development board and learning board occasions. Because it
is based on wireless remote control, so it is convenient, effective, and the field of
application is also more and more wide now. About the product of our company we
have flowing introduction.
Experimental Principle:
The infrared remote control transmitter is using infrared light emitting diode to
send a modulated infrared light wave. Infrared receiver circuit is composed of an
infrared receiving diode and triode or photocell.They convert infrared light (sending
from infrared transmitters) to the corresponding electrical signals, then send it to
the post amplifier.
The transmitter is composed of the command key (or operating lever), the
instruction code system, the modulation circuit, the drive circuit, the transmission
circuit and so on. When you press the command button or operate lever, instruction
encoding circuit generates the required instruction code signal, make the instruction
code signal to modulate the carrier wave,and then the drive circuit carry out power
amplification, the transmitting circuit transmits the instruction coded signal which is
transmitted by the transmitting circuit.
The receiving circuit is composed of a receiving circuit, an amplifying circuit, a
modulating circuit, an instruction decoding circuit, a driving circuit, an executing
circuit (mechanism) and so on.
Receiving circuit receives the coded signal which transmitter send out and
modulated, enlarge it and send to demodulation circuit.
The demodulation circuit modulates the coded signal which has been modulated,
that is, restore it to coded signal.
The instruction decoder carries out the decoding of the coded instruction signal,
and finally, the drive circuit drives the executive circuit to realize the operation
control of various instructions.
technical parameter:
Infrared remote control distance:>8m;
Infrared wavelength of emission tube: 940nm;
crystal frequency:455KHZ
carrier frequency:38KHZ
Code format:NEC
Dimension:86* 40* 6mm
Power supply:CR2025/1600mAH
Experimental Procedure
Install battery to the infrared remote controller before use, and Infrared remote
control should be used in combination with infrared receiving module, the infrared
receiving module is responsible for receiving information from infrared remote
controller and decode it into hexadecimal code, so as to achieve the communication.
The infrared receiving module is connected with the Arduino correctly, the S is
connected with 11, the VCC is connected with the +5V, GND is connected with the
GND, and fix it well. Open Arduino programming IDE
Add IRremote.zip library inside the the code folder, compile and upload code, it
should be Ok!
Code Analysis
In the test We show up the corresponding button code in the Serial Monitor
Window
Look at the test code:
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); //Initialize the infrared remote control
pinMode(12,1);
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);//In hexadecimal output to receive a new line
code
Serial.println();//In order to watch the output increase a blank line
irrecv.resume(); // To receive the next value
}
}
Experimental Phenomena
Switch on the arduino development board, upload the code, open the serial port
monitor, when we use an infrared remote control point at the infrared receiver press
the button you can see, this button code is displayed inside the serial.
when you press another key, we can see that the code is different. which
appears FFFFFFFF because when we press this button for a long time,the sending
code is FFFFFFFF when long pressing infrared remote control.
Experiment Extension
We know how to show our serial code of the pressed key, and we can record the
key code,judge the receiving code when receiving the infrared in the recycle. If it is
the key code before we recorded, then open LED; if not,no open. So achieve an
infrared remote control LED!
You can refer to the following code
void loop() {
if (irrecv.decode(&results)) {
if(results.value==16753245) //Acknowledging receipt of the first row of keys
1 code, this code is the key code Previously read out
{
digitalWrite(12,1);
// LED lights
Serial.println("turn on LED"); // serial display lights
}
else if(results.value==16736925) //Acknowledging receipt of the first row of
keys of encoding 2
{
digitalWrite(12,0);
// LED off
Serial.println("turn off LED"); // serial display turn off the lights
}
irrecv.resume(); // receive the next value
}
}