Abstract
As the number of complex entertainment system components on the market today continues to grow, the complexity of home entertainment grows as well. The result is a concentration of entertainment equipment in a single room, many remotes, and a rat’s nest of wires. This project will try to adapt this home entertainment model to take advantage of the computer networks already present in many homes. The entertainment media will be centralized on a single server and streamed to a single, cheaper entertainment box in each room, increasing both the flexibility and the practicality of existing home audio and video libraries. Finally, low cost and simple configuration will make these components more accessible and easier to use. In this paper, each of the units will be described and analyzed for the conclusion of senior design.
Table of Contents
1. Background
2. The Server
2.1 The File Directories:
2.2 Changing the httpd.conf file:
2.3 Adding the cgi files:
2.3.1 Music2name.cgi
2.3.2 videoNames.cgi
2.4 DHCP Turbo Server:
2.4.1 Players Scope
2.4.2 Our_Scope
2.5 Side Notes:
3. The Audio Box
3.1 Format:
3.2 Processor:
3.3 Decoder:
3.4 Amplifier:
3.5 Power Supply:
3.6 User Interface:
3.7 Final Specifications:
3.8 Audio Box Design Changes:
3.9 Budget:
5. Timeline
6. Conclusion
Appendix A. The Code:
Video Box Code
Audio Box Code:
Appendix B – Schematics
1. Background
Right now there are many forms of entertainments systems available on the market, ranging from small audio towers to big entertainment systems that are capable of playing all types of media applications. In order to play all forms of media, these systems consist of many modules. These modules usually take up a lot of room and have to be stored in cabinets or closets. Because there are many modules, there are many different wires that have to be run between these modules and not all wires are compatible with I/O ports on other devices. As a result, you have to get more devices to make the modules you have compatible, which escalates the problem even more. Moreover, the only devices currently available, which include streaming capabilities, are very expensive and don’t stream video.
2. The Server
The server that we used was Windows 2000 running Apache Web Server 1.3.3. The other programs installed where ActivePerl 5.8.0 and DHCP turbo server (if you don’t have a router). All three of these programs are easy to install using the exe file provided and following the instructions provided.
2.1 The File Directories:
There are three file directories that need to be added to the C drive. Open up My Computer C drive. In the C drive add a folder called “theFiles.” Within theFiles folder create two folders called “music” and “videos.” All of your videos that you want to stream go in the videos folder and all of the music that you want to stream goes in the music folder.
2.2 Changing the httpd.conf file:
Apache needs to be configured. By going to Start Program Files Apache HTTP Server Configure Apache Server edit httpd.conf file using Notepad. There are only two things that need to be changed in httpd.conf. The first thing is to search for the following lines and change the DocumentRoot to say “C:/TheFiles”.
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/TheFiles"
The other section that need to be changed is seen below. The last line needs to be changed to #!c:/program files/perl/perl.
# Apache parses all CGI scripts for the shebang line by default.
# This comment line, the first line of the script, consists of the symbols
# pound (#) and exclamation (!) followed by the path of the program that
# can execute this specific script. For a perl script, with perl.exe in
# the C:\Program Files\Perl directory, the shebang line should be:
#!c:/program files/perl/perl
2.3 Adding the cgi files:
Three cgi files need to be added to the cgi-bin folder. Goto Program Files Aache Group Apache cgi-bin and add the files called videoNames.cgi, music2name.cgi, and listfiles.cgi. Listfiles.cgi and music2name.cgi ended up being the same file, but one is for the video box, and the other is for the audio box. The code for the cgi files is seen below:
2.3.1 Music2name.cgi
#!C:\perl\bin\perl.exe -wT
use CGI qw(:param);
$data = param('path');
$dirtoget ="C:/theFiles/music".$data;
opendir(IMD, $dirtoget) || die("Cannot open directory");
@thefiles=readdir(IMD);
closedir(IMD);
print"Content-type: text/html\n\n";
foreach $f (@thefiles)
{
unless( ($f eq ".") || ($f eq "..") )
{
print"/$f\n";
}
}
print"END_LIST000\n";
#This perl app. looks up the files within C:/theFiles/music
2.3.2 videoNames.cgi
#!C:\perl\bin\perl.exe -wT
$dirtoget ="C:/theFiles/videos/";
opendir(IMD, $dirtoget) || die("Cannot open directory");
@thefiles=readdir(IMD);
closedir(IMD);
print"Content-type: text/html\n\n";
foreach $f (@thefiles)
{
unless( ($f eq ".") || ($f eq "..") )
{
print"$f \n";
}
}
#This perl app. looks up the file names in the video folder C:/theFiles/videos
2.4 DHCP Turbo Server:
We set the Players scope between 160 and 200 and Our_Scope was set between 1 and 158. The following pictures show the settings.
2.4.1 Players Scope
2.4.2 Our_Scope
2.5 Side Notes:
- ActivePerl just needs to be installed and it doesn’t need any configuration.
- The installed location of perl by default is C:\perl\bin\.
- The IP address of the server was set to 192.168.0.150.
- If there are any mistakes, odds are they are in setting up Apache. This can be troubleshot through the apache website (
- The server is now configured properly and can be restarted.
3. The Audio Box
The audio box we designed communicates through a home network with a server as shown in the figure below. It is capable of receiving and decoding sound files encoded in the MP3 format and outputting them through an integrated digital-to-analog converter and audio amplifier. This device allows a large number of music files to be centrally located on a single server, while maintaining access to those files from throughout the house using the existing CAT5 network.
Figure A1: Smart Home Entertainment Diagram
3.1 Format:
The MP3 format was chosen due to its current widespread use for encoding audio files. Using this compression scheme, the size of a typical sound file stored on an audio compact disc can be reduced by as much as a factor of twelve. This compression reduces the storage space needed on the server for each file as well as the total network bandwidth required to stream the music, reducing network congestion.
3.2 Processor:
Figure A2: Audio Box Block Diagram
The block diagram for the audio box is shown above in figure A2. As you can see, the system is based around a Rabbit 2000 microcontroller from Rabbit Semiconductors. This microcontroller is based on the Z-80 architecture with an external data bus and large data address space, allowing for fast bandwidth over the Ethernet network and a large data buffer for the received sound files. This processor is very efficient at moving large amounts of data and has plenty of I/O pins to control the user interface. It is also responsible for negotiating file transfers with the file server and streaming the received files to the MP3 decoder chip.
The microcontroller is installed on a pre-designed single board computer, also from Rabbit Semiconductors, which includes the processor, memory, and Ethernet control logic on a single board roughly half the size of a credit card. This board, the RCM2200 shown in figure A3 below, is clocked at 22.1MHz and will interface with a motherboard of our design through two 26-pin 2mm headers. Using this board made the design cheaper, simpler, allows for easier repairs and upgrades in the future.
- 128KB SRAM Memory
- 256KB Flash Memory
- 22.1MHz Clock
- On-Board Ethernet Interface
- In-Circuit Programming and
Debugging
Figure A3: RCM2200 Single Board Computer and Features
3.3 Decoder:
A dedicated MP3 decoder chip, the STA013 from ST Microelectronics is used to offload the intensive task of decoding the sound files received. This frees the processor to control the network connection with the server and interact with the user interface. This chip has a simple serial interface and a fully automatic decoding scheme. The decoder automatically detects the bit rate of the current file being decoded and ignores any packets that are invalid. This allows the processor to simply feed entire files to the decoder without first removing any information headers present, speeding the processor response and efficiency while also allowing it to handle higher quality/bit rate data files.
The digital output of the MP3 decoder is then connected to the input of a CS4334 digital-to-analog converter from Crystal Semiconductors. This is a 24-bit digital-to-analog converter for a high quality line-level output to drive the speaker amplifiers. This particular chip has a 96dB dynamic range and –88dB total harmonic distortion, for a clean and dynamic representation of the original sound file.
Figure A4: Similar STA013 and CS4334 MP3 Decoder Circuit
3.4 Amplifier:
The audio amplifier for this device is designed around the TDA2005 bridge amplifier IC from ST Microelectronics. This is a small, integrated audio amplifier capable of running from a single supply voltage and includes several useful features. The IC package of the device allows for efficient heat dissipation as well, for high power operation up to 20 watts. A line-level output will also be available on the outside of the box to allow for external amplifiers to be used with the device. The special features of the audio IC chosen are outlined below:
- Short Circuit Protection
- Over-Temperature Protection
- Open-Ground Protection
- Drives Very Inductive Loads
- Wide Supply Range 8V-18V
- Maximum Total Harmonic Distortion of 1%
Figure A5: TDA2005 Specifications
3.5 Power Supply:
The power supply for this design had to be high powered in order to drive the power amplifier. For the transformer, we used a 12.6V RMS transformer with a maximum output current of three amps. This was rectified with a full bridge rectifier and filtered with two 4700uF electrolytic capacitors. The filtered output was then regulated with a simple 12V linear regulator. Because more current was needed than could be supplied by a simple 7812 regulator, a pass-through transistor was added to boost the current output to the full three amps output by the transformer. A sense resistor is added to the input of the 7812 and the input pin of the 7812 is connected to the base of the transistor. As the current draw increases, the voltage drop across the sense resistor increases until it is sufficient to turn on the transistor. The transistor then sources the majority of any additional current. Finally, the output was connected to both the power amplifier and the control electronics. The power supply schematics are shown in Appendix B.
The turn on voltage for the TIP2955 transistor is 1.8V, so we chose a 5Ω sense resistor. This sets the current draw for the regulator at 360mA, with a maximum additional current draw of 44mA to drive the pass-through transistor, for a total output current of 3A.
3.6 User Interface:
The user interface of the device consists of a 16x4 character LCD for visual feedback and a small 7 key keypad for navigating menus and controlling sound playback. Additionally, the device contains a remote control receiver, which works with all common universal remote controls. The keypad allows the user to navigate the file system on the server for selecting and generating play lists. During playback, the display scrolls the first level directory name, second level directory name, and the name of the MP3 file. With this in mind, the directory structure of the server can be setup accordingly with structures such as genra\artist\song.mp3 or artist\album\song.mp3. Additionally, these structures will make it much quicker and easier to navigate the files and create new playlists. File lists are downloaded and searched by the audio box’s operating system using the Perl scripts listed in the server section.
The IR detector used to detect the remote is shown in figure V4, in the video box section. This unit was chosen because it includes a built-in filter to demodulate the remote control signal. The remote control signal is modulated so that it can be distinguished from other light sources, such as fluorescent lighting. This simplified the circuit greatly as the output from this device could simply be connected directly to the PIC processor that would decode the signal. Due to time constraints, we were unable to integrate the remote programming code into the operating system before the end of the semester. It has been programmed for one particular remote control for demonstration purposes.
In order to ease the setup and administration of this system it will be configured automatically when it is plugged into any network containing a valid Smart Home Entertainment server. All network settings and defaults will be sensed and adjusted without user intervention as soon as the system is plugged in using universal default settings stored on the server. However, this process may take several minutes depending on the network configuration. In order to find the server, the box will ping each IP address in its own subnet until it finds a valid web server. Due to limitations in the TCP/IP stack, the least significant byte of the server must be between one and two hundred. This limitation is caused by an inability to flush the ARP cache, which maintains an entry for each address accessed. Cache entries last several minutes before they are finally released and the maximum allowable size is 200 entries. Because the box pings each address sequentially, it will initialize faster when the server IP is closer to one. Alternatively, the address may be set manually each time in the main menu.
3.7 Final Specifications:
Figure A6: Final Audio Box Specifications
3.8 Audio Box Design Changes:
The most significant change we made to the audio box design was to move the IR decoding process off of the main processor. We found a working implementation of a programmable IR decoder online from a similar project at This circuit only supported IR control, but had several extra I/O pins available to connect a small keypad. We then changed the code to poll these buttons on a regular basis and to transmit the detected key presses to the main processor. By offloading these processes from the main processor, we were able to simplify the main board and the processor was able to more easily accommodate higher bit-rate files. The schematic for this circuit is listed in Appendix B.
We also chose a different amplifier IC for the built-in amplifier. There was no reason to include 40W per channel amplifiers when the specifications only called for 10W per channel. The power supply required to supply this amount of power would have been much more expensive and would have made the final box much larger. Additionally, the amplifier we finally decided to use was available in kit form. This kit followed the reference design for the included amplifier IC exactly, was cheaper than buying all of the parts individually, and included a circuit board. An image of the assembled kit is shown in figure A7. All we had to do differently was connect the audio potentiometer on the front of the box to the potentiometer connection on the circuit board. Although this kit was capable of output 20W per channel, the final implementation is limited to approximately 10W per channel due to the power supply design. The schematic for this device is shown in Appendix B.
Figure A7: 20W + 20W Audio Amplifier Kit
Fast forward and rewind functionalities had to be removed due to bandwidth limitations and an overall awkwardness of implementation. Ideally, the user should be able to hear the song playing while fast forwarding or rewinding so that they can stop the music at the desired location. However, our processor was not able to download the music at such an accelerated rate, or backwards. Additionally, the processor would need to process each packet to ensure that the decoder receives valid data or nothing would come out of the speakers. This is also not possible at accelerated speeds. The only alternative implementation would simply show the playtime on the LCD without playing the music. This was not possible either as variable bit rate support means that each packet in the song may have a different bit rate so that play time estimation is not possible without downloading and analyzing each and every packet anyway.
One less significant change made to the design included a 16x4 LCD instead of a 20x4 LCD. Noting that there was a 16x4 LCD already available in the senior design lab, we decided that this would be sufficient for a usable interface and would save money from our budget as well.
Finally, the reduction of keypad size from eight buttons to seven buttons reflected subtle changes in our user interface. We were able reuse buttons for several different functions, depending on the current context of the user interface, simplifying the final design.
3.9 Budget:
- RCM2200 Development Kit$239
- PIC16F84$ 6
- 16x4 Character LCD$ 30
- STA013 MP3 Decoder$ 12
- CS4334 24-bit DAC$ 5
- IR Demodulator Module$ 4
- Printed Circuit Board$ 60
- Power Amplifier Kit$ 30
- 12.6V Transformer$ 10
- Enclosure$ 7
- Audio Potentiometer$ 4
- Miscellaneous $ 40
Sub Total:$447