Lamp, is a Bluetooth-controlled desk lamp.
It can be controlled by the computer through the (ARDUINO.IDE) or from an app on an Android device. This project was done with my 10 year old son. The goal was to try to do something fun to use that would wake up Some interest in it for robotics and programming...
For this we gathered some material that we had at home, a piece of wood, An old lamp that was damaged, an Arduino kit of initiation and HM-05 bluetooth controller.
Attention to play with electricity can be very dangerous, do not plug directly from 220v to relay NEVER.
In this project I used a AC Adaptor to limit the eletric tension to only 12V.
1 - Piece of wood with 200x1,8x0,5 cm, cut in 6 equal parts of 40 cm.
1 - Piece of wood with 20x16x0,5 cm
1- Arduino kit
1 - Bluetooth HM-05
2 - Servos
1 - Relay 5V
1 - AC Adaptor 12V and the Lamp socket that re-used from the old demaged lamp.
Step 1: Cut and Assemble:
Cut the piece of wood with 200x1,8x0,5 cm, cut in 6 equal parts of 40 cm.
Make a hole in the middle 1cm away from the top and at the base of the wooden ruler
Do the same for the remaining pieces.
At the wooden base drill holes for the arduino, relay, vertical arm and servo.
Many bolts with nut will be needed, 3 spacers with 2 cm and 6 spacers with 1cm.
Step 2: Arduino Connections
With Prototyping Shield for Arduino that comes with the beginner kit it is easy to make all the connections.
Lots of GND and +5V rails
Servo1 pin 9, used a ( futaba S3003 ) from a old plane for more power.
servo2 pin 10
light (relay) pin 13
bluetooth pin 0 "white" connect (TXD) and pin 1 "green" connect ( RXD ) "red" to +5V "black" to GND
I used the HM-05 Bluetooth module but only works with android for iphone you need HM-10 bluetooth 4.0 Module.
Step 3: The Code
You have to import to arduino libraries the ( VarSpeedServo ).
After some test I have chosen to use this option because it allows to set a value for speed of the servo.
The servos position is also adjustable by coding ( angle1 = angle1 + 30; ) and the speed ( int SPEED1 = 30; // Sets servo1 speed )
The values for bluetooth app ( if (input == "2") )...
Step 4: Power AC Adptor
The relay connection is made through the power adapter,
that will connect the gnd (Black) to the NC, and 12V (Red) to NO.
Before connecting the wires of the 12V power adapter, first test the relay is working properly since it is to be powered by the Arduino + 5V and the switch must already work. ( turn red ON )
You can use the 12V AC adaptor to power the arduino, do not connect this lead directly to the relay as it will not work properly. Make a connection lead before.
Step 5: The App
the app used for control desk lamp is Android Bluetooth Controller
is very easy to set the value for the keys, also i can use de ( ARDUINO.IDE ) through the serial monitor.
Set the value 2 for height up (servo1 )
Set the value 3 for height down (servo2 )
Set the value L for left move
Set the value R for right move
Set the value 1 for light On
Set the value 0 for light Off
Set the value 4 for detach (servo1 )
Set the value 5 for attach (servo1 )
Step 6: Next
- Improve balance of horizontal arm, lack weight to balance arm.
- Swap the bluetooth HM-05 for HM-10 or another that is 4.0 to be able to run with IOS.
- Insert the power adapter to supply power to the Arduino as well.
I hope you enjoyed…
It is remember the electrical energy is dangerous, do not touch the electric power without being present an adult.