You have already seen serial communication in Lab 2, but you will see it again here. This time, instead of sending the signal across a wire, we will send it through the air as modulated light.
Your task for this lab is to reverse engineer (hack) an IR remote control so you can get it to light up some LEDs for you. Unfortunately, IR remotes don’t really follow much of a standard, but they tend to operate similar to each other. We will exploit that to learn how they work.
WARNING: This lab has been around for a while, but I have changed it this semester. If I see your code looks like work from previous years, I will assume you are cheating and you will loose a lot of points. Depending on how bad it looks, it could result in an honor case.
You will need to use the timer interrupt and the general purpose pin interrupt to decode a remote control. Be sure to pick one remote for the whole lab, as remote codes vary between manufacturer.
This lab will be completed in 3 steps:
If you finish a day early, move on to the next day’s work
Please do the prelabs, they will help you meet the above deadlines
I will not check these, but you need to do them to stay on track.
Do Not Power Your Board When You Are Wiring It Up!
Insert the IR receiver module into the protoboard. Look at the datasheet and make sure you are wiring up the receiver module correctly. When you are looking at the sensor ball on your IR receiver module, the pin on the left is your signal pin; the pin in the middle is your ground pin; and the pin on the right is your Vcc.
Hook up your Launchpad to the IR module as shown in either picture:
On your MSP430, connect:
When hooking up to the logic analyzer, remember to connect the MSP430 ground to the logic analyzer ground. Also, hook the signal from the IR sensor to one of the POD1 inputs bits.
Following the picture above:
test3.c
and then download it onto your LaunchPad. Make sure to open the variables tab (View -> Variables).
The values in Timer0 are how long the signal was at zero for and the Timer1 was how long it was high for.
The logic analyzer should look sort of like the following:
WARNING: On my remote control, the full remote control signal was about 80ms. Please note that remote control data packets are not standardized, so the remote that you use to perform these experiment will almost certainly generate results different from those that your neighbor’s remote will generate.
Also, different remotes do different things. It appears remotes send the same command multiple times (~ x3). However, they do it differently.
The above remote sends one good packet and 2 empty packets immediately following one button press.
This remote however, appears to send 3 copies of the same button press.
Use the logic analyzer to measure the following information for your remote. Show your instructor these:
Pulse | Duration (ms) | Timer A counts |
---|---|---|
Start: logic 0 half pulse | ||
Start: logic 1 half pulse | ||
Data 1: logic 0 half pulse | ||
Data 1: logic 1 half pulse | ||
Data 0: logic 0 half pulse | ||
Data 0: logic 1 half pulse | ||
Stop: logic 0 half pulse | ||
Stop: logic 1 half pulse |
Connect your MSP430 back to the logic analyzer as you did during day 1. Now that you know the characteristics of your remote, we want to capture the packets now.
Write the codes (in hex) for at least 5 remote control buttons. Make sure you know both the button and the hex code. You should be able to identify the start of the message and from there identify the logic 0/1 half pulse.
Show your instructor the following table
Button | Button name | Hex code (not including start and stop bits) |
---|---|---|
1 | ||
2 | ||
3 | ||
4 | ||
5 |
Each of the above actions are independent. Do not hit multiple buttons at the same time or hit remote buttons to interrupt button 4 blinking lights.
For the IR remote data, you only need to detect the data’s logic high as either a 0
(should be short time) or a 1
(should be a long time)
irPacket
irPacket
After both rising/falling edge, clear the P2IFG
TAIFG
WARNING: This lab has been around and I have made changes to it. When I review your code, if I see code from the old way to do the lab you will receive 0 pts for your code. Please do not cheat.