Welcome! In this Instructable I will show you how to make a dual laser pointer cat toy using an arduino, a few servos, and a couple of laser diodes. I have a few cats at home, and a normal single laser pointer just doesn't cut it.

First off, some safety issues: lasers can always be dangerous, so avoid looking into the lasers or shining the lights into others' eyes. The laser diodes I use don't have enough power to permanently damage someone's eye, but will still be bad if you look into them for a while. So don't!

Depending on what products you already have access to, this project will probably cost anywhere between $0 and $50. I use some basic electronics equipment (wires, breadboard, a couple of resistors) that not everyone may have immediate access to, but that is readily available online.

Step 1: Materials

1) A couple Laser Diodes

-I ordered mine from Amazon, 10 for about $2.50: https://www.amazon.com/gp/product/B00R73MC1S/ref=...

-Instead of ordering online, if you already have a novelty pocket laser pointer, you can take that apart for the laser.

2) A few (exactly 3) Servos (+ screwdriver for the servos)

-These Micro Servos are from HobbyKing, 10 for about $15.00 (including shipping): http://www.hobbyking.com/hobbyking/store/__9549__T...

-Any servo will do, though.

3) Arduino

-Arduino Uno, about $30 total (including cable), from Amazon: https://www.amazon.com/Arduino-UNO-board-ATmega328...

4) A couple Resistors to restrict the power to the lasers, about 120 Ohms

5) Assorted wires, and breadboard

6) A few AA batteries

7) Tape to mount the servos and lasers, and superglue or (highly suggested!) solder

Step 2: Combine the Servos

To make a dual laser pointer, we want two lasers mounted on separate servos. But, lasers that just move in a single line is a bit boring (your cats may not care, but you do!), so let's add a third servo that moves the two laser-mount servos. Now we have a much more interesting 2D motion.

First, tape together the two mount servos. Make sure that the wires come out of the same side-don't tape the servos in with one backwards. Next, put the two combined mount servos on the base servo. (Don't be shy on the tape-we want the base servo to have a very firm connection with the mounts, so it won't loosen after a lot of movement). Make sure that the base servo has the cables going out in the same direction as the two mount servos when you attach them, so wires don't get tangled during the movement.

Step 3: Add the Lasers and Attach the Servo-laser Assembly to the Breadboard

Now we will attach the lasers to the mount servos, affix the entire thing to the breadboard we use as a base, and add better wires to the lasers. As a note, the lasers are 5V, 650 nanometer wavelength (red light), and 5mW. 5mW means that the power is low ( 5 thousands of a Watt), and is the standard for normal pocket laser pointers.

Attaching the lasers is simple enough. Tape, tape, and more tape! Tape the servo arm and the laser together, and then attach and screw the servo arm onto the servo. Attaching the completed assembly to the breadboard is just as easy a tape job. However, one word of caution: if you just randomly stick the servo arm onto the servo motor, then you don't know the range the arm could sweep out. Servos have 180 degrees of rotation capability, but rotate the arm until you can't anymore, so you can make sure the arm will rotate in the positions you want. You want both servos to stop, pointing directly down, with the capabilities to rotate up and around, away from the wires coming out of the servos.

Unfortunately, the wires that the lasers come with are a bit fragile, and don't fit well in the breadboard (especially when you have to adjust them multiple times). So, let's add some regular electronics lab wires to the end of the laser wires. These added wires are much sturdier and are made for the breadboard, so we will have an easy time making any needed adjustments. However, I currently do not have soldering equipment with me, so I had to make do with a hacky method to attach the two wires. First, I stripped a little bit more wire on the end of the laser wires, and then I wrapped that exposed wire tightly around one end of the breadboard wire. Making sure that there was a strong connection, I then superglued the two wires together. After that I wrapped a bit of tape around the connection to protect it. This method works surprisingly well for me, and I haven't had any troubles with the connection yet, but I need to order a soldering kit soon.

Step 4: Wiring!

One of the last steps is to wire everything together. While at first glance perhaps a daunting task, this step is actually really easy. The attached file is a fritzing schematic that shows all the connections, with red LEDs in place of the laser diodes, since I couldn't find a laser in the parts list in fritzing.

First of all is power. While the arduino will supply power, it has a limited power supply, and the servos consume a surprising amount of current, especially when just starting to move. When I tried to power everything off of the arduino, the servos were jerky, and the lasers turned off when the servos moved. However, we can power the servos themselves off of a few AA batteries (three or four should work well), and power the lasers from the arduino. To make sure the circuit won't blow up unintended, we need to make sure that all the grounds are connected together. Having two separate grounds in a circuit is a big mistake, because one ground could be at a voltage offset from the other, so current could flow in really weird (and potentially damaging) ways. Therefore, wire the ground from the arduino to the breadboard, and wire the ground from the batteries to the same connection.

The batteries should all be connected to each other in series, meaning that the positive end of one battery goes into the negative end of the next battery, and so on. The resulting product should end up with just one negative end (which is ground and connects through the breadboard to the arduino's ground), and one positive end, which we will use to power the servos. The best way to have the batteries work is by having an actual battery pack with positive (red) and ground (black) terminals to plug into the breadboard. However, I used tape on a few batteries, and used some wire to connect the ends together. It's hacky, but it works.

Next, we will wire the servos. Servos have three wires, one positive, one ground, and one control. Each servo may have a different color scheme, and those are found readily online, but usually positive will be red, ground black or brown, and control something else, like yellow. Connect the ground wires from the three servos to ground on the breadboard, and the positive wire to the positive side of the batteries. The control wire will go to the Arduino. My code has the base servo going to pin 9, and the two mount servos going to pins 10 and 11. It's hard to tell which mount servo goes where, so if the lasers point up at the end, then switch those two wires.

Now we have the lasers. These will be powered from the arduino, and we ignore the battery pack. The ground wire from the lasers (blue or black) goes to ground. Instead of plugging the positive end directly into the arduino, we should add a resistor to each laser first. This resistor will put a control on the amount of power the arduino outputs to the laser, because the arduino can only output so much current before taking damage. A 120 Ohm resistor for each laser works pretty well, but that's a rough estimate of the needed resistance. Then, we can connect those resistors to the arduino in pins 7 and 8. It doesn't matter which laser goes to which pin-they both simply turn on or off.

*Note: Sometimes servos can be a bit jerky, especially when not continuously moving around. If the servos are jumpy with the external battery pack, try putting a capacitor between the positive side of the battery and ground. This capacitor will smooth out quick fluctuations in voltage caused by the servo turning on or off.*

Step 5: Code

Lastly, let's have the code for the arduino!

We need the code to control the servos, and make sure that the lasers are turned on.

First, we need to include the servo library with "#include ", and then we can declare servo variables with "Servo baseServo, mount1Servo, mount2Servo;". We will tell the servos which pins they connect to in the setup function, but we can go ahead and tell the lasers which pins they connect to (pins 7 and 8). We also need variables to tell where the servos need to go, and we have three variables, one for each servo (basePos, mount1Pos, and mount2Pos)

In the setup function, we declare the laser pins as outputs, and set them to HIGH, meaning that they will output 5 Volts while the program runs. We then attach the servos to pins 9, 10, and 11, making sure that the baseServo is connected to pin 9. Again, if at the end the lasers are pointing up, then switch the 10 and 11 pin attaches.

Lastly, we have the loop function. This code is rather simple, and just assigns random positions to the servos (so that they'll be facing down on the ground), and then tells the servos to go to those positions. At the end of the loop function we delay for half a second to allow time for the servos to reach their assigned positions, and then the loop function repeats, assigning new random values to the positions for the servos.

If you'd like, you could write more complicated functions with a little knowledge of arduino, including ones that sweep through the servo positions instead of randomly jumping to different positions.

Step 6: Enjoy!

That's it, you're done! Just make sure that the batteries have a charge, and that the arduino is powered and has the program loaded, and you're set. Just add cats! (^w^) (^w^) (^w^)

<p>Fun idea for a cat toy. This would be great to set on a timer when you are out of the house. </p>

About This Instructable




More by WPChops:Dual Laser Pointer Cat Toy 
Add instructable to: