Bluetooth Voice Controlled Moving Lamp
by Nikus in Circuits > Arduino
20638 Views, 240 Favorites, 0 Comments
Bluetooth Voice Controlled Moving Lamp
![mini.jpg](/proxy/?url=https://content.instructables.com/FOD/ZCCT/J7AQVPOO/FODZCCTJ7AQVPOO.jpg&filename=mini.jpg)
![Arduino Voice Controlled Bluetooth Moving Lamp](/proxy/?url=https://content.instructables.com/FDA/F5H8/J7ARGA2W/FDAF5H8J7ARGA2W.jpg&filename=Arduino Voice Controlled Bluetooth Moving Lamp)
![DSC00637.JPG](/proxy/?url=https://content.instructables.com/FHJ/4YLO/J7AQV3EW/FHJ4YLOJ7AQV3EW.jpg&filename=DSC00637.JPG)
![DSC00668.JPG](/proxy/?url=https://content.instructables.com/F0Y/5EQL/J7AQV3Z9/F0Y5EQLJ7AQV3Z9.jpg&filename=DSC00668.JPG)
Bluetooth and voice control, this two topics are close to each other when it comes to Arduino. A lot of people want to make something with bluetooth, and some of them want to use voice control. There are a lot of project of bluetooth controlled, robots, cars, boats, drones and so on. And they are cool, I like them, but I prefer to make more original things, that have never been made before or at least add something new to old, well known things. When I am making this kind of projects I feel like Neil Armstrong when he was the first man on the moon :D Just kidding, but I like creating new things that have never been made before, because I can :)
So what I wanted to make in this project? Basicly a lamp, everyone know what is a lamp but for last few hundreds of yeas when you wanted to move your lamp you have to make this by hand. And this is a simple task, but imagine this kind of situation, that I faced with very often, you are soldering something, in one hand you have soldering iron and tin in second hand. So if you want to move a lamp you have to stop soldering move the lamp and start again. That's annoying! And here my lamp comes, to overcome this problem I added a voice control over bluetooth. So if dream about controlling your lamp with your voice, you want to solder more efficient or you are such a lazy person :) this project is perfect for you! Without more talking let's see what we will need to make it.
Subscribe to my channel: https://goo.gl/x6Y32E
Like my Facebook fan page: https://www.facebook.com/Nikodem-Bartnik-18911577...
Follow me on Instagram: https://www.instagram.com/nikodembartnik/
What We Will Need?
![DSC00538.JPG](/proxy/?url=https://content.instructables.com/F1E/1SBP/J7AQVPQT/F1E1SBPJ7AQVPQT.jpg&filename=DSC00538.JPG)
![DSC00544.JPG](/proxy/?url=https://content.instructables.com/FH3/HIG6/J7AQVQ9E/FH3HIG6J7AQVQ9E.jpg&filename=DSC00544.JPG)
![DSC00548.JPG](/proxy/?url=https://content.instructables.com/FE9/X8N4/J7AQVQJ8/FE9X8N4J7AQVQJ8.jpg&filename=DSC00548.JPG)
There are no all of the components on the photo above because I forgot about putting them on it :) Sorry, here is the list of all things that we will need:
- Servo motors (x3)
- Lamp
Bottom Plate
![DSC00549.JPG](/proxy/?url=https://content.instructables.com/FMF/4LR9/J7AQVQJI/FMF4LR9J7AQVQJI.jpg&filename=DSC00549.JPG)
![DSC00551.JPG](/proxy/?url=https://content.instructables.com/FIS/QBGR/J7AQVQMW/FISQBGRJ7AQVQMW.jpg&filename=DSC00551.JPG)
![DSC00552.JPG](/proxy/?url=https://content.instructables.com/FD1/Y2TY/J7AQVQP2/FD1Y2TYJ7AQVQP2.jpg&filename=DSC00552.JPG)
Put servo cable in hole on the side of servo container and screw servo down with M2 screws.
Rotary Disk
![DSC00553.JPG](/proxy/?url=https://content.instructables.com/FM6/H8IC/J7AQVQR8/FM6H8ICJ7AQVQR8.jpg&filename=DSC00553.JPG)
![DSC00555.JPG](/proxy/?url=https://content.instructables.com/F31/K212/J7AQVQTD/F31K212J7AQVQTD.jpg&filename=DSC00555.JPG)
![DSC00557.JPG](/proxy/?url=https://content.instructables.com/F12/46CJ/J7AQVQTG/F1246CJJ7AQVQTG.jpg&filename=DSC00557.JPG)
![DSC00558.JPG](/proxy/?url=https://content.instructables.com/FF4/F36H/J7AQVQTJ/FF4F36HJ7AQVQTJ.jpg&filename=DSC00558.JPG)
![DSC00560.JPG](/proxy/?url=https://content.instructables.com/FKS/CAA1/J7AQVQXH/FKSCAA1J7AQVQXH.jpg&filename=DSC00560.JPG)
To servo that we mount previously we can screw down 3D printed disk that will hold rest of our lamp. Make sure that you use small screw, otherwise it will be impossible to mount servo. Simply put the servo in place and leave cable on the back of the servo. Screw it down with two M2 screws. Make sure that everything is ok and screws are tightened.
First Arm
![DSC00562.JPG](/proxy/?url=https://content.instructables.com/FBU/XX4W/J7AQVQZ9/FBUXX4WJ7AQVQZ9.jpg&filename=DSC00562.JPG)
![DSC00563.JPG](/proxy/?url=https://content.instructables.com/F82/5QZQ/J7AQVR9J/F825QZQJ7AQVR9J.jpg&filename=DSC00563.JPG)
![DSC00564.JPG](/proxy/?url=https://content.instructables.com/FW8/BINX/J7AQVRFY/FW8BINXJ7AQVRFY.jpg&filename=DSC00564.JPG)
![DSC00565.JPG](/proxy/?url=https://content.instructables.com/FLG/VLEA/J7AQVRHK/FLGVLEAJ7AQVRHK.jpg&filename=DSC00565.JPG)
![DSC00567.JPG](/proxy/?url=https://content.instructables.com/FA3/YZFY/J7AQVRN3/FA3YZFYJ7AQVRN3.jpg&filename=DSC00567.JPG)
![DSC00568.JPG](/proxy/?url=https://content.instructables.com/FGI/03GU/J7AQVRN5/FGI03GUJ7AQVRN5.jpg&filename=DSC00568.JPG)
![DSC00569.JPG](/proxy/?url=https://content.instructables.com/FEA/53LP/J7AQVRRX/FEA53LPJ7AQVRRX.jpg&filename=DSC00569.JPG)
![DSC00571.JPG](/proxy/?url=https://content.instructables.com/FLS/K6RM/J7AQVRWQ/FLSK6RMJ7AQVRWQ.jpg&filename=DSC00571.JPG)
First arm is the one with my name and place for servo at the end. Firstly you should put cable inside special hole that hide the cable and make it look cleaner and better (later I also put right there servo cable, you also should, so do it now, because later you will have much more work to do so). Cable should be long enaugh to connect LED with relay so keep that in mind. When cable is in place you can mount the arm on the disk and servo as shown above, be careful because it is easy to broke this part. Screw arm to servo with M2 screw. On the top of the arm you have to put last servo (remember about servo cable) and screw it to arm with long M2 screw. Make sure that everything is solid :)
Second Arm (top Arm)
![DSC00572.JPG](/proxy/?url=https://content.instructables.com/FYR/C6J8/J7AQVS1K/FYRC6J8J7AQVS1K.jpg&filename=DSC00572.JPG)
![DSC00573.JPG](/proxy/?url=https://content.instructables.com/FYV/P59L/J7AQVS80/FYVP59LJ7AQVS80.jpg&filename=DSC00573.JPG)
![DSC00574.JPG](/proxy/?url=https://content.instructables.com/FBP/BUUF/J7AQVS9O/FBPBUUFJ7AQVS9O.jpg&filename=DSC00574.JPG)
![DSC00575.JPG](/proxy/?url=https://content.instructables.com/FT7/NL07/J7AQVS9Q/FT7NL07J7AQVS9Q.jpg&filename=DSC00575.JPG)
Again we can start by putting cable in hole (the same cable that we put in first arm in previous step). And the same as before fix arm to the servo shaft with M2 screw.
Diode Installation
![DSC00578.JPG](/proxy/?url=https://content.instructables.com/FUG/T4VH/J7AQVS9Y/FUGT4VHJ7AQVS9Y.jpg&filename=DSC00578.JPG)
![DSC00579.JPG](/proxy/?url=https://content.instructables.com/F0D/PVEL/J7AQVSA1/F0DPVELJ7AQVSA1.jpg&filename=DSC00579.JPG)
![DSC00581.JPG](/proxy/?url=https://content.instructables.com/FWQ/8OMP/J7AQVSI4/FWQ8OMPJ7AQVSI4.jpg&filename=DSC00581.JPG)
![DSC00582.JPG](/proxy/?url=https://content.instructables.com/FBI/3ZJL/J7AQVSU6/FBI3ZJLJ7AQVSU6.jpg&filename=DSC00582.JPG)
![DSC00585.JPG](/proxy/?url=https://content.instructables.com/F5G/H2BL/J7AQVT49/F5GH2BLJ7AQVT49.jpg&filename=DSC00585.JPG)
![DSC00588.JPG](/proxy/?url=https://content.instructables.com/FS3/L2UH/J7AQVT4X/FS3L2UHJ7AQVT4X.jpg&filename=DSC00588.JPG)
![DSC00590.JPG](/proxy/?url=https://content.instructables.com/FA7/6L6A/J7AQVTDN/FA76L6AJ7AQVTDN.jpg&filename=DSC00590.JPG)
It's time to install diode in arm but firstly we have to solder it to cables. So take of the insulation, twist the cables, put shrinkable sleeves on the cables, and solder them. Remember about polarity and colors. In my case grey is + and black is -. At the end just put led diode in hole at the end of arm. It should stay in place without any glue.
Pull the Cable
![DSC00592.JPG](/proxy/?url=https://content.instructables.com/FUI/CX0M/J7AQVTGA/FUICX0MJ7AQVTGA.jpg&filename=DSC00592.JPG)
![DSC00593.JPG](/proxy/?url=https://content.instructables.com/F1W/DSUH/J7AQVTGK/F1WDSUHJ7AQVTGK.jpg&filename=DSC00593.JPG)
You will propably have to much cable between the arms, just pull it on the down side.
Top Servo Cable
![DSC00594.JPG](/proxy/?url=https://content.instructables.com/FUE/HSTD/J7AQVTGU/FUEHSTDJ7AQVTGU.jpg&filename=DSC00594.JPG)
![DSC00598.JPG](/proxy/?url=https://content.instructables.com/F54/TJM3/J7AQVTPT/F54TJM3J7AQVTPT.jpg&filename=DSC00598.JPG)
![DSC00599.JPG](/proxy/?url=https://content.instructables.com/FWY/W4CI/J7AQVTU5/FWYW4CIJ7AQVTU5.jpg&filename=DSC00599.JPG)
![DSC00600.JPG](/proxy/?url=https://content.instructables.com/FQI/1LQ3/J7AQVTUF/FQI1LQ3J7AQVTUF.jpg&filename=DSC00600.JPG)
![DSC00602.JPG](/proxy/?url=https://content.instructables.com/FFU/9XT4/J7AQVU25/FFU9XT4J7AQVU25.jpg&filename=DSC00602.JPG)
![DSC00603.JPG](/proxy/?url=https://content.instructables.com/FLC/LRVB/J7AQVU2G/FLCLRVBJ7AQVU2G.jpg&filename=DSC00603.JPG)
![DSC00606.JPG](/proxy/?url=https://content.instructables.com/FAX/DCWU/J7AQVU7C/FAXDCWUJ7AQVU7C.jpg&filename=DSC00606.JPG)
![DSC00608.JPG](/proxy/?url=https://content.instructables.com/FT7/6WM3/J7AQVU7K/FT76WM3J7AQVU7K.jpg&filename=DSC00608.JPG)
![DSC00611.JPG](/proxy/?url=https://content.instructables.com/FKH/7IIB/J7AQVU7U/FKH7IIBJ7AQVU7U.jpg&filename=DSC00611.JPG)
Frame Finished
![DSC00615.JPG](/proxy/?url=https://content.instructables.com/F4N/HFPL/J7AQVUA7/F4NHFPLJ7AQVUA7.jpg&filename=DSC00615.JPG)
![DSC00612.JPG](/proxy/?url=https://content.instructables.com/F1O/QY4E/J7AQVU9O/F1OQY4EJ7AQVU9O.jpg&filename=DSC00612.JPG)
Electronics Connection
![schematic.png](/proxy/?url=https://content.instructables.com/FXG/TM8A/J7AQW1XG/FXGTM8AJ7AQW1XG.png&filename=schematic.png)
![DSC00665.JPG](/proxy/?url=https://content.instructables.com/F62/NL4W/J7AQV3SR/F62NL4WJ7AQV3SR.jpg&filename=DSC00665.JPG)
![DSC00672.JPG](/proxy/?url=https://content.instructables.com/F8G/9YBG/J7AQV4CJ/F8G9YBGJ7AQV4CJ.jpg&filename=DSC00672.JPG)
![DSC00661.JPG](/proxy/?url=https://content.instructables.com/FIS/WSV6/J7AQV3FT/FISWSV6J7AQV3FT.jpg&filename=DSC00661.JPG)
Arduino Code
![1.png](/proxy/?url=https://content.instructables.com/FVC/CKSV/J7ARG63I/FVCCKSVJ7ARG63I.png&filename=1.png)
Explanation of the code is in the comments. There is one thing that can be unclear. When lamp is moving forward not only middle servo is moving, also the top one, it is needed to make lamp point in the same direction, otherwise it would be hard to control the lamp. The rest of the code simply reads the data from Bluetooth and move the lamp to a proper position. There are also for loops to move lamp slowly just to protect servos and lamp from destruction.
#include
String command; String value;//I don't know why I named them like that. Servo servo_rotation; Servo servo_tilt; Servo servo_height;
int step_delay = 50;
void setup() { Serial.begin(9600); servo_rotation.attach(3); servo_tilt.attach(5); servo_height.attach(6); servo_rotation.write(90); servo_tilt.write(90); servo_height.write(100); //that's for relay pinMode(7, OUTPUT); digitalWrite(7, HIGH); }
void loop() { while (Serial.available()){ delay(10); char command_char = Serial.read(); if (command_char == '#') {break;} command += command_char; } if (command.length() > 0) { Serial.println(command);
//sometimes when you say counter clockwise it sends it together or separately so we have to have right there two if if(command.indexOf("*counterclockwise") >= 0) { value = command.substring(17, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_rotation.read()+1) >= 0 && (servo_rotation.read()+1) <= 180){ servo_rotation.write(servo_rotation.read()+1); delay(step_delay); } } }
if(command.indexOf("*counter clockwise") >= 0) { value = command.substring(18, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_rotation.read()+1) >= 0 && (servo_rotation.read()+1) <= 180){ servo_rotation.write(servo_rotation.read()+1); delay(step_delay); } } }
if(command.indexOf("*clockwise") >= 0) { value = command.substring(10, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_rotation.read()-1) >= 0 && (servo_rotation.read()-1) <= 180){ servo_rotation.write(servo_rotation.read()-1); delay(step_delay); } } }
if(command.indexOf("*front") >= 0) { value = command.substring(7, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_tilt.read()+1) < 140 && (servo_tilt.read()+1) > 50){ servo_tilt.write(servo_tilt.read()+1); } if((servo_height.read()-1) < 150 && (servo_height.read()-1) >= 0){ servo_height.write(servo_height.read()-1); } delay(step_delay); } }
if(command.indexOf("*back") >= 0) { value = command.substring(5, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_tilt.read()-1) < 140 && (servo_tilt.read()-1) > 50){ servo_tilt.write(servo_tilt.read()-1); } if((servo_height.read()+1) < 150 && (servo_height.read()+1) >= 0){ servo_height.write(servo_height.read()+1); } delay(step_delay); } }
if(command.indexOf("*up") >= 0) { value = command.substring(3, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_height.read()-1) < 150 && (servo_height.read()-1) >= 0){ servo_height.write(servo_height.read()-1); delay(step_delay); } } }
if(command.indexOf("*down") >= 0) { value = command.substring(5, command.length()); for(int a = 0; a < value.toInt(); a++){ if((servo_height.read()+1) < 150 && (servo_height.read()+1) >= 0){ servo_height.write(servo_height.read()+1); delay(step_delay); } } }
if(command.equals("*on")) { digitalWrite(7, LOW); }
if(command.equals("*off")) { digitalWrite(7, HIGH); } }
command=""; }
Downloads
Android App
![Screenshot_2017-09-09-17-33-44-928_robotspace.simplelabs.amr_voice.png](/proxy/?url=https://content.instructables.com/FM1/OIYV/J7AQVCHN/FM1OIYVJ7AQVCHN.png&filename=Screenshot_2017-09-09-17-33-44-928_robotspace.simplelabs.amr_voice.png)
I am an Android programmer, but I decided to use an app from Google Play instead of making my own, because it is easier for you to download it directly from Google Play instead of installing an apk file (I am aslo a little bit lazy :).
Here is link to this app, it is very popular and a lot of people used it in Arduino projects, but nobody before have made a voice controlled lamp ( ͡° ͜ʖ ͡°)
https://play.google.com/store/apps/details?id=robo...
How to connect to your bletooth module?
Just click 3 dots in upper right corner and choose connect robot, then choose your bluetooth module.
How to send command to Arduino?
After connecting to your bluetooth module, just click the microphone icon and say what you want to send to Arduino
Some Problems
![DSC00663.JPG](/proxy/?url=https://content.instructables.com/FK7/QKG7/J7AQV3FX/FK7QKG7J7AQV3FX.jpg&filename=DSC00663.JPG)
![DSC00664.JPG](/proxy/?url=https://content.instructables.com/FYJ/0J81/J7AQV3ME/FYJ0J81J7AQV3ME.jpg&filename=DSC00664.JPG)
While building this lamp I also faced some problems, that I want to let you know about.
My first problem was that top servo was broked. To replace it, I should take out the cable from this hole and put different one, but this is difficult so I decided to cut out cables from the old servo and solder them to the new one. And it is fine right now, you can see it on the first photo above.
Second problem was that first arm (the one with my name) wasn't tight enaugt with servo shaft so I used some glue to fix that, now it is ok. On the photo above you can see that there is glue around the shaft.
Finnaly Working!
![Arduino Voice Controlled Bluetooth Moving Lamp](/proxy/?url=https://content.instructables.com/FSJ/31LO/J7ARGCEG/FSJ31LOJ7ARGCEG.jpg&filename=Arduino Voice Controlled Bluetooth Moving Lamp)
![DSC00628.JPG](/proxy/?url=https://content.instructables.com/FQN/J0BR/J7AQV3EQ/FQNJ0BRJ7AQV3EQ.jpg&filename=DSC00628.JPG)
![DSC00653.JPG](/proxy/?url=https://content.instructables.com/F2H/DH9I/J7AQV3FP/F2HDH9IJ7AQV3FP.jpg&filename=DSC00653.JPG)
After solving those 2 small problems my lamp finnaly works. Here you can see how :) As you can see while soldering I put my phone under wrist so I can easily click on screen to control the lamp.
List of Commands
![DSC00633.JPG](/proxy/?url=https://content.instructables.com/FXK/TOVN/J7AQV3EU/FXKTOVNJ7AQV3EU.jpg&filename=DSC00633.JPG)
-
Clockwise [number] - it will rotate the lamp clockwise with the given degrees, numer means degrees
-
Counterclockwise [number] - it will rotate the lamp counterclockwise with the given degrees, numer means degrees
-
Front [number] - lamp will go forward with given degrees, number means degrees.
-
Back [number] - lamp will go backward with given degrees, number means degrees
-
Up [number] - lamp will go up with given degrees, number means degrees
-
Down [number] - lamp will go down with given degrees, number means degrees.
-
On - lamp will turn ON
-
Off - lamp will turn OFF
Conclusion
![DSC00656.JPG](/proxy/?url=https://content.instructables.com/FR3/X6S3/J7AQV3FQ/FR3X6S3J7AQV3FQ.jpg&filename=DSC00656.JPG)
![DSC00646.JPG](/proxy/?url=https://content.instructables.com/FV1/YXUU/J7AQV3FI/FV1YXUUJ7AQV3FI.jpg&filename=DSC00646.JPG)
![DSC00631.JPG](/proxy/?url=https://content.instructables.com/F5U/WVGE/J7AQV3ES/F5UWVGEJ7AQV3ES.jpg&filename=DSC00631.JPG)
If your laziness is beyond scale, this project is definitely for you :) But to be serious it is very useful for soldering and any kind of job when you have both hands busy. It is also just fun to make, and basically everything voice controlled is awesome!
Feel free to ask questions in the comments, leave a <3 if you like my project and vote for it if you love it!
Subscribe to my channel: https://goo.gl/x6Y32E
Like my Facebook fan page: https://www.facebook.com/Nikodem-Bartnik-1891157704439330/
Follow me on Instagram: https://www.instagram.com/nikodembartnik/
Thanks for reading, have a great day!