In this illustration we will going to wire the Infrared Transmitter. The infrared transmitter are now common in our house, offices, even in our cars and other places, etc., It is based on wireless sensing, but also can be more a remote control.
Infrared emission control also known as infrared emitting diode, actually it’s belongs to two tube can be directly converted into electrical energy near-infrared light and a light emitting device can radiate out, its structure with the general principle of the light and the emitting diode similar with the semiconductor on the different components. The infrared communication has its two parts or two elements, mainly composed of silicon crystal and highly integrated circuits, the main function is to filter, shaping, decoding, zoom and other functions, that Photodiode (PD) is the responsible to receive the optical signal by number.
The illustrated schematics below works as modulated infrared emitting diode, can transmit after receiving, decoding, filtering, and a series of operations after the signal recovery.
The infrared emitting diodes should be clean and good conditions and during the operation must not exceed the limit value of positive to the current 30~60 mA, pulse forward current 0.3 to 1 A, Reverse voltage 5v, power dissipation 92 mW, working temperature upto 260 degree Celsius. The infrared emission tube and then closed head should be paired, otherwise it will distract the sensitivity.
The infrared receiver is a low humidity environment storage keep in mind to protect the infrared receiver surface, do not touch the surface, do not wash or polluting gas in body or salt environment, place it without external pressure.
As you can see the illustration below to understand the infrared transmitter and receiver module specific connection with the Arduino. We will going to test the receiving and transmitting base on two Arduino Board. A master or a transmitter and the slave.
Required Components
Arduino Boards
Infrared Emission Sensor Module
Solder less bread board
Jumper / DuPont Wires
Wiring Diagram
Arduino Sketch Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
/* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ 14CORE TEST CODE FOR INFRARED TRANSMITTER MODULE 8888888888888888888888888888888888888888888888888888888888 */ const int analogInPin = A0; int sensorValue = 0; int KEY ; int NEWKEY ; int OLDKEY = 0; int OK = 0 ; int FLAG = 0; int coun = 0; int coun1 = 0; int look = 0; int chk[16] = {0,100,260,385,482,530,587,630,660,688,714,735,753,769,784,800};// To set array comparision value #include long irKeyCodes[16] = {0x00000000, 0x40BFF807, 0x40BF7887, 0xC03FC03F, //correspond to Keypad button '1', '2', '3','4' 0xC03F40BF,0x40BF00FF, 0x00000000, 0x00000000, //correspond to Keypad button'5', '6', '7','8'0x00000000, 0x00000000, 0x00000000, 0x00000000, //correspond to Keypad button'9', '10', '11,'12' 0x80FFC13E, 0x80FFE11E, 0x80FFD12E, 0x80FFF10E //correspond to Keypad button'13', '14', '15','16 }; IRsend irsend; void setup() { Serial.begin(9600); //Set Baud Rate: } void loop() { sensorValue = analogRead(analogInPin); delay(15); aaa: if (FLAG == 0) { if (chk[0]<=sensorValue && sensorValue { KEY = 1; } else if (chk[1]<=sensorValue && sensorValue { KEY = 2; } else if (chk[2]<=sensorValue && sensorValue { KEY = 3; } else if (chk[3]<=sensorValue && sensorValue { KEY = 4; } else if (chk[4]<=sensorValue && sensorValue { KEY = 5; } else if (chk[5]<=sensorValue && sensorValue { KEY = 6; } else if (chk[6]<=sensorValue && sensorValue { KEY = 7; } else if (chk[7]<=sensorValue && sensorValue { KEY = 8; } else if (chk[8]<=sensorValue && sensorValue { KEY = 9; } else if (chk[9]<=sensorValue && sensorValue { KEY = 10; } else if (chk[10]<=sensorValue && sensorValue { KEY = 11; } else if (chk[11]<=sensorValue && sensorValue { KEY = 12; } else if (chk[12]<=sensorValue && sensorValue { KEY = 13 ; } else if (chk[13]<=sensorValue && sensorValue { KEY = 14 ; } else if (chk[14]<=sensorValue && sensorValue { KEY = 15 ; } else if (chk[15] { KEY = 16 ; } else if (sensorValue>1000 ) // { KEY = 0; } NEWKEY = KEY; //save value of KEY to NEWKEY if ( NEWKEY == OLDKEY) //if NEWKEY = = OLDKEY then OK + 1 { OK++; } else { OK = 0; // if not, then OK=0 } OLDKEY = NEWKEY; if(OK>=5) // if OK =5 print the value { Serial.print("KEY = "); Serial.println(NEWKEY); Serial.println(sensorValue); Serial.print("look = "); Serial.println(look); if (NEWKEY !=0) { switch(NEWKEY){ case 1: FLAG =1; break; case 2: FLAG =1; break; case 3: FLAG =1; break; case 4: FLAG =1; break; case 5: FLAG =1; break; case 6: FLAG =1; break; case 7: FLAG =1; break; case 8: FLAG =1; break; case 9: FLAG =1; break; case 10: FLAG =1; break; case 11: FLAG =1; break; case 12: FLAG =1; break; case 13: FLAG =1; break; case 14: FLAG =1; break; case 15: FLAG =1; break; case 16: FLAG =1; break; } } if(NEWKEY>0) { coun1++; } if(co un1>5) { coun1=0; irsend.sendNEC(irKeyCodes[NEWKEY], 32); look++; } if (sensorValue>950) { coun++; } if(coun>1) { FLAG =0; coun = 0; goto aaa; } } } |