Introduction: Cheap Wireless Transmission Between Two Arduinos With Infrared

About: French engineer in robotics. I love Arduino projects / coding / guitar / various electronics. Oh, I like cooking also ! PS : English is not my main language, please inform me in case of grammar mistakes ! T…

Hi all,

For a project, I was looking for a cheap solution to send data from an Arduino to an other one. The serial port was already taken, and my transmission (unidirectional) needed to be wireless.

My researches has brought me to discover these kinds of radio modules (433MHz). They were available on the net, but I was still looking for something else.

So, I remember that I have in my stock an IR receiver with a small remote control. I also had an IR led. After some researches on the web for libraries, I used an existing one to create a small and easy IR protocol to send data between my two cards.

Of course, the range and the baud rate are limited, and you must keep the cards in "eye contact".

Here is a step by step presentation of this system. In my example, a temperature and humidity sensor will be used for data transmission (DTH11). The data will be sent to the other Arduino and sent to a computer. Feel free to use and modify this example for your own projects !

Thanks for the 20k views !

Step 1: Materials List

Ok, you will need:

• two Arduino cards (uno, mega...). I'll use an Uno and a Mega in this project.
• a computer with the Arduino software
• an IR led, with a 100 ohms resistor
• a 38 kHz receiver module
• wires
• breadboard, or similar
• In my case, a DTH11 temperature and humidity sensor. If you don't have it, you can simply sent a demo string. (see the code in the next step)

This site was a good source of information. I encourage you to read it ! The main IR libraries are here. Please download and install them in the Arduino "Libraries" folder. (Should be in "My documents / Arduino")

The libraries for the temperature and humidity sensor are here.

Step 2: Wiring the Emitter

The emitter is easy to build. You just need to wire a led with a 100 ohms resistor, and use an other pin to connect the sensor.

The Arduino pin used for the led is the 3. (See the attached pics). Watch out, the Fritzing illustration doesn't fit my real module. If you have the naked chip, you will need more parts ! See the DTH11 datasheet.

If (like me) you are not sure about the LED orientation, or if you don't know if it works correctly, temporally connect the DATA wire to the +5v pin on the Arduino (to turn the LED on). Then, check with a mobile phone camera if the led is emitting (you should see a low purple colour, see pics)

The temperature sensor is wired this way:
• Vcc : to the +5v pin of the Arduino
• Dnd : to a GND pin
• Data : arduino pin 2

If you don't have this sensor, you can try the transmission by sending a string. Just check the code.

The code is attached. Compile it and upload in on the card.

Step 3: Wiring the Receiver

Ok, for the receiver, I have a ready-made reception module (38 kHz). It was used with a small remote control. Just connect it to the second Arduino following:

• Gnd to GND
• Vcc to Arduino Vcc (+5v)
• Data : Arduino pin 11

Watch out, again the module shown in the illustration is not the same as my module. if you have a naked receiver, you must add parts !

The receiver has a built-in LED, so we will be able to check if incoming data is received.

The receiver sketch is attached. The incoming data is collected then sent to the serial port.

Compile it and upload in on the card.

Step 4: Use It !

In this last step, we will turn everything on and check if it works.

I use the PuTTY software to receive the data from the Arduino.(Of course you can also use the Arduino Serial Monitor, the result will be the same !) Of course, it uses the USB connection, through the virtual serial port.

• Ok, turn on the emitter card. Remember, you can check the LED by using a mobile phone camera.
• Make sure the IR led on the emitter card and the receiver are aligned.
• Put the receiver card not far away. My receiver module has a build-in LED that blinks in case of incoming data.
• Launch PuTTY, select "Serial" and type "COM4" in the serial line text box. If you don't know the correct serial port, just check the bottom right line in the Arduino IDE : mine says "Arduino Mega on COM4". Make sure the baud-rate is correct (9600 in my example), then click Open. It should work !

Ok, it's quite stupid to sent a whole sentence. It's slow, and it may be better to sent only the two variables (temperature and humidity). Remember that this Instructable is only an example !

Here we are, a simple solution to send mono-directional data between two Arduino cards. Of course, real wireless solutions (433 MHz modules, Bluetooth or Wifi) are also perfectly suitable. In my case, the IR module was in stock, and it was possible to use it (no obstacles between them). If you need to simply send data (at low speed), just remember the good old IR transmitters... Its is possible to improve this code, for example by adding a control error, or by adding bi-directional links.

Thanks for reading !