edit

# Grove - Infrared Emitter

The Infrared Emitter is used to transmit infrared signals through an infrared LED, while there is an Infrared receiver to get the signals on the other side. An infrared LED is like any other LED, with its color centered around 940nm. We can not only use the emitter to transmit data or commands, but also to emulate remotes to control your home appliance using an Arduino. The Infrared Emitter can transmit signals reliable up to 10 meters. Beyond 10 meters, the receiver may not get the signals. We often use the two Groves-the Infrared Receiver and the Grove - Infrared Emitter to work together.

## Version¶

Product Version Changes Released Date
Grove - Infrared Emitter v1.0 Initial Nov. 01 2015
Grove - Infrared Emitter v1.1 Change the Infrared transmitting tube location Jul. 24 2016
Grove - Infrared Emitter v1.2 Change the valnue of C1 to make the power more stable Dec. 14 2016

## Application¶

• Infrared remote control units with high power requirements
• Free air transmission systems
• Infrared source for optical counters and card readers

## Specification¶

Parameter Value/Range
Operating voltage 3.⅗V
Peak wavelength 940nm
Angle of half intensity ϕ = ± 17°
Distance 10 meter(MAX)
Operation Temperature -40℃ to +80℃
Size 20mmX20mm

Tip

## Platforms Supported¶

Arduino Raspberry Pi

Caution

The platforms mentioned above as supported is/are an indication of the module's software or theoritical compatibility. We only provide software library or code examples for Arduino platform in most cases. It is not possible to provide software library / demo code for all possible MCU platforms. Hence, users have to write their own software library.

## Getting Started¶

The Grove - Infrared Emitter can send data while Grove - Infrared Receiver will receive them.

### Play With Arduino¶

Note

If this is the first time you work with Arduino, we firmly recommend you to see Getting Started with Arduino before the start.

#### Hardware¶

• Step 1. Prepare the below stuffs:
Seeeduino V4.2 Base Shield Grove - Infrared Emitter Grove - Infrared Receiver
Get One Now Get One Now Get One Now Get One Now
• Step 2. Connect Grove - Infrared Emitter to port D3 of one Grove-Base Shield.

• Step 3. Connect Grove - Infrared Receiver to port D2 of the other Grove-Base Shield.

• Step 4. Plug Grove - Base Shield into Seeeduino.

• Step 5. Connect Seeeduino to PC via a USB cable.

Note

If we don't have Grove Base Shield, We also can directly connect this module to Seeeduino as below.

Seeeduino Grove - Infrared Emitter
5V Red
GND Black
Not Conencted White
D3 Yellow
5V Red
GND Black
Not Conencted White
D2 Yellow

#### Software¶

Copy the following Send Example Code to the Arduino IDE:

Send Example Code:

/* send.ino Example sketch for IRLib2
*  Illustrates how to send a code.
*/
#include <IRLibSendBase.h>    // First include the send base
//Now include only the protocols you wish to actually use.
//The lowest numbered protocol should be first but remainder
//can be any order.
#include <IRLib_P01_NEC.h>
#include <IRLib_P02_Sony.h>
#include <IRLibCombo.h>     // After all protocols, include this
// All of the above automatically creates a universal sending
// class called "IRsend" containing only the protocols you want.
// Now declare an instance of that sender.

IRsend mySender;

#define IR_SEND_PWM_PIN D3

void setup() {
Serial.begin(9600);
delay(2000); while (!Serial); //delay for Leonardo
Serial.println(F("Every time you press a key is a serial monitor we will send."));
}

void loop() {
//send a code every time a character is received from the
// serial port. You could modify this sketch to send when you
// push a button connected to an digital input pin.
//Substitute values and protocols in the following statement
// for device you have available.
mySender.send(SONY,0xa8bca, 20);//Sony DVD power A8BCA, 20 bits
//mySender.send(NEC,0x61a0f00f,0);//NEC TV power button=0x61a0f00f
Serial.println(F("Sent signal."));
}
}


Copy the following Receive Example Code to the Arduino IDE:

/* rawR&cv.ino Example sketch for IRLib2
*  Illustrate how to capture raw timing values for an unknow protocol.
*  You will capture a signal using this sketch. It will output data the
*  serial monitor that you can cut and paste into the "rawSend.ino"
*  sketch.
*/
// Recommend only use IRLibRecvPCI or IRLibRecvLoop for best results
#include <IRLibRecvPCI.h>

void setup() {
Serial.begin(9600);
delay(2000); while (!Serial); //delay for Leonardo
}

void loop() {
//Continue looping until you get a complete signal received
Serial.println(F("Do a cut-and-paste of the following lines into the "));
Serial.println(F("designated location in rawSend.ino"));
Serial.print(F("\n#define RAW_DATA_LEN "));
Serial.println(recvGlobal.recvLength,DEC);
Serial.print(F("uint16_t rawData[RAW_DATA_LEN]={\n\t"));
for(bufIndex_t i=1;i<recvGlobal.recvLength;i++) {
Serial.print(recvGlobal.recvBuffer[i],DEC);
Serial.print(F(", "));
if( (i % 8)==0) Serial.print(F("\n\t"));
}
}
}

• Step 7. Open the Serial Monitor of Arduino IDE by click Tool-> Serial Monitor. Or tap the Ctrl+Shift+M key at the same time.

For the Send Example, the Serial should be like this:

For the Receive Example, the Serial Monitor should be like this: