Wednesday, July 18, 2012

Defense Against The Dog Arts!


Here is the video:

This project uses six ultrasonic emitters on bicycle to be repulsive to a dog.

Dogs tend to be a problem for most cyclists.  Residential areas are by far the worst.  There seems to be some wiring in a dogs head that makes them insanely aggressive when they see a person on a bicycle. 

There are several things you can do to help protect yourself from dogs.  Some suggest yelling  things like "Bad dog!", "go home!" or obscenities.  I have tried this and found it to be completely useless.  I had a friend that would carry ammonia in a squirt bottle.  He would squirt the ammonia on the ground and when the dog smelled it, the dog would completely forget about chasing you and go investigate the strong smell of the ammonia.  I never tried this.  Others claim that a capsaicin based spray is the only way to go.  But, windy days can effect your aim.  I even found that a small revolver was invented in France specifically for shooting a dog from a bicycle.   It was a revolver without an external  hammer so the hammer would not get stuck on clothing.  (click here)  That seems a bit extreme.  The final way is to use high pressure sound waves to get the dog to move away from you.  There are two ways to accomplish this.  The first is a CO2 based horn.  If a CO2 canister from an air rifle were used to generate high frequency noise, the output could be tremendously loud.  (there are off the shelf dog whistles, but they do not have any sound intensity ratings.)  Since I like the electronics more than the mechanical side of things, I decided to build a custom circuit board and enclosure to power 6 ultrasonic emitters.
What ever you do, you want to first avoid getting hit by a car, wrecking, or getting bit by the dog.

From what I have read on the internet, smaller dogs can hear higher frequencies than a larger dog.  But, since smaller dogs have little chance of catching a cyclist, there is not much a threat there.  So, I used four emitters at 25KHz and two at 40KHz.  (I had the 40KHz emitters from a previous project)  

For the main MCU, I used an Atmel ATmega644.  I needed an MCU with three timers for the different frequency outputs.  Besides, I already had the MCU.   (the board in the picture above uses and ATMEGA32)  When a dog is heard getting close, the rider flips a toggle switch under the seat on.  The emitters then start doing their thing and hopefully drive the dog away.  I put a human audible piezo emitter next to the toggle switch to let me know it is working.  (this is much better than an LED, I would have to look at the LED, which would take my eyes off of the road and the dog)

The code is written in AVR studio and uses the GCC compiler.  Most of the time, the software is at the ultrasonic transducers resonant points.  (25KHz and 40KHz)  But, the software does move around the output frequency some to get a "siren" effect. 

Did it work?

I have not had a dog chase me since the box was installed on my bicycle.  But, I did try it out on my cat, Willie.  I disabled the human audible peizo emitter near the toggle switch before the test.  (I didn't want that to skew the test.)  The video is at the top of the post.
In all honesty, Willie is 18 years old and doesn't hear well.


  1. Cool.
    I've built these to but I just use some 555's, a big tweeter and a class AB amp with apropriate filters. It's not as specific as yours and both cats and dogs freak out .. as well as most children, birds, rodents and hearingaids.

  2. So, in conclusion the flawed test you did didn´t work. But does it work???? I would be interested to replicate this project :D thanks for the post.