|
OpenMV Module |
x 1 | |
|
AMB23 (RTL8722DM-MINI) |
x 1 |
|
arduino IDEArduino
|
|
|
OpenMV IDE |
Machine Vision Trip WIre | Switch App when Motion Detected
Introduction
Wanna slack off abit but scared to be busted? Here is the all-in-one wireless tripwire that help you automatically switch your computor program when motion is detected! Best of all, it uses MicroPython to program OpenMV so you can even add some "whitelist" using face recognition, and it also use RTL8722DM_MINI as the Bluetooth Keyboard, so you can even trigger a custom script upon motion detected~??
Demo
Project Details
A hearty combination of "Machine Vision" and "Bluetooth HID" function yields this "Office Tripwire" device.
How it works:
Essentially, it works by letting the OpenMV device to constantly comparing the current frame captured with the last frame, if the difference is greater than a set threshold, then a signal will be generate on a GPIO pin to alert the Ameba (AMB23 RTL8722DM), which then functions as a bluetooth keyboard and send a "Alt + Tab" keystroke over bluetooth to the connected device whose primary program will be switch to the next program.
Arduino Code
#include "BLEHIDDevice.h"
#include "BLEHIDKeyboard.h"
#include "BLEDevice.h"
BLEHIDKeyboard keyboardDev;
BLEAdvertData advdata;
#define ENABLE_PIN 9
void setup() {
Serial.begin(115200);
advdata.addFlags();
advdata.addCompleteName("AMEBA_BLE_HID");
advdata.addAppearance(GAP_GATT_APPEARANCE_HUMAN_INTERFACE_DEVICE);
advdata.addCompleteServices(BLEUUID(HID_SERVICE_UUID));
BLEHIDDev.init();
BLE.init();
BLE.configAdvert()->setAdvData(advdata);
BLE.setDeviceName("AMEBA_BLE_HID");
BLE.setDeviceAppearance(GAP_GATT_APPEARANCE_HUMAN_INTERFACE_DEVICE);
BLE.configSecurity()->setPairable(true);
BLE.configSecurity()->setAuthFlags(GAP_AUTHEN_BIT_BONDING_FLAG);
BLE.configServer(3);
BLE.addService(BLEHIDDev.hidService());
BLE.addService(BLEHIDDev.battService());
BLE.addService(BLEHIDDev.devInfoService());
pinMode(ENABLE_PIN, INPUT);
BLE.beginPeripheral();
}
int flag = 0;
void loop() {
if (BLE.connected() && digitalRead(ENABLE_PIN) && flag == 0) {
Serial.println("Sending keystrokes");
keyboardDev.keyReleaseAll();
delay(100);
keyboardDev.keyPress(HID_KEY_ALT_LEFT);
delay(100);
keyboardDev.keyPress(HID_KEY_TAB);
keyboardDev.keyReleaseAll();
delay(100);
flag = 1;
} else {
flag = 0;
delay(100);
}
}
Future Improvement:
The same function can be achieved by just using a PIR sensor. However, with OpenMV, you may add in a hint of AI by enabling the Face Recognition feature on OpenMV, then this device could potentially only triggers when a face that is not on the whitelist is detected, making it actually useful and fun.
-----------
PS: This project is also posted on Hackaday.io at
https://hackaday.io/project/183782-wireless-tripwire-with-machine-vision
Machine Vision Trip WIre | Switch App when Motion Detected
- Comments(0)
- Likes(1)
- SimonX Jul 28,2022
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by SimonX
- Minimalist 5G WiFi & BLE microcontroller In my other projects, I have demonstrated the power of the Ameba RTL8720D based IoT microcontroller ...
- DIY Handheld Thermometer with WiFi BackgroundNow is 2022 and we are still combatting COVID and its varients, it's a long battle so we n...
- Machine Vision Trip WIre | Switch App when Motion Detected IntroductionWanna slack off abit but scared to be busted? Here is the all-in-one wireless tripwire t...
- Hand Controlled LED | OpenCV | MicroPython | IoT LED + OpenCV + MicroPython + AMB23 IoT Microcontrollers = Wireless Hand Control LEDLaziness is one o...
- 3D Printed Collapsing Light Saber with RGB LED Let's watch a demo first! ??https://www.youtube.com/shorts/7kb5SGYx1NIBackgroundRecently I got obsse...
- DIY Function Generator in 3 Lines Code IntroductionMake your own programmable Function Generator using only 3 lines of Python code!Function...
- Dual-Band Wi-Fi Toolkit | 2.4 + 5GHz | A powerful Swiss Army Knife for Wi-Fi IntroductionI have previously demonstrated a few other projects such as1) 5G WiFi Scanner2) WiFi Sig...
- BW16 Stamp - Tiny 5GHz WiFi Dev. Board Demo 1:Demo 2:Want the best of 5G WiFi connectivity while still maintain super compact form factor? ...
- The Fuxk Button | Best Desktop Tool for Linux Beginners What is this project about?When you just got started with Linux, there are a lot of commands to lear...
- DIY IoT Terminal Demo VideoIntroductionA dedicated IoT terminal can be really useful sometimes for displaying your Io...
-
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
113 0 0 -
DIY Laser Power Meter with Arduino
163 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
156 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
564 0 3