Introduction: A Heartbroken Lamp
It's a lamp which enjoys himself. Without human interupt, he opens his lid and listens to his favorite music.
But when people approach to him at a certain distance, due to a bad memory of previous mater, he tries to hide himself by shutting down its lid, turning off the light and music. He completely hide himself from any human beings. What a poor lamp..
Here are materials and instructions that I used. Hope you enjoy it!:)
Step 1: Tools & Materials
Servo motor (X2)
LED (Amazlab UB2 LED Retro Bright Idea Lightbulb USB Powered)
USB Type A Female Receptacle Breakout board
Wooden sticks (X4)
Step 2: Write and Test a Code (Arduino)
First of all, I wrote and tested a code one by one until I got everything work.
When people are away from the lamp
1. Activate a ultarsonic sensor-when the distance is more than 40cm
2. Show 'ON' sign (rotate a servo motor 180 degree from 'NO' sign)
2. Open the lid (rotate another servo motor 90 degree)
3. Turn the LED on
4. Play music track #1
When people apporach to the lamp
1. Activate a ultarsonic sensor-when the distance between the lamp and him/her is less than 40cm
2. Show 'NO' sign (rotate a servor motor -180 degree from 'ON' sign)
3. close the lid(rotate the other servo motor back)
4. Turn off the LED
5. Music off
Step 3: Create a Box & Put Stuff Together
I used a light material, a cardboard, which a servo motor can easily support.
After making a simple box, I drilled holes to put ultrasonic sensor on the front aspect and holes for two servo motors on each side. Servo motors should be firmly attached in order to make the wing ratates, otherwise, the motor itself revoles. Eventually, I put both motors on the surface of the box directly. And for the support, I colored wooden sticks in black and used cable ties to adhere together and used glueguns to fix them firmly.
Making part is not really challenging but figuring out where to attach the servo motors. I'd recommend you to use a hinge machanism (https://www.youtube.com/watch?v=kh252HOZrqc) and try it with a light material if you going to use normal servos. Or you can use any material you want and use DC motors which is more powerful than servo motors.
Step 4: Enjoy!!:)
You can go back and forth in front of the lamp and play!!
We have a be nice policy.
Please be positive and constructive.