Blinking Light on Camera Motion
This is a quick video on how to blink a light when an Eagle Eye camera detects motion. There are plenty of ways to do this, and this is just the way I decided based on what I had available on my desk.
I used the following parts:
- Raspberry Pi 2B
- Arduino Uno
- one red LED
- 3D printed Eagle Eye logo
- EE-blinker that runs on the Raspberry Pi
- blink_sketch that runs on the Arduino
The Arduino was configured with the red LED on pin 13. The sketch looks for serial communication (over the USB port from the Raspberry Pi) of an ASCII character. If the character is '1' then it turns on, if it is '2' then it turns off.
As an aside, why didn't I make it 1 or 0? Because originally I was planning on having multiple states and the states did a sequence of things.
The Raspberry Pi is just running a Node.js program and it could be replace by any other computer. The program itself could also be replaced with any other language to subscribe to the Eagle Eye API.
You can see the code for the entire project here. Make sure to read the README file and follow the instructions to create an appropriate `config.js` file. It also contains the correct serial port for connecting to the Arduino so make sure you have that correct.
What else can we do with this?
The above example is listening for motion events. Specifically it is listening for ROMS and ROME events (ROI motion start, ROI motion end). It could easily be adapted to use other events.
If you are monitoring for status changes (camera online/offline, recording on/off, streaming on/off) you most likely want to listen the status bitmask directly. The events are delayed because we go through our own internal heuristics to filter out false positives.
You can find an example of subscribing to the poll stream, getting the status bitmask, and parsing it in this example project.
I hope you found this helpful. If you have any questions please feel free to reach out to us at api_support@een.com