How to Communicate to the BX-24 with an Infrared (IR) Universal Remote Control and an IR detector.
|
|
Parts Needed:
|
|
How It Works:The Remote Control Sends out an Infrared Signal on a 40kHz carrier wave. The IR-Decoder receives the signal and strips out the 40Khz carrier wave. The IR Decoder then outputs the remaining serial data stream without a carrier to the BX-24 chip through a serial connection. Connecting the decoder to Pin 12 on the BX-24 is recommended, since this is the input capture pin. The data stream is then decoded through software on the BX to give you discrete numbers from the keys of the remote control. Getting discrete numbers for each key pressed from a remote is a little tricky. Each manufacturer uses a different encoding scheme to transmit information. Fortunately, there are some sample programs written from NetMedia that are in the examples folder that come with the BasicX Environment. There is also really good documentation on Infrared Serial Commmunication in the Application Notes section in the BasicX environment folder. I highly recommend reading it. The programs that come with the BasicX environment decode the infrared signal produced by the Universal Remote Control Programmed to VCR # 0048 and send the data to a computer through a serial connection on COM 1. The programs are:
The IR Detector rejects all sources that are not modulated at a 40kHz carrier. This cuts back on noise from background IR. The Detector operates on 5V and can be run from the power the BX-24 chip provides. |
|
Step By Step:
|
|
Some Things To Note:Most of the things below were stated above but I'll re-list the things that we felt were important or that cost us a lot of time to figure out.
I hope it all works. |
|
Part 2 - Now comes the fun part - futzing with code.There are actually two parts to the BX24 IR application note - IRcodes and bxserial. These should be in the "application notes" folder in the bx24 program folder. If they are not, you can download them from Nettmedia (http://www.basicx.com/). |
|
If you are making your application portable, both of these files need to be in the same folder.
The only one you need to touch will be IRcodes.
Remember that if you do a "save as" to create a new project, you may need to manually change the path in your bxp file. (Just open it in notepad and replace "ircodes" with your project name).
Most of the programming is dedicated to interpreting the strange timing of the IR demodulator.
The rest of it prints out the codes on your computer. There are two codes for each button.
The ITZA remote control will continue to send the codes if you hold down the buttons.
I can't vouch for any other remote controls. |
|
After you go through all the buttons and write down their codes
(do it yourself so you can't blame us if it doesn't work), you can comment out all the programming dealing with printing out codes. (By the way, there is no code for the volume button.
In case you were wondering.)
There is also a 1 second delay.
We reduced it down to 0.01 seconds and it worked fine. |
|
Because the code is a series of subroutines, it is easiest to call your own subroutine from within the existing programming and send it the value of the IR code.
We used a series of case statements to check the value of the codes
(2 codes per button) and then called other subroutines from within the case statements. |
|
Problems you may run into:
|
|
Other notes:If you just want to use a remote control as an On/Off, you don't need any of this fancy programming. Simply use getADC. The demodulator is normally high (+5 v), but dips low (apx. 0 v) when it transmits. |
|
Our CodeIf you'd like a reference you can download our code.You will also need the file SerialPort to be in the same project file as the file above. Just copy and paste the code into the BasicX Environment Editor. |
|
Good Luck! |
If you have any questions, don't hesitate to email us.
Sasha Harris-Cronin sasha@mortalspaces.com | Scott Wolynski swolynsk@hotmail.com |
Click here to return to Sasha's physical computing home page.
] mortalspaces [