Introduction: Laser Controller
In this instructable I made an Arduino project that allows me to control a laser with a smartphone or tablet.
Step 1: Things You Will Need
2 9 gram servo motors.
1 bread board.
1 laser.
1 Arduino Nano board.
Assortment of wires.
1 Bluetooth transceiver.
1 9v battery.
1 Smartphone or tablet.
1 box.
Double sided tape.
Soldering iron (Not required but usefull)
Step 2: Preparing the Laser
- open up the laser and remove the batteries
- attach a wire to the + inside the laser
- attach a wire to the - on the side of the laser where it is screwed on, preferably with a soldering iron or with hot glue
- wrap a wire around the laser in order to keep the button pressed down.
Step 3: Preparing the Servos
- attach one servo on top of the other with glue or a by wrapping a wire or a string around the servo and the attachment on the other servo.
Step 4: Upload the Code to the Arduino Board
<p>#include <br>Servo XAxis; Servo YAxis;</p><p>int XAxisAngle = 90; int YAxisAngle = 90;</p><p>void setup() { Serial.begin(9600); XAxis.attach(7); YAxis.attach(8);</p><p> XAxis.write(XAxisAngle); YAxis.write(YAxisAngle); }</p><p>void loop() { int ChangeValue = 2; if (Serial.available() > 0) { char Character = Serial.read();</p><p> if (Character == 'L') { XAxisAngle += ChangeValue; Serial.println("Left"); } else { if (Character == 'R') { XAxisAngle -= ChangeValue; Serial.println("Right"); } else { if (Character == 'U') { YAxisAngle += ChangeValue; Serial.println("Up"); } else { if (Character == 'D') { YAxisAngle -= ChangeValue; Serial.println("Down"); } else { Serial.print("Command not found:"); Serial.println(Character); } }</p><p> } } } if (YAxisAngle > 180) { YAxisAngle = 180; } if (YAxisAngle < 0) { YAxisAngle = 0; } if (XAxisAngle > 180) { XAxisAngle = 180; } if (XAxisAngle < 0) { XAxisAngle = 0; } YAxis.write(YAxisAngle); XAxis.write(XAxisAngle); }</p>
Step 5: Putting Everything Together
- put the Arduino in to the breadboard.
- attach the Bluetooth transceiver to the Arduino board (tx to rx and rx to tx)
- attach the servo motors to the Arduino on pins 7 and 8.
- attach the laser to the servo motor with double sided tape
- put the 5v and ground wires of the laser to the 5v and ground of the Arduino.
- use the double sided tape to attach the servo motors to the bottom of the box and use a wire to secure it in place.
- stick the breadboard on to the side of the box
- attach the battery to the Vin and ground of the Arduino
Step 6: Bluetooth App
- Download an Arduino Bluetooth controller app.
- Set the Up arrow to send the letter U.
- Set the Down arrow to send the letter D.
- Set the Left arrow to send the letter L.
- Set the Right arrow to send the letter R.
Step 7: Finished!
That it. You're done.