Introduction: Precious Things Protector
Has your 3-year old or dog ever smashed or tried to eat the Christmas ornaments on the tree? We have little munchkin visiting this year so I made a sensor that will buzz if he gets too close to alert me. Then I can come running to tell the pup to knock it off or scoop up my nephew. Crisis averted!
This device can also be used as an alert for other precious things as well, such as a buzzer by the china cabinet or the garage door. My nephew often gets concerned when people leave the main room and go into the garage so he often sits outside the garage door. This can be a problem if someone opens the door. To avoid this, we could also install this buzzer alarm to alert the person in the garage that the baby is sitting by the door so they know to open the door slowly.
Step 1: Gathering Your Supplies
To begin you'll need to gather the following supplies:
- LinkIt One Media Board
- Groove Buzzer
- Groove Distance Interrupter
- Battery
- A mischievous 3-year old or puppy
Step 2: Connect the Buzzer
To start we will need to connect the buzzer. It plugs right into the white Groove port (shown above).
We'll use this sensor to notify the adult in the house whenever our mischievous little one gets too close to our precious thing (i.e. Christmas tree).
Step 3: Connect the Distance Sensor & Battery
The last two things we need to connect to our LinkIt One is the distance sensor and the battery. The distance sensor gets plugged into the other white Groove port (shown above). The battery gets plugged into the white port in the lower left corner of your board (shown above). Now you are ready to fiddle with the code!
Step 4: Program the Buzzer
In order to make the buzzer work, you simply need to write a signal of 'HIGH' to it. This will send a high signal and make the buzzer turn on, emitting a painfully loud and annoying noise. This has a duel purpose: to alert you and scare away anyone who dares get close to your precious Christmas tree!
void DoBuzz()<br>{ digitalWrite(6, HIGH); delay(3000); digitalWrite(6, LOW); }
Step 5: Set-up & Program the Distance Sensor
The distance sensor is actually a little difficult to get the hang of at first. It took me a while to figure it out because you can't read different distances within the code. For example, you can't read "4 feet" or "2 feet away". Instead, you have to physically adjust the sensor to read an exact distance.
This means that it will only tell you if something is further than X or less than X units away. For our application, this will work great! How do you adjust this though? Well, you will have to pull out a tiny screwdriver and turn the little screw labeled 'R8'. Do this until the sensor stops beeping. That is your distance!
For our code, we'll just read if the signal is High or not (if someone has entered our danger zone!).
bool isSomeoneClose()<br>{ if(digitalRead(2)==HIGH) { return true; } else { return false; } }
Step 6: Putting It All Together!
Now that everything is attached, deploy the code attached to this step.
Attachments
Step 7: Protect Your Stuff!
To protect your precious ornaments place this device in the lower branches of the Christmas tree. Now you are all set to protect your precious things!