Introduction: Modular Chirping Nest Toy for Cats
My wife and I recently moved to a new apartment with our cat, Nymeria. This new apartment came with an extra houseguest - a small bird just outside our door. This bird happily chirps all day, which torments our cat who can't find the source of the chirping. I decided to make a chirping toy using a few extra components I had on hand. I'm happy to report that our cat loves it and is quite fond of destroying the nest trying to get to her toy.
x1 microcontroller - I'm using a NODE MCU, but an Arduino would work just as well.
x1 ISD 1820 audio playback module (comes with an 8 Ohm speaker)
Soldering equipment and assorted wires - Male to Female wires will be quite handy
A device capable of playing sound for the recording
Optional parts for Power Amplifier
x1 LM386 Op amp
x2 100 uF (micro Farad) capacitors
x1 1000 uF (micro Farad) capacitor
x1 100 nF (nano Farad) capacitor
x1 10k potentiometer
A source of power. I recommend using a 9v battery + holder, but you could also use an old USB cable + rechargeable battery pack.
For the Toy:
x1 Empty cylindrical can - I recommend using an empty Oats cylinder
1-3 ft of hemp string / rope / twine
Step 1: Building the Nest and Housing
To build the nest, take a 1-2 ft piece of twine or string and begin to unravel it. Unravel it as finely as possible - check the pictures for an example of ideal thickness. Once you have a decent clump of material, begin pushing the strands together. Gently flatten the material and curl it around your fist, or use your thumbs to apply pressure to the center, while cupping the outsides.
In a small bowl, mix together one part wood glue with 2-3 parts water. Gently dip the outside of the nest in the water, and allow to dry around a bowl. This will help keep the nest together and prevent your cat from destroying it.
To prepare the container, simply measure the circumference of your speaker on the lid, and on the bottom of the container. Cut a hole in each. If the bottom of the container is metal, tape the edges to prevent injury.
Step 2: Prepare the ISD 1820 Module and Microcontoller
Prepare the ISD module by soldering the wire leads to the + and - speaker pads. Please note the positive and negative pins on the module. Plug in the speaker, apply 5v to the pin labeled VCC, and provide a ground connection to GND. Verify that you can successfully record sound and play it back.
This a good time to record your bird sound. The ISD module allows you to record 10 seconds at 6.4 kHz sample rate and 2.6 kHz bandwidth. Either record the full 10 seconds of bird song, or record a small sample to create your own chirp effect. This choice will determine which code you use later.
I recommend using this video:
Your recording will be saved after you remove the power.
At this point, you may want to remove the PlayE and PlayL pushbuttons. This will make it easier to add your control wire, though it is not required. To do this, simply clip the legs of the button. Use a pair of plyers to pull the metal leg while using a soldering iron to heat the hole.
Solder a wire to the PLAYE or PLAYL terminal (see image) and connect the other end to your microcontroller.
Step 3: Optional Step: Power Amplifier Circuit
A power amplifier is a simple circuit that amplifies the sound coming from the ISD 1820 module. To construct it, follow the circuit diagram pictured. I highly recommend using a potentiometer to control the volume of your incoming signal, as well as tone down some of the noise.
Once your main circuit is assembled, attach a female lead to your input (this will connect to the ISD module), and the speaker to your output.
Before moving on, I recommend testing your circuit. Connect the female lead to the positive speaker pin on your ISD module. Power the module, and verify that you can hear sound out of your speaker.
Full credit goes to abzza for the amplifier circuit shown here.
This Instructable is worth a read to learn more about audio amplification.
Step 4: Connect and Mount the Electronics
The final step is to connect everything together. I recommend using a proto-board or a bread board which will simplify power and ground connections. To do this, simply cut and solder an old USB cable or 9v battery holder to the +_and - rails on the proto-board.
To power your components, solder leads from your power rail to the following pins:
5v pin on the ISD module
Vin on your microcontroller
Pin 6 on your LM386 op amp (if used)
Create a connections from your ground rail to the following pins:
GND on your ISD module
GND on your microcontroller
GND on pins 2 & 4 on your op amp (if used)
The (-) lead on your speaker
Be sure you have an electrical connection from your microcontroller to your ISD module. The code uses pin D7, but you can use any pin you want - just be sure to change the code to match.
Lastly, once your speaker is attached to your controller, use some tape or hot glue to attach your speaker to the underside of the plastic cap so that it is facing downward. Use tape or screws to secure your board to the top of the cap, then place it on the bottom of the can.
Step 5: The Code
Download and install the code. To change how the chirps play, follow the instructions are included in the .INO file.
Step 6: Run It!
Apply power and see how your kitten enjoys it!
Step 7: [Optional] Modular Add-Ons
This step is a quick way to add some additional features to the toy. A motion sensor can be mounted on the front of the tunnel and trigger the chirp when your cat walks by. This will also activate a servo which will move a smaller toy (I used string since our cat loves string) near the back of the tunnel.
Please note that I used an Arduino to test these and as such, my code is written for an Arduino. If you are building this from scratch and want to include these features, I recommend using an Arduino.
1. Make a small incision near the top of the tunnel entrance. It should be wide enough to accommodate 4 wires. Attach these wires to all 4 pins on your hc-sr04 ultrasonic sensor. Run them through the hole so that your sensor is mounted upside down with the wires coming out of the top. Attach the pin labeled VCC to a 5v power source, GND to ground, TRIG to pin 11, and ECHO to pin 12. If you use different pins, changes will need to be made in the code.
2. Remove the speaker and route the servo wires through it. Replace the speaker. Attach the red wire to 5v source, brown to ground, and orange to pin 9. Once again, change the code if you use a different PWM pin.
3. Use hot glue to secure the toy to the servo, then secure the servo to the back of the tunnel. I suspended mine from the roof so the string would be more interactive and have a greater range of motion.
4. Download the code attached and upload it to the board.
Participated in the