Introduction: Bluetooth Voice Controlled Moving Lamp
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/
Step 1: What We Will Need?
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
Step 2: Bottom Plate
Put servo cable in hole on the side of servo container and screw servo down with M2 screws.
Step 3: Rotary Disk
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.
Step 4: First Arm
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 :)
Step 5: Second Arm (top Arm)
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.
Step 6: Diode Installation
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.
Step 7: Pull the Cable
You will propably have to much cable between the arms, just pull it on the down side.
Step 8: Top Servo Cable
Step 9: Frame Finished
Step 10: Electronics Connection
Step 11: Arduino Code
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=""; }
Step 12: Android App
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
Step 13: Some Problems
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.
Step 14: Finnaly Working!
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.
Step 15: List of Commands
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
Step 16: Conclusion
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!