Skip to content

Commit 36b443c

Browse files
chupingshanrenIRISZZW
authored andcommitted
HUST_SHMS
1 parent 8836b6d commit 36b443c

17 files changed

+3730
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Smart Home Monitoring System
2+
3+
The smart home monitoring system collects video information through a camera, and processes the data locally to monitor the situation of the elderly. The hardware modules mainly used in this project are IoT DK development board, OV7670 camera module, buzzer and display. The system can be used in more interesting applications in the future. For example, different behaviors of people can be judged according to different movement patterns, so as to realize the recognition of human activities.
4+
5+
* [Introduction](#introduction)
6+
* [System Architecture](#system-architecture)
7+
* [Hardware and Software Setup](#hardware-and-software-setup)
8+
* [Required Hardware](#required-hardware)
9+
* [Required Software](#required-software)
10+
* [Hardware Connection](#hardware-connection)
11+
* [User Manual](#user-manual)
12+
* [Before Running This Application](#before-running-this-application)
13+
* [Run This Application](#run-this-application)
14+
15+
## Introduction
16+
The smart home monitoring system has the functions of real-time monitoring of human activities, recognition of daily activities and falling actions, and real-time alarms for falling actions.
17+
18+
19+
### System Architecture
20+
![][4]
21+
22+
## Hardware and Software Setup
23+
### Required Hardware
24+
- [ARC IoT Development Kit][1]
25+
- [OV7670 Camera Module][2]
26+
- Buzzer Module
27+
- Arduino
28+
29+
### Required Software
30+
- ARC GNU Toolchain 2020.03
31+
- Serial port terminal, such as putty, tera-term or minicom
32+
- [embarc_osp(Branch:embarc_mli)][3]
33+
- Python3.6
34+
- Pycharm
35+
- Tensorflow 2.0
36+
37+
### Hardware Connection
38+
1. Connect OV7670 camera module to ARC following below instructions
39+
40+
# ARC: 2x18 Pin Extension Header
41+
SIOC -> I2C0_SCL (need pull-up 10K resistor)
42+
SIOD -> I2C0_SDA (need pull-up 10K resistor)
43+
44+
# ARC: Arduino PIN
45+
VSYNC -> PIN IO0
46+
OE -> PIN IO1
47+
WEN -> PIN IO2
48+
WRST -> PIN IO3
49+
D7~D0 -> PIN IO4~11
50+
RCK -> PIN IO12
51+
RRST -> PIN IO13
52+
53+
3V3 -> +3.3V
54+
RESET -> +3.3V
55+
GND -> GND
56+
PWDN -> GND
57+
58+
2. Connect Buzzer module to IoT DK 2x18 Pin Extension Header
59+
60+
3. Boot up ARC IoT Development Kit Board to start
61+
62+
4. Connect the USB port of ARC to the laptop to recieve results
63+
64+
## User Manual
65+
### Before Running This Application
66+
* Download source code of SHMS from github
67+
* Make sure all connection is correct again
68+
69+
### Run This Application
70+
Here take IoT DK, CUR_CORE = arcem9d with ARC GNU Toolchain 2020.03 for example to show how to run this application.
71+
1. To build this applicaiton, select the proper board version, core configuration and build with selected toolchain using this command `make BOARD=iotdk BD_VER=10 CUR_CORE=arcem9d TOOLCHAIN=gnu run`.
72+
2. Open your serial terminal such as Tera-Term on PC, and configure it to right COM port and 115200bps.
73+
3. Interact using IoT DK and serial port terminal.
74+
4. After ARC connect with the laptop via USB, type `python python/helper.py` in the terminal to start recieving the results.
75+
76+
[1]: https://embarc.org/embarc_osp/doc/build/html/board/iotdk.html "ARC IoT Development Kit"
77+
[2]: https://www.voti.nl/docs/OV7670.pdf "OV7670 Camera Module"
78+
[3]: https://github.com/foss-for-synopsys-dwc-arc-processors/embarc_osp.git "embarc_osp(Branch:embarc_mli)"
79+
[4]: ./doc/system.png "System Architecture"
Loading
38.3 KB
Loading
34.6 KB
Loading
Loading
Loading
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Application name
2+
APPL ?= SHMS
3+
4+
5+
CUR_CORE = arcem9d
6+
7+
BOARD = iotdk
8+
TOOLCHAIN = gnu
9+
10+
APPL_DEFINES = -DUSE_APPL_MEM_CONFIG -DV2DSP_XY -DMODEL_BIT_DEPTH=8
11+
#
12+
# root dir of embARC
13+
#
14+
EMBARC_ROOT = ../../../..
15+
16+
MID_SEL = common
17+
LIB_SEL = embarc_mli
18+
# application source dirs
19+
APPL_CSRC_DIR = ./src
20+
APPL_ASMSRC_DIR = .
21+
22+
# application include dirs
23+
APPL_INC_DIR = ./src
24+
25+
# include current project makefile
26+
COMMON_COMPILE_PREREQUISITES += makefile
27+
28+
### Options above must be added before include options.mk ###
29+
# include key embARC build system makefile
30+
include $(EMBARC_ROOT)/options/options.mk
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import tkinter as tk
2+
import time
3+
import threading
4+
import re
5+
from tkinter import messagebox
6+
import random
7+
import serial
8+
from time import sleep
9+
10+
on_hit = False
11+
12+
class Application(tk.Tk):
13+
def __init__(self):
14+
super().__init__()
15+
COM_PORT = '/dev/serial/by-id/usb-Digilent_Digilent_USB_Device_251642542476-if00-port0'
16+
BAUD_RATES = 115200
17+
#self.ser = serial.Serial(COM_PORT, BAUD_RATES)
18+
19+
20+
self.title('家居助手')
21+
self.createUI()
22+
23+
def createUI(self):
24+
tk.Button(self, text='开始', command=lambda :self.thread_it(self.start, 1)).pack(expand=True, side=tk.LEFT)
25+
self.text = tk.Text(self)
26+
self.scroll = tk.Scrollbar()
27+
self.scroll.pack(side=tk.RIGHT,fill=tk.Y)
28+
self.text.pack(side=tk.LEFT,fill=tk.Y)
29+
self.scroll.config(command=self.text.yview)
30+
self.text.config(yscrollcommand=self.scroll.set)
31+
32+
def start(self, songs):
33+
global on_hit
34+
if on_hit == False:
35+
on_hit = True
36+
self.ser=serial.Serial("COM9",9600,timeout=0.5)#using serial port: winsows com1
37+
while(on_hit):
38+
self.update()
39+
40+
41+
42+
data = self.ser.readline().decode()
43+
para = data.split(',')
44+
self.text.insert(tk.END, "跌倒概率:%s \t-- %s\n" %(para[0], time.ctime()))
45+
self.text.see('end')
46+
if re.search('fall',data):
47+
messagebox.showwarning('Warning', 'someone fall')
48+
49+
else:
50+
on_hit = False
51+
self.ser.close()#close serial port
52+
#time.sleep(5)
53+
#self.var.set('')#var.set('')
54+
55+
@staticmethod
56+
def thread_it(func, *args):
57+
t = threading.Thread(target=func, args=args)
58+
t.setDaemon(True)
59+
t.start()
60+
# t.join()
61+
62+
63+
app = Application()
64+
app.mainloop()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#ifndef _APPL_MEM_CONFIG_H_
2+
#define _APPL_MEM_CONFIG_H_
3+
4+
#if defined(BOARD_EMSK)
5+
/* arcem9d only */
6+
7+
#define REGION_MLI_ROM REGION_ROM
8+
#define REGION_MLI_DATA REGION_DCCM
9+
#define REGION_MLI_BSS REGION_DCCM
10+
#define REGION_MLI_ZDATA REGION_DCCM
11+
#define REGION_MLI_MODEL_P2 REGION_DCCM
12+
#define REGION_MLI_MODEL REGION_DCCM
13+
#define REGION_MLI_XDATA REGION_XCCM
14+
#define REGION_MLI_YDATA REGION_YCCM
15+
16+
#elif defined(BOARD_IOTDK)
17+
18+
#define REGION_MLI_ROM REGION_ROM
19+
#define REGION_MLI_DATA REGION_DCCM
20+
#define REGION_MLI_BSS REGION_DCCM
21+
#define REGION_MLI_ZDATA REGION_DCCM
22+
#define REGION_MLI_MODEL_P2 REGION_DCCM
23+
#define REGION_MLI_MODEL REGION_XCCM
24+
#define REGION_MLI_XDATA REGION_XCCM
25+
#define REGION_MLI_YDATA REGION_YCCM
26+
27+
#elif defined(BOARD_EMSDP)
28+
29+
#define REGION_MLI_ROM REGION_ROM
30+
#define REGION_MLI_DATA REGION_DCCM
31+
#define REGION_MLI_BSS REGION_DCCM
32+
#define REGION_MLI_ZDATA REGION_DCCM
33+
#define REGION_MLI_MODEL_P2 REGION_DCCM
34+
#define REGION_MLI_MODEL REGION_XCCM
35+
#define REGION_MLI_XDATA REGION_XCCM
36+
#define REGION_MLI_YDATA REGION_YCCM
37+
38+
#elif defined(BOARD_NSIM)
39+
#define REGION_MLI_ROM REGION_ICCM
40+
#define REGION_MLI_DATA REGION_DCCM
41+
#define REGION_MLI_BSS REGION_DCCM
42+
#define REGION_MLI_ZDATA REGION_DCCM
43+
#define REGION_MLI_MODEL_P2 REGION_DCCM
44+
#define REGION_MLI_MODEL REGION_XCCM
45+
#define REGION_MLI_XDATA REGION_XCCM
46+
#define REGION_MLI_YDATA REGION_YCCM
47+
#endif
48+
49+
#endif /* _APPL_MEM_CONFIG_H_ */

0 commit comments

Comments
 (0)