Introduction: How to Create an 'Alarm Mat' With Arduino Mega
We all have those mornings where we have trouble getting out of bed. The alarm keeps going off and we keep hitting snooze until...it's too late! We've missed the meeting, or class has already begun. To help combat this problem we have created the Alarm Mat, the device combining mental and physical activity to get you out of bed! Once out of your bed and performing physical and mental exercise, you'll be less likely to get back in bed and, sucess! You'll be on time to your next event!
Step 1: Gather Materials
To create the project you will need the following:
CREATING THE BASE:
-1 35x35x1/4in piece of plywood
-8 9x9x1/4in pieces of plywood
-10 11x11x1/4in pieces of plywood
-4 35x1x1/2in pieces of plywood
-1 can of spray adhesive https://www.walmart.com/ip/Loctite-1408027-13.5-Oz...
-1 bottle of Gorilla Wood Glue https://www.walmart.com/ip/18-oz-Gorilla-Wood-Glue...
-1 roll of aluminum foil https://www.walmart.com/ip/Great-Value-Aluminum-Fo...
-8 pieces of loose leaf paper
-4 rolls of 1/4x1/2x10ft foam insulation tape http://www.homedepot.com/p/M-D-Building-Products-1...
-24 1/2in flat head wall screws and matching washers http://www.acehardware.com/product/index.jsp?produ...
Available at: https://www.adafruit.com/wishlists?wid=415431
-DS1307 Real Time Clock
-9VDC Power Adapter
-Hook up Wire Spool Set
Available at: https://www.sparkfun.com/wish_lists/131641
-Basic 16x2 Character LCD
-Jumper Wires Awg 20 Pack
-Arduino Mega 2560
-Momentary Button Panel Mount x3
-Coin Cell Battery 12mm
-10K Resistors 20 Pack
-piezo buzzer https://www.radioshack.com/products/radioshack-76d...
-connecting cord for Arduino https://www.amazon.com/gp/product/B00NH11KIK/ref=o...
Step 2: Assemble the Border
1. Take each of the 4 35x1x1/4in pieces of plywood and cut a 45 degree angle at the end.
2. Using the Gorilla Wood Glue, attach them to the outer perimeter of the base plate, in a fashion that creates a border. The internal dimensions of the base board now measure to 33x33 inches
3. Images 3 and 4 show how the border corners should meet together.
Step 3: Attach the Contact Plates to the Base
1. The contact plates are the 9x9x1/4in pieces of plywood. They should be attached, using the wood glue, to the base as shown. After gluing, let set overnight.
2. At this time, glue two 11x11x1/4in pieces of plywood together to create one 11x11x1/2in piece of plywood. This is the center tile and should be glued in the center of the baseboard.
In the image shown above, the dark gray tile is the 11x11 center tile. The clear tiles are the 9x9 tiles.
The second image shown, although a few steps ahead, provides you with a general idea of what the tiles will look like when glued into place.
Step 4: Attaching Aluminum Foil to the Contact Plates
1. Using the Aluminum Foil, cut out the shapes as shown in the image. Then using the spray adhesive attach these cutouts to the contact plates. It is very important to be sure that none of the "arms" of the aluminum foil cutouts are touching each other.
2. Using the Aluminum Foil, cut out sheets that cover each of the remaining 8 11x11x1/4 inch pieces of plywood. Attach the Foil using spray adhesive to one side of each of these plates. It is very important that the aluminum foil is smooth and also that no spray adhesive gets on the foil.(Image 3) Image 4 shows what the tiles look like with the aluminum foil smoothed out. If you are having problems getting the foil to stay attached, try using a piece of electrical tape on the corners.
3. After all of the Aluminum Foil is attached to the appropriate squares, place the contact plates on the base as shown in Image 5. They are not attached by anything, however should securely fit into the board.
Step 5: Place Foam and Wire the Board
1. To form our pressure sensing button we lined the base plates with foam. Cut the foam to length and apply to the squares. As shown in image 1(look at the white strips).
2. Using the hook up cable, wire the board. On the contact plates, to one side of the E attach (using screw and washer as shown in image 3) one wire that will go to +5V on the arduino and one wire that will go to the input pin on the arduino. On the other E attach a 10K resistor to the foil and then attach a ground wire that will go to ground on the arduino. The image is much more descriptive. (Image 2). Repeat for each of the 8 contact plates, labeling the wires as you go. The wires are placed in the bored in an organized fashion that works for you. I decided to run it through the open gaps and to secure it to the baseboard with electrical tape.
Occasionally it is necessary to cut a part of the foam away so that the wire has somewhere to fit. This is shown in image 3. When complete, each tile should look like image 4. Image 5 shows what the "port" for the wires should look like
Step 6: 3D Print the Container
1. Using the attached 3D printer file, 3D print the container box.
2. After the box is printed, assemble so that the 3 button holes are the top lid of the box and the LCD screen is on the front face of the box. Use superglue to assemble the box together but be sure not to glue the lid shut. Use superglue to attach the LCD screen, the buttons, and the 8 LEDs on the front of the box.
3. On the top of the container is the three buttons that the user pushes to set the alarm. These pins must be reassigned in the code to match with the pins that you choose to use.
Notice in image 3 that the side of the container has two holes, one allows the data cord and input wires to run in, and the other provides access for a wall power supply.
Step 7: Wire All Components and Decorate
1. Wire all the Components according to the fritzing diagram(file also available).
2. The 8 input wires, ground, and +5V will come into the box through the side port and be plugged into the arduino accordingly. These input wires can go into whichever open port that you desire.
3. The LEDs should each be grounded and their input pins attached to any open ports you desire.
4. We chose to place a layer of rubber over our tiles so that the user would be more comfortable. On top of the rubber was a rough draft of our design. After attaching the rubber with gorilla glue, we placed fabric over it and recreated our design out of felt.
Step 8: Program the Arduino
In order to view these files and program the arduino, you will need to download the arduino compiler.
https://www.arduino.cc/en/Main/Software (DOWNLOAD LINK)
1. Program the Arduino using the included arduino program.
2. It may be necessary to import the included libraries into your Arduino compiler. Do not forget to change the input pins to match what you have created.
The Code works like this:
-set time on real time clock chip using computer
-user enters alarm time, computer compares actual time to alarm time
-when time matches, alarm function begins
-during alarm function, randomly generated number 1-8 is chosen corresponding to a tile on the mat. If for example, 4 is chosen the buzzer will buzz for times and the 4th LED will light up. Once the user steps on the 4th tile, the next tile is selected and the process repeats until 4 numbers have been stepped on.
-at the end of the alarm function the time is once again displayed waiting for the user to set another alarm
Step 9: How to Use the Alarm Clock Mat
Congratulations, you have finished creating the Alarm Clock Mat. Here is how to use it!
1. Make sure the Alarm Clock Mat is powered. Once it is programed, it is no longer necessary to plug it into your computer. There is a port in the side of the 3D printed container for both the programming USB cord as well as a wall power cord. As a practical use, it is best to use the wall power cord.
2. To set the alarm, the 3D printed container should be on your nightstand or close to your bed. Begin setting the alarm by pressing the "set" button on the top of the container. The LCD screen now prompts you to set the alarm. Use the "increase" button to increase the hour and then the "hour/minute" button to switch to minutes and increase minutes as needed. Now press the "set" button again. The LCD screen confirms that the alarm has been set.
4. When the alarm goes off you will first here 12 beeps. This is to allow you time to get out of bed. At this time you should study on the center tile of the mat. Now listen for the number of beeps, as well as look at which LED lights up. If you hear 4 beeps and the 4th LED lights up, put your full weight on the 4th button. Stay in this position until the next LED lights up. Repeat 3 more times and you have completed the wake up sequence.
Way to go! You made it to class on time and feel even more awake then normal.