So, I'm not saying this would help you in your plans of world domination, but it won't hurt, either.
The project here is for a laser that can be aimed by joystick. The joystick I used came from a broken RC helicopter toy, but should consist of two Potentiometers (ie, not 4 microswitches).
This is my first project, I'd love suggestions if I did something wrong.
Step 1: Parts Required
- A basic Pan/Tilt camera mount, with two servos. I used aliexpress for my parts, but I'm sure they're available elsewhere also. The mount can be bought with the servos (I'm using two SG90's), or they can all be bought separately. The mount cost me $0.40, and the servos us$1.20 each:
- An Arduino of some sort. I'm using an Uno. AliExpress has them for us$3.20:
- A Microswitch, for firing the laser. Can be any switch, but I would recommend a dead-man switch of some sort - if the laser is permanently switched on, it will overheat, and can destroy your project (instead of the world). us$3.00 gets you 20 of them:
- A laser diode. I'm using a "KY-008" 3pin 650nm Red Laser Diode, from Aliexpress. They cost us$0.69 each:
- A joystick. I salvaged one from an old broken RC helicopter toy, but AliExpress has them as well, for us$0.77:
- A white cat. C'mon people, you gotta take this stuff seriously. Admittedly, mine is a tabby, and he's not very evil. Yet. I'm working on it (see a later project, possibly).
Also, get yourself a breadboard and some cabling. I'm assuming you already have those.
Step 2: Set Up the Hardware
We're going to be using Analogue pins in this one, and both 3.3 volt as well as 5v for our inputs. The laser works on 3.3 volt but the stepper motors want a little more grunt.
First, unplug your Arduino. Never plug stuff into the board while your power is on. Avoid trouble.
Let's begin! First, the servos.
- Hook up the Arduino 5v to the "+" rail on the breadboard.
- Hook up the Arduino GND to your "-" rail on the breadboard.
- The two SG90 Stepper motors have 3 wires:
- GND (brown) - plug both into "-" rail on breadboard
- 5v (red) - plug both into "+" rail on breadboard
- DATA (orange) - plug into pins "A4" and "A5" on the Arduino.
- Left-Right goes into A4
- Up-Down goes into A5
Next, the joystick. It's made up of two potentiometers (10k is common, but others will probably work just as well). The Pots have three wires again:
- GND - plug both into "-" rail on breadboard
- 5v - plug both into "+" rail on breadboard
- DATA - plug into pins "A0" and "A1" on the Arduino.
- Left-Right goes into A1
- Up-Down goes into A0
Once the unit is up and running, if you find that your laser is not working the way you expected it to, you can interchange the GND and 5v pins of the pots to make them reverse direction of the servos.
Next, the laser. I'm using a KY-008 module, which already has the resistor on the mini-board, but if you're using a loose laser component, don't forget to add the resistor to this circuit.
- Plug the laser's Vdc pin into on pin of the microswitch, and the other pin into the 3.3v pin of your Arduino
- Plug the laser's GND pin into the "-" rail of your breadboard.
- I'm not using the REF pin (the middle one) as I'm not sure what it does. It seems to work without. (anyone?)