ECE511 Group11 Final Report 20131213...
-
Upload
dinhkhuong -
Category
Documents
-
view
212 -
download
0
Transcript of ECE511 Group11 Final Report 20131213...
MP3 Boombox
ECE 511 PROJECT GROUP 11
12/03/2013
CARLOS R ARAUJO
BRIAN D JARVIS
SHAWN WILKINSON
DIVYA CHINTHALAPURI
LEEGIA S JACOB
1
Abstract For this project, the motivation was to create a product which would entertain the user. The group voted and an
MP3 player was selected. The goals were to create a player which would maximize the utilization of the MSP430
while at the same time be fun and intuitive to use. With five team members, it was important to derive five high
level features which would comprise the project such that each person had a decent amount of responsibility. In
the end, the MP3 player was a success. Featuring an LCD display, wireless remote, graphical VU meter, RGB led
light show, and MP3 playback, it is a wonder that a single MSP430 is controlling the entire device.
Contents Abstract ......................................................................................................................................................................... 1
Motivation ..................................................................................................................................................................... 2
Solution .......................................................................................................................................................................... 2
Components .................................................................................................................................................................. 2
MP3 Trigger ............................................................................................................................................................... 2
Hardware Interface ................................................................................................................................................ 3
Software Interface ................................................................................................................................................. 3
EQ Filter ..................................................................................................................................................................... 3
Hardware Interface ................................................................................................................................................ 3
Software Interface ................................................................................................................................................. 4
Liquid Crystal Display ................................................................................................................................................. 4
Hardware Interface ................................................................................................................................................ 4
Software Interface ................................................................................................................................................. 5
Infrared Remote and Infrared Receiver Breakout ..................................................................................................... 5
Hardware Interface ................................................................................................................................................ 5
Software Interface ................................................................................................................................................. 6
RGB LED Lighting Effects ............................................................................................................................................ 6
Hardware Interface ................................................................................................................................................ 6
Software Interface ................................................................................................................................................. 6
Results ........................................................................................................................................................................... 7
Lessons Learned ......................................................................................................................................................... 7
Achievements ............................................................................................................................................................ 7
Shortcomings ............................................................................................................................................................. 7
Conclusion ................................................................................................................................................................. 7
Appendix A: Team Member Tasking .............................................................................................................................. 8
Appendix B: Parts List .................................................................................................................................................... 8
Appendix C: Schematic .................................................................................................................................................. 9
2
Motivation The team wanted to create a project which would be challenging and utilize every resource of the MSP430 while at
the same time being fun and entertaining to use. An MP3 player fit these requirements and was voted as the best
project for the team to pursue. However it was soon discovered that there was a dilemma. Decoding the MP3
format requires more processing power than the MSP430 can provide. However the dedicated MP3 decoder
boards available on the market go too far in the opposite direction, performing most MP3 player functionality by
itself. In order to ensure the project was challenging and sufficiently demanding for each team member, features
were added which would utilize as much of the MSP430 as possible.
Solution One of the key goals for the MP3 project was to maximize the resources available in the MSP430. To do this,
features were added which would utilize each available peripheral on the microcontroller. The MP3 player
features an LCD display, wireless remote, graphical VU meter, RGB led light show, and MP3 playback. These
components are implemented according to the block diagram below.
Figure 1 : MP3 Player High Level Block Diagram
In this diagram it is important to note that the MSP430 is the central controller of each external component. As
such, the software for each component was developed keeping in mind that it must coexist and share resources
with four other major components. Each of the major components are described in the sections that follow.
Components
MP3 Trigger The MP3 Trigger is the device that was selected to provide the MP3 decoding function for our project. The MP3
Trigger has 18 external input pads that when activated can trigger preselected tracks stored in an onboard micro
SD card. Furthermore, the board has a full duplex serial port that provides full transport control and remote
triggering for up to 255 tracks. The micro SD card used for MP3 storage can be formatted using a FAT 16 or FAT 32
file system from a Windows machine. At the heart of the MP3 Trigger board is a Cypress CY8C29466-24SXI 16bit
microcontroller which serves MP3 data to an onboard VS1063 audio codec IC.
The MP3 Trigger can recognize a number of commands that it receives through the serial port. We are using a
subset of the available commands to control the device, enumerated below:
• Play/Stop
3
• Next Track
• Previous Track
• Volume Up
• Volume Down
In response to the above commands and other functions the MP3 trigger will provide limited feedback to the
controlling device, the MSP430. The feedback is in the form of a single 8 bit ASCII character.
MP3 Trigger Feedback:
• ‘x’ acknowledges a command execution
• ‘X’ indicates end of current track
• ‘E’ error code
Hardware Interface In an effort to save pins for the other components that were integrated to the MSP430, we decided to use the
UART to control the MP3 Trigger. The UART is multiplexed with some other internal modules in the MSP430 on
P1.1 (RXD) and P1.2 (TXD). The MP3 Trigger TXD was connected to the MSP430 RXD, and the MP3 Trigger RXD to
the MSP430 TXD to achieve full duplex communication.
Software Interface For the software part 4 files were created: one source and header file to support the MP3 control and another
source and header pair for the UART control. In the UART implementation there is an initialization file that sets all
the internal registers for the UART operation. The baud rate was set to 9600 with no parity check, and one bit
start and stop. Other functions were also created to receive/transmit a single character or a series of characters
until the new line characters was received.
The MP3 implementation has functions to control the MP3 player using some of the UART functions for single
character transmission and reception. There are two main functions in the MP3 implementation file,
MP3_sendCommad and MP3_readStatus. These two functions are called from the main loop after checking two
flags which dictate whether MP3 actions are needed. One flag indicates the latest command received by the
remote and the other indicates whether a character was received on the UART; the flags are checked before calling
the two main functions to save processor time.
EQ Filter A feature of the MP3 player is that it analyzes the audio signal being player and displays the signal levels in the
form of a graphical VU meter on the LCD screen. This is accomplished with an MSGEQ7 IC. This chip takes the left
and right channels as input, performs filtering and level detection in seven frequency bands, and outputs the level
of each band as a voltage level on its analog output pin. To represent seven frequency bands on one pin the
output is multiplexed, driven by two pins for reset and strobe from the MSP430.
Hardware Interface Three GPIO pins from the MSP430 are used to interface to the MSGEQ7 chip. Two are configured as port outputs:
one for the reset pin and the other for the strobe pin. The third pin is configured as an input to the ADC module of
the MSP430. Electrically, the MSGEQ7 has five additional pins which must be connected according to the diagram
below.
4
Figure 2: MSGEQ7 Graphical Equalizer Circuit
The additional circuitry requirements depicted above allow the chip to perform its filtering and level detection
which ultimately lead to the signal level representations output to the MSP430.
Software Interface The software to control the MSGEQ7 is split into three sections: Timer Interrupt, ADC Interrupt, and Main Loop.
Timer
One of the timer modules is configured for use in controlling the MSGEQ7. The timer is configured to operate in
incrementing count-up mode. The timer interrupt is enabled and configured to interrupt every 72 microseconds.
Inside the timer interrupt service routine, the MSGEQ7 reset and strobe lines are managed. Additionally, the timer
ISR kicks off analog to digital conversion of the MSGEQ7 output according to datasheet timing requirements.
Analog to Digital Converter
The ADC module is configured for use reading the MSGEQ7 output values and digitizing them. The ADC is
configured to use the VCC and Ground as reference voltages. The ADC interrupt is enabled and set to only convert
values when commanded to do so (i.e. not continuous conversion mode). Inside the ADC ISR, the latest converted
value is simply saved into a global array which can be accessed by other portions of the software.
Main Loop
As part of the main loop of the MP3 player software, the graphical VU meter levels are updated according to the
values read from the MSGEQ7 chip. Once the Timer and ADC interrupts are properly running as described above,
an array of seven frequency band levels is updated regularly and much faster than the main loop executes. As a
result, each time the main loop iterates, new values are available in the frequency level array. At this point the
levels are written to the LCD display as a graphical representation of the playing audio signal levels.
Liquid Crystal Display A 16x2 LCD panel is used in this project as the central information display. The two significant roles of the LCD in
this project are given below.
1. Display the song title and artist: The LCD should display the song title and the artist information on the
top row of the screen while the song is being played
2. Display the VU Meter frequency levels: The LCD should display the VU meter on the bottom row of the
screen while the song is being played. The output from the MSGEQ7 ADC conversion is used to draw one
of eight custom characters representing different signal levels for each frequency band.
Hardware Interface The LCD is interfaced with the MSP430 chip using GPIO pins. Four pins are used for data, one for Enable and
another one for Register Select. The LCD drives 3.3 Volts. Therefore, it is compatible with the MSP430 chip.
Additionally, a potentiometer is used to adjust the contrast of the LCD. The hardware interface is given below.
5
Figure 3: 16x2 LCD interface with MSP430
Software Interface LCD was configured to 4 bit data mode (in order to save some pins on the chip), 2 line display and 5x8 pixels on
each character. The software that was used to control the LCD module was broken down to different functions.
• LCD initialization: In this function LCD pins and its directions were set up, started the LCD, custom
characters for frequency bands are also stored in RAM.
• LCD Trigger: The LCD was triggered using the enable signal from the MSP 430 chip.
• LCD writes data: This function enables LCD to receive data on the display when Register Select = 1.
• LCD writes command: This function makes the LCD capable of receiving commands when Register Select =
0.
• LCD Cursor position: X, Y position of the LCD cursor is set up in this function.
• LCD set text: This function sets up the LCD to print strings on the LCD particularly used to display song title
and the artist information.
• LCD band setup: 5x8 pixels character mode is used to display frequency bands using levels. On a 5x8 pixels
character there are 5 columns and 8 rows in which each row is used as a level for the frequency band
display. For different frequency values, different levels are displayed. It can store up to 8 custom
characters. This function is used to draw these frequency levels on the LCD.
Infrared Remote and Infrared Receiver Breakout A feature of this project is to remotely control the MP3 functions. The functions supported from the remote are:
"Play/Stop”, “Next Track”, “Previous Track”, “Volume up/down". To implement this feature Sparkfun's Infrared
remote controller and infrared receiver breakout TSOP853 are used. The receiver breakout board consists of a
lens, preamplifier and filter units mounted on it. The codes from the remote button press are received by the
receiver at a detectable distance and are interfaced to MSP430 which in turn interfaces with MP3 functions to
trigger a particular function to be operated.
Hardware Interface The IR remote communicates with the IR receiver using infrared radiation. The remote’s infrared output signal is
modulated at 38 kHz and therefore is compatible with the IR receiver module operating at this frequency. There
are nine buttons on this particular IR remote which emits unique 32-bit codes for each button press. These codes
are received one at a time by the receiver board and are sent out on its OUT pin (Figure 5). Therefore in this
project implementation, the IR receiver's OUT pin is interfaced to MSP430 on pin P2.4 and this pin is configured as
an input pin. The remaining two pins of the receiver are Vcc and Gnd.
6
Figure 4: TSOP853 Infrared received breakout board circuit
Software Interface The IR software makes use of the timer of the MSP430. As button codes are decoded the latest commands are
made available to the rest of the software so they may take action accordingly.
Timer
The IR receiver makes use of timer A1.2 on the MSP430 and is configured to operate in capture mode, capture on
both edges and with capture interrupt enabled. Upon interrupt, which is when the receiver has received a 32 bit
code and sent it in digital form on the OUT pin to the MSP430's P2.4pin, then the control is transferred to the
timer ISR. The timer ISR has the pulse definitions of the NEC protocol in terms of “mark” and “space” for the
header and data portions of the button codes (Figure 6). Depending on the width of the received pulse, either a 1
or 0 is decoded. Once 32 bits are decoded, the received code is matched against the set of expected HEX values. In
the MP3 trigger software, these HEX values are used to take action depending on which particular button was
pressed.
Figure 5: Example pulse sequence of NEC protocol
RGB LED Lighting Effects The RGB LED portion of the project including 8 RGB LEDs in the shape of a circle. The circuit was able to display
different patterns based on user input via the IR remote control. Using cascaded shift registers, the circuit is able
to individually set 24 different LEDs (8 red, 8 green, and 8 blue) using only three pins from the MSP430 (data, clock,
and latch pins).
Hardware Interface Three digital I/O pins are all that was required to send data to the three cascaded shift registers used to drive the
24 individual LEDs. One pin was used to send serial data (P2.7), one pin served as a clock (P1.6), and the final pin
served as a latch to enable/disable the shift registers (P1.7). The shift registers, which can hold 8 values each,
overflow from one to the others such that with three cascaded, 24 individual LEDs could be manipulated.
Software Interface The main “while()” loop of the program is focused on servicing the RGB LEDs. While some of the hardware used
interrupts and timers, it was up to this main loop to update the MP3 Trigger with any commands received from the
IR remote as well as updating the LCD with information from the graphic equalizer IC. After analyzing the length of
time it takes to update the MP3 Trigger and the LCD, the RGB LED changes and delays were set so that the light
patterns were consistent whether the microcontroller needed to service other components or not.
7
Results
Lessons Learned One of the most important things learned was the ability to timeshare a microprocessor’s limited resources. With
four interrupts firing regularly, some of which required significant time to process, there was not always much CPU
time remaining for the code operating in the main loop. In the course of integration, the team had to react quickly
to challenges resulting from these timing constraints as they popped up.
Achievements The team was successful, first and foremost, in achieving the goal of maximizing the resource utilization of the
MSP430. Our software approached the limit of available memory on the device. So close, in fact, that we could
not create one more variable without running out of memory. When these challenges were faced, we succeeded
in working around them with clever programming alternatives. Additionally, the team succeeded in creating a fun
to use and entertaining MP3 player. Lastly, the integration platform built for the prototype was integrated and
assembled very professionally, contributing to the overall fit and finish of the MP3 player.
Shortcomings One of the team’s original goals was to design a PCB layout to be fabricated in time for the final demonstration.
Unfortunately due to scheduling and issues encountered during final integration, there was not time to send the
layout for fabrication.
Conclusion The MP3 player project set out to achieve a few specific goals. We wanted to maximize the resources available in
the MSP430 while at the same time creating a fully functional, fun, and entertaining MP3 player. Each of these
goals was met as we fully utilized the MSP430 down to the last instruction possible. Additionally the playback
functionality and remote control ability create a very fun and entertaining musical experience complete with visual
feedback in the form of lighting effects and graphical VU meter. In the process, the team gained valuable
experience integrating electronics with a low-resource microcontroller and managing the software accordingly.
8
Appendix A: Team Member Tasking Each member should add their contributions into the sections below:
Carlos Araujo
Carlos was primarily responsible for the MP3 decoder, and building the integration platform. Also, He did the MP3
software integration with the LCD and IR code. He also assisted in the custom character creation for the VU meter.
Brian Jarvis
Brian was primarily responsible for the EQ Filter and graphical VU meter. He also assisted with the decoding of the
infrared remote signal and helped integrate the various software components.
Shawn Wilkinson
Shawn was primarily responsible for the RGB LED portion of the project, which encompassed both the hardware
and software portions. He ensured the RGB LED code, the graphic equalizer code, the MP3 Trigger code and the IR
remote code were all synchronized.
Divya Chinthalapuri
Divya was responsible for IR remote and IR receiver coding, and she could accomplish the task with the help of
Brian. Alongside she also assisted in preparing the final presentation slides.
Leegia Jacob
Leegia was primarily responsible for LCD module of the project that includes both hardware and software. She also
helped with the final testing of the circuit.
Appendix B: Parts List
Table 1: Bill of Materials
Part# Description QTY Vendor
MSGEQ7 Graphic Equalizer 1 Sparkfun
COM-00105 RGB LED Commond Cathode 8 Sparkfun
NHD-0216HZ-FSW-FBW-33V3C-ND 2x16 CHAR LCD 3.3VDC 1 Digikey
MSP430G2553IN20 IC MCU 16BIT 16KB FLASH 20PDIP 1 Digikey
RHM100PDKR-ND RES 100 OHM 1/4W 5% 24 Digikey
2N7000TA MOSFET N-CH 60V 200MA TO-92 1 Digikey
TC54VN3002EZB IC VOLT DET N-CH OD 3.0V TO92-3 1 Digikey
WIG-11029 MP3 Trigger 1 sparkfun
VS-MBRA140TRPBF DIODE SCHOTTKY 40V 1A DO214AC 1 Digikey
3362P-1-103LF TRIMMER 10K OHM 0.5W PC PIN 1 digikey
EEA-GA1H100H CAP ALUM 10UF 50V 20% RADIAL 2 Digikey
LD1086V33 IC REG LDO 3.3V 1.5A TO220AB 1 digikey
CC1206JRNPO9BN330 CAP CER 33PF 50V 5% 1 Digikey
CC1206KRX7R9BB104 CAP CER 0.1UF 50V 10% 3 Digikey
CC0402KRX7R7BB103 CAP CER 10000PF 16V 10% 1 Digikey
SEN-08554 IR Receiver Breakout 1 Sparkfun
COM-11759 Infrared Remote Control 1 Sparkfun
KTR18EZPF2202 RES 22K OHM 1/4W 1% 3 Digikey
SN74HC595DWR IC 8BIT SHIFT REG 3ST-OUT 3 Digikey
9
Appendix C: Schematic
Figure 6: MP3 Player Schematic, Page 1
10
Figure 7: MP3 Player Schematic, Page 2