dec 1st 2009 mp3 player doorbell ee331 - u of s … player doorbell kyle weisgarber, craig lytle,...

11
MP3 Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell

Upload: vudang

Post on 10-Mar-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

MP3 Player DoorbellKyle Weisgarber, Craig Lytle, Curtis Flavel

Dec 1st 2009Professor Wahid

EE331

MP3 Player Doorbell

Page 2: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Block Diagram and Explanation

MCU: The MCU is the control unit in our design. It takes in the input values and outputs signalsaccording to our code to the LED's and the MP3 player.

Doorbell 1: This is the button for the hypothetical front door and will be used to drop the voltagetied into the front doorbell input of the MCU to zero.

Doorbell 2: This is the button for the hypothetical back door and will be used to drop the voltagetied into the backdoor input of the MCU to zero.

Reset: This is the last of the inputs and it is used to reset our doorbell counter. It cannot be resetwhile the doorbell is still ringing.

MP3: The MP3 player is used to store the music we want to use for the songs. Its inputs are theplay and skip buttons which are directly connected to the MCU. Its output is the speaker.

Speaker: The speaker gets its data from the MP3 player, and plays the songs.

LED: The LEDs are used as counters to show the owner of the doorbell how many times thedoorbell has been rung. Also while the doorbell is ringing the LEDs flash a pattern.

MP3 Player Doorbell

Page 3: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Reason for choosing MCU

The microcontroller we used for our design was the PIC16F886 MCU. We chose this MCUbecause it was available in the lab and met all of the requirements for our design project. One ofthe major requirements for our design was to have enough I/O pins to run two seven segmentdisplays as well as have 3 input buttons and two outputs to the MP3 player. This MCU had 25 I/Opins so it worked perfectly for this requirement. We also decided to use this MCU because itcontained 14kB of memory and we thought this would be enough to cover all of our design needs.We did not use any of the interrupt pins although they could have been used effectively in ourdesign if we would have decided to implement this option.

Key Features

For our project we designed a doorbell which will play MP3 formatted songs when thedoorbell is pressed. We have two doorbell buttons to simulate a front door and a back door andeach will have its own individual song so that it is easy to distinguish which button had beenpressed. Our doorbell system will also contain two seven segment LED displays so that the homeowner will know how many times his doorbell has been rang since the last reset so they know ifthey missed a visitor. This ring counter has a reset button to reset the count back to 0, or when itgets to 100 it will also go back to 0. Once one of the doorbell buttons has been pressed the buttonswill not do anything and the doorbell song cannot be stopped. This will prevent multiple pressesfrom restarting the song and from sounding annoying. While the song is playing the sevensegment LED’s will also be flashing in a pattern to add more novelty to the design. Anotherhighlight of our design is how we where able to use a MCU to control an additional electronicdevice. We took apart the MP3 and found which pins where kept high all the time on our playand skip buttons, then we soldered wires onto each of those pins. Once that was done we tiedthose wires into PORTA of the MCU as outputs.

MP3 Player Doorbell

Page 4: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Design Challenges

Our first challenge was to implement the MP3 player in our design. First we had to figureout how to tie into our MP3 player and connect it to our MCU. We went to the lab and checkedthe voltages across each button we wanted to control. We found that all button’s terminals arekept high and are grounded when the button is pressed. In order to accomplish this using a MCUwe decided to run our entire circuit at 3V. We would have two output pins running from the MCUto the sides of the buttons of the MP3 player. These output pins would always be kept high at 3volts until we wanted to perform an action on the MP3 player. The correct pin would then bepulled low and the action would occur. We soldered wires to our MP3 player connections and ranthese wires to the breadboard and MPU.

Our next challenge was setting up delays between the skip and play buttons. During ourtesting we found that if we did not have a sufficient enough delay between the play and skipcommand the MP3 player would ignore the second command. We tried many different lengths ofpauses in between in order to minimize the delay between actions, we found that the delay for theMP3 player was approximately 0.1 seconds. The delay we used was 1.4 seconds when playcomes before skip, and when skip is before play we have 0.7 seconds. Also we have to set playand skip low for 0.07 seconds or else the command won't register. This means that if you try topress the doorbell again immediately after the song finishes it will not work. There is also a slight

MP3 Player Doorbell

Page 5: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

delay after the button is pressed before song two is played. The only way we could have correctedthis issue would have been to buy a better MP3 player as the problem is with their software andnot ours.

Another challenge we had was to implement a different song for each doorbell button onlyusing one MP3 player. We had to come up with a system to always have the same song playingfor each door so that we could tell what button had been pressed. To do this we decided to havethe MP3 player always ready at the start of the first song. When the first button was pressed theMCU would send out a signal to hit play, play the song for approximately 30 seconds, pause thesong, delay briefly, skip to the next song, delay briefly, and then skip back to the start of the firstsong. If the second button was pressed the MCU would first skip to the next song, delay briefly,play the song for approximately 30 seconds, pause the song, delay briefly, and then skip back tothe start of the first song. This system works to keep the same song for each button while stillmaking sure that the songs start at the beginning each time.

Our next challenge was implementing the LED displays. Our displays were running at 3volts instead of the 5V normally used so we had to use two 100 ohm resistors in parallel to get theright amount of current. This increased the LED’s brightness, but they are still not as bright asnormal because we did not want to destroy the MCU by running too much current through it. Wealso had to change our counting system so that it displayed in decimal and did not get confused byhex numbers over 9. We decided to use two variables, one for each LED display. When the leastsignificant digit is at nine and the doorbell is pressed the least significant digit is reset to 0 and themost significant digit is incremented by one. We did this rather than using one variable and addingsix when the last digit is nine because it was easier to implement and we were having somedifficulty in getting this to display perfectly. We have a different look up table for each display aswe wired them by convenience rather than by ease of programming.

MP3 Player Doorbell

Page 6: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Our last challenge was learning how to use MPLAB. We have never used MPLAB before sowe had to learn how to write in assembly, how to run simulations, how to set up configuration bitsand how to program the MCU. We ran into problems with our design because we were unsure onhow to set up our configuration bits. We ended up turning off most of the protection features asthey were causing our MCU to reset continuously.

Shortcomings/Improvements

The first flaw we found was in our delay functions. We believe we could minimize thedelays so that our buttons are quicker to respond. Right now we have a general delay functionwhich we call before each time a button should be pressed. What we could have done is specify adelay for each time a button was pressed since the skip and play/pause button have different delaytimes. We might have been able to slightly improve the delay length for our design, but in order totruly fix the delay would have to get a better MP3 player or design our own external memory andspeaker system. The external memory and speaker system would be much more difficult toimplement but would give us much more control over every aspect of the music playing. A betterMP3 player might help to reduce the problem, but there is no guarantee that it would not have thissame problem as it is a design feature to make sure that multiple buttons are not pressedaccidentally.

Another improvement would be to use the wall outlet as a power supply instead of a powersupply from the electrical lab. This could be done by using a step down transformer and pluggingour design into an outlet. Also if we wanted the MP3 player to run on an outlet as well instead ofusing a battery we would just have to use a voltage divider to get the voltage to 1.5 volts. Wewould have to come up with a transformer and regulator circuit in order to do this, or we couldtake a system that is already out there such as the many devices used to charge electronics like cellphones and use that to change from 120V AC to 5V or 3V DC.

MP3 Player Doorbell

Page 7: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Furthermore our MP3 player and MCU are on all the time which is inefficient. Thisconsumes power at a much greater rate than if we were to have both devices enter a sleep modewhen not in use. For the MCU we would have to enable sleep mode and then use interrupts for thebuttons. We did not learn about interrupts in class until we were well into the design of our deviceso we decided not to implement them. In order to have our MP3 player in sleep mode we wouldhave to buy a more expensive one as our current unit is very limited in its functionality. Againusing external memory and our own music system would have been more efficient but moredifficult to do.

If a power failure occurs with our current design the MP3 player will continue to play a songbecause it has its own battery power supply. This would throw off the song cycle and the systemwould have to be reset by hand. If we were to design our system so that both the MCU and MP3ran off the same wall supply we would not have to worry about this problem as both would bereset when the power goes off.

If we needed to distinguish between how many times the back door was rung and how manytimes the front door was rung we could just make a decimal on the LED displays light up toseparate the two counts. If doorbell one was pressed we would increment a doorbell one count tobe displayed, but if doorbell two was pressed we would increment a doorbell two count. Also wewould need to add an extra button which would light up a decimal on one of the LED displays andwhen that button is lite, the display would show how many times the back doorbell has beenrung.

Also we only have two songs on our MP3 so we can tell apart the front doorbell from theback doorbell. An improvement would be to have more songs on our MP3 and have the frontdoorbell play a certain genre of music and the backdoor play another genre. This could beaccomplished by setting up our songs in an alternating pattern (genre 1, genre 2, genre 1...), thenwhen the front doorbell is pressed the first song would begin to play and once it is paused againwe would skip twice to always be at genre 1. Then if the back doorbell is pressed we would skip

MP3 Player Doorbell

Page 8: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

first, then play the song for genre 2, and then skip again so we once again would always be atgenre 1. As long as there is an even number of songs we would not have to change our code.

We could improve our counting efficiency by counting in binary with one variable instead ofusing the two variables. We currently use one variable for the ones LED and one variable for thetens LED and do the conversions from binary to decimal as they are inputted. Instead we couldcount in one binary variable and only convert back to decimal when we need it to be outputted onthe displays.

Lastly we could make our LED displays brighter so it would be easier to read. This can bedone by getting more current by using a driver. Our MCU can only handle a set amount of currentsafely and we did not want to go over this limit and wreck our MCU. Instead, we made acompromise and settled for having dimmer displays. If we used a driver we could use the MCU tocontrol it and would not have to worry about this over current issue.

Breakdown of Tasks

Kyle Weisgarber:* Code*Initial design*MP3 experimentation*Code debugging*Hardware debugging*Block diagram*Detailed diagram*Key features*Breakdown

Curtis Flavel:*Initial Design*MP3 research*MP3 experimentation*Build Circuit*Code debugging*Code commenting*Hardware debugging*Design challenges*Design shortcomings

MP3 Player Doorbell

Page 9: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Craig Lytle:

*Write up*Initial design*MP3 experimentation*Build Circuit*LED research*LED implementation*Code debugging*Hardware debugging*Choice of MCU

MP3 Player Doorbell

Page 10: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

Appendix

Below are two attached figures. The first figure is a detailed circuit diagram of our breadboard.Below that is our original design when we though we had to use 5V to power the MCU.

MP3 Player Doorbell

Page 11: Dec 1st 2009 MP3 Player Doorbell EE331 - U of S … Player Doorbell Kyle Weisgarber, Craig Lytle, Curtis Flavel Dec 1st 2009 Professor Wahid EE331 MP3 Player Doorbell Block Diagram

MP3 Player Doorbell