loading

I have been planning to add Infrared Remote support to Visuino for over a year, but always other sensors or features took priority. Finally couple of weeks ago I received a great Robot KIT from Elegoo, and since the kit came with Infrared Remote and Infrared Receiver Sensor included, I could not resist, but try programming it with Visuino. I added the necessary components, and started playing with the robot. I will be making Tutorials on the robot including Infrared control ones. Here I decided to show you first the basics of the Infrared Receiver support in Visuino.

In this Tutorial I will show you how easy it is to connect Infrared Receiver Module to Arduino Nano and program it with Visuino to decode the commands.

Step 1: Components

  1. One Arduino compatible board (I use Arduino Nano, because I have one, but any other will be just fine )
  2. One Digital Infrared Receiver Module I got from this cheap 37 sensors set.
  3. One Infrared Remote - I got my one form an Arduino Robot KIT donated by Elegoo but you can use very much any remote from a TV, VCR, DVD/CD Player or anything else. My one uses NEC protocol but the project should work with other protocols as well.
  4. 3 Female-Female jumper wires

Step 2: Connect the Infrared Receiver Module to Arduino

  1. Connect Ground(Black wire), Power(Red wire), and Data(Gray wire) to the Infrared Receiver Sensor Module (Picture 1)
  2. Connect the other end of the Power wire(Red wire) to the 5V power pin of the Arduino board (Picture 2)
  3. Connect the other end of the Ground wire(Black wire) to Ground pin of the Arduino board (Picture 2)
  4. Connect the other end of the Data wire(Gray wire) to Digital pin 2 of the Arduino board (Picture 3)
  5. Picture 4 shows where are the Ground, 5V Power, and Digital 2 pins of the Arduino Nano.

Step 3: Start Visuino, and Select the Arduino Board Type

To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://www.arduino.cc/.

Make sure that you install 1.6.7 or higher, otherwise this Tutorial will not work!

The Visuino: https://www.visuino.com also needs to be installed.

  1. Start Visuino as shown in the first picture
  2. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino
  3. When the dialog appears, select "Arduino Nano" as shown in Picture 2

Step 4: In Visuino: Add and Connect Infrared Receiver Component

  1. Type "infra" in the Filter box of the Component Toolbox then select the "Infrared Receiver" component (Picture 1), and drop it in the design area
  2. Connect the "Out" output pin of the "Digital[ 2 ]" channel of the Arduino component to the "Sensor" input pin of the InfraredReceiver1 component (Picture 2)
  3. Connect the "Out" output pin of the InfraredReceiver1 component to the "In" input pin of the "Serial[ 0 ]" channel of the Arduino component (Picture 3)

Step 5: Generate, Compile, and Upload the Arduino Code

  1. In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE
  2. In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

If you get compiler error in the Arduino IDE, this means that you are missing the following library:

https://github.com/z3t0/Arduino-IRremote

Look at the Next Step to see how to install it!

Step 6: If Not Installed: Install the Arduino-IRremote Library

If you don't have the IRremote library already installed, follow these steps:

  1. In the Arduino IDE menu, select |Sketch|Include Library|Manage Libraries...| (Picture 1)
  2. Type "IRremote" in the filter box (Picture 2)
  3. Select the IRremote by shirriff library, and click the Install button (Picture 2)
  4. The dialog will show the progress of the install (Picture 3)
  5. Click on the Close button (Picture 4)
  6. In the Arduino IDE, click on the Upload button, to compile and upload the code

Step 7: And Play...

On Picture 1 you can see the complete Visuino diagram.

On Picture 2, and in the Video, you can see the completed and running project.

  1. In Visuino select the Serial Port and click the Connect button (Picture 3)
  2. If you point the infrared remote to the sensor and press some buttons, in the Serial Terminal you will see the decoded button codes received by the sensor (Picture 3)

Congratulations! You have learned how to connect Infrared Remote Receiver to Arduino, and how to program it with Visuino.

Also attached is the Visuino project, that I created for this Tutorial. You can download and open it in Visuino: https://www.visuino.com

<p>Thanks for adding the IR module to Visuino. I have a quick question, let's just say I want to turn on LED by pressing 1 on the remote. When I press 1, Serial shows a value, however if I press 1 couple of times, it shows a different value. How can I make the value of button 1 constant? I was also wondering, how can I turn on the LED on PIN13 of UNO by pressing 1?</p>
Thank you. The value should be the same. If you get a different value, most likely there was a noise and the sensor did not pick the infrared signal clearly. I am already working on Instructable to turn the PIN13 On/Off with a button ;-) If you download the latest Visuino version, add element for your remote type to the &quot;Infrared Receiver&quot; and in the element set the code for the button. Then add T-FlipFlop, connect the Clock input pin of the flip-flop to the remote element, and the output to pin 13 and you are ready :-)
<p>Do you mind posting the raw code as well? Thank you.</p>
I can post it, but since it uses the Visuino open source libraries: <br>https://bitbucket.org/mitov/visuino-libraries<br>and they change as Visuino is developed, the raw code will soon become incompatible :-( . Visuino always makes sure it generates code compatible with the latest version of the libraries, so it is better to use the Visuino to generate the code.
Cool project
Thank you! :-) Enjoy!
<p>Thank you, this is pretty cool.</p>
<p>You are Welcome! Enjoy :-)</p>

About This Instructable

4,104views

66favorites

License:

More by BoianM:Program Arduino UNO With Visuino to Draw on ILI9341 TFT Touchscreen Display Shield With Pen Assemble Kuman Wi-Fi Robot With Camera and Manipulator Arduino and Visuino: Long Distance Remote Light Sensor With RFM95W/RFM98W Makerfabs LoRa Shields  
Add instructable to: