Вы находитесь на странице: 1из 9

[?

] Subscribe < To This Site

Universal Serial Infrared Receiver.


You can use this Universal Infrared Receiver (UIR) project to control your PC: Starting Windows programs, setting the Windows volume control, even moving the mouse around the screen!

Custom Search Sign up for MicroZine: ''The'' Microcontroller Newsletter

Home Forum Project Sponsored Links... Ideas All at the touch of a button - with your TV remote C Course control in fact! LCDKeys one port PIC Project s TIPS & Techni ques Learn about the tool used for creating this diagram. PIC Introdu ction It uses a PIC microcontroller to characterize the PIC Progra demodulated infrared signal and then transmit it as a serial data stream to the PC. mming Progra Software running on the PC recognizes data stream mmer for each key press (in fact the PC software has to Types learn the data stream for each key press) and activates the program (or event) that you specify. PIC Progra Since the software can learn each key press you mmer can use it with any remote control e.g. TV, video, DVD, satellite etc. Schem atic It's even good with multiple remotes so you could Tool use any one of a set of remotes to control the PC PIC

Name: E-Mail:

Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine

Enter your first Name and primary email address in the form above: And receive absolutely FREE a full project for:

"Measuring Analogue Voltages Without An ADC"


(Using only one pin). Instant Download: You Can Get It Right Now

Tutoria Warning: This project ls Specification for Serial Infrared could be Removed Digital receiver project. at any time. Downl oads Baud Rate 57600 Baud Store It will NOT be Clock Internal 8Mhz My available Secret Remove Control Any (Point any control at it and indefinitely SO let the PC software learn its Oscillo type To avoid codes). scopes disappointment About get it: Note: Some remote controls need two key presses Me Contact(if you press the same key) as they output an inverted key sequence for a repeated key. If you Now Me press a different key then it works as a normal Terms remote. of Use Search Serial Infrared receiver : Project Details Remember this is a project This with full description and Site Serial Infrared Receiver Project debugged C Source code Article Mikrolectronika C compiler V5.0.0.3 and it's not available from the s Compiler main website. Free! MicroB 16F88 (retargetable to other PICs You can only get it through log Target that have a built in USART). this newsletter. Books Software level Easy. Resour To get exclusive access Enter Software notes No special notes. ce your first name Name and Links Hardware level Easy. primary email address Now Site Hardware notes No special notes. in the form above.: Map Project version But wait ! Initial Release 1.00 Privacy Enter your details to get the There's more... Policy Download Link
and get the microcontroller newsletter:

Project files

You'll receive more Your Name: free and Primary E-Mail: exclusive (Note: Your email is safe it will never be sold reports as well or rented). You will get All the C source code as site and hex file. information and site product Essential C Programming Course: updates.
CLICK HERE.

Scroll up to the form above and sign up You can program the PIC in circuit through the ICSP NOW. Don't forget it's

connector. For a tutorial on compiling these files click here. You can recompile the serial Infrared receiver files to examine the operation of the code (using the built in simulator) or change the source code. The hex file is contained within the download.

FREE and if you don't like it you can unsubscribe at any time. Click Here Now to

use the form above to How the Serial Infrared receiver works get your Valuable information absolutely This project uses a standard Infrared detector free. module (one of those 3 pin devices) as the main
input. It's not worth making your own circuit up as it will not match the performance of a three pin demodulator module. I had a go using some circuits I found on the web and but these use a PIN diode and a high impedance amplifier e.g. LM3140 - but the circuits are actually light meters and saturate when a light shines on them (even desk lamp) - so they become insensitive to the IR light - the PIN diode reacts to any light source. You can get some use out of them up to about six feet but a lot of engineering has gone into the three pin modules so it really is worth using them and they are very cheap. Inside the module is a PIN diode, AGC circuit, band Readers comments pass filter, control logic and output detector. The datasheet specifies use from 15m (45ft) up to "I wanted to thank possibly 30m (90ft) max!. These are very good detectors that are also insensitive to sunlight (has a you so so so much physical filter over the PIN diode and the electronic for all the information you have provided in bandpass filter). your site it's

Social Bookmarking

Serial Infrared receiver


How the Serial Infrared receiver works.

SUPERB and FANTASTIC."

- Ranish Pottath

This project took longer than it should have and I "This site really is have ended up with a far smaller source code than the best and my favorite. my initial attempts! First off I used the capture I find here many useful facility in the CCP and the Timer1 timer to projects and tips." accurately measure each period of high and low decoded IR. This turned out to be too accurate! - Milan

bursach<at>gmail.com

IR signal codes decoding accuracy


Learn PIC C Now You don't need accuracy in this project - IR codes are designed not to need accurate measurement and if you attempt it slight variations in the edge positions or measuring accuracy cause the output numbers to change. Since the decoder software in the PC relies on a repeatable data stream (with slight variation) this method does not work.

Wondering how to program your next project using C and need a great start? "First Module Free:" CLICK HERE

IR signals are designed so that you can sample them but this requires that you know the code sequence (or encoding e.g. RC5) in advance so that you can time from the start sequence to the exact "Awesome site, middle of a bit position. very, very easy and nice to navigate!" Since this project allows you to use any remote control unit, the encoding sequence can not be - Matt matt_tr<at> known in advance, so the the solution is to sample wolf359.cjb.net the remote control sequence at a high frequency. The problem is that if you start decoding from the first rising edge then errors accumulate due to slight "I am a newbie to PIC variations in the remote control output (or the and I wanted to say how great your sampling edge occurs at the same time as an input site has been for me." transition) causing a random data stream output which can not reliably be decoded by the PC - Dave software.

IR decode solution

de_scott<at>bellsouth.net

Learn Microcontrollers The solution is to sample the input data starting "Interested in from each rising and falling edge where a bit Microcontrollers?" measurement period counter (period counter) is reset. At each sample point (here it is about 50us) the period counter is incremented. This gives Sign up for The a number that represents the period of each high or Free 7 day guide: low part of the signal. The 50us sample period is about ten times the expected signal period (IR codes generally use 500us minimum period) so this gives a good period measurement.

FREE GUIDE : CLICK HERE


"Your site is a great and perfect work. congratulations."

Note that the period counter is 8 bits long so that for long input sequences (high or low) the counter - Suresh wraps around - this does not matter since the period counter will always produce the same value for the same input sequence and this is what the PC integratredinfosys<at> yahoo.com decoder software is looking for.

RS232 Output

"I couldn't find the correct words to define yourweb site. At every signal transition the period counter value is sent to the RS232 interface so the value represents Very useful, uncovered, the number of 50us periods in the previous frame. honest and clear. The value sent is a raw binary number and you can not view it on a terminal such as hyperterminal as Thanks so much for you won't get a readable value. your time and works. To stop the sequence from generating RS232 data forever the counter value is monitored until it goes above 200. If at the same time the value of the input is zero then output stops and control is returned to waiting for the next interrupt i.e. the next remote control key press. Note: The internal USART takes about 30us to set up and it then goes off and transmits the byte by itself which at 57600 baud takes about 170us so there is plenty of time before the next transmission (500us IR code period). You could use a lower baud rate e.g 38400 which would still fit. If you used a baud rate such as 9600 then a byte would take ~1ms to transmit which would mean lost period data - it probably works as you would still get an indication of code periods but may not always work. Regards." - Anon

PC Software
The PC software used is PC Remote Control. As it does not require the use of the RX line on the USART. It is better for experimentation as it lets you generate TX data only and it does not check whether the microcontroller is active by querying the microcontroller (generating data to the Rx port of the microcontroller) i.e. you only have to generate TX data and not worry about RX data so it's easier. Some control programs won't proceed unless the microcontroller gives the correct response. You can find it here.

Testing
I have tested the infrared receiver and PC Remote

Control with the following remotes: JVC Thomson Philips Samsung Grundig Medion

These all worked fine - some you have to press the button twice as the code alternated for the same key. It expect it to work with just about any remote control as these represent a wide range of differing encoding schemes.

Serial Infrared receiver Hardware


Serial infrared remote receiver schematics. (click to open pdf)

Learn about the tool used for creating this diagram. The universal infrared receiver uses an IR decoder module (Note that there is no standard pinout and you have to check your version's pinout using its data sheet). There is nothing difficult about the circuit and it just consists of a PIC micro, an ICSP interface and an RS232 level translator.

Serial Infrared receiver Software


The software is contained in two files: Infrared Receiver Source Files 16F88-infrared-decoder.c

bit.h bit.h contains compiler independent bit manipulation macros. Infrared Receiver Project Files 16F88_Infrared_decoder.ppc Infrared Receiver Output files: 16F88_Infrared_decoder.hex

16F877A-Infrared-decoder.c
The only use for main( ) is to initialize the ports and interrupts - it then enters an infinite loop waiting for an interrupt. Input pin RB0 is used as an interrupt source and then polled. An interrupt for RB0 is setup to trigger when a rising edge occurs (probably should be falling edge as the decoded output is inverted - but it works as is!) When the interrupt occurs the routine sample_bits is called - Note this is within the interrupt so sample_bits becomes part of the interrupt routine itself. sample_bits() takes control and polls the RB0 input as described previously. It also returns control to the interrupt routine at an appropriate point; waiting for the next remote control key press. Jump from PIC Infrared Receiver to Best Microcontroller Projects Home Page.

Share this page: Don't forget to Sign Up for your Microcontroller Newsletter With "Essential tips and techniques", ..."New Site Info" and more...

Including a free project : How to drive an LCD and 12key keypad using "Only One 8 Bit Port" with no interface logic!...
(Works for any microcontrol ler)

This costs you : Nothing... Just fill out the form below and you'll get full C source code and project schematic and description .

Name: E-Mail:

Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine

Web

www.best-microcontroller-projects.com

<-- --> <-- -->

Вам также может понравиться