My sister has the worst time getting out of bed in the morning. I swear a marching band could walk through her bedroom and she wouldn't so much as roll over, let alone get out of bed. In order to help her out, I decided to create a Smart Alarm for her bed. This alarm will go off at her alarm time, and track if she actually gets out of bed or not using sensors in the bed. This will ensure that the alarm doesn't go off until she actually gets out of bed, preventing her from just swinging her arm over and hitting snooze.
Step 1: Supplies
We'll need a few different components here for this project. If you don't have a well stocked lab, you might need to search the interwebs for a few different pieces:
- LinkIT ONE Board
- Force Sensor
- Audio Jack Extension Cable (if the speaker cables are two short, mine were so I had to buy these)
- PIR Motion sensor (optional)
I used a set of old computer speakers I had laying around to save some money. You don't need nice speakers for this, just something with a 3.5mm jack that will plug into your LinkIT ONE.
Step 2: Hook Up the Force Sensor
First, let's work on getting the Force Sensor hooked up.
The Force sensor is actually pretty simple to set-up. You'll need your 27k resistor here as that will help us measure the resistance (AKA, the Force) from our sensor. You'll want to refer to the above diagram on how to properly connect your force sensor to your LinkIT ONE. For a more in-depth analysis, I would highly recommend you take a look at Sparkfun's walkthrough on the topic.
If you just want to see it in action, go ahead and download the attached code and read the comments.
**Note that I showed this on a breadboard, but you'll probably want to actually solder the connections together. Fritzing's 'Schematic' view didn't really show the Force sensor that well, so I wanted to show it on a breadboard to make it more clear.
Step 3: Put Some Music on Your LinkIT ONE
We'll want to make sure we have some cool tunes to wake up to every morning that actually get us out of bed. In my sister's case, she needed the exact opposite: Horrible music that forced her to get up. Find whatever suits your fancy.
First, you'll need to switch your LinkIT ONE to 'MS' mode. This stands for Mass Storage and makes your computer treat the LinkIT ONE just like a big USB thumb stick. This makes it easy for you to simply click and drag music from your Computer to your LinkIT ONE.
While your LinkIT ONE is in 'MS' mode, it won't be able to deploy code. You'll have to switch back to 'UART' in order to deploy code to it!
Step 4: Coding Your Alarm
In order to code the alarm piece of our project, we'll need some help in the form of a library called 'Timealarms'. This awesome library will make it super easy for us to set alarms and trigger our music to go off in the morning.
You'll want to download the library from here and install it to your arduino IDE.
At the top of your code file, you'll want to set the time. I usually set this right before I deploy.
Next, you'll want to create the actual alarm. This means putting in the time you want to set the alarm off at, and a function that it should call to start the alarm.
Remember too that this alarm is in military time, so 8PM would actually be 20.
Step 5: Putting All the Code Together
Now, let's combine all the coding elements we just learned into one to create our project!
The basic logic goes something like this:
Wait for our alarm to go off...
Once it does, start the music!
Stop the music when we no longer can feel any force on the force sensor for a whole 30 seconds. This prevents my sister from just sitting up real quick and turning the alarm off.
Then, go back to waiting for the alarm to go off the next day!
Step 6: Full Deployment
Finally, we will want to deploy everything to their actual location. Since the force sensor is pretty thin and lightweight, I was able to just put a small piece of tape on it and put it under the comforter. If you put it under enough pieces of bedding, the person sleeping on top can barely feel it, but the sensors still works pretty well.
Make sure to also plug in your speakers to your LinkIT ONE so that it can play it!
Hopefully this will serve you a little more incentive to get out of bed in the morning!
Step 7: Going Forward
Hopefully this instructable has given you a good grasp of the capabilities of the LinkIt ONE and a cool project to boot. Going forward with this project, I would look to expand on the coding aspect of it. Maybe put in different alarms? Or maybe even try and hook up an SD Card full of music so you don't always wake up to the same thing! Tons of possibilities exist with the LinkIt ONE!