Intro: Android Phone Controlled Lamp
In this Instructable we're going to make a lamp that we can control with an android phone. Using an app, we'll be able to adjust the brightness of the lamp.
Step 1: How It Works
The brightness of the lamp is regulated by a simple dimmer switch. The switch is rotated autonomously using a basic servo, that is controlled by an arduino. The arduino rotates the servo in a particular fashion when it receives a certain command from the android phone. The commands are sent via bluetooth. The phone app sends a command whenever the user adjusts the brightness of the phone, either verbally or with text.
*All the code has already been written and is available throughout the Instructable.
Step 2: Materials and Tools
- Desk Lamp
- Dimmer Switch //controls brightness of lamp, available at any hardware store
- Wire Box //box that encloses switch contents, available at any hardware store
- Switch Plate
- 3 screw nuts //Generally comes packaged with dimmer switch
- Arduino Uno
- Bluetooth Module //I'm using a bluetooth mate
- 9v Battery and Battery Pack //You only need one battery pack to power the servo, but I'm using a second one to power the arduino
- Android Phone
- Glue Gun
- Wire Strippers
- Soldering Iron
- Electrical Tape
Step 3: Install the Dimmer Switch
This part of the project is going to take a few steps to get through. Proceed with caution. The installation is straight forwards but we don't want to take any risks.
Start off by unplugging the lamp. Make sure the lamp is unplugged until the installation is over!
Now, cut the lamp cord in two. I recommend cutting the wire near the half way point.
Step 4: Strip the Lamp Cord Wires
Strip all 4 wires of the lamp chord.
Step 5: Snip the Neutral Wire From Dimmer Switch
We won't need to use the neutral wire on the dimmer switch. So I recommend snipping the exposed portion of the neutral wire as a precaution.
Step 6: Connect Lamp Cord Wire to Dimmer Switch
We have to identify the side of the cord that is neutral and the side of the cord that is hot. The neutral side will tend to have ribbing or ridges. I double checked by opening up the lamp. You can triple check with a multimeter. The neutral side will be connected to a white wire and the hot side will connected to a black wire. After you have identified the hot and neutral sides, label them to ensure there will be no errors.
After you label the wires, run them through the sides of the wire box.
Connect the neutral wires together with a screw nut and connect the each of the hot wires to a black wire on the dimmer switch, also with a screw nut. Wrap the screw nuts with electrical tape afterwards.
Step 7: Screw Switch and Lid in Place
Stuff the wires in the wire box and then screw the switch and lid in place, with the provided hardware.
Congratulations! You have successfully installed a dimmer switch on your lamp. Plug the lamp into a socket and adjust the brightness by rotating the switch dial.
Step 8: Attach Servo, 9v Battery Packs, Breadboard and Arduino
Hot glue the servo horn to the centre of the dial.
Secure the servo to the switch plate in any way that you would like. I bolted one section of the servo to the switch plate.
I know it doesn't look very pretty but it was quick to set up :)
Afterwards, attach the arduino to the wire box. I kept my arduino in place with an elastic.
Glue your battery pack, for the servo, to the box and stick your breadboard on as well.
I glued on a second battery pack to power the arduino.
Grab the bluetooth module and stick it into the breadboard.
Step 9: Wire the Servo and Bluetooth Module Up
Wire up the servo and bluetooth module.
Make sure the RX port of the bluetooth module is connected to the TX port of the arduino. And that the TX port of the bluetooth module is connected to the RX port of the arduino.
Ensure the servo is connected to port 8 of the arduino.
Step 10: Upload Arduino Code
Upload the code to your arduino board.
Step 11: Install Protocoder
Install Protocoder on your android phone.
Step 12: Upload Code to Phone
Make a new program in Protocoder and paste the contents of phoneCode.js into the program.
Step 13: Try It Out!
You have finished making an RC Lamp.
Power your arduino and then run the app on your phone. Tap Connect To Bluetooth and select your bluetooth module. Wait for the module to connect, generally the module will have an LED indicator. Enter a value from 0-180 and watch the lamp adjust. Try using the voice control method afterwards. Tap Inc/Dec and then say either Increase, Decrease, or Stop. Saying increase will brighten the lamp. Saying decrease will dim the lamp. And saying stop will stop the servo.
Step 14: Future
You may notice that if you send an 'a' or 't' over the serial port, the lamp will start flashing. In the future, I was hoping to get the lamp to flash every time the user received a text or set an alarm. If you guys come up with any ideas on how to improve the lamp, I would love to hear them.
mehdis3 made it!