IR remote control signal receiver using AVR microcontroller
27,624
An IR remote control is a widely used device found with televisions, VCRs, and home theaters. It can also be utilized to control personal devices such as lights and air conditioning. Remote controls operate using infrared (IR) light, which has a wavelength of approximately 950 nm. A significant challenge in using IR light is the presence of various other sources, such as sunlight, light bulbs, and fire. To mitigate interference from these sources, the IR signal is modulated at a specific frequency, with most remote controls transmitting IR signals at a frequency of 36 kHz. Transmitting and coding the signal is relatively straightforward compared to receiving and decoding it. Decoding is typically achieved using microcontrollers. The receiver must first eliminate the 36 kHz carrier frequency, which is a complex task, leading to the development of specialized IR receiver ICs. One such IC is the TSOP1736, which effectively removes the 36 kHz carrier signal and outputs clean pulses for device control. This module is compatible with microcontrollers like AVR or PIC, as it produces TTL signal levels. Pulse-distance modulation is commonly employed by manufacturers like LG, JVC, Acorp, Hitachi, Nokia, Aiwa, Akai, AverMedia, and NEC. In pulse-distance modulation, fixed-length pulses are used, with the gap between them indicating whether the logical value is a 1 (long gap) or a 0 (short gap). When a remote control button is pressed for an extended period, it sends a complete data packet followed by continuous unitary pulses to indicate that the button remains pressed. It is important to note that different manufacturers may use varying pulse lengths.
The following code snippet demonstrates the implementation of an IR remote control receiver using the TSOP1736 chip. The pin connected to the TSOP1736 is defined as K1:
The interrupt service routine `ISR(TIMER0_OVF_vect)` is triggered at a frequency of 10.8 kHz, which is sufficient to capture the pulse frequency of the received code. Initially, the input signal is inverted, and the current signal level from the photo-sensor is stored in the variable `impulse`. The duration of positive and negative impulses is tracked using `counter_impulse_0` and `counter_impulse_1`, which measure the elapsed time since the signal front was detected. The code corresponding to the remote control button is stored in the EEPROM and can be programmed by pressing the remote control button 20 times. If the button is missed, the process can be restarted from 0 to 20. An optional RS232 interface allows for the expansion of the remote switch's functionality by connecting it to another embedded platform or PC. The circuit transmits code in ASCII format at a speed of 1 kB/s. This implementation provides a foundational understanding of using a remote control with embedded platforms, with potential for further enhancements and adaptations.IR remote control is a device you can find everywhere where you can find TV, VCR or home theatre. Why not to use one of them for controlling your own devices like light, air conditioning etc. As we know remote control devices uses IR light. This is invisible light about 950nm wavelength. One biggest problem in using IR light is that there many oth er sources of it like sun, light bulbs, fire. In order to exclude other sources, IR signal is modulated by some frequency. Receiver has to be tuned for this frequency. Mostly remote controls transmit IR signal using 36kHz frequency signals. Transmitting and coding is one part which can be done more easily than receiving and decoding. Decoding is usually performed by using microcontrollers. Firs of all receiver has to get rid of 36kHz carrier frequency. This is not simple task to demodulate signal, this is why special IR receiver IC`s are produced. One of them is TSOP1736: this receiver simply removes 36KHz carrier signal and gives clean pulses that are used for device control. I won`t go too deep in how it works you can find this information in datasheets. This module is convenient to connect to microcontrollers like AVR or PIC, because it forms TTL signal levels compatible to them.
Pulse-distance modulations is commonly used by LG, JVC, Acorp, Hitachi, Nokia, Aiwa, Akai, AverMedia, NEC. So further we will discuss only this modulation type. As you have noticed pulse-distance modulation uses fixed length pulses while gap defines weather it is 1 (long gap) or 0 (short gap) logical value.
When using Pulse-Distance modulation firs goes LSB then MSB bits. If remote control button is pressed for a long time, then it sends one full packet and then after som time continuously sends unitary pulses informing that button is still pressed. Note, that different manufacturers may use different length of pulses. //pin connected to TSOP1736 #define K1 (1<3)&&(flag_rx=1)&&(counter_impulse_0<23) {//if receiving symbols if(counter_impulse_0>12) //logical 1 received code |=(1<30) {//one long synchro pulse code=0; counter_ik=0; flag_rx=1; } }; if(impulse=0)&&(flag_rx=1)&(counter_impulse_1<150) //counting negative pulses counter_impulse_0 ; if(counter_impulse_0>50)&&(flag_rx=1)&&(impulse=0) {//end of receive flag_rx=0; counter_impulse_0=0; counter_impulse_1=0; counter_ik=0; code=0; }; impulse_prev=impulse; } Interrupt service routineISR(TIMER0_OVF_vect)is called with frequency of 10. 8kHz. This frequency is more than enough comparing with pulse frequency of receiving code. At the beginning of procedure signal is inverted. Current signal level from photo-sensor is defined by variable impulse. Signal reference is signal front (variable impulse_prev). Duration of positive and negative impulses are defined by variables counter_impulse_0 and counter_impulse_1.
They show how much time have passed since signal front was registered. Remote control button code is stored in EEPROM. It can be programmed by pressing remote control button 20 times. After this code is saved to EEPROM. If you missed button then start again from 0 to 20. RS232 interface is optional if you want to expand functionality of remote switch by connecting it to another embedded platform or PC. Circuit sends code in ASCII format at kB/s speed. Of course it is easy to construct algorithm to another AVR MCU and for different purposes. This article only gives an idea of using a remote control with embedded platforms. We aim to transmit more information by carrying articles. Please send us an E-mail to wanghuali@hqew. net within 15 days if we are involved in the problems of article content, copyright or other problems.
The emitter will consistently be a few hundred millivolts lower than the base voltage in this configuration. With the base voltage set at 5V, the emitter voltage is likely to be around 4.5V, depending on the current drawn by...
Climber A ascends a route while Climber B remains on the ground, tracking Climber A's progress with a laser pointer. The Redpointer device records the exact route taken. In Mode 1, the recorded route is played back in real-time,...
The 10K resistor is necessary if the receiver is to mute (squelch) under no-signal conditions. An additional 100K resistor can be added in series with this resistor to create an adjustable squelch. This circuit is designed to drive a...
Briefly it's an Infrared receiver which communicated with your pc to command many windows application, so once you have built the interface, programmed the pic16f84 with the code and connected everything to your serial com2 you'll be able to...
The FM497 is an integrated electronic ignition controller designed for breakerless ignition systems that utilize Hall effect sensors. This device operates an external NPN Darlington transistor to manage the coil current, thereby delivering the necessary stored energy while maintaining...
LBl690 is a three-phase brushless DC motor drive control integrated circuit manufactured by Sanyo, a Japanese company. It is extensively utilized in both domestic and imported applications for broken wind and fresh air conditioning systems that require brushless DC drive...
Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713
Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713