Pet Toy Beeper 2

by kristeller62 in Circuits > Arduino

1565 Views, 5 Favorites, 0 Comments

Pet Toy Beeper 2

5897f0998080cf94d60017be.jpeg
5897f9bc6b71fa1f7c001b2f.jpeg

I recently made a Pet Toy Beeper (https://www.instructables.com/id/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

Materials

5897f0eb1441aac23b005a16.jpeg
5897f0fe8080cfd983008107.jpeg
5897f11aef665ad2c200479c.jpeg

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 (http://www.jameco.com/z/SEN0032-DFRobot-Triple-Axis-Accelerometer-ADXL345_2190741.html).

Connections

wired.png
IMG_2248.JPG

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.

Component Build

5897f1f1f9ff19a6ed006bd9.jpeg
5897f2038852ddbf17005f28.jpeg
5897f2186b71fa2b97000d40.jpeg
5897f29a8852ddfcfb0031f6.jpeg
IMG_2251.JPG
IMG_2252.JPG
IMG_2254.JPG
IMG_2256.JPG
IMG_2257.JPG

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.

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

http://www.robotshop.com/media/files/pdf/datasheet...

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.

Testing

anti-motion sensor
Pet Toy Beeper Test 2
Pet Toy Beeper Test 3

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!