Maker.io main logo

MiMaMori Alert for Your Home Security

2021-07-25 | By M5Stack

License: General Public License Arduino

 

* Thanks for the source code and project information provided by @aNo研

 

 

Story

"MiMaMori Alert" is automatic security camera for your home. Automatic learning without teaching images, and notification if there is a visitor. You're not at home, but you can see your visitors and thieves.

 

 

 

Introduction

Why worry about home while on the go! Have you experienced this?

  • While you were out, someone was pushing the intercom!
  • Or a thief has come into your house!!
  • Or your food was taken by family!!!

In such a case, if there is MiMaMori Alert, it will be solved. MiMaMori Alert is an automatic security camera. If network settings are required, you need only install the camera. No teaching image learning is required.

If there is any suspicious movement in front of the camera, the camera will automatically take a picture and notify you. MiMaMori Alert is very compact. And is very low cost.

 

Hardware

 

2

 

MiMaMori Alert is two configration.

・M5StickV + M5StickC

・M5UnitV + M5StickC

M5StickV and M5UnitV include Kendryte K210 is a very powerful device to compute neural networks.M5StickC is a portable network device. Which can be connected to the Internet.

 

3

M5StickV/UnitV and M5StickC are connected via the Grove ports. Communication is by UART and is performed using a proprietary protocol of data sent in 10-bit units.

 

Algorithm

 

4

The algorithm is as follows.

①First, feature vectors are calculated using Mobilnet's neural network. Mobilnet has created a V1 weight of 0.5 with Keras and NNcase. NNCASE is a Kendryte tool.

Copy Code
task = kpu.load(0x200000)
fmap = kpu.forward(task, img)
new_data = np.array(fmap[:])

②The feature vector obtained by the neural network is filtered in the time series direction, and a weighted average is obtained. Vector operation uses Numpy

Copy Code
#Feature Vector Update
def update(capture,new_data,weight):
new_data= new_data*weight+capture*(1.0-weight)
return new_data

new_data=update(capture,new_data,cap_weight)

③The distance between the average vector and the feature vector at the current time is calculated. This is equivalent to finding motion. The distance is large if moving, and small if static.

Copy Code
#Feature Vector Compare
def get_dis(new_data,master_data):
dist = np.sum((new_data-master_data)*(new_data-master_data))
return dist

dist=get_dis(new_data,master_data)

④Detects rising edge of waveform and sends data by UART. The rising edge is compared with the previous data in time series

5

 

Copy Code
if dist > dist_thresh:
if dist_old <= dist_thresh:
img_buf = img.copy()
img_buf.compress(quality=70)
img_size1 = (img_buf.size()& 0xFF0000)>>16
img_size2 = (img_buf.size()& 0x00FF00)>>8
img_size3 = (img_buf.size()& 0x0000FF)>>0
data_packet = bytearray([0xFF,0xF1,0xF2,0xA1,img_size1,img_size2,img_size3,0x00,0x00,0x00])
uart_Port.write(data_packet)
uart_Port.write(img_buf)
time.sleep(1.0)
print("image send,data_packet")

⑤M5StickC sends images and messages to LINE by notification from UART. M5StickC is programmed using the ArduinoIDE.

6

 

More Application

7

This devicecan detect object movement. Installation is also very easy, just place the object to be monitored in front of the camera. Various applications are possible.

Here is defense technique for Japanese traditional food "nameko". "MiMaMori Alert" is set behind the nameko. If the nameko is taken, it will notify you via LINE.

 

Demo instruction

This source code requires the MixPy option configuration Numpy. Custom binaries are stored within Github. Also, Neural networks require a MobileNetV1 with a weight of 0.5. This Kmodel file is also stored in Github. Write to M5StickV / UnitV with Kflash GUI Tools.

 

8

 

References

PuddingAlert-V

https://m5stack.hackster.io/anoken2017/puddingalert-v-34c560

Cheering Watch of M5StickC&V

https://m5stack.hackster.io/anoken2017/cheering-watch-of-m5stickc-v-34f0cc

 

 Schematics

 

99

 

Code

GitHub:anoken / MiMaMori_Alert

 

 

 

 

制造商零件编号 K027
M5STICKV K210 AI CAMERA
M5Stack Technology Co., Ltd.
¥406.19
Details
制造商零件编号 U078-C
UNITV AI CAMERA OV7740
M5Stack Technology Co., Ltd.
¥284.09
Details
制造商零件编号 U078
UNITV AI CAMERA OV2640
M5Stack Technology Co., Ltd.
More Info
Details
制造商零件编号 K016-C
M5STICKC ESP32-PICO IOT DEV KIT
M5Stack Technology Co., Ltd.
More Info
Details
制造商零件编号 K016-P
M5STICKC PLUS ESP32-PICO IOT KIT
M5Stack Technology Co., Ltd.
¥165.08
Details
Add all DigiKey Parts to Cart
TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum