| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Martin Daniel Final Project

Page history last edited by Daniel Martin 6 years, 2 months ago

Alarm Clock MP3 Player Using Arduino Micro

 

     Have you ever woken up at 6:00 am to the sound of your alarm buzzing loudly -- only for you to slam the snooze button in frustration? After ten rings, you wish your alarm would never ring again, but you cannot be late for class, so you drag yourself out of bed in a grumpy mood. If you're looking to wake up in better moods -- and be on time for class -- this simple alarm clock MP3 player is the perfect solution. Upload your favorite music into this alarm and you can wake up to the sound of your favorite rock star or country singer or even to the voice of your mother! Simply follow these steps to build your own version of this alarm clock. 

 

Step 1: MP3 Player

 

1a) Parts List:


-- Solderless Breadboard

 

-- Arduino Micro

http://arduino.cc/en/Main/arduinoBoardMicro 

 

-- Micro SD Card 

     -- Micro SD Card Adapter

 

-- HEF 4050BP Non-Inverting Buffers

http://html.alldatasheet.com/html-pdf/17717/PHILIPS/HEF4050BP/501/2/HEF4050BP.html

 

-- 1/8" Stereo Panel Mount Audio Jack

http://www.radioshack.com/product/index.jsp?productId=2103452

 

-- Breakout Board for VS1053 MP3 (Decoder)

https://www.sparkfun.com/products/9943

 

-- USB Cable  (micro USB male to USB A male)

     -- AC adapter (USB)

     http://www.adafruit.com/products/501

 

-- Stereo Speakers     

 

-- Assortment of Breadboard Wires

 

-- Right Angle Male Header (7 pins)

 

 

1b) Preparation:

Insert the microSD card into the adapter and connect it to your computer. Download your favorite songs onto the SD card. The songs can only be *.mp3 or *.wav files encoded with iTunes.

 

Solder a seven pin right angle male header to the Micro SD card adapter as shown in the link below.

Micro SD Card Adapter with Header

 

Be sure to solder the short ends onto the adapter, the long ends fit better into your breadboard. The two ends of the SD card are unused, do not solder anything onto them.

 

Next, solder three wires to each of the pins of the audio jack as shown in the link below.

Audio Jack with Wires

 

I recommend using Scotch tape around the leads to prevent the wires from accidentally shorting. 

Now take a look again at the audio jack. The pin labeled RIGHT corresponds to the right speaker; the pin labeled LEFT to the left speaker. The pin protruding from the side is Ground.

 

1c) Procedure:

Place the Arduino Micro, MicroSD card adapter (with the microSD card inside), HEF 4050BP, MP3 decoder, and the three wires from the audio jack into the breadboard such that no wires or pins are directly connected. Keep the components well spaced to easily connect wires. In my project the microSD card adapter is placed in one corner so that the micro SD card can be accessed even after it is put in the box.

 

Follow the schematic and connect the wires accordingly. Note that all grounds should be connected to the Arduino Micro's GND.

Check again to make sure the MP3 Decoder, SD Card, and HEF4050BP are receiving only 3.3V, not 5V, to prevent damage to these components.

 

Download the code from these files using the following procedure:

Download Song8.ino first. A message pops up to create a folder: click OK, and download all the other files into that folder (the folder will be called Song8, and all the other files should appear as tabs). Rename Utilities(1).ino to Utilities.ino.

 

Make sure you have downloaded all the libraries onto your computer, that are listed at the top of the program. Click this link to learn about libraries.

Finally connect the USB cable from the Arduino Micro to your computer and upload Song8.ino.

 

Connect speakers to the audio jack, and you will hear your own music playing!

You can disconnect the USB cable from the computer, connect it instead to the AC adapter, and plug it into your wall.

 

 

Step 2: Clock/Display

 

2a) Parts List:

 

-- DS1307 RealTime Clock Breakout Board

http://www.adafruit.com/products/264

 

-- 16 x 2 LCD Display

http://www.adafruit.com/products/181

 

-- Male Header (at least 12 pins)

 

-- Female Jumper Wires (at least 12)

http://www.radioshack.com/product/index.jsp?productId=12825860

 

-- 10 kohm potentiometer

 

-- Assortment of Breadboard Wires

 

2b) Preparation:

Follow the Assembly instructions from the RealTime Clock to prepare it for use.

 

2c) Procedure:

Follow this schematic to wire up the RealTime Clock to the Arduino Micro. Only four of the pins will be usedNote that all grounds should be connected to the Arduino Micro's GND.

 

Place the header along one column so none of the pins are connected.

 

Follow this schematic to wire up the LCD Display to the Arduino Micro, as shown here. Use the jumper wires to connect the LCD to the header on the breadboard, then use the breadboard wires to connect to the Arduino.

Note that all grounds should be connected to the Arduino Micro's GND. Be sure the background light (pin 15) is connected to 3.3V, not 5V, otherwise the display may get damaged.

 

Download the code from these files, creating folders for each. Make sure you have downloaded all the libraries onto your computer listed at the top of the program. Connect the USB cable from Arduino to your PC, upload either of these programs, and you will be able to see the time on your display! 

 

Check it out!

 

Once again, you can disconnect the USB cable from the computer, connect it instead to the AC adapter, and plug it into your wall.

 

Step 3: Combination of MP3 and Clock - Plus Buttons!

 

3a) Parts List:

 

-- Slider Switches (x2)

http://www.radioshack.com/product/index.jsp?productId=2062492

 

-- Momentary Pushbutton Switches (x2)

http://www.radioshack.com/product/index.jsp?productId=2062539

 

-- Force Sensitive Resistor

https://www.sparkfun.com/datasheets/Sensors/Pressure/fsrguide.pdf

 

-- 10 kohm resistors (x4)

 

-- One 27 kohm resistor

 

-- Assortment of Breadboard Wires

 

3b) Preparation:

Solder two wires to each of the following:

-Slider Switch 1 

-Slider Switch 2

-Momentary Pushbutton Switch 1

-Momentary PushButton Switch 2

-Force Sensitive Resistor 1

 

Slider Switch Photo

FSR Photo

 

Once again I recommend using tape to prevent shorting.

 

3c) Procedure:

Use the following schematics to wire up the buttons and sensor:

 

Schematic 1: Button 1

Schematic 2: Button 2

Schematic 3: Slider 1

Schematic 4: Slider 2

Schematic 5: FSR

Note that all grounds should be connected to Arduino Micro's GND.

 

Download the code from these files, creating folders for each. Download Combo12.ino first, create the folder, and install all the other files into that folder. Rename the other files and remove any (1) or (2) in the file name. Make sure you have downloaded all the libraries onto your computer listed at the top of the program.

 

Note: *Due to the restricted time I have not included one of the sliders into the code, so it is not functional yet (music on/off). 

 

Upload Combo12.ino and you have finished your alarm clock!

 

Click this link for instructions.

 

Explanation:

 

     At first, while only the clock is running, the Arduino program constantly checks for user interface. When MODE is pressed first, the FWD button can be used to increment the Hours; when mode is pressed again, the Minutes can be incremented using the FWD button. Flipping the ALARM switch twice turns on the alarm. The program checks when current time equals alarm time, and if true, will play music from the SD Card. Flip the ALARM switch to turn the alarm/music off.

     This is how it works: the song is sent from the SD Card 2 KB at a time to the Arduino. The Micro then sends this to the decoder as a PWM signal at 8 bytes/sec through the non-inverting buffer (HEF4050BP). The decoder contains a DAC and uses it to convert the signal from digital to analog and output it to the audio jack. Initially I tried to amplify the signal using an audio amplifier, but it overheated and would not run on 5V, so I highly recommend not to use an amplifier even if the sound is too low. If the sound is too high and your speakers do not have adjustable volume, open the Arduino code, find the line "#define mp3_vol      254 " and reduce the number, for example, to 175.

     The RealTime clock with battery backup is needed because the Arduino's timer functions are reset to 0 when a new program is uploaded or the Arduino is powered off. This is what happens in your alarm clocks without battery backup; it will flash 12:00 am after power was shut down.

     How do you make sure you'll wake up? The FSR is designed to respond to how hard you press the longer you snooze (this feature is not yet implemented).

 

Appendix

 

Box:

 

I decided to enclose the breadboard in a box, so using this file created on Adobe Illustrator I made the holes for the following parts: SD card, power, audio jack, snooze, mode, forward, alarm switch, music switch, and LCD display. For the LCD I needed to file the edges of the big rectangular hole in the center so the LCD could fit in snugly. It turned out that four holes for screws for the display were unnecessary. I used Scotch tape to fix the snooze FSR. The pushbuttons come with nuts so it was simple to attach them. For the sliders I used four 40 x 3/8" screws without nuts. I cut a grommet and put it around the power cord, then pushed the grommet into the hole so it would hold the power cord. 

 

Here are some photos of the process of building the box:

Front View with Three Sides and Bottom

Back View with Three Sides and Bottom

Top View with Four Sides and Bottom

Front View With Parts Attached

Top View of Box

Front View with Alarm Clock On

Complete Box with Speakers

 

Videos:

 

These videos represent the different steps in the process of making this project.

MP3 Only

Alarm Clock (setting the alarm)

Alarm Clock MP3

Alarm Clock MP3 in Box

Final Project Video

 

Design Point of View: This project was inspired from my own problem, that I cannot get up easily to go to school. I feel that I need an alarm clock playing my favorite music to wake up on time.

 

Verplank Diagram

 

Photos of Prototype:

     Photo 1

     Photo 2

     Photo 3

Note that these photos do not represent the actual project, but were preliminary design ideas.

 

State Diagram

 

Project Code  Follow the procedure described in Step 3c. 

 

Challenges/Issues

 

- Proper Allocation of Arduino's pins (14 digital and 6 analog) to components being used.

- Trade-off between UI and Arduino's response times.

- Conflicts such as creating a delay using non-blocking code while merging MP3 and clock programs.

- Careful consideration of component placement to ensure robust wiring scheme.

- Software issues with display when MODE button is pushed multiple times

      --Arduino needs to reboot.

- SD card can get corrupted due to power surges. 

     --Make sure power is off when rewiring or checking components.

 

 

 

Comments (2)

Nik Martelaro said

at 10:17 pm on Aug 19, 2014

Daniel Martin

Intro:
Nice litle vignette of current alarm clocks and how the alarm clock could be. I also like that you introduce the project documentation as a build guide.

Build Steps:
Nice parts list and I really like that you added the links to the products that you used.

Excellent schematic and nice debugging check to check for the 3.3V and 5V lines. Nice linking to all the resources and files you used. Very clear instruction and helpful hint throughout the build steps.

Might have been nice to embedd the photos and annotate them in the document, but it is great that they are there.

Really like the instruction for use that you provide.

Explanation:
Nice explanation of how the device works. I also like how you discussed you trouble with the audio amplifier and how you resovled the volume issues. I think that the recommendation of not using the amplifier is a bit strong, but does get acrosst he point that it may not be a super simple part to use.

Appendix:

Box:
I would have included the design of the box in the main section rather than the appendix. It would have been nice for you to describe the steps you used just like wth the electronic above, but the descritption is still nice.

Nicely labeled photos. I will say that the wiring is a bit of a mess, but the final box hides it well and appears well constructed and designed.

Glad that you included all the videos. It might have been nice to upload them to youtube so they were embeded and did not need to be downloaded, but nonetheless great that they are included.

POV: The POV short and I understand your need of getting up although you have confounded the solution you came up with and the deeper need of needing to get up.





Nik Martelaro said

at 10:17 pm on Aug 19, 2014

Verplank Diagram: Clear and understandable. Would be nice to get a darker scan, but it was still readable.

The images of the paper protoype were nice, but I was not sure what you learned from them. Would have been nice to explain how they helped you during your design process.

Nice state diagram, although I don;t understand wht the bwck/fwd events are.

Challenges/Issues:
I like the listed challenges that you had. It would have been nice for you to discuss how you worked through these like you did in the main document. Also would have been nice to see what you learned from working through these chanllenges.

Overall:
Your project was nicely scoped and well executed. Although the wiring was bit bit messy, I think that you did a really good job of integrating the entire project and achieving the functionality and interaction that you were intending. Your build documentation was excellent and you provided all the needed steps that students would follow to recreate your work. Great job on this. I hope that it work for you and that you can improve the functionality in the future.

You don't have permission to comment on this page.