Smart Bedside Mat - Stand on It to Stop the Alarm!
by Arpan Mondal in Circuits > Arduino
2351 Views, 24 Favorites, 0 Comments
Smart Bedside Mat - Stand on It to Stop the Alarm!
The Covid 19 lockdown changed everyone's lives. It brought in some good habits and some bad ones too. And one bad habit I developed after the lockdown is waking up late. I have now mastered the skill of snoozing the alarm multiple times until it's so late that I have no option but to skip my morning workout! If you or your kids have the same problem, here is the ultimate solution - The Smart Wake-up Mat! This floor mat is an alarm clock that should be placed beside your bed. Once the alarm starts ringing, the only way to stop it is to get up and stand on the mat for 5 to 10 seconds. Now that is something you can't snooze! Full disclosure, this is not an original idea of mine. I had come across a similar product on amazon but it was very expensive. This DIY version is very inexpensive and easy to make. Plus, you have the option to customize it to your heart's content. Sounds interesting? Then let's get making!
Supplies
1x Arduino UNO / NodeMcu Link to buy
1x Piezo buzzer Link to buy
1x LED (Optional)
1x 10k Ohm resistor Link to buy
Aluminum foil wrap
Cardboard
Wires
Glue
1x Floor mat (Obviously)
Designing the Circuit
The circuit is pretty simple. I suggest you give it a try on Tinkercad first (like I did). The reason is that you can simulate the circuit online and make sure it works before actually building it. This will avoid having to debug the errors after making all connections which is a hassle.
Due to the project's minimal component count, it's a good option for Arduino newbies. A push button, a 10K resistor, and a buzzer are all that is required.
Make the circuit as depicted in the pictures above. Using Tinkercad is very simple, and it also enables Arduino board emulation. In other words, you can simulate running the code and observe how the Arduino responds. I, later on, added an LED parallel to the buzzer for visual indication when the alarm goes off. But this is optional.
Code and Simulation
Coding can be the most boring part for some people. To be honest, it used to be the same for me too. But you can easily make it much more fun and intuitive by using code blocks instead. Tinkercad thankfully has code blocks built in so we can make use of that.
Let's start easy. Ignore the code in the first image for now. Start with the second image.
Arduino has two functions by default. The SETUP and LOOP. Or in code blocks, we can call them ON START and FOREVER. The ON START part will run only once when you power the Arduino ON. The FOREVER part will run continuously, you know, forever (Until you power the Arduino OFF)
In the ON START section, we turn pin 6 ON, wait for 1 second and then turn pin 6 OFF. This is to produce a beep once the Arduino is powered to give an indication that the Smart Mat is now active. So pin 6 is where the buzzer will be connected. We also set the alarm_time variable to 86400. This is to set 24 hours as the time difference between two alarm rings. 24 hours equals 86400 seconds.
Now we get to the FOREVER section. First, we wait "alarm_time" seconds. In other words, we wait 24 hours before the alarm rings again. Then we set "flag" to 5. This variable defines how long you have to be standing on the Mat for the alarm to turn off. Here I have defined this duration as 5 seconds. When it is time, the code repeatedly turns the buzzer ON and OFF with a wait time of 500 ms between each beep.
But when pin 2 reads an input (HIGH), the value of the "flag" is reduced by 1. The weight sensor under the Smart Mat is connected to this pin. So, we have to stand on the Mat until the value of "flag" becomes 0. In this case, it is 5 seconds. Once the alarm turns off, the whole process repeats again after 24 hours.
You might have noticed, I am also reducing the value of the variable "alarm_time" by 1 every time the buzzer beeps. This is to compensate for the time consumed during the alarm ringing from the 24-hour duration.
In any case, I have attached the INO code file in this step. You can download it and directly upload it to your board in case you would want to try it out.
Or, you can interact with my Tinkercad simulation too! I have embedded my simulation here so you can try it out. In the simulation, I have added a 10-sec interval instead of 24 hours. I'm sure you don't want to wait 24 hours to test the simulation :)
When you click on "Start Simulation", you should hear one beep from the buzzer indicating that the circuit is ready to operate. After 10 seconds, you should hear continuous beeps. If you press the push button and hold it for 5 seconds, the beeping will stop. After 5 more seconds, it will repeat all over again.
Downloads
Build the Weight Sensor
While you can get a load cell for more reliable and accurate sensing, I prefer to keep it simple. Here, the "Weight Sensor" is just a fancy name for a large DIY push button. To make it, first, cut two rectangles from cardboard. The dimensions can be slightly smaller than the dimensions of your mat. My mat measured 55cm X 35cm. So I kept the dimensions of my weight sensor 50cm X 30cm. If you want it to be more durable, I suggest using thin MDF board instead of cardboard.
Then cut a third cardboard rectangle, but this time, make it hollow from the middle. It should look like a photo frame. You can get references for my dimensions from the images above.
Now, take some aluminum foil wrap and stick it evenly on the two cardboard rectangles. Stick one piece of wire to each foiled surface. Then stick all three rectangles with the hollow frame sandwiched in between. Make sure the foiled surfaces are facing inward. Well, now we have our very own "Weight Sensor"!
When you put your weight on it, the top cardboard bends and makes contact with the bottom one. This completes the circuit. When you take your weight off it, the cardboard straightens and loses contact which breaks the circuit.
Build the Circuit
This is quite simple. Just follow the circuit you made on Tinkercad. I have assembled my circuit inside a black cardboard box to make it look cleaner and hide all the messy wiring. The weight sensor goes in place of the push button in the Tinkercad circuit. One thing I didn't explain earlier is why there is a 10 K ohm resistor connected to pin 2 and GND. This is called a pull-down resistor. This prevents the Arduino from reading random values from the environment when the weight sensor is OFF.
Now power it all up with a 5V power adapter. You can use a smartphone charger for this. Lastly, place the weight sensor under your floor mat. And finally, we have finished making the DIY Smart Floor Mat!
What Next?
This was definitely a fun project to build and try. I do have some thoughts about making the Smart Mat smarter. Firstly, it is not very intuitive to have a 24-hour delay for the alarm to ring. It will be much better to have a mobile app so that we can set alarms whenever we like to. That is actually very simple to make. We can use a NodeMcu instead of an Arduino and use an IFTTT applet to set the time. I've made multiple projects earlier using NodeMcu and IFTTT. Here's one for reference: ISS Globe- Blinks When the ISS Passes Overhead
Another problem with the current version is that if there is a power cut in between, the delay will get reset to 24 hours. This can also be solved using NodeMcu and IFTTT.
Another improvement can be adding a nice tone to the buzzer instead of it just beeping. Also, we can add a night light to the floor mat so that when you step on it in the middle of the night to use the washroom, it can light up your path.
These improvements can be added to another version - Wake-Up Mat 2.0. But as of now, this is it. I hope you enjoyed the project! Feel free to drop your ideas and questions in the comments. And if you make one too, don't forget to add it in the "I Made It section", I'd love to see your version!