Introduction: Pet Toy Beeper 2

I recently made a Pet Toy Beeper ( so my dog and I could continue to play fetch after dark or in the snow. This worked fine but it annoyed my dog to have the beeper going constantly. So I decided to try and make an anti-motion sensor that I could put in his new favorite toy. The beeper would only start if the sensor detected NO motion. That way when he picks it up it stops and when he cant find it it beeps. Turns out it was pretty simple with an arduino, an adxl345 and some misc odds and end

Step 1: Materials

I started with the basic electronics toolkit (solder, jumpers, breadboard, etc.). Then I grabbed a Kong chew toy, a little LED flashlight, an arduino and an ADXL345 accelerometer (

Step 2: Connections

There is a lot of information on the internet for connecting the arduino and the ADXL345. Through some trial and error I ended up with this layout. I use the digital pin 3 and 4 for driving the beeper and LEDs.

Step 3: Component Build

I wanted the components to fit inside the little flashlight. I also wanted to use the built in switch of the flashlight for turning it on and off. As it turns out, the flashlight is grounded through the barrel of the flashlight. So connecting the negative battery lead to the switch inside, then having my ground wires touch the inside sides of the barrel allowed the switch to perform as designed.

Step 4: Resources

Searching for Arduino and ADXL345 provides a lot of material to sift through. All of it is good but it takes time to find information specific to what you are doing. I found this PDF ( also located at

to have the most information to use as a starting point. Many of the ADXL345 sample code available have include libraries for arduino. The problem is they are each specific to the programming samples included and they are all labeled as ADXL345. When you find sample code also download their library.

Also included here is my source code for my build.

Step 5: Testing

The ADXL345 has interrupts built in to allow testing ACTIVITY and INACTIVITY. I use these to set a flag value to control the BEEP. There are also setting for the INACTIVITY timeout and ACTIVITY forces. These are well documented in the PDF.

Thanks for looking!

Sensors Contest 2017

Participated in the
Sensors Contest 2017