Midnight's Playground
Warning! Please read this first! Do not hurt your pet!
Lasers are dangerous! I DO NOT recommend building this project AS IS for several reasons.
- Because it is too easy for a cat to look at the laser
- Perhaps replace the laser with a "fishing rod & string" (type of cat toy) poking out of the hole...
- Interference can cause the laser servo to behave unexpectedly & reset to 0 position
- Cannot quickly turn off the laser, or re-direct the laser. Unlike a hand held laser
- Cat is attracted to the noise & movement of the servos and looks at the laser
- Cat does not understand the dangers of lasers
My cat loves to chase lasers.
My arms get tired too fast for her liking when it comes to her chasing the laser pointer I wave around... Sure, I give her a good run; once in awhile, for a few minutes, but I needed something more automated... I love automating stuff.
I recently followed the arduino tutorial below and built a "CAT LASER POINTER".
https://create.arduino.cc/projecthub/circuito-io-team/how-to-make-a-cat-laser-pointer-5f6307
This knowledge is a prerequisite to Midnight's Playground.
You will learn how to connect servos to an arduino, configure the bluetooth, get the required software. Its all very simple and the tutorial is very well laid out.
I followed the instructions.I had a friend 3D Print out the 3 small components it requires. I then ordered the bluetooth module, the servos (and some extra servos).
I am always trying to learn stuff about the arduino and electronics. I find "Instructables" an invaluable resource and find ideas and great tips here everyday! I'm am no professional, and I am still learning. I love programming computers, so I was looking forward to playing with these servos and lasers.
I built the "cat laser pointer" and it worked as expected. The cat was indeed happily chasing the red dot that was randomly projected onto the floor.
Then Instructables had a contest for PETS. I couldn't resist. I already had an Arduino Mega 2560 R3 and have built some other projects, so I have a few extra sensors sitting in a box.I gathered some scrap pieces of wood I had. Some bits and pieces here and there that I might find a use for.
And, I decided to build Midnight a little playground using the laser as a "Instructable".
Supplies
Core Required Components
- Arduino Mega 2560 (or similar) & USB Cable
- Breadboard & Multiple Jumper Cables (M-M. M-F, F-F)
- 9v & 12v Power Adapters (For Arduino & Servo's)
Playground Components
- (4) x DXW90 Micro Servo Motor 9g/1.6kg
- (1) x Three Terminal Voltage Regulator Module For Arduino
- (2) x HY-SRF05 Ultrasonic Distance Sensor Module
- (1) x Pan/Tilt Mechanism (https://www.thingiverse.com/thing:2800192)
- (1) x HC-05 6 Pin Wireless Bluetooth RF Transceiver Module
- (1) x Laser Diode Module Mini 650nm 6mm 5V 5mW Laser
- (6) x Various Pieces of Wood
- (2) x Cushioning Pads
- (1) x Old bed sheet to wrap everything in
Software
- Arduino IDE
- Arduino BlueControl available from the Google play store.
Miscellaneous Tools
- Staple Gun
- Drill
- Voltage Meter (For troubleshooting, not necessary)
- Tape Measure
- Wire Cutter
- Screw Drive/Needle Nose Pliers
- Electrical Tape
- Scissors
- Utility Knife
But What Can I Make!?
Since this is for my cat, I had to consider a few things... I don't want my kitty to get hurt, and and the toys should be flexible...
I had just purchased a few extra servos and I had a few ultrasonic range sensors in a drawer... Plus, I had just made a awesome automated laser pointer.
I looked around the apartment and let my imagination run wild. I had some old plastic coffee containers. I could use the round lids and rotate them with the servos. I found a old spray bottle that didn't spray anymore, I examined the salvaged plastic tube within it and discovered it had some neat features that would work nicely.
I am always keeping boxes way longer than I should... So, I had a nice big box that I could cut up and mount things to. The cardboard came in useful many times during the project. The ball holder is made of cardboard, the ultrasonic mounts are made of cardboard. I used cardboard to cover the wires to help protect them, and I will eventually cover the wire and electronics in a cardboard box.
The Layout & Build
I already had some pre cut wood laying around, so I tried to utilize what I already had...
- One 2' 1" square piece of plywood (for the base)
- One 1" x 6" board (for the shelf)
- Three 1" x 1"s About 1' 1" in length (to hold the shelf)
- One 1.5" 1.5" pedestal (to hold the laser mechanism)
Acknowledged, this is a pretty simple design. I am sure with more time, and a little creativity, you could come up with something spectacular I'm sure!!!
I'm going to use that big flat piece of cardboard on the back to hide the wheels and levers.
I pre drilled the holes and used some wood screws to hold everything together. I'm not a very good carpenter, so please excuse the some of the visible mistakes...
I stapled some sound proofing padding I had to the wood. Using cardboard to help hold the staples down.
WARNING! Keep the pedestal low, an inch at the most. The cat can look directly into it if it is too high! Mine is too high!
The Attractions
The Laser Turret
The main attraction is the laser turret.
I recently made a automated cat laser pointer.
It was perfect toy to build the Midnight's playground around. The "pointer" can be controlled via bluetooth and your Android phone using a app called "Arduino BlueControl" available from the Google play store. I must admit. The software for the original pan/tilt mechanism was instrumental in getting this started. I was quickly sending my arduino bluetooth commands in minutes. The software has a "Autoplay" mode where the laser is randomly moved around a predefined area. It works great for what I had in mind!
The Bouncing Ball/Jumping mouse Lever
This is simply a yarn type ball tied to a string I found. I then attached this to lever, which in turn is attached to a servo. The servo can be programed to rotate anywhere from 0 - 180 degrees. I use this functionality to move the lever up and down randomly, and give the ball a jiggle once in awhile.
A bonus: I attached a mouse to the lever. When the lever pulls the string up, the mouse appears above the backdrop. When the ball drops, the mouse drops down behind the backdrop.
The Mouse Wheel
Attached to one of the servo's is the plastic lid from a coffee can. I taped my mouse to the lid and attached the lid to a server. I then cut out special holes (window?) for the mouse to "appear" suddenly. One hole above the shelf, and one hole below. Rotating the wheel allows me to position the mouse on either level or hide it even.
The String Wheel
Once again, I used the plastic coffee can lid, however this time I glued some yarn strings to the lid. Using the same principle as the mouse wheel, I can jiggle the strings back and forth in front of a "window", hide it or make it re-appear. (Unfortunately, due to a faulty servo, I had to remove this festival attraction.
Arduino Information, Sketch, Variable Info, Etc
Arduino pinout
We will use digital pins, 2, 5, 7, 10, 11, 22, 23, 24, 25, 36, 40.
// Define Bluetooth pins
#define BTHC05_PIN_RXD 10 #define BTHC05_PIN_TXD 11// Define Laser pin #define LASER_PIN_S 2
// Define 5 servo pins #define SERVO9G1_PIN_SIG 36 // Laser Left and Right #define SERVO9G2_PIN_SIG 40 // Laser Up and Down #define SERVO9G3_PIN_SIG 5 // Ball Lever #define SERVO9G4_PIN_SIG 7 // Mouse Wheel // Define Trig and Echo pin for HY-SRF05 (Ultrasonic Sensors 1 & 2) #define trigPin1 22 // 12 Ball proximity sensor #define echoPin1 23 // 13 Ball proximity sensor #define trigPin2 24 // Playground proximity sensor #define echoPin2 25 // Playground proximity sensor
Minimum & Maximum variables for servos:
// This defines the min & mix position for the servo's
example:
int servo1Min = 70;
int servo1Max = 110; int servo2Min = 25; int servo2Max = 90;
PlayTime State
A routine that executes code when a object triggers the appropriate ultrasonic sensor.
if (playTimeState ) {
// Warning! Configure laser coordinates according to the dimensions you built! draw circle, draw line, etc, etc... }
Warning! Lasers are dangerous. Do not look directly at the laser.
I used a 12v - 5v regulator to provide a smoothed 5v to servos and sensors.
Downloads
The Serial Output
While using Arduino's IDE, you can view the "Serial Monitor" to view the output as the routine is executed.
Below is a edited sample of the output produced.
start Ultrasonic Sensor 1 - 28.85 Ultrasonic Sensor 2 - 42.66 Ultrasonic Sensor 1 - 28.79 Ultrasonic Sensor 2 - 43.36 Ultrasonic Sensor 1 - 28.78 Ultrasonic Sensor 2 - 43.66 Ultrasonic Sensor 1 - 28.31 Ultrasonic Sensor 2 - 43.07 Ultrasonic Sensor 1 - 28.29 Ultrasonic Sensor 2 - 112.42 (Playground sensor . exceeded "< 38 OR > 45" rule!) Object has entered playground - Laser ON - Draw circle x - 100.00, y - 45.00 x - 100.00, y - 45.20 x - 99.99, y - 45.39 ... (a whole bunch of coordinates edited out) x - 97.37, y - 51.76 x - 97.23, y - 51.91 x - 97.10, y - 52.05 - Draw diagonal towards ball x - 91, y - 20 x - 92, y - 21 x - 93, y - 22 ... x - 121, y - 50 x - 122, y - 51 x - 123, y - 52 - Drawing line to ball x - 123, y - 53 x - 123, y - 54 ... x - 123, y - 59 x - 123, y - 60 x - 123, y - 61 - Laser OFF - Activating Ball Lever - Laser ON - Drawing line down from ball x - 123, y - 62 x - 123, y - 61 x - 123, y - 60 ... x - 123, y - 48 x - 123, y - 47 x - 123, y - 46 - Drawing line right to mouse x - 123, y - 45 x - 122, y - 45 x - 121, y - 45 ... x - 76, y - 45 x - 75, y - 45 x - 74, y - 45 - Drawing line up to mouse x - 73, y - 44 x - 73, y - 45 x - 73, y - 46 ... x - 73, y - 83 x - 73, y - 84 x - 73, y - 85 - Laser OFF - Wiggling Mouse - Laser ON - Drawing circle x - 100.00, y - 45.00 x - 100.00, y - 45.20 x - 99.99, y - 45.39 ... x - 97.37, y - 51.76 x - 97.23, y - 51.91 x - 97.10, y - 52.05 - Laser OFF Play Time Over! Ultrasonic Sensor 1 - 27.45 Ultrasonic Sensor 2 - 42.12 Ultrasonic Sensor 1 - 27.56 Ultrasonic Sensor 2 - 41.47 Ultrasonic Sensor 1 - 27.93 Ultrasonic Sensor 2 - 42.02
Demonstration Videos
First Video
I'm demonstrating the main "playground" routine, using one ultrasonic sensor.
This routine is as follows:
- Laser draws a circle
- Laser follows a programmed path to the bouncing ball lever
- Ball is bounced 10 times between random positions and then returned to bottom bucket
- Laser follows a programmed path to the mouse wheel
- Mouse wheel is jiggled back and forth a bit, then mouse moves to top shelf. Then returns to original position.
- Laser draws circle
- Laser shuts down and waits for a trigger to happen
Second Video
I'm demonstrating the bouncing ball lever/servo routine using another ultrasonic sensor.
Third Video
I'm demonstrating starting in Autoplay mode. Then when a object is detected (or attracted), the routine mentioned in the first video starts.
Fourth Video
Midnight is beta testing the playground for me. She is doing a great job!
Fifth Video
This is one of my blooper videos. Because a ground wire had become disconnected some unexpected results were produced... The sound is coming from my tv, but it almost looks synchronized... I thought it was a tiny bit amusing. I'm just glad nothing was damaged.
Some Final Thoughts
- For the safety of the cat. Don't use the laser point at all. There are just too many variables to consider and we don't want to hurt our furry little friend.
- The wheels and levers provide plenty of stimulation, add a few bells or LEDs and viola... You have a safe alternative to the laser.
- Please be careful when and if you decide to use your staple gun. I shot a staple into the same finger twice. Blood gushed. Unfortunately, I didn't think to take a picture until after I cleaned it up... Sorry :(