Saturday, February 6, 2016

Creating my own TV Tuner IR remote with a PIC16F684

While I was home this winter, I saw that the remote for our TV tuner was damaged physically, causing the buttons to not function responsively. Some of them just didn't work. I saw this as an opportunity for a fun couple days' project to build a new remote controller for the tuner.

The TV tuner was manufactured by a brand name RealView and, as expected, I couldn't find much detail about it. Thus, I had to reverse engineer the remote. From my previous experience in working with IR remotes, I had a hunch that the IR was most likely modulated at ~38kHz or ~56kHz. For those of you who don't know how this works, I highly recommend going through this website:

Thus, I connected a 38kHz IR receiver I had at home (TSOP1738) to an oscilloscope in order to figure out what IR protocol is used by the remote. Upon pressing the 4 key on the remote, I saw the following waveform:

Fig. 1: Oscilloscope waveform capture of the received IR signal

Note that I inverted the signal on the oscilloscope since the IR receiver output is active-low.

I then compared the waveform to some of the common IR protocols, paying particular attention to the initial first high and low states. After going through SIRC, RC5, RC6 among others, I noticed that this matched the NEC protocol:

Fig. 2: Standard NEC IR protocol pulse train

Fig. 3: NEC IR protocol logic high and logic low signals

Using the waveform shown above, I found that ~address was not being sent, meaning that the extended NEC protocol was being used:

Fig. 4: Extended NEC IR protocol pulse train

From the waveform, I found that the address was 0xBD02. I then proceeded to make a simple decoder with a PIC16F877A since I had a development board with an IR sensor mounted on it. Using this, I found all the required commands for the different keys of the remote. I decided to exclude some of the keys that were never used (eg play, pause, stop, fast forward, rewind).
You can find this part of the project here:

This left me with the following keys and commands:


I then proceeded to write an IR transmitter using the PIC16F684 (using the MPLAB X IDE and XC8 compiler), following the timing information from the extended NEC protocol. In order to connect all the keys, I connected them in matrix keypad form.

In order to power the remote off 2xAA batteries, it is necessary to use sleep mode - otherwise the battery will be drained extremely quickly. So, in order to detect when a button is pressed, an interrupt is used. After the IR command is sent, the microcontroller goes to sleep. The interrupt wakes up the microcontroller when a button is pressed. Debouncing is achieved using simple software delays. When a button is held down, the NEC command repeat sequence is not sent. Instead, the remote relies on releasing the button and pressing it again.

To minimize leakage current through the input capacitor, I decided not to use an electrolytic capacitor. A red LED illuminates to confirm that a button has been pressed.

 Fig. 5: Schematic of IR remote design

Everything was put together, a PCB was designed and when tested with the TV tuner, everything worked as expected! I measured the sleep current with a portable DMM and it was read as 1.6μA! I'm not sure how accurate the DMM is at such low currents, so I wouldn't entirely trust this number - however, it does seem to be within spec for the PIC16F684.

Due to a lack of time, I had to put the remote together with electric tape! Here you can see pictures of the final design:

Fig. 6: Final IR remote, top

 Fig. 7: Final IR remote, bottom

I am back at college now, but I have been told that the same set of batteries are still working on the remote, and it is working perfectly fine!

You can find the MPLABX project, source code, schematic and pcb files all here:

Let me know what you think! If you have any questions, let me know in the comments section!


  1. Salam Tahmid, your fan from Karachi, Pakistan here. Ill be really thankful if you could share Proteus model for SG3525 PWM controller with me.

    Thank You.

  2. Hello Tahmid ... i have been read all your writtings ... and i like to ask you a questions ... can i have your email address or maybe a facebook contact so i can contact you... please i need you to fix my problem.. thanks..

  3. Hello Tahmid ... i have been read all your writtings ... and i like to ask you a questions ... can i have your email address or maybe a facebook contact so i can contact you... please i need you to fix my problem.. thanks..

  4. Hi! Tahmid! Needed ur help with the single phase inverter! Using microcontroller!ATMEGA16/32. Gone through! Your articles! Very helpful!. please provide the schematic and pcb files!!..plzz mail at! Or upload it!..would be so helpful!..thank you!!

  5. Is 250W flyback converter practical?

  6. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it. What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity..

    Digital marketing company in Chennai

  7. It is really a great and useful piece of info. I’m glad that you shared this helpful info with us. Please keep us informed like this. Thank you for sharing.

    Digital marketing company in Chennai

  8. #define tx RA2_bit

    void Init_Timer1(){
    TMR1H = 0xfc;
    TMR1L = 0x18;
    T1CON = 0x01;
    INTCON.PEIE = 1; // Bit6 Enable Peripheral interrupts
    INTCON.RAIE = 1;
    PIE1.TMR1IE = 1; // Timer1 interrupt enabled
    PIR1.TMR1IF = 0; // Timer1 interrupt Flag cleared
    INTCON.GIE = 1;


    void interrupt() {

    tx =1;
    TMR1H = 0xfc;
    TMR1L = 0x18;
    T1CON.TMR1ON = 1; //start timer1
    //TMR1IE_bit = 1; //enable timer 1 interrupt

    if (TMR1IF_bit)
    tx = 0;
    //tx = 1;
    T1CON.TMR1ON = 0; //stop timer1
    INTCON.INTE = 1;
    TMR1IE_bit = 1; //enable timer 1 interrupt



    void main() {
    CMCON = 7; // disable comparator
    ANSEL = 0; // disable analogue
    TRISA = 0x18; // IR b0 = input, rest output
    TRISC = 0x01;
    TRISA.F4 = 1;

    //if(RA4_bit==1)tx=1;else tx=0;


    please help me ,

  9. Tahmid, best wishes for you. Can you suggest me the place or shop for PCB making in Dhaka. thanks in advance.

  10. ASK2projects provides best final year IEEE projects for Engineering/Diploma students particularly for EEE, E&I, ECE department students. We are the best IEEE Projects Center in Chennai.
    IEEE Projects in Chennai
    IEEE Projects Center in Chennai

  11. Hi,

    Can you please tell me how to read datas from CCP1 Pin.
    Similar to your IR remote project. I want to read the external signal as same as IR signal which is shown in CRO screenshot.


  12. Nice Electronic circuit images are there in this blog.DHgate Coupon

  13. Wow! What a nice image of the circuit are

  14. This comment has been removed by the author.

  15. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    Dissertation Writing Services

  16. I enjoyed over read your blog post. Your blog have nice information,
    I got good ideas from this amazing blog.

  17. Hi, It's a nice post and very thankful to you for sharing me a great post and informative knowledge.

    Indo American Health is providing Medical Tourism in India at very cheap rates that you can’t even have imagined.

  18. GlucoChem.
    Are you looking for a cereal derivatives provider? Look no further for Shafi Gluco Chem is what you need. Specializing in rice and tapioca ingredients, among many others, our portfolio comprises of Gluten-free, Non-GMO, Vegan, Fructose-free, Kosher, and Halal products. Click here to get in touch with us now.
    <a href=" augmentation</a>

  19. There is noticeably a bundle to know about this. I assume you made certain nice points in features also. WebHostingDubai

  20. Nice and interesting post,I appreciate your hard work,keep uploading more, Thank you for sharing valuable information.

    You can anytime plan your Plastic Surgery In India with Healguru India Pvt. Ltd. as we have a network of hospitals to serve the best possible treatment. We will provide assistance throughout your journey, begin it now with us.

  21. Searching for an experienced and trustworthy Nutritionist In Dubai is no less than a task. Diets & More is a one-stop solution for your search and I, Shreya Katyal, will help you in forming a diet plan that will give you all the required nutrients and help you in staying fit. Call me to discuss your requirements.

  22. I read your article and it’s helped me a lot, thank you so much for share this wonderful article.

    Buy Men Loafers Online at the best price only at Sartojiva. We provide the best in class fitting for your feet. Select from our exclusive range of loafers directly from the website, we assure you that the quality, design and price, nothing will leave you disappointed.

  23. Great blog it’s useful for me, I am enjoy to read this, keep share like this type of helpful information.

    To get yourself diagnosed the right way, you should reach the right destination and platform. Arun Imaging is an Imaging Centre In Delhi loaded with the right equipment and have experts to serve the best assistance during imaging.

  24. Very Interesting read. As i go through the article i just kept reading it.
    odzyskiwanie danych

  25. Good and very useful article. Thank you very much!

  26. I will recommend anyone looking for Business loan to Le_Meridian they helped me with Four Million USD loan to startup my Quilting business and it's was fast When obtaining a loan from them it was surprising at how easy they were to work with. They can finance up to the amount of $500,000,000.000 (Five Hundred Million Dollars) in any region of the world as long as there 1.9% ROI can be guaranteed on the projects.The process was fast and secure. It was definitely a positive experience.Avoid scammers on here and contact Le_Meridian Funding Service On. / WhatsApp...+ 19893943740. if you looking for business loan.

  27. Ayo Raih Kesempatan Mendapatkan Uang Ratusan Juta Rupiah... Bandar Sabung Ayam Online Terbesar dan Terpercaya di indonesia, Kunjungi Website Kami Di Disini dan Dapatkan Juga Promo Bonus Natal dan Tahun Baru untuk mendapatkan akun Sabung Ayam anda.
    Hubungi kami di WA: +62-812-2222-995 & Telegram : @bolavitacc

  28. Am reușit să-mi iau soțul cu ajutorul unui doctor vrăjitor numit dr Ajayi când am descoperit că a fost fermecat de o altă femeie, am fost foarte fericit că am contactat casta de vrăjitoare pentru că el este motivul pentru care am reușit să-mi câștig înapoi soțul. și acum trăim în pace. Luați legătura cu dr Ajayi pentru toate lucrările dvs. de vrajă, el m-a ajutat să-mi revin husand, cred că vă va ajuta cu ceea ce vă deranjează. E-mail: sau whatsapp: +2347084887094.

  29. If you are stuck with your Management assignment then in this case you can opt for our Management Assignment. we provide the bestOnline marketing expert.We also provideSupply chain Management for students across the globe. for more information contact us +16692714848.

  30. Hello Tahmid
    I've used a pair PIC16F684 & TSOP1838 for purport infrared remote control the light On/Off, But it's not work.
    Can you show me using PIC16F684 circuit diagram
    I'm looking forward your answer
    Thank's much
    Best regards

  31. Gangaur Realtech is a professionally overseen association having some expertise in land administrations where coordinated administrations are given by experts to its customers looking for expanded an incentive by owning, involving or putting resources into land. usb cord

  32. Yuk baca artikel tentang kopi yang lagi viral Dalgona!!!

  33. Boughts supplies replacement parts for general consumer electronics like TV Remote and other TV accessories. Boughts has a wide range of Original TV Stands for all Brands of Televisions. Visit our website ( to place your order.

  34. dear friend, can you design a automatic hand sanitizer using ultrasonic sensor

  35. Божественно волшебныеи к тому же невероятно точнейшие онлайн гадания для предречения вашего ближайшего будущего: это исключительно то, что поразит тебя на сайте гаданий. Гадание на трех картах, на будущее оказывается действенным быстрым и действенным вариантом для получения нужных данных из ментального поля Земли.

  36. Thanks For sharing your valuable information!!!
    dear friends get a good solution/.
    Dubai VPS Server

  37. Buna ziua, eu sunt Allison Howarts Dupa ce am fost în rela?ie cu Anderson ani de zile, s-a despar?it de mine, am facut tot posibilul sa-l aduc înapoi, dar totul a fost în zadar, l-am dorit atât de mult din cauza iubirii pe care o am pentru el, L-am implorat cu tot, am facut promisiuni, dar el a refuzat. I-am explicat problema mea prietenului meu ?i ea mi-a sugerat ca ar trebui sa contactez mai degraba o caseta de vraja care m-ar putea ajuta sa arunc o vraja pentru a-l readuce, dar eu sunt tipul care nu a crezut niciodata în vraja, nu am avut de ales decât sa-l încerc, eu i-a trimis caseta vraja ?i mi-a spus ca nu este nicio problema ca totul va fi bine înainte de trei zile, ca fostul meu se va întoarce la mine înainte de trei zile, a aruncat vraja ?i surprinzator în a doua zi, era în jurul orei 16.00. Fostul meu m-a sunat, am fost atât de surprins, am raspuns la apel ?i tot ce a spus a fost ca îi pare atât de rau pentru tot ce s-a întâmplat, încât a vrut sa ma întorc la el, încât ma iube?te atât de mult. Eram atât de fericit ?i m-am dus la el încât a?a am început sa traim din nou ferici?i împreuna. De atunci, mi-am facut promisiune ca oricine ?tiu ca are o problema de rela?ie, a? fi de ajutor unei astfel de persoane, referindu-l la ea singura casa de vraji reala ?i puternica care m-a ajutat cu propria mea problema. e-mail: pute?i sa-i trimite?i un e-mail daca ave?i nevoie de asisten?a sa în rela?ia dvs. sau în orice alt caz sau WhatsApp, la +2348069032895
    1) Vraji de dragoste
    2) Vraji de dragoste pierdute
    3) Vraji de divor?
    4) Vraji de casatorie
    5) Vraja de legare.
    6) Vraji de rupere
    7) Alunga un iubit trecut
    8.) Dori?i sa va promova?i în vraja dvs. de birou / Loterie
    9) dori?i sa va satisface?i iubitul
    Contacta?i acest om grozav daca ave?i vreo problema pentru o solu?ie de durata

  38. Are you looking for where to buy hemp oil in Australia? Visit Ricks Hemp Oil store to choose from a premium organic range of hemp seed oil products today!

    cbd stands for
    cbd oil near me
    medical marijuanas oil

  39. Hey, What's up, I'm Abhishek. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link. Best astrology app
    Astro guru online
    Best astrologer
    Talk to astrologer
    Best astrologer
    Online pandit
    Online astrologer in delhi NCR

  40. Hey, What's up, I'm Abhishek. I'm an application developer living in Noida, INDIA. I am a fan of technology. I'm also interested in programming and web development. You can download my app with a click on the link. Best astrology app
    Astro guru online
    Best astrologer
    Talk to astrologer
    Best astrologer
    Online pandit
    Online astrologer in delhi NCR

  41. Очень потрясающиеи к тому же поразительно правдивые онлайн гадания для уточнении загадывания вашего дня грядущего, это именно то, что вы увидите на портале гаданий. Точное гадание на отношения оказывается самым доступным и действенным вариантом для извлечения необходимых данных из эмпирического поля планеты Земля.

  42. Astogurutips is the top best Online Astrology website in India with more than 500+ astrologer on the portal. He gives a Best Astrology solutions from the Best Astrologers . You can connect with our astrologer through call or chat and ask you any question about your carrier, health, future, love partner etc. Talk to astrologer

  43. Astogurutips is the top best Online Astrology website in India with more than 500+ astrologer on the portal. He gives a Best Astrology solutions from the Best Astrologers . You can connect with our astrologer through call or chat and ask you any question about your carrier, health, future, love partner etc. Talk to astrologer

  44. Невероятное изобилие игр выходит ежеквартально. Особо доступным способом заполучить любимую игрушку считается игры на русском языке скачать торрент. Быть знатоком в элементах стационарных игр не так легко в результате достаточного их богатства. Скачивая игрушки с треккера вы получите больший уровень надежности. Мошенники сумеют использовать неопытность юзеров и раздавать спам-программы. Загрузка торрента считается легкой процедурой, терпимой как минимум для юных посетителей.

  45. Thank you for the helpful article. And I recently launched a new website, an online audio Converter You can use my Youtube 2 mp3 Converter to download any track to your iPhone.

  46. Большое количество игр изготавливается ежеквартально. Самым популярным путем получить долгожданную игрушку представляется Разбираться в поджанрах ПС игр не так просто по факту многочисленного их многообразия. Скачивая игры с треккера вы получаете достаточный уровень безопасности. Жулики могут использовать наивность заказчиков и распространять вирусы. Загрузка Torrent оказывается ничем не примечательной процедурой, понятной даже для молодых юзеров.

  47. На платформе мп3смак.ру есть все что нужно – новинки музыки 2020 бесплатно самые свежие. На земле есть огромное количество мп3 на любой смак. Только лишь свежаки текущего периода в невероятно высоком формате. Отыщите популярную подборку для путешествия на работу или увлекательной вечеринки. Какую угодно музыку, выложенную на данной платформе, запросто слушать полностью без оплаты. – новейший уникальный мп3 сайт, какой позволит отыскать нужное в считанные секунды.

  48. Каждый стремится знать собственную судьбу и представляет определенные варианты предсказания судьбы наиболее результативными. Гадание на любимого человека - вариант понять предстоящие события всегда привлекал род людской. Ворожба позволяет понять, что вас ожидает в предстоящее время.

  49. Широкий число строительных принадлежностей для коммунальной сферы. Чуть ниже представлены центральные приоритеты коммуникации с этой компанией. Получайте максимальные выгоды исключительно тут