Using IR to control equipment in automation systems


IR remote control

What does it take to teach a robot to obey an infrared (IR) remote control? First, we need the remote control itself. You can use a regular TV remote control, or you can purchase a miniature remote control for your car radio. These types of remote controls are often used to control robots.

This remote control has 10 digital buttons and 11 buttons for manipulating music: volume, rewind, play, stop, etc. More than enough for our purposes.

List of RTV-02 and R-TV2 setup codes

AIWA 814, 827, 884 AKAI 886, 157, 885, 809, 176, 053, 782, 787, 795, 840, 845, 849, 850, 854, 863, 865, 887, 888, 889, 059, 006, 890 , 891, 073, 883 AKIRA 886, 786, 746, 447, 704, 053, 384, 537, 539, 519, 440, 807, 892, 893, 894, 044 AVEST 176 BBK 134 BEKO 895 , 896, 897 , 040, 374 BENQ 841, 846 CHANGHONG 028, 130, 131, 136, 139, 141, 146, 151, 156, 161, 166, 171, 176, 181, 186, 196, 201, 285, 315, 323, 331 , 340, 341, 346, 351, 361, 365, 366, 371, 376, 381, 386, 390, 396, 401, 406, 411, 415, 416, 421, 431, 432, 436, 440, 441, 4 46 , 451, 456, 457, 461, 466, 474, 476, 481, 482, 486, 491, 498, 502, 658, 663, 668, 679, 683, 688, 729, 745, 781, 786, 791, 8 52 , 858 CONROWA 063, 068, 178, 353, 468, 473, 514, 537, 542, 547, 552, 562, 740 CYBEX 752 DAEWOO 808, 813, 819 DRE 855, 927, 924 ELENBERG 248 , 258, 265, 807 ERISSON 898, 746, 807, 764, 157, 440, 148, 814, 033 FUNAI 412, 899, 900, 248, 807 GENERAL 924, 927, 855 GOLDSTAR 776, 530, 797, 798, 803, 8 18, 830, 861 , 862, 901 Grundig 843, 777, 778, 783, 788, 793, Video (874) Haier 524, 001, 033, 059, 158, 190, 195, 205, 214, 219, 529, 534, 682, 684, 684, 684. 687, 694, 715, 720, 739, 756, 761, 774, 807, 812, 825, 832 HI-VISION 152 HORIZONT 530, 901, 903, 775, 789, 794, 796, 799, 801, 823 , 837, 857, 859 HISENSE 133, 003, 016, 022, 024, 034, 035, 043, 044, 132, 163, 168, 173, 185, 204, 209, 229, 276, 281, 291, 296, 301, 338, 343, 348, 448, 453, 458, 463, 511, 516, 519, 535, 538, 548, 553, 558, 559, 563, 564, 567, 568, 569, 572, 573, 574, 578, 579 , 582, 583, 584, 587, 589, 592, 602, 607, 612, 622, 627, 632, 642, 647, 672, 677, 699, 700, 704, 705, 706, 710, 711, 716, 766 , 779, 856 HITACHI 076, 496, 501, 506, 526, 531, 536, 541, 019, 037, 103, 108, 113, 116, 149, 545, 546, 551, 556, 561, 566, 571, 749, 811, 816, 821, 826, 511, 516, 521 HYUNDAI 746, 133, 447 JAV 066 JINXING (SVA) 010, 020, 153, 164, 169, 213, 218, 223, 228, 316, 373, 4 29, 492 KONKA 879, 033, 006, 012 , 014 , 038, 062, 072, 074, 077, 115, 120, 124, 125, 144, 248, 253, 258, 263, 268, 273, 278, 283, 288, 293, 298, 303, 308, 313, 3 18 , 352, 362, 367, 372, 377, 387, 392, 394, 399, 404, 409, 424, 479, 484, 489, 494, 499, 504, 605, 610, 641, 646, 651, 656, 6 86 , 701, 707, 721, 726, 731, 800, 805, 810, 878 LG 776, 601, 530, 056, 096, 447, 520, 525, 576, 586, 591, 596, 771 LOEWE 922 MITSUBIS HI 760, 829 , 831, 834, 835, 860 NEC 876 ORION 904, 905, 923, 807 PANORAMA 045 PANASONIC 822, 906, 864, 869, 053, 078, 114, 133, 243, 319, 324, 329, 334 , 339, 344 , 349, 354, 359, 364, 434, 439, 444, 550, 696, 817 PANDA 002, 042, 047, 052, 107, 140, 152, 154, 159, 233, 238, 321, 378, 383, 414 , 452, 462, 467, 472, 477, 487, 509, 555, 565, 570, 630, 708 PEONY 017, 082, 135, 189, 310, 488, 512, 517, 522, 665, 666, 671, 691 , 742 PHILIPS 759, 764, 064, 901, 015, 040, 069, 070, 075, 080, 085, 090, 095, 100, 105, 110, 230, 240, 245, 754 POLAR 020, 447 PRIMA 013 , 018 , 023, 027, 049, 067, 089, 112, 117, 122, 134, 145, 157, 192, 200, 211, 235, 237, 250, 260, 272, 307, 328, 332, 357, 374, 3 82 , 407, 449, 454, 459, 464, 469, 661, 693, 698, 703, 722 PROWEST 926 QINGHUAT OUGFANG 046, 051, 118, 593, 719, 734, 743 REKORD 133, 907, 908 , 909, 910 ROLSEN 176, 432, 157, 883, 775, 789, 794, 796, 799, 801, 823, 837, 857, 859, 911, 912 ROWA 092, 102, 183, 188, 193, 199, 358, 455, 5 27, 581, 690, 695 RUBIN 897, 902, 779, 040 SAMSUNG 685, 877, 755, 137, 925, 902, 385, 007, 009, 142, 147, 194, 306, 360, 363, 368, 385 , 419, 478, 483, 609, 614, 619, 624, 629, 634, 670, 675, 680, 681 SANAM 872, 883 SANYO 123, 533, 815, 143, 148, 206, 333, 503, 508, 513, 518, 523, 528, 533, 713, 735, 815, 820, 011, 058, 101 SANSUI 748 SHARP 773, 768, 763, 423, 917, 104, 126, 388, 393, 398, 403, 408, 413, 418, 758 SHIVAKI 759, 893, 447, 482 SITRONIKC 053 SKYWORTH 000, 005, 026, 031, 036, 045, 050, 054, 055, 060, 065, 079, 086, 091, 111, 121, 129, 138, 150, 155, 160, 162, 165, 167, 170, 172, 175, 177, 180, 182, 187, 197, 202, 207, 212, 217, 222, 225, 227, 232, 242, 247, 252, 257 , 262, 267, 277, 282, 287, 292, 297, 302, 312, 317, 322, 326, 327, 337, 342, 347, 369, 379, 384, 389, 470, 490, 515, 532, 539 , 540, 544, 549, 557, 560, 575, 577, 585, 588, 595, 597, 600, 603, 608, 613, 617, 618, 623, 628, 633, 637, 638, 643, 648, 652 , 653, 657, 662, 664, 667, 669, 673, 674, 678, 702, 709, 712, 717, 725, 727, 730, 746, 751, 765, 769, 770, 780, 785, 790, 839 , 844 SNOWA 875, 880, 882 SOKOL 804, 809 SONY 913, 836, 088, 093, 098, 106, 109, 234, 239, 244, 249, 254, 259, 264, 269, 274, 279, 284 , 289, TCL 447 , 02 1,039 , _ _ _ 048, 061, 087, 094, 099, 255, 265, 270, 275, 280, 290, 295, 300, 305, 320, 325, 330, 335, 345, 350, 355, 370, 375, 380, 395 , 397, 400, 402, 405, 410, 412, 417, 420, 422, 425, 427, 430, 433, 435, 437, 438, 442, 443, 445, 450, 460, 465, 475, 480, 485 , 495, 500, 505, 510, 606, 611, 615, 616, 620, 621, 625, 626, 631, 636, 639, 644, 649, 654, 659, 718, 723, 724, 728, 733, 753 , 784, 848 THOMSON 853, 914, 915, 916, 792, 824, 828, 838, 867 TOSHIBA 081, 191, 806, 216, 221, 226, 231, 236, 241, 246, 251, 256, 26 1,266, 286, 311, 336, 356, 391, 426, 471 VESTEL 919, 918, 920, 015 VITYAS 921, 530, 015 XIHU 008, 029, 030, 071, 084, 174, 179, 184, 741 X. V ISION 873 OTHERS 004, 032, 057, 073, 083, 097, 119, 127, 128, 210, 215, 220, 224, 271, 543, 594, 598, 599, 604, 689, 692, 697, 714, 732, 736 , 747, 750, 882

IR sensor

Secondly, to receive a signal from the remote control we need a special IR sensor. In general, we can detect infrared radiation with a conventional photodiode/phototransistor, but unlike it, our IR sensor perceives infrared signal only at a frequency of 38 kHz (sometimes 40 kHz). It is this property that allows the sensor to ignore a lot of extraneous light noise from lighting lamps and the sun.

For this lesson we will use the popular IR sensor VS1838B , which has the following characteristics:

  • carrier frequency: 38 kHz;
  • supply voltage: 2.7 - 5.5 V;
  • current consumption: 50 µA.

Other sensors can be used, for example: TSOP4838, TSOP1736, SFH506.

Connection

The sensor has three leads (three legs). If you look at the sensor from the IR signal receiver side, as shown in the figure,

  • then on the left there will be an output to the controller,
  • in the center - negative power contact (ground),
  • and on the right - positive power contact (2.7 - 5.5V).

Schematic diagram of connection

Layout appearance

User manual for 4 in 1 universal remote control.

Manual code entry:

1. Press the power button of the relevant device and make sure it is working properly.
2. Press and release the button of the selected device ( TV, SAT, DVD, AUX ), and the LED indicator will blink once.

3. Press the SET UP until the LED turns solid, then release the button.

4. Enter a 4-digit code from the code list. If the code is correct, the LED will turn off immediately, otherwise it will flash for three seconds and then turn off. To begin, repeat step 2.

5. Point the remote control at the corresponding device and press the power buttons, the device's power will turn off.

6. If you want to set up another device, repeat step 1.

Automatic code search:

1. Press the power button of the relevant device and make sure it is working properly.

2. Press and release the button of the selected device ( TV, SAT, DVD, AUX ), and the LED indicator will blink once.

3. Press the SET UP until the LED turns solid, then release the button.

4. Point the remote control at the appropriate device and press the P+ . If the device responds, save the current code.

5. Click OK to exit.

Program

Having connected the IR sensor, we will write a program for Arduino Uno. To do this, we will use the standard library IRremote , which is designed specifically to simplify the work with receiving and transmitting IR signals. Using this library, we will receive commands from the remote control, and to begin with, simply display them in the serial port monitor window. This program will be useful to us in order to understand what code each button gives.

#include "IRremote.h" IRrecv irrecv(2); // indicate the pin to which the receiver is connected decode_results results; void setup() { Serial.begin(9600); // set the speed of the COM port irrecv.enableIRIn(); // start receiving } void loop() { if ( irrecv.decode( &results )) { // if data arrived Serial.println( results.value, HEX ); // print data irrecv.resume(); // accept the following command } }

Load the program onto Arduino. After that, we try to receive commands from the remote control. Open the serial port monitor (Ctrl+Shift+M), pick up the remote control, and point it at the sensor. By pressing different buttons, we observe the codes corresponding to these buttons in the monitor window.

Problem loading the program

In some cases, when trying to load a program into the controller, an error may appear:

TDK2 was not declared In his scope

To fix it, just delete two files from the library folder. Let's go to the explorer. Go to the folder where the Arduino IDE application is installed (most likely “C:\Program Files (x86)\Arduino”). Then to the library folder:

…\Arduino\libraries\RobotIRremote

, and delete the files: IRremoteTools.cpp and IRremoteTools.h. Then, we restart the Arduino IDE and try to load the program onto the controller again.

Preparation for use

To work with the remote control, you will need a computer, the RCCreator program (you can download it from the manufacturer’s website) and a USB - mini USB cable. The RCCreator program is specifically designed for programming remote controls manufactured by . The program also has a number of additional service capabilities that allow you to expand the functionality of Changer remote controls. From there you can also download an archive of photos of remote controls that is connected to the RCCreator program database.

The system requirements for the computer on which you can install the RCCreator program will be satisfied by almost any platform:

  • Pentium II processor or AMD equivalent;
  • 128 MB RAM, 800x600 screen;
  • operating system MS Windows XP;
  • Windows Vista or Windows 7.

When you start programs, the search function for updates of the program itself and the database is automatically turned on. During testing of the remote control, the database was updated several times. The RCCreator program interface is simple and intuitive. The program supports the choice of interface language (12 available languages, including Russian and Ukrainian). The language can be selected during the installation process of the program or assigned while the application is running.

On the left side of the program window there is a block for selecting parameters for database filters and modifying the Changer remote control. Searching for data on known remote control models can be carried out using the manufacturer's database, a user-created database, or all available databases.

The filter allows you to:

  • Set a brand. The database supplied with the RCCreator program contains data on remote control models for video and audio equipment produced by various manufacturers.
  • Select device type. Devices about which there is information in the database are divided into 19 categories (TV, SAT, DVR, HiFi, AUX, VCR and others). To use the filter, you can specify several types of devices from this list.
  • Specify the device model. The remote control data selected by the search filter can be saved as an XML file. Previously created remote control database files can be imported into the currently used database.

To use the program with the Changer universal remote control, you need to select its modification. The program provides the ability to select four types of Changer USB remotes: TV, DVD, SAT and 4:1. In the right part of the program window, a table of correspondence of control commands to the buttons of the selected remote control, an image of the type of universal Changer remote control with binding of the buttons of the selected remote control to the buttons of the Changer remote control are displayed. By switching to the “Pictures” tab, you can display the image of the remote control selected by the search filter. Information about the selected remote control (its image, the correspondence of the keyboard layout to the buttons of the universal Changer remote control) can be printed from the RCCreator program in the form of a kind of “business card” of the remote control.

When I first connected the Changer RC USB 4v1 to the computer's USB port, the OS detected it as a USB HID-compatible device. The system installed the drivers automatically. The RCCreator program detects the presence of a Changer RC remote control connected to the computer.

We control the LED using the IR remote control

Now that we know which codes correspond to the remote control buttons, we try to program the controller to turn on and turn off the LED when the volume buttons are pressed. To do this we need codes (may vary depending on the remote control):

  • FFA857 - increase volume;
  • FFE01F - decrease volume.

As an LED, we use the built-in LED on pin No. 13, so the connection diagram will remain the same. So, the program:

#include "IRremote.h" IRrecv irrecv(2); // indicate the pin to which the receiver is connected decode_results results; void setup() { irrecv.enableIRIn(); // start receiving } void loop() { if ( irrecv.decode( &results )) { // if data arrived switch ( results.value ) { case 0xFFA857: digitalWrite( 13, HIGH ); break; case 0xFFE01F: digitalWrite( 13, LOW ); break; } irrecv.resume(); // accept the following command } }

We upload it to Arduino and test it. Press vol+ - the LED lights up. Press vol- and it goes out. Now, knowing how it all works, you can control robot motors or other homemade microelectronic devices instead of an LED!

Design

The Changer RC USB 4v1 remote control is housed in a small black plastic case. Case dimensions 194 x 48 x 18 mm.

The remote control weighs no more than conventional (non-programmable) remote controls. There is a recess on the bottom cover of the case that makes it easier to hold the remote control in your hand. The surface of the case is matte, dirt-repellent. The remote control keyboard consists of 48 buttons . The keyboard buttons are located strictly symmetrically, the body is also symmetrical, so the remote control is equally convenient to use, holding it in your right or left hand. The remote control buttons are pressed softly. Tactile feedback is good.

Keyboard buttons are grouped into zones according to their functional purpose. The buttons for each zone are different sizes and shapes. The navigation circle is located exactly in the center, the numeric keypad buttons are at the top, and the service selection buttons are at the bottom. To expand the functionality of existing buttons, the Shift prefix button can be used.

There is a small area of ​​8 buttons labeled MINI TV. This is a minimal set of buttons for controlling viewing (switching programs, changing the volume level, confirming the installation, selecting a low-frequency input, muting the sound, switching to standby mode).

In the very bottom row of the keyboard there are buttons for selecting the controlled device: TV, DVD, SAT and AUX .

Most of the keyboard buttons are black. The Power, Shift buttons and a group of functional (“colored”) buttons are highlighted in color. The Power button is backlit, which turns on when the command assigned to the programmed button is sent. There are clear, easy-to-read symbols on the keyboard and the remote control body that describe the functions of the buttons.

On the front (upper) part of the case there is a logo and the name of the remote control modification (“4:1”). mini USB connector used for communication with a computer. The remote control is powered by three AAA batteries.

Rating
( 2 ratings, average 5 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]