In this Instructable I'll show you all the parts you need, give you the Arduino sketch I used and walk you through building a dog collar that allows your best friend to voice his opinions to the world.
Here's a short video of my dog talking. Normally we tell him, "Speak," and he'll bark until you tell him, "That's enough." I think the camera spooked him because we had to ring the door bell to make him bark.
Step 1: Parts and Sketches
Main Collar Parts List
Arduino (I use a Duemilanove... $25-$35 depending on where you buy it. The Uno is the latest and greatest, but I bought my Arduino a while back so it isn't the newest one http://www.spikenzielabs.com/Catalog/index.php?main_page=product_info&cPath=12&products_id=40)
Adafruit Wave shield (I went with a Music and Sound Pack just to be sure I would get an SD card that worked properly and it came with a speaker)
Wave shield $22 (If you choose this option you will need to buy an 2GB max SD card and a small speaker that is still loud enough to work at normal room sound levels) http://www.adafruit.com/products/94&zenid=80d8423d846699d9ee654a2b86118553
Music and Sound Pack $35 http://www.adafruit.com/products/175&zenid=80d8423d846699d9ee654a2b86118553
Shield Stacking Headers (at least one set) $1.50 http://www.adafruit.com/products/85
Adafruit Proto shield $12.50 http://www.adafruit.com/products/51
1/4 size breadboard (for Proto shield) $4 http://www.adafruit.com/products/65
Sound Impact Sensor $7.99 http://www.parallax.com/Store/Sensors/PressureFlexRPM/tabid/177/CategoryID/52/List/0/SortField/0/Level/a/ProductID/614/Default.aspx
10-inch Extension Cable with 3-Pin Header $2.25 http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/385/Default.aspx?txtSearch=3+wire
9v battery holder $4 http://www.adafruit.com/products/67
10K-Ohm linear potentiometer A local electronics store should sell these for 3 or 4 bucks
Fancy "Control Knob" for potentiometer These will usually come in a four pack and run about 3 dollars. Pick whatever you think looks the best, but make sure it will fit the shaft size of the potentiometer you bought
1/2 a yard of Pleather $5.99 (I ended up using about half of it, but get extra in case you make a mistake. Everything's 65% easier the second time around!)
Thrift Store belt with a large metal buckle $1 (Only want the buckle... mine is just under 3 inches wide)
Spool of Coats Upholstery Thread $2.20
Two pouch fasteners (I used self adhesive velcro squares, but if you're better with a sewing machine you might try buttons)
Misc Parts List
Rosin core Solder
Assuming you have the tools but need to buy the collar specific materials, this project will cost you just over $100 USD. Not too shabby to be the only owner of a talking dog on your block!
There is only one Sketch for this project so I will link in at the bottom of Step #4 (When the shields are assembled to the Arduino but before they are put inside the Talking Collar).
Step 2: Assemble Shields and Prep Sensors
The only modification we will make for this Shield is instead of soldering in the header pins that came in a strip of 36, we will solder in the shield stacking headers we bought in the last step. We do this so we can stack our Proto Shield on top of the Wave Shield later. Clip off two of your unused header pins and solder them onto the two wires of your speaker. Then plug the speaker into the Wave Shield near the headphone jack.
The Wave Shield also needs a special library to run properly. The library can be downloaded from Google's code hosting page. http://code.google.com/p/wavehc/
Click the Downloads tab at the top left of the page and download the newest library from the list. Once it is downloaded you'll need to unzip it into your Arduino's, "Library," folder. I'm using Arduino version 0018 and my directory looks like this;
This shield we can assemble exactly as the instructions show. Once everything is soldered in place and cooled down a bit, you can strip off the backing of the 1/4 size breadboard and stick it to the Proto Shield.
Next is the 10K potentiometer. Solder one wire to each of the three pins. Color coding them now will help us a great deal later. Solder 15 inches of white hook-up wire to the middle pin and 15 inches of red and 15 inches of black hook-up wire to the two outside pins. You can interchange which of the outside pins is red and which is black, but the middle pin is important and must be easily identified.
Sound Impact Sensor
All this sensor needs is to be plugged into either end of the 10 inch Extension Cable. Plug the white wire into the sensor where it reads "SIG," the red wire goes to "5V," and the black wire goes to "GND." Then insert the 3-pin header into the other end of the cable.
9v Battery Pack
The only difference is you will need to replace the black and red wires the pack comes with to 18 inches of black and red hook-up wire.
Step 3: Get Audio Clips for Your Wave Shield
AT&T Labs Natural Voices
You can use a friend as a voice actor, or you can use AT&T's phonetic text-to-speech web page to get your text. I used AT&T's page. It works pretty well and you can choose from 17 different voices, which is pretty cool. Probably the best thing about AT&T's Natural Voices Lab is it gives you the audio in *.wav file format, which is exactly what our audio needs to be in to use in our Wave Shield! How convenient is that? Very, the answer is very convenient. There are some restrictions to using AT&T software though. First is a 300 character limit. Sorry, but your dog will not be reciting War and Peace every time he barks, no matter how funny that would be. Second is the recordings made with it can not be uploaded here for you to download. I like not going to jail and this quote came straight out of their fine print, "Sharing the audio clips on the internet is not." (In reference to what is OK to do under the "Limited Use of Audio Clips" clause)
So I'll leave you with a little SD card info here.
The program your Arduino runs will look for a total of 60 audio tracks from your SD card to play when your dog barks, and the code breaks them up into 4 categories. This can be changed in the code if you wish, that is just the way I have it programmed. A 1 GB card should give you well over 300 minutes of uncompressed audio. That's a lot of talking dog phrases.
The files on the SD card need to be named 1.wav through 60.wav
Here are some things my dog likes to talk about:
Quotes from movies I like
Ironic "Gansta" slang in a British accent
Doggie themed poop jokes
Classic literature critiques
Step 4: Stack Shields and Upload Code
Carefully stack the Wave Shield on top of your Arduino making sure that all of the pins from the Wave Shield are going into the appropriate header of the Arduino.
Next stack the Proto Shield on top of the Wave Shield, again making sure you don't bend any pins.
Place the 3-pin header end of the Sound Impact Sensor's extension cable in the Proto Shield's breadboard as shown in the picture. Use hook-up wire to make the following connections;
Black sensor wire gets jumped to Arduino Gnd
Red sensor wire gets jumped to Arduino 5V
White sensor wire gets jumped to Arduino digital pin 7
Attach the 10K potentiometer (pot) to the Proto Shield.
Black pot wire plugs into Arduino Gnd
Red pot wire plugs into Arduino 5V
White pot wire plugs into Arduino Analog 1
At this point everything is ready for uploading your code. Download my TalkingDog.pde file linked below. Next connect your Arduino to your computer with an A/B cable and upload the sketch. Once the sketch is finished uploading, you can unplug your AB cable and plug in your 9v battery. Make sure the battery pack's "On/Off" switch is in the on position and snap your fingers in front of the sounds impact sensor and after a slight delay you should hear your speaker talk.
If not here are some possible errors;
Did you put a fresh 9v battery in?
Is the volume wheel on the Wave Shield turned all the way down? You might think it's on 100% when it's really at 0%. I recommend putting it about half way at first and then adjusting it to full volume.
Did you put correctly named *.wav files on your SD card?
If you get sound when you snap your fingers near the sound impact sensor then everything is working properly. Next you need to adjust the sensor's sensitivity so normal room noise doesn't set it off, but your dog's bark will. To adjust the sensor there is a little white plastic piece that has a slot in it for either a Straight or a Phillips screwdriver. This is a trim pot and works like the 10K pot we added to our collar earlier. By adjusting this back and forth you adjust how low or how high of a noise will break the threshold and trigger your sensor. I adjusted mine by putting the TV on just loud enough that I had to raise my voice for somebody else in the room to hear me. Then I turned the white knob down until the LED next to the microphone turned on. Then I backed it down again until it turned off. At this setting normal room noise shouldn't set it off, but a sharp dog bark will.
Step 5: Alter the Code (Optional)
Default is for 60 phrases from 4 categories to be randomly said. The potentiometer determines which category will be pulled from, so each quarter turn of the potentiometer will choose from 15 separate phrases.
If you want to change the number of categories I'd suggest mapping the potentiometer's output first.
In the void loop(), after this line of code;
potvalue = analogRead(1);
potvalue = map (whatever you want to change it to goes in here)
then later in the loop whenever an if statement asks for the potvalue change it to fit your needs.
If you want to add or subtract the number of phrases your dog says, here's what you need to do.
Each block of code that looks like this;
is one phrase your pouch can say. This particular block is to play phrase 1. You'll have to delete the ones you don't want or add extras you do want. You'll also need to add a file to your Wave Shield's SD card.
You will also have to alter the;
randNum = random(x, y);
line of code in each category to match the number of phrases you want in each category.
Also, when I wrote this code I had allowed for pin 13 to light up an LED while the dog was talking (You can see that in the block of code above). If you have enough room on your collar, you can add that. I ran out of room on my collar, but left the LED code in case anybody else wanted to add it.
Step 6: Build the Collar and Add the Arduino
I started with a template that would fit around my dog's neck and decided where all my parts would fit. After adding extra material on every side it was used to cut the outside part of the band that goes around his neck. The main band is two parts with wires, a speaker, a potentiometer and a sound impact sensor sandwiched between them. A hole slightly smaller than the speaker was cut in the speaker spot and hot glued down. Another small hole was cut for the potentiometer and then hot glued down in it's spot. A hole was also cut inside each pocket so wires can be routed into the pockets from the collar's main band.
After the outside half of the main band was cut, the inside half was cut to the same dimension. A small hole was cut for the microphone of the sound impact sensor where it would fit over my dog's throat and it was hot glued in place. I'd like to remind you to calibrate your sound impact sensor (Outlined in the Prep Sensors Step) before you glue it down. After it is glued, it can't be easily adjusted.
Next each pocket was cut out and sewn together inside out. Then they were flipped right side out and sewn to the outside of the main band of the collar, being careful to leave a gap for wires to pass through.
Then the outside half was paired to the inside half of the collar and carefully sewn together with the hook-up wire, extension cable, speaker, sound impact sensor and potentiometer between the two halves. The Arduino and the two shields were not in the collar at this time.
Next a large metal belt buckle was scavenged from a Thrift Store belt and sewn onto one end of the collar. The other end was tapered down to fit inside the buckle and small holes were cut to fasten the collar.
I used velcro to fasten down the flaps for the pockets, but buttons or snaps will work if you know how to attach them.
Finally the Arduino and shields were plugged back into the 9v battery, sound impact sensor, speaker and potentiometer. You should be able to flip the switch on the battery to "on," put the collar on your dog and listen to him talk when he barks.