Escolar Documentos
Profissional Documentos
Cultura Documentos
The remote control is a cheap NEC Format remote, usually supplied with small DVD players. Three buttons are used to command the circuit. The UP key increase the fan's speed while the DOWN key decrease it. The ENTER key is used to switch on or off the fan. The unit provides 10 way speed control from 0 to 9. The current speed is displayed in a seven segment display. The yellow LED on the PCB indicates the power status of the load. If the load is switched off using the R/C then the LED will also be switched off. The main parts of the circuit is labeled below. 1. 2. 3. 4. 5. 6. 7. The seven segment display used to show the current speed level. The TSOP1738 sensor is used to pick up commands from remote control. The Yellow LED indicates the power status of the load. OUT - Here the AC load is connected in series. Tested on 220v 50Hz AC line. IN - Power supply from a 12-0-12 transformer is applied here. MCU - ATmega8 AVR 8 bit Microcontroller. SWITCH - Manual Switch used to operate the unit without the remote control.
PDFmyURL.com
PDFmyURL.com
After that you can solder the ceramic disk capacitors, the 16MHz crystal, 7805, Triac, TSOP Sensor, Display. Finally Connect the 12-0-12 Transformer and apply power. The display should show '0'. Then you can press the up/down key in remote control to adjust the speed. The display should change accordingly. This ensures that the circuit is running properly. Its time to connect a real AC load. Connect a 220V 100W incandescent lamp (NO CFL Please). As shown in the above wiring diagram. Replace the fan with bulb because its easier to test. WARNING !!!
PDFmyURL.com
Never Touch any part of t he circuit when AC load is connect ed. It can give you a f et al shock !!! Now you can can use the remote control to increase/decrease the lamp's brightness using the remote control. You can also switch it on and off using the ENTER key.
Troubleshooting
If the unit does not respond to the remote control signals then look for the following. 1. AVR ATmega8's Fuse BIT is programmed to HIGH=0xC9 LOW=0xFF 2. AVR is clocked with 16MHz crystal (other value won't work) 3. Remote Control is NEC Format Only (Chinese DVD/CD player remote works good, TV Remote Generally do not work as these are RC5 coded) 4. Remote Key codes has been feed to rckey.h file. Build and run this demo and press UP,DOWN and ENTER keys to get their keycode and put them in rckeys.h file. All remotes available in market has random keycode, so This part is very important. After editing the rckeys.h file the project must be Rebuild. (I hope you know what does that means). 5. IR sensor is of good quality and must be labeled TSOP1738 (other values won't work). 6. If you get a KIT from us then most of the problem do not arise.
PDFmyURL.com
06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
22pF Ceramic Disk Capacitor (2 Nos) 0.1uF Ceramic Disk Capacitor (3 Nos) 470uF 50v Electrolytic Capacitor 16 MHz Crystal Half Size 1N4007 Diode (6 Nos) LED 5mm Any Colour MCT2E Opto Coupler MOC3021 Opto Triac Driver ATmega8-16PU General purpose 8 bit MCU Triac BT136 7805 Voltage Regulator Common Anode Display TSOP1738 IR Sensor 220V AC to 12-0-12 Centre Tapped Transformer (NOT Included in KIT) Hobby Remote Control (NEC)
Schematic
PDFmyURL.com
PDFmyURL.com
Other Lib: eXtreme NEC Decoder. Hardware: INT0 - IR Receiver INT1 - Zero Crossing Detector. PD5 - Triac Control. PB2 - Manual Switch For ATmega8 @ 16MHz Fuse: HIGH=0xC9 LOW=0xFF Copyright (c) 2008-2010 eXtreme Electronics, India NOTICE -------NO PART OF THIS WORK CAN BE COPIED, DISTRIBUTED OR PUBLISHED WITHOUT A WRITTEN PERMISSION FROM EXTREME ELECTRONICS INDIA. THE LIBRARY, NOR ANY PART OF IT CAN BE USED IN COMMERCIAL APPLICATIONS. IT IS INTENDED TO BE USED FOR HOBBY, LEARNING AND EDUCATIONAL PURPOSE ONLY. IF YOU WANT TO USE THEM IN COMMERCIAL APPLICATION PLEASE WRITE TO THE AUTHOR. */ #include <avr/io.h> #include <util/delay_basic.h> #include <avr/interrupt.h> #include "remote.h" #include "rckeys.h" #define FAN_POWER_LED_PORT PORTD #define FAN_POWER_LED_DDR DDRD #define FAN_POWER_LED_BIT 7 #define POWER_LED_ON() FAN_POWER_LED_PORT&=(~(1<<FAN_POWER_LED_BIT)) #define POWER_LED_OFF() FAN_POWER_LED_PORT|=(1<<FAN_POWER_LED_BIT) uint8_t table[10]={141,125,109,94,78,62,47,31,16,1};
PDFmyURL.com
uint8_t speed=0; uint8_t fan_on=0; void Initialize() { FAN_POWER_LED_DDR|=0B10000000; POWER_LED_OFF(); DDRC|=0b00111111; //Seven segment DDRB|=0b00000010; //Middle segment G Display(0); RemoteInit(); //Initialize the zero crossing detector INT(1) MCUCR|=((1<<ISC11)|(1<<ISC10)); //INT in Rising edge GICR|=(1<<INT1); //Enable INT1 //Output DDRD|=(1<<PD5); PORTD|=(1<<PD5); //Set Timer 2 TCCR2|=(1<<WGM21); TIMSK|=(1<<OCIE2); sei(); } /* Zero Crossing Detect. */ ISR(INT1_vect) { if(!fan_on)
PDFmyURL.com
{ PORTD|=(1<<PD5); return; } if(speed==9) { PORTD&=(~(1<<PD5)); //low = TRIAC ON return; } PORTD|=(1<<PD5); OCR2=table[speed]; TCNT2=0x00; TCCR2|=((1<<CS22)|(1<<CS21)|(1<<CS20)); } /* Timer2 Compare ISR */ ISR(TIMER2_COMP_vect) { PORTD&=(~(1<<PD5)); //low = TRIAC ON TCCR2&=(~((1<<CS22)|(1<<CS21)|(1<<CS20))); } /* Simple Wait Function */ void Wait() { char i; for(i=0;i<100;i++) _delay_loop_2(0); }
PDFmyURL.com
//Stop Timer
/* Displays a number in Seven Seg Display */ void Display(uint8_t num) { if(num>9) return; switch (num) { case 0: PORTC=0B00000000; PORTB|=0B00000010; break; case 1: // xxfedcba PORTC=0B00111001; PORTB|=0B00000010; break; case 2: // xxfedcba PORTC=0B00100100; PORTB&=(~(0B00000010)); break; case 3: // xxfedcba PORTC=0B00110000; PORTB&=(~(0B00000010)); break; break; case 4: // xxfedcba PORTC=0B00011001; PORTB&=(~(0B00000010)); break; case 5: // xxfedcba PORTC=0B00010010; PORTB&=(~(0B00000010));
PDFmyURL.com
break; case 6: //
xxfedcba
PORTC=0B00000010; PORTB&=(~(0B00000010)); break; case 7: // xxfedcba PORTC=0B00111000; PORTB|=0B00000010; break; case 8: // xxfedcba PORTC=0B00000000; PORTB&=(~(0B00000010)); break; case 9: // xxfedcba PORTC=0B00010000; PORTB&=(~(0B00000010)); break; } } void main() { uint8_t cmd; //Command received from remote Initialize(); while(1) { //Get Command For the Remote Control cmd=GetRemoteCmd(1); //Now process the command //UP Key if(cmd==RC_UP) { if(speed<9) speed++;
PDFmyURL.com
} //DOWN Key if(cmd==RC_DOWN) { if(speed>0) speed--; } //Enter Key if(cmd==RC_ENTER) { if(fan_on) { POWER_LED_OFF(); fan_on=0; //Turn Off } else { POWER_LED_ON(); fan_on=1; //Turn On } } Display(speed); } }
Not e: Other files that are part of the eXtreme NEC decoder must also be added to the project. They can be downloaded from links given below.
Downloads
Complete AVR Studio Project. HEX File For ATmega8-16PU Chip. A Compatible Remote Control is available from our shop. PCB Layout s in PDF,Microsoft Word and PNG Formats.
Buy Kit
PDFmyURL.com
Buy complete kit including PCB, Parts, Programmed MCU and Matching IR Remote Control Unit. You just need to buy a 12-0-12 Transformer of current rating 500ma or more because it is NOT included in the kit. Buy Remot e Cont rolled Fan Regulat or Kit .
Related Post
Using IR Remote Controls with AVR MCUs By Avinash Gupt a www.AvinashGupta.com me@avinashgupta.com
PDFmyURL.com