on Sunday, 23 March 2014


Hello friends, I'm back with an amazing project. As name says we are going to control all  the home  appliances using TV remote. Before i have written on the similar project  here where  we have controlled only one load by TV remote, but if you want to control all the appliances of home then it wont work with that project...
So,I'm writing this post by which we can control all the home devices using Philips TV remote. We use Philips remote which works on RC5 protocol.
Without wasting time lets jump into the project....

Basic understanding:
We need to have basic understanding of few modules to design this project.Next thing is to write software code for it.
We are going to look at few important things how they work,like RC5 protocol, Relays, IR sensor,etc
Before going to this section, first we should have clear picture on aim of the project.

AIM: Our aim is to switch ON and OFF any of the home appliance by using Philips TV remote which works on RC5 protocol.

In general to do this, we need something called sensor to detect the IR pulses from TV remote and a relay to switch.
In general the output of Micro-controller gives 5v output but in order to switch ON any home device we require 230v AC , so to get this we use device 'Relay'. Relay acts as switch. Let’s have a look on it, i have explained in dept in my previouspost so i strongly recommend you to refer it for better understanding.
Now we need to look at how TV remote sends its pulses when a key is pressed. Only if we understand the protocol (set of rules) only then we can program for it better. As I said earlier we use Philips remote which works on RC5 protocol. Below are few model numbers of Philips remote which works on RC5 protocol.

List of model numbers of Philips remote which works on RC5 protocol:
Lot of remotes works on this protocol, better ask for RC7805 in your local market. In India we find lot of local brands which sell Philips universal remotes costs less than Rs. 120(china remotes ).

RC5 Protocol:
It is must to understand about this protocol in order to write code by our own. I will not relate this section with unnecessary topics.
when we press any key of remote it will transmit stream of pulses. Every remote have its own way of transmitting its pulses. So, let us look at our remote how it sends, what is the order of pulses and which part of stream of pulses we need to process.

Look at the above fig. the standard format of  stream of pulses have total of 14 pulses, in which
s1,s2                                = Start bits(always 1)
T                                      =Toggle bit(which changes for every time we press the key)
a0,a1,a2,a3                      = Address bits(for TV remote it have different address for VCR  
                                             remote it have different  address , so on.. we need not to worry about this)
c0,c1,c2,c3,c4,c5             = Command bits( each key will have different command, 
                                            we will recognise which key is pressed by using these bits)

RC5 uses machester coding. i.e to transmit logical zero(0) remote will transmit 10
and for transmitting logical one(1) then 01 will be transmitted..

****i.e for logical '1' low to high transition takes place, for zero high to low takes place.whole logical 1 or zero stands for 1778us i.e half 889us on either sides.. so if we want to check whether it is logical 1 or zero just if we check the 2nd part that's enough i.e for logical 1 second part is 1 and for zero second part is zero. As we use IR sensor like Tsop1738 or Tsop1736 their output is active low i.e whenever a pulse it detect it will give '0' output. so it acts as inverter i.e for logical 1 output from TSOP sensor will be 10 and for logical zero output will be 01. as we are using these sensors we need to check first half to know what actually the bit is, for '1' the first half will be '1' , for '0' first half will be '0'. look below fig.

>> Look at the below image for commands
e.g for key0 then command block  will be decimal 0, key1=decimal1, key2=decimal3,so on

How it works internally(Algorithm):
>>Once look at the  standard format  picture, below pulses are just the example it will change according to the button pressed.

we need not to worry about address bits i.e a0 to a3 , we just need the command bits c0 to c5. we don't know when the pulses arrive at the microcontroller, we cannot know when the user press the TV button, so we need to implement a hardware interrupt (int).
As we know that first two pulses we get are logical 1(s1,s0 always 1) , we know that logical 1 means 10 from the output of the tsop1738 sensor. so we set interrupt for high to low transition for the first pulse, when ever high to low occur an interrupt will be generated,by which we can know that TV button have been pressed.
>>Look at the below fig carefully and understand the given steps below

>>Remote will transmit data as long as the key is pressed,so to know actually person pressed the same key again we need to check T bit.
when ever a person presses a key, T bit will be flipped, for example suppose we pressed key '1' then T=01 and after some time again we press key '1' or any other key then T will be 10. for every key press it will be inverted.

Step by step procedure for programing:

>> we need to start an falling edge interrupt, when ever interrupt occur uc will know that data has been arrived and it has to be saved.Disable the interrupt.

>>As we need to take the first half portion transition from all,so we need to produce a delay of 1000us in order to take the first bit of 's2'

>> we need to produce the delay of 1778us in order to take the first bit of 'T' , again we need to produce the delay of 1778us in order to take the first bit of 'A4', again we need to produce the delay 1778us to jump to 'A5', in the same way we take all the bits.

delay_us(1000); //step2
  took[i]=portb.f0;//taking input from portb.f0 int0 pin
>> we took input in an array , so we need to convert it to a string of pulses to check command data
for(i=7;i<13;i++)//we are only taking from command bits
   took[i]=took[i]<<j; //left shift
   holdr=holdr|took[i];//or operation
>> Lets check which key has been pressed, and flip its output, i.e if we press once then it will be in ON state and if we press the same key again, then it will be in OFF state
if(holdr==1)portc.f0=~portc.f1;//if we pressed key 1, then portc pin 1 will be flipped
if(holdr==2)portc.f1=~portc.f2;//if we pressed key 2, then portc pin2 will be flipped
Note:Notice from above code, i dint took key 0 and key 3, because i'm getting little error for these keys, so i have took key 1,2,4,5,6, so on
>> when ever we press the key on remote and senses by the uc correctly then portc.f7 will be blinked
Circuit diagrams:POWER SUPPLY:As we are using 9v input battery , so we need to convert it to 5v using 7805 Ic.

Relay circuit:
(I use to write articles of 'dostmuhammad' website before)

Overall Circuit:

The general connections for pic are the same
i.e crystal oscillator between 13 and 14th pin, pin31=pin12=ground,pin11=pin32=pin1=vcc.

MikroC is one of the comprehensive software which have lot of inbuilt libraries. We need not to worry about writing code for general modules interfacing like Lcd's, keypad's, and many more.. so basic idea at C language is enough to code using MikroC compiler.
Now let us analyze the code, its very simple code.
*** We need to press the same key twice to  enable or disable  the corresponding pin. Rather than connecting directly relays to uc, just connect leds for the testing if we get appropriate result then connect relays.. I have tested this code on real hardware.
volatile char allow=0,i=0,holdr=0b00000000,took[15],toggl=2,intru=0;
 void interrupt()//ISR when interrupt occurs
     INTCON=0X0;delay_us(1000);//disable the interrupt and delay of 1000us
      for(i=0;i<13;i++)//taking input
      }allow=1;//allow flag to 1, indicating that we have received all data
void main()
 unsigned char j,dustbin;
 TRISB=0XFF;TRISC=0X0;//portb input and portc output
 delay_ms(2000);//stabilize the device 
 INTCON=0b10010000;//enable the interrupt int0
 INTCON2.INTEDG0=0;//for falling edge
      while(allow==0);//when allow flag is 0 then be in this loop for ever.
      if(took[1]!=toggl)//check the T bit i.e toggle bit with previous one.
                      //check the fist line of code,we assigned toggl as 2,
                      //if toggl==2 then take real T bit into it  
        for(i=7;i<13;i++)//convert array to variable for 
                             easy comparison with command
           took[i]=took[i]<<j ;
Special thx to GOD. 
Suggested by Ravi Teja by e-mail. 
Special thx to SHerzod bek from Uzbekistan for his support


Anonymous said...

nyce ....

Surajit said...

Did you have the Code foe NEC remote

madin said...

This is one of the best posts i have seen in buy Repliche Orologi a long time. thanks for posting it. while there are different grades of replicas,( some better than others) it is best to read the reviews from the owners on these boards to find out Svizzeri Repliche Orologi the real quality of a watch you are wanting to purchase. never listen to a seller just arbitrarily saying his product is grade 1 or AAA. he only wants your money.

preethi Shetty said...

Needed to compose one little word yet thanks for the suggestions that you are contributed here, really impressed very much with this blog and wanna read regularly to get more updates...
Best Online Software Training Institute | Java Training

Anonymous said...

Thanks for sharing
android training in chennai
aws training in chennai
dotnet training in chennai
informatica training in chennai
hadoop training in chennai
hadoop training in chennai
devops training in chennai
php training in chennai
salesforce developer training in chennai

zasi said...

Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

AWS Training in Velachery | Best AWS Course in Velachery,Chennai

Best AWS Training in Chennai | AWS Training Institutes |Chennai,Velachery

Amazon Web Services Training in Anna Nagar, Chennai |Best AWS Training in Anna Nagar, Chennai

Amazon Web Services Training in OMR , Chennai | Best AWS Training in OMR,Chennai

kiran mai said...

You really did a great job. I found your blog very interesting and very informative. I think your blog is great information source & I like your way of writing and explaining the topics.

Tekslate Online Trainings.

Divya M said...

I am really happy with your blog because your article is very unique and powerful for new reader.
Click here:
selenium training in chennai
selenium training in bangalore
selenium training in Pune
selenium training in pune
Selenium Online Training

Afiah B said...

This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolite festivity to pity. I appreciated what you ok extremely here.

Core Java interview questions and answers

Java training in Chennai | Java training in Tambaram

Java training in Chennai | Java training in Velachery

Java training in Chennai | Java training in Omr

Ram priya said...

Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me
Data Science training in rajaji nagar | Data Science Training in Bangalore
Data Science with Python training in chennai
Data Science training in electronic city
Data Science training in USA
Data science training in pune

sakthi said...

This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.

best rpa training in chennai
rpa training in chennai |
rpa online training
rpa course in bangalore
rpa training in pune
rpa interview questions and answers | blueprism interview questions and answers

thulasi ragini said...

I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.
python training institute in marathahalli
python training institute in btm
Python training course in Chennai

johnsy sai said...

Inspiring writings and I greatly admired what you have to say , I hope you continue to provide new ideas for us all and greetings success always for you..Keep update more information..
excel advanced excel training in bangalore | Devops Training in Chennai

sathya shri said...

Thank you for allowing me to read it, welcome to the next in a recent article. And thanks for sharing the nice article, keep posting or updating news article.
angularjs interview questions and answers

angularjs Training in bangalore

angularjs Training in bangalore

angularjs Training in chennai

automation anywhere online Training

mounika said...

Nice post..

python django training in BTM

python training centers in BTM

python scripting classes in BTM

python certification course in BTM

python training courses in BTM

python institutes in BTM

python training in btm

python course in btm

best python training institute in btm

Nadeem Malik said...

hello sir,
thanks for giving that type of information.
digital marketing company in delhi

Vikash Kumar said...

nice work keep it up thanks for sharing the knowledge.Thanks for sharing this type of information, it is so useful.
block adhesive manufacturer in delhi

Akash Thakur said...

Thanks for giving great kind of information. So useful and practical for me. Thanks for your excellent blog, nice work keep it up thanks for sharing the knowledge.
interior designer company in noida

Amase LED Lighting said...

Home Decor Wall Lights in delhi
Thanks for giving great kind of information. So useful and practical for me. Thanks for your excellent blog, nice work keep it up thanks for sharing the knowledge.

alex said...

Online casino is the best solution to money issues the best online casino with us come in and win.

Vikash Kumar said...

Thanks for sharing such an amazing blog. It is really helpful for me and I get my lots of solution with this blog. Thank you for sharing valuable information. Nice post. I enjoyed reading this post…
Painting Services in Delhi

مروة محمد said...

شركة تنظيف بالدمام

Anuj Zhik said...

I get my lots of solution with this blog. Thank you for sharing valuable information. Nice post. I enjoyed reading this post…
Love Problem Solution in Delhi

Sanvi said...

Very nice post here and thanks for it .I always like and such a super contents of these post.

CEH Training In Hyderbad

Pooja Rao said...

Rice Packaging Bags Manufacturers
Pouch Manufacturers

Pooja Rao said...

we have provide the best ppc service.
ppc services in gurgaon
website designing company in Gurgaon
PPC company in Noida

Pooja Rao said...

we have provide the best fridge repair service.
fridge repair in faridabad
Bosch Fridge Repair in Faridabad
Godrej Fridge Repair in Faridabad
Haier Fridge Repair in Faridabad
Videocon Fridge Repair in Faridabad

Pooja Rao said...

Bali Honeymoon Packages From Delhi
Bali Honeymoon Packages From Chennai
Hong Kong Packages From Delhi
Europe Packages from Delhi
Bali Honeymoon Packages From Bangalore
Bali Honeymoon Packages From Mumbai

Belago said...

Гибкая світлодіодна лента лучшая на рынке, я обычно покупа в Экодио, лучше не найти.

cynthia williams said...

Amazing blog with the latest information. Your blog helps me to improve myself in many ways. Looking forward for more like this.
RPA Training in Chennai
RPA course in Chennai
Blue Prism Training Chennai
Blue Prism Training in Anna Nagar
UiPath Training in Chennai
RPA Training in Velachery
UiPath Training in Chennai
RPA course in Chennai

شركة المثالي سوبر للخدمات المنزلية 0550171619 said...

شركة تسليك مجارى بالدمام
شركة تنظيف بالدمام
شركة تركيب كهرباء بالدمام

شركة تمديد و صيانة برك مسابح بالدمام

IELTS Coaching in Dwarka said...

I feel happy about and learning more about this topic. keep sharing your information regularly for my future reference. This content creates new hope and inspiration within me. Thanks for sharing an article like this. the information which you have provided is better than another blog.
Best IELTS Coaching in Dwarka sector 12

creative web solution said...

such a nice post thanks for sharing this with us really so impressible and attractive post
are you searching for a caterers service provider in Delhi or near you then contact us and get all info and also get best offers and off on pre booking

caterers services sector 29 gurgaon
caterers services in west Delhi
event organizers rajouri garden
wedding planners in Punjabi bagh
party organizers in west Delhi
party organizers Dlf -phase-1
wedding planners Dlf phase-1
wedding planners Dlf phase-2
event organizers  Dlf phase-3
caterers services Dlf phase-4
caterers services Dlf phase-5

creative web solution said...

Alleyaaircool is the one of the best home appliances repair canter in all over Delhi we deals in repairing window ac, Split ac , fridge , microwave, washing machine, water cooler, RO and more other home appliances in cheap rates

Window AC Repair in vaishali
Split AC Repair in indirapuram
Fridge Repair in kaushambi
Microwave Repair in patparganj
Washing Machine Repair in vasundhara
Water Cooler Repair in indirapuram
RO Service AMC in vasundhara
Any Cooling System in vaishali
Window AC Repair in indirapuram

venkatesh@CS said...

Very useful tutorials and very easy to understand. Thank you so much for sharing.
hadoop interview questions
Hadoop interview questions for experienced
Hadoop interview questions for freshers
top 100 hadoop interview questions
frequently asked hadoop interview questions
hadoop interview questions and answers for freshers
hadoop interview questions and answers pdf
hadoop interview questions and answers
hadoop interview questions and answers for experienced
hadoop interview questions and answers for testers
hadoop interview questions and answers pdf download
hadoop interview questions pdf

Pardeep Mengi said...

Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job Man,Keep it up.
Study in New Zealand

Post a Comment