Bluetooth Voice Controlled Moving Lamp

by Nikus in Circuits > Arduino

20638 Views, 240 Favorites, 0 Comments

Bluetooth Voice Controlled Moving Lamp

mini.jpg
Arduino Voice Controlled Bluetooth Moving Lamp
DSC00637.JPG
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.

LINK TO VIDEO IF YOU USE APP

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
DSC00544.JPG
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:

Bottom Plate

DSC00549.JPG
DSC00551.JPG
DSC00552.JPG

Put servo cable in hole on the side of servo container and screw servo down with M2 screws.

Rotary Disk

DSC00553.JPG
DSC00555.JPG
DSC00557.JPG
DSC00558.JPG
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
DSC00563.JPG
DSC00564.JPG
DSC00565.JPG
DSC00567.JPG
DSC00568.JPG
DSC00569.JPG
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
DSC00573.JPG
DSC00574.JPG
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
DSC00579.JPG
DSC00581.JPG
DSC00582.JPG
DSC00585.JPG
DSC00588.JPG
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
DSC00593.JPG

You will propably have to much cable between the arms, just pull it on the down side.

Top Servo Cable

DSC00594.JPG
DSC00598.JPG
DSC00599.JPG
DSC00600.JPG
DSC00602.JPG
DSC00603.JPG
DSC00606.JPG
DSC00608.JPG
DSC00611.JPG
To put servo cable in hole you have to cut out it's connector. To the end of the cable you can solder cable from different servo so it will be long enaugh to easily opconnect to Arduino. Don't forget to insulate everything to make it safe. Shrinkable sleeves are the best for that but black tape is also good.

Frame Finished

DSC00615.JPG
DSC00612.JPG
Frame is finished all cables are in place connectors are soldered, now we can connect electronics.

Electronics Connection

schematic.png
DSC00665.JPG
DSC00672.JPG
DSC00661.JPG
Here is the schematic of connection. The small led diode symbolize 12V LED diode that we put in the frame before, I just didn't find the exact part in fritzing. It is much easier to connect servo motors if you have arduino with connectors for servo and you don't have to use breadboard. I have 2 channel relay but you can use single channel relay, no problem. To make it cleaner I put all cables from lamp in cable sleeve (I am not sure if this is proper name). We don't have to connect RX of Bluetooth module to arduino because we will only transmit data from Bluetooth module to Arduino, not the other way.

Arduino Code

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

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
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
DSC00628.JPG
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
  1. Clockwise [number] - it will rotate the lamp clockwise with the given degrees, numer means degrees

  2. Counterclockwise [number] - it will rotate the lamp counterclockwise with the given degrees, numer means degrees

  3. Front [number] - lamp will go forward with given degrees, number means degrees.

  4. Back [number] - lamp will go backward with given degrees, number means degrees

  5. Up [number] - lamp will go up with given degrees, number means degrees

  6. Down [number] - lamp will go down with given degrees, number means degrees.

  7. On - lamp will turn ON

  8. Off - lamp will turn OFF

Conclusion

DSC00656.JPG
DSC00646.JPG
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!