گیرنده های IR در واقع نوعی دیود هستند که مقاومت آنها با تغییر میزان اشعه مادون قرمز در محیط تغییر می کند.ماژول گیرنده مادون قرمز 38 کیلوهرتز دارای کاربرد وسیعی در زمینه ی روباتیک می باشد .این ماژول با مصرف جریان پایین ، مناسب برای دریافت مادون قرمز و استفاده به عنوان ریموت کنترل سیستم است. این ماژول با بردهای آردینو سازگاری کامل دارد.

مشخصات
حالت فعال در 0 منطقی
تعویض پذیری دیتا در 1,200 بار در ثانیه
ولتاژ تغذیه 5 ولت
مثال
در در مثال زیر ماژول متصل به آردینو کد های ارسالی از ریموت کنترل را دریافت کرده و در serial monitor نمایش داده میشود.

کد:
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
// Dumps out the decode_results structure.
// Call this after IRrecv::decode()
// void * to work around compiler issue
//void dump(void *v) {
// decode_results *results = (decode_results *)v
void dump(decode_results *results) {
int count = results->rawlen;
if (results->decode_type == UNKNOWN) {
Serial.print("Unknown encoding: ");
}
else if (results->decode_type == NEC) {
Serial.print("Decoded NEC: ");
}
else if (results->decode_type == SONY) {
Serial.print("Decoded SONY: ");
}
else if (results->decode_type == RC5) {
Serial.print("Decoded RC5: ");
}
else if (results->decode_type == RC6) {
Serial.print("Decoded RC6: ");
}
else if (results->decode_type == PANASONIC) {
Serial.print("Decoded PANASONIC - Address: ");
Serial.print(results->panasonicAddress,HEX);
Serial.print(" Value: ");
}
else if (results->decode_type == JVC) {
Serial.print("Decoded JVC: ");
}
Serial.print(results->value, HEX);
Serial.print(" (");
Serial.print(results->bits, DEC);
Serial.println(" bits)");
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");
for (int i = 0; i < count; i++) {
if ((i % 2) == 1) {
Serial.print(results->rawbuf[i]*USECPERTICK, DEC);
}
else {
Serial.print(-(int)results->rawbuf[i]*USECPERTICK, DEC);
}
Serial.print(" ");
}
Serial.println("");
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
dump(&results);
irrecv.resume(); // Receive the next value
}
}
مرجع:
Ken Shirriff's blog: A Multi-Protocol Infrared Remote Library for the Arduino
جهت سفارش این کالا، به این بخش در فروشگاه آفتاب رایانه مراجعه نمایید.