Jonathan Warren

Wires Expert GitHub YouTube Blogger LinkedIn

Laser Toy

Winter 2021

Continuing to feel that creative urge, I suddenly had an idea to use part of a somewhat disappointing robotic claw kit I'd picked up on a whim long ago. I realized if I strapped a laser to the pan/tilt pieces, maybe I could make something my cat would want to play with!

LaserToyR1

I kept the hardware design fairly simple - 2 servos for 2 axis motion, a laser diode, and a button to trigger the toy manually.

Shopping List

First, I had to get the hardware assembled and installed in a "final" location. Next, I could then calibrate the servo range so that the laser is only moving around the open floor - not shining up into anyone's eyes, not tricking my cat into running into a window, etc. I put together a simple calibration program to determine those numbers manually.

Once I had my constraints built in, I began the surprisingly challenging task of writing an algorithm that caught my cat's attention. You can see in the examples below that even things that looked fun quickly became quite boring for the floofy fella.

What finally won out was an algorithm that picks a random place, moves from its current spot to that spot in jerky, overshoot-y motions, and then "quivers" in that spot for a random amount of time before moving on to the next spot. I'm sure every cat has different desires, so good luck! I've left my previous attempts in the code, commented out, so there's lots to play with.

Recently I realized I could tidy up the build a bit, and I printed a simple enclosure for the hardware. Snazzy!

SnazzyEnclosure     EnclosureRear

Links