For those of you receiving your Espruino Bluetooth Starter Kits this week (we still have some left), here is a nice little project for you to start with:-
This project makes use of a cheap HC-SR501 PIR (Passive Infrared Sensor) module which can be bought on Ebay for only a few dollars. Using an Espruino, the PIR sensor module and a 9V battery, we can make an intruder Alarm that sends an alert to a mobile phone via Bluetooth...Perfect for catching your little brother in your bedroom and messing with your stuff!
[See attached image of the extremely simple circuit]
The demo App in the attached SPK will write a little program to the Espruino (via Bluetooth) which sends alert messages to the App whenever a signal is detected coming from the PIR module.
Here is the very simple Espruino code:-
function OnMotion()
{
console.log("Movement detected");
}
setWatch( OnMotion, C0, {repeat:true, edge:"rising"} );
How to use the App
1. Turn down the sensitivity and timeout settings on the PIR module with a small screwdriver (anti-clockwise).
2. Point the PIR detector away from you and other moving bodies.
3. Pair with the Espruino in your Bluetooth settings (shows as HC-05) using the password=1234.
4. Start the App and press the connect button.
5. Press the menu icon and choose the 'Program' option.
6. Wave your hand in front of the PIR detector (you should see and hear an alert on your phone)
Notes
- It's useful to run this App via the WiFi IDE at first, so you can see what is going on in the debug log.
- If you press the 'Save' menu option, then the program will be saved on the Espruino and run every time it's powered up.
- If you press the 'Reset' menu option, then the Espruino will be reset and all programs cleared for that session.
Further development ideas
- Add an option to send text message to a remote tablet or second phone.
- Add an option to send an email to your PC or tablet.
- Connect a siren to the board and allow remote triggering.
- Set your phone up as a security camera and trigger photos and/or video recording.