Birthday Surprise With Arduino
About the project
By using this EVIVE STARTER KIT I am going to give a small surprise to my partner on her birthday.
Estimated time: 1 hour
In a world where everything is new and interesting, surprises make your life awesome. It is a perfect way to add a spark to a dull week and make it fun. One way to give a smile on someone's face is by giving them a small gift. There is nothing like a gift that can bring a smile on someone's face and your own.
Electronics and love, are like the north-pole and the north pole, the only correlation between them is that they always repel each other. BUT, STEMpedia has given a new definition to love by combining love with electronics. By using this EVIVE STARTER KIT I am going to give a small surprise to my partner on her birthday.
Step 1: Circuit Diagram
The plan is to shower love upon my partner with rose petals, as soon as she walks out of our bedroom.
For this project we need: 1. HC-SR04 Ultrasonic Sensor 2. SG90 Servo Motor 3. ATmega2560 powered evive Starter Kit The good thing is, all these components are part of the evive Starter Kit.
Start by connecting the TRIG pin and the ECHO pin of the ultrasonic sensor to Pin numbers 12 and 11 of the Arduino. Then connect the PWM pin of the servo to Pin number 9 of the Arduino. After that we are going to connect all the +ve and -ve terminals of the sensors to the +ve and -ve pins of the Arduino. That's it, it's just simple as that.
Step 2: 3D Model
Using a 3D model I am going to show you guys the design and working of the flower dispenser.
Alright, so this is the whole setup. The back bit sticks to the wall and using these two holders it holds a lightweight stick which in-turn will hold the front-bit or the dispenser. I am going to put all the rose petals in here. When the ultrasonic sensor detects an object in its way, it will send a signal to the Arduino, which will then rotate the servo causing the dispenser flap to open. When the flap opens all the rose petals will fall on my partner. The whole setup is made using a cardboard box, making it lightweight and easy to stick to the wall.
Step 3: Quick Demo
So, this is how it looks like.
Once we power the evive starter kit, the ultrasonic sensor starts waiting for a moving object. As soon as an object is detected the flap opens up to dispense the flowers.
Step 4: Code
The code has two parts, in the first part we are detecting the motion using an ultrasonic sensor and in the second part, we are rotating the motor to open the flap whenever motion is detected.
Start by including the "Servo.h" library in the program. Then define the constants and the global variables that will be used throughout the code. To use the servo we are creating an object of the Servo class. Then in the setup section, we are initializing the servo by using the "servo.attach()" function and defining the pin modes for the ultrasonic sensor.
Finally, in the loop() section after initializing the ultrasonic sensor we are checking if the distance of the moving object is less than 100cm. If the distance is less than 100cm we are going to open the flap by rotating the servo 90 degrees.
Step 5: Testing
Alright, now the interesting bit. So, let's go ahead and set everything up. The petals dispenser stays on the top of the door and the ultrasonic sensor at her waist level. Finally, I just need to connect all the sensors to the evive box. After that, it's just a matter of waiting for her to come out and activate the sensor. If everything goes as per plan, I would be able to give her a nice surprise.
Step 7: Files
Step 8: Thank You
Thanks again for reading the tutorial. I hope it helps you.
If you want to support me you can subscribe to my channel and watch my other videos. Thanks ca again in my next video, bye now.