Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

Universal IR Remote Control

Description

Comments

Your project is really useful. but how can we dump the program in the arduino. Please provide me the step by step approach in using software.

 

thank you.

Can you upload code using ATMEGA?

Is TSOP is connected to Arduino ? Means is  it  a part of your project or it is universal part of any reciever?

 

Nice project

can you pls provide the list of components required clearly?

 

 sketch_may20a:30: error: unable to find numeric literal operator 'operator"" F1288A such type of problem is create during uploading plz help me out

 

How many air con support do you have in your code? 

YOU CAN UPLOAD YOUR CODE FOR PIC16F628A IN C PLZ 

/* 
 * File:   IR_remote _decoder
 * Author:  shams
 *controller: pic16f628a
 
************************************************************************/
 
// Global includes
#include <htc.h>
#include <Pic.h>
#define __PIC16f628A_H
//__CONFIG(WDTE_OFF  &PWRTE_OFF & LVP_OFF & BOREN_OFF);
__CONFIG( WDTE_OFF & PWRTE_OFF & MCLRE_OFF & CP_OFF & CPD_OFF & BOREN_OFF);
 
 
#define IRSENSOR PORTAbits.RA2 // IR PORT defination 
 
 
 
//#define TICKSPERMS  1004      // tick in a milli second 
#define TICKS11ms 11044       // ticks in 11ms
#define TICKS5o5ms 5522 // ticks in 5.5ms
#define TICKS2o3ms 2309 // ticks in 2.3ms
#define TICKS3ms   3012 // ticks in 3sm
#define TICKS0o2ms 200 // ticks in 0.2ms
#define TICKS8ms 8032 // Tick
 
unsigned int TIMEOUT  = TICKS11ms;       // the pulse should occur before this time excede Otherwise it is an error 
unsigned int PREPULSE = TICKS8ms; // the interrupt should occur after this time Otherwise it is an error
 
 
static unsigned short long timer; // varible to keep track of long timeouts  ( it can also be int if you want to save flash memory for some other purpose  ) 
static unsigned char dataready; // varible to use as flag when data is completly received and  ready it is 1 else 0 
 
static  unsigned char necpoj=0; /* (necpoj=NEC position )this varible is used to keep track of the edges of the input singal 
as decoding of the singal is done by a state machine 
so this varible acutalley sotores what state we currently are 
and total bits 32 and 2 leading pulse */
 
 
 unsigned char address=0,notaddress=0; // these varible are used to store received address
 unsigned char command=0,notcommand=0; // these varible are used to store received address
 
void interruptOnChangeIsr(void);   // interrupt service routine for interrupt on change of input port for IR sensor of mcu 
void timerInterruptIsr(void); // interrupt service rouine for timer0 
 
 
void interrupt t0intr(void)
{
if(INTCONbits.T0IF) // check the timer0 over flow interrupt flag 
{
timerInterruptIsr(); // timer0 overflow interrupt has been occur call the isr
INTCONbits.T0IF =0; // clear the timer0 interrupt flag
}
 
 
    
}
 
/* THE main source code Start here*/
 
 
void main() 
    TRISAbits.TRISA2=1; 
  PORTAbits.RA2 = 0;
                 //INTERRUPT ON CHANGE INPUT only RA2
    TRISB=0X00;
    PORTB=0X00;  
    PCON=0X08;             //SET INT OSC AT 4 MHZ
    CMCON=0x07; // disable the comparator 
TMR0 = 0; // clar the timer
OPTION_REG = 0x88; //pullups are disabled
//timer0 clock source is internal
//timer0 perscaller is 1:1 (disabled "assigned to WDT")
INTCONbits.T0IE = 1; // Timer0 overflow interrupt enable
INTCONbits.T0IF = 0;    // clar the timer0 intrrupt flags
INTCONbits.INTE = 1;   // external interrupt on RB0 pin is enabled
INTCONbits.RBIF = 0; // clear the external interrrupt flag
INTCONbits.PEIE = 1;    // peripheral intrrupt enable
INTCONbits.GIE = 1;     // GLOBL interrupt enable
  
 
 
while(1)       // wait forever for  the data received and ready  
{             
 
 
if(dataready=0) // data is received and ready to be procssed 
{
// key1  0x21 to Toggle relay 1 // these are command of the IR remote control which i have 
// key2  0xA1 to Toggle relay 2
// key3  0x61 to Toggle relay 3
// key4  0x80 to Toggle relay 4
        // key5  0x40 to Toggle relay 4
// key6  0x00 to Turn off all the relays
 
switch(command) // swich on 
{
case 0x21: PORTBbits.RB3=0;  // LED ON 
  break;
case 0xA1:PORTBbits.RB7 = 0; // LED ON
  break;
case 0x61: PORTBbits.RB4 =0; //LED ON
  break;
case 0x80: PORTBbits.RB5=0; //LED ON
  break;
        case 0x40:PORTBbits.RB1=0;   //LED ON
  break;
        case 0x00:PORTBbits.RB6=0;   //LED ON
                 
//  break;
default :
break;
}
 
 
INTCONbits.GIE = 1;   // Enable the interrupts 
dataready=0; // data has been processed so clear the dataready flag 
 
}
 
}
 
}
 
void interruptOnChangeIsr(void)
{
 
unsigned short long tdiff;       
unsigned char pin;
static unsigned long rxbuffer;
 
 
tdiff = ((timer<<8)+TMR0) ;     // calculate how much time has been passed since last interrupt 
// the time shold be less then time out and greater than PREPULSE 
pin = IRSENSOR; // store the current status of Sensor 
TMR0 = 0; // reset the timer0 to measure the next edge(interrupt) of input
timer = 0; // reset the timer varible to
 
 
if ((tdiff>PREPULSE) && (tdiff<TIMEOUT) ) // the edge (interrupt) occurrence time should be less then the TIMOUT and greater then PREPULESE else it is an fake singal
{ // At the very first edge (necpoj==0)  this conditon will always false and the false block of this if will bring the state machine (necpoj) to position 1(position 1 means 9ms leading pulse has started now we have to wait for 4.5ms start pulse to occur) 
 
if(necpoj==1 || necpoj==2) // when we are hear it means 9ms leding pulse has ended and now we are necpoj=1 or necpoj=2
{
 
if((pin==1) && (necpoj==1))
{
necpoj++;
TIMEOUT = TICKS5o5ms;   // timeout for 3rd pulse 5.5ms
PREPULSE   = TICKS3ms; // PREPULSE for 3rd pulse 3ms
}
else if((pin==0)&& (necpoj ==2))
{
necpoj++;
 
TIMEOUT = TICKS2o3ms;   // now data starts so timeout is 2.3ms
PREPULSE   = TICKS0o2ms;  
 
}
else // this block handle the conditon if any error occur after the completing the pre pulses 
{
necpoj = 0; //reset the state machine  
TIMEOUT =   TICKS11ms;
 
PREPULSE = TICKS8ms;
}
}
else if(necpoj>2) //now we are picking the data
{
 
necpoj++; //necpoj sill inrement on every edge
 
if(necpoj&0x01) // here we check the if necpoj is an odd number because when necpoj goes greater then 3 then 
    //necpoj will always be and odd value when a single bit tranmission is over  
{
rxbuffer=rxbuffer<<1; //shift the buffer 
if(tdiff>1250) //we are here means we just recevied the edge of finished tranmission of a bit 
// so if last edge was more than 1.24 ms then the bit which is just over is one else it is zero 
{
rxbuffer = rxbuffer | 0x1;
   
}
else
{
rxbuffer = rxbuffer |0x0;
  
}
 
}
 
if(necpoj >66) // we have reached (Leading pulse 2 +address 16+~address16+ command 16+ ~command 16+ last final burst first edge 1)=67th edge of the message frame means the date tranmission is now over 
{
 
address = (rxbuffer>>24)& 0xFF; //extract the data from the buffer 
notaddress = (rxbuffer>>16)& 0xFF;
command = (rxbuffer>>8) & 0xFF;
notcommand = (rxbuffer) & 0xFF;
rxbuffer=0; //clear the buffer
 
if((!(address & notaddress)) && (!(command & notcommand))) // check weather the received data is vaild or not
{
dataready =0;
               
}
else
{
dataready=1;
}
TIMEOUT =   TICKS11ms; // weather we received the vaild data or not we have to reset the state machine 
PREPULSE = TICKS8ms;
necpoj=0;
}
 
}
else 
{
 
TIMEOUT = TICKS11ms; // some error occured reset state machine 
PREPULSE = TICKS8ms;
}
 
 
 
 
}
else
{
 
if(pin==0) //we are here means that after a longtimeout or PREPULSE we just detect a pulse which may be the start of 9ms pulse 
{
necpoj = 1; // yes it could be the start of 9ms pulse 
}
else 
{
necpoj = 0; // no it's not start of 9ms pulse 
}
 
address = 0xFF;
notaddress = 0xFF;
command = 0xFF;
notcommand = 0xFF;
dataready = 0x000;
TIMEOUT =  TICKS11ms; //default timing  
PREPULSE = TICKS8ms;
}
 
}
 
void timerInterruptIsr(void)
{
if(timer<0xFFFF) // this code is to increment the variable timer's value on every over flow but this if conditon will prevent this variable form rollover when a long timeout occurs
timer++;
}
 
PLZ HLP THIS CODE FOR LOW LEVEL OUTPUT.
 

can you help to develop a program for rotating 2 geared motor withrespect to a tv remote ?

ic used is AT89C51 

 

Dear Deepesh if ur work over this, I required to make universal Remote receiver for some limited functions switch. If ur interested call me on 7840047550 or mail me [email protected].

can you do FIRMWARE for me - new URC TV REMOTE for aging and disabled

[email protected]