Title: Remote Control For Windows Media Player
1Remote Control For Windows Media Player
Jose Mayen Kavita Mahdu ECE 345 Spring 2001 TA
Jeffrey Cook
2Objective of Project
- To design a system that can perform the basic
functions done by Windows Media Player from a
universal remote control. - Functions Include Power On/Off, Play, Stop,
Pause, Skip, as well as other basic cd player
functions.
3Presentation Outline
- Design Overview
- Design Areas
- Hardware
- Software
- Testing
- Comments
4Project Overview
A universal remote control transmits an infrared
signal when a button is pressed.
The infrared signal is demodulated into a digital
signal. This digital signal is sampled by a
series of shift registers and counters in order
to obtain data that can be passed on to the
computer.
A Visual Basic program receives the data via the
serial port of the computer and interprets it.
It then simulates keystrokes or shortcuts that
the application uses in order to implement the
desired function.
5Hardware Design
- Functions Performed
- Receive IR signal and demodulate into usable
signal - Interpret signal and create data
- Repack and send data into RS-232 format in order
to be read onto the serial port
6Receiving the IR Signal
- The IR signal is received by a GPU152X chip
- This chip demodulates, amplifies, and cleans the
IR signal into a 5 V signal modulated at approx.
38 kHz
- Only problem occurs with ambient light
- Solve by creating a physical filter which
consists of a - black box placed over the receiver
7Interpreting the Signal and Creating Data
The basic idea is to count the time between
arriving rising edges in the demodulated signal.
A sharp narrow pulse is created by an R-C net
every time a rising edge is detected. This
pulse is to be used as a clear signal for the
other chips.
A counter chip does the counting. Before
clearing its registers on a clear command, it
passes an 8-bit count to a shift register. The
shift register sends the 8-bits to an RS-232 chip
and loads new values on a clear command.
8Repacking and Sending the Data to the Serial Port
The RS-232 chip receives the 8-bit counts and
changes the signal to one that the serial port
can receive
So after a button is pressed on the remote, the
serial port is fed with a string of 8-bit counts
that can be interpreted as Hex or Decimal at
the serial port
Example 209 252 226 209 209 223 239 209 Or E5
F5 D5 E2 E3 E3 E5 E5
9Data Analysis
- After looking at the values received on the
serial port with a program called Serial Watcher
we learned the following
Every time a button was pressed on the remote,
exactly 50 bytes were received at the serial port.
For every button pressed, the first 34 bytes
received were very close. Difference of /-
1. The last 16 bytes contained major differences
between buttons.
Example Stop Button 229 209 225 209 209 209
209 209 209 208 .. 209 209 208 209 209 209 226
225 226 226 Play Button 229 209 226 209 209 209
208 209 209 208 .. 209 209 209 209 209 225 226
209 225 226
Useful because we can find differences between
buttons according only to last 16 bytes so that
the software may distinguish between buttons.
10Hardware Testing
- The hardware was first simulated in Pspice.
- After obtaining a successful simulation the
circuit was built. - The output of the hardware was read by Serial
Watcher. - Main problem with the hardware was the clean
simulation of a clock used by the counter. - We were unsuccessful in creating a usable clock
signal, so we used a function generator to create
the clock pulse. - After testing the circuit with the function
generator we found that we obtained the best
performance when the generator emitted a pulse
that matched the serial speed of the port 19200
Hz
11Software Used
- Visual Basic 6.0
- Win 32 API (Application programmers Interface)
12Software Design
- Functions Performed
- Visual Basic Program is always running
- Receives data from the RS-232 chip through the
serial port following a receive interrupt - Stores data into a buffer
- Compares certain values in the string of numbers
to cases corresponding to each action - If a valid combination is received a key stroke
is simulated to perform an action
13Software Challenges
- Problems
- Initial Idea was to add code in the Media Player
applications code. - Right Protected.
- Solution
- Win 32 Interface to access short cut keys of the
application - Used Virtual Key Press on Keyboard created by
Visual Basic.
14Serial port
- Com1 of the Serial port reads the data.
- Reads 19200 bits per sec.
- Com1 stores data into integer value.
15Visual Basic
- MSComm is Visual Basics custom control for
serial communications. - MSComm offers better performance than other
methods of port access. - MSComm1 Configures speed, Input buffer size and
interrupt events. - Used MSComm1 to receive data from com1 in binary
format. - MSComm1 opens the serial port and stores the data
into the buffer as an array of 50 bytes. - Buffer gets created in Asynchronous format.
(8-N-1)
16Manipulation of Data
- The input from the serial port is placed into a
buffer - The last 16 bytes of the buffer will be used to
determine which button was pressed on the remote. - After analyzing the data we found differences in
the last 16 bytes for every button. - We then preset each buttons corresponding values
into the VB code. - The buffers last 16 bytes are then compared to
each different case, and if a valid combination
is received then an action is performed. If an
invalid string of bytes is received then the
buffer is cleared.
17Example of Data Manipulation
- Data received from serial port is (50 bytes)
- buffer 209 226 209 226 226 225..209 225
225 225 209 225 - If buffer (48) 209 Then
- If buffer(49)209 Then
- call power_on
- ElseIf buffer (48) 209 Then
- If buffer(49) 225 Then
- call play
- In this case the buffer does not agree with
the presets in power_on, so the presets for play
are compared. Since they do agree, play is
called. - The play command simulates a Virtual Key Press
on the keyboard so that the action is performed.
18Win 32 API
- Win 32 API is used to simulate key strokes.
- Used Keyboard event and Virtual key map functions
of user 32 library to simulate key strokes.
19Testing
- Tested the code before using it with the
hardware. - Wrote a separate code which transmitted preset
data in the same format as the hardware circuit
would. - Were successful in simulation.
- No problem in receiving the data by the code that
would be used.
20More Testing
- When we actually connected the hardware to the
software, initially we were only going to compare
two numbers from the buffer. - We found that sometimes the button pressed on the
remote was not actually the action that was
called. - We then decided to compare the last 16 bytes of
the buffer to the preset values. - We found that the software did not respond well
to that many If statements. - We were finally successful in comparing 5 bytes
of the buffer to the presets.
21Conclusion
- The project was successful in implementing all
the basic functions the Media Player performs. - Recommendations
- Obtaining a crystal oscillator to generate the
clock pulse used by the hardware - Using a better shielding device for ambient
light.