Introduction: Bluetooth Smart Light Switch
Hi, My name is Rachel, and I am a senior at Irvington High School. I did this project for Ms. Berbawy's Robotics class. In our class, we have a Maker Space which included 3D printers, a laser cutter, Soldering Irons, etc.
Have you even been so lazy or tired at night to the point that you don't even want to stand up and turn off the lamp beside your bed? Then the Bluetooth light switch is the perfect switch for you! Bluetooth Smart Light Switch enables you to turn the device on and off from your phone.
For a video of the completed project.
The original project instructions made by Alasdair Allan, Don Coleman, and Sandeep Mistry can be found at http://makezine.com/projects/diy-smart-light-switc...
Step 1: Materials
Materials that you will need:
1 Arduino Uno ($21.99 from amazon)
1 LED light (100 pieces from amazon: $6.97)
1 Powerswitch Tail ($25.95 from adafruit.com)
2 solderless breadboard ($4.35 from Amazon)
Male-Male Jumper Wires ($5.99 from Amazon)
1 nRF8001 Bluetooth LE board ($19.95 from adafruit.com)
1 push button ($2.75 for 100 tactile push button on Amazon)
1 smart phone
Materials that you will need for the box:
PLA( polylactic Acid)
Step 2: Tools/ Equipment
Tools that you will need:
- 1 computer with Arduino IDE
- 1 soldering Iron
- 1 screwdriver
If you want to make a box for the project, you can try 3D printing the project.
Tools you will need for 3D printing the project:
- 1 3D printer (The 3D printer I used was Lulzbot Taz 6 with MOARstruder)
- 1 laser cutter (40 Watts)
Step 3: Testing the LED
In this step, you will be testing the LED light after connecting it to the Arduino.
First, connect the LED light to the Arduino Uno board. The Anode is connected to pin 13 and the Cathod is connected to GND.
Second, connect the Arduino Uno to the computer using a USB cable.
Next, open the Arduino IDE and look for the code used to turn the LED on and off. It will be under File -> Examples -> 01. Basics -> Blink
After you open the code on Arduino IDE, verify it then upload it. To verify a code, click the check that is under File on the top left hand corner.
Then the LED will be turning on and off by itself!
Problems: If you are having problems uploading your code, check under tools that you choose Arduino Uno as your board and you also choose the right port.
LED picture was taken from the RC Trains website.
Information on the code: loop makes the function repeat
When the LED is on high it turns the led on, and when it is on low it turns the led off.
Step 4: Mistakes
When I first tried to test the push button, I put everything together like the diagram above, but no matter how many times I tested it, it would not work. That is why I found another way to test the push button.
The diagram was taken from the Make website.
Step 5: Tuning the LED on and Off With a Button
In this step, you will be connecting the push button to the Arduino Uno and the LED.
First, connect everything like the picture shown above, the red, blue, and black lines are jumper wires. The resistor in the picture shown above is a 10k ohms resistor.
Picture was taken from the Arduino website.
Second, open Arduino IDE and look for the code under File -> 02. Digital -> Button
Third, repeat the process of verifying the code then upload it.
Then the LED should be turning on and off when you push the button!
Information on the code: When the push button is pressed, it means that the button's state is on high, and the led should turn on.
when the button is not pressed the led is turned off, the LED pin should be on low.
Step 6: Turning the LED on and Off Using Bluetooth
First, break off the extra pins for the Bluetooth LE board. Then solder the pin to the Bluetooth LE board(Bluetooth Low Energy Board).
Second, connect one of the solderless breadboard to the Bluetooth LE board.
Third, connect everything like the picture above. (The picture above the code on the right hand side.)
The picture was taken from the Make website.
Fourth, download the code from the GitHub website.
The code is inside the ble-smart- switch folder. Click on the ble-smart-switch.ino to display the code. Then transfer the code on to Arduino IDE. Download the library (Sketch-> Include Library-> Manage Libraries-> look up BLEPeripheral-> install it)
code done by Alasdair Allan
After transferring the code, verify it then upload it on to the Arduino Uno.
Get your phone and download the Bluetooth app. If you have an android phone the app is called nRF Master Control Panel. If you have an iPhone, it is called Light Blue. (a picture of the Light Blue app is shown above, the picture was taken from the App Annie website.)
After you are done downloading, turn on Bluetooth on your phone, keep your Arduino Uno connected to the computer, then open the app. After opening the app you should see "Smart Light Switch" under Peripherals Nearby. Tap on "Smart Light Switch", then tap on switch. After you tap on switch, it will show the value of switch, which should be on 0X00, this means the LED is off. Under that, you should see a line where it said "write new values", tap on it and type 01. Then the value of the switch will turn into 0X01 which will turn the LED light on.
Problems: If you do not see the "Smart Light Switch" under the Peripherals Nearby, then check if everything is connected correctly, and properly.
Information about the code for Bluetooth LE. There are two characteristics: state and switch. For switch, the UUID(universally unique identifier) is FF11, for State the UUID is FF12. The UUID(universally unique identifier) is a number the computer uses to analyze information. Under the switch characteristic, when it is 01 the LED light should be on, and when it is 00 the LED light should be off. The state characteristic will alert us when there are any changes in the status of the switch. When the LED pin is HIGH it means it should be on and when LED pin is low it should be off.
Information gotten from the Make website.
Step 7: Connect the Power Switch Tail
First, take a screwdriver and unscrew the screws on the top of the power switch tail.
Second, connect everything according to the picture shown above.
Picture was taken from the Make website.
Third, download the code from the GitHub website.
The code we need for this step is in the ble- light- with-powertail folder. Then click on the ble-light-with-powertail.ino to see the code. Then transfer the code onto Arduino IDE.
code is done by Alasdair Allan.
After transfering the code, verify it then upload it to the Arduino Uno.
Next, connect the power switch tail to a lamp or any other electrical device( as long as the voltage is 210vac) to one end of the power switch tail and connect the other end to an outlet.(Remember to keep the Arduino connected to a power source)
I didn't have a multi-outlet extension cord with an USB ports, so I used a battery charger that has a USB ports (there is a picture of the battery charger above).
Then you should be able to turn the lamp or electrical device on and off using Bluetooth!
Problems: If it is not working, check if the switch on the lamp is turned on.
Information on the code: In this code, (LED_PIN, HIGH) is changed to (LED_PIN, LOW) and (LED_PIN, LOW) is changed to (LED_PIN, HIGH). It is because power will only flow when it is on Low for the power switch tail.
Step 8: Making the Box
If you want to 3D print your box you can just print this out:
Box Dimensions: 8.5in.*6.5in.*4.25in. Thickness is 0.25in
If the holes on the side are too small, you can Dremel it to make it bigger.
I used Autodesk Inventor to make the box then 3D print it.
Problem: When I printed the box, the holes are not big enough so I had to Dremel the holes.
It takes about 6 hours to 3D print this box.
For the top, I used clear acrylic and I used the laser cutter to cut it. To make top you have to cut 5 pieces.
Acrylic box top:
1st piece: 9in*7in
Acrylic box sides:
2nd & 3rd piece: 9in*0.25in
4th & 5th piece: 6.5in*0.25in
After you are done cutting acrylic just glue it together with acrylic glue and wait for it to dry.
Have Fun with the project!