5673 views|1 replies

1372

Posts

2

Resources
The OP
 

【Home Electronic Guard】Work Submission [Copy link]

 

Electronic door guard

Author: cruelfox

I. Introduction of
  the Work Title: Electronic Door Guard. The idea is to use RSL10 with a low-power accelerometer, attached to the back of the door panel, to collect acceleration information, detect the door panel vibration caused by knocking and the door panel acceleration caused by opening the door, and thus record the events of knocking and opening the door. The BLE function of RSL10 sends status information to the BLE terminal in real time, which can be used to view logs and control other electronic devices, such as expanding functions such as wireless doorbells and intrusion alarms.

2. System Block Diagram
  The work consists of two parts: a wireless sensor unit (using RSL10-COIN-GEVB development board) attached to the back of the door panel and a mobile BLE terminal (using RSL10-QFN-EVB development board). The wireless sensor unit is a slave, powered by a 3V button battery; the BLE terminal is a host, powered by a small lithium iron phosphate or USB.

The wireless sensor unit is connected to a KX023 three-axis acceleration sensor through the reserved I2C interface of RSL10-COIN-GEVB.

The BLE terminal is connected to the expansion PCB via the Arduino interface of RSL10-QFN-EVB, on which there is a 96x64 monochrome graphic LCD module with an I2C interface for information display; there are also 6 buttons directly connected to the GPIO for control.

The wireless sensor unit and the BLE terminal exchange information through the BLE connection.

3. Functional description of each part

After the wireless sensor unit is started, it collects three-axis acceleration signals at a sampling rate of 50Hz, and generates a "DoubleTap" status flag through the built-in signal processing function of KX023. The RSL10 software processes the Z-axis acceleration signal, identifies the door opening action, and directly reads the "DoubleTap" detection result of KX023 as the knock judgment. Acceleration signal collection works 24 hours a day, and the BLE function is also continuously turned on. When it is not connected to the BLE terminal, it is in a continuous broadcast state (1500ms interval). When the BLE terminal scans the device and initiates a connection, the two are always in a connected state (400ms interval) unless there is a communication failure or one party loses power.

After the BLE terminal is started, it will automatically scan the wireless sensor unit and actively initiate a connection. After the connection is successful, it will obtain the internal time and date information of the target device and provide an operation interface for modifying the date and time. Then, the BLE terminal will display the latest event (door opening and door knocking) information records and can browse up to 1024 event records stored in the target device.

The working mode state transition diagram of the BLE terminal is as follows:

  The wireless sensor unit uses a custom BLE service, which includes two Characteristic, one for sending log records to the terminal (4 bytes each, 4 records are transmitted at a time); the other is used to send status information to the terminal (8 bytes, using the Notify method) and receive commands from the terminal.

  The power saving mode of the wireless sensor unit is particularly important because it is always in the state of data collection and processing, and wireless communication is always on. Saving power consumption in any part is related to the battery working time. Because the KX023 sensor has a small amount of internal cache, it can store up to 0.8 seconds of 16-bit three-axis acceleration data at a data rate of 50Hz. As long as the wake-up cycle of RSL10 is less than this time, data loss can be guaranteed. In this design, the RSL10 of the wireless sensor unit mainly works in Sleep mode, that is, to minimize its current when it does not need to work. Sensor data access and BLE operation are performed through RTC timed wake-up. The timer setting is automatically completed by the BLE SDK function. The software does not directly intervene, but only reads the RTC counter value for software timing (because there is no hardware calendar clock function).

  Through power consumption optimization, the continuous working average current of the wireless sensor unit is about 30 microamperes (including the working current of KX023 of about 11 microamperes, including the temperature sensor on the COIN board consumes 2 microamperes). The average current in BLE broadcast mode is slightly smaller than that in the connected state, which is due to the reduced working time of the wireless part.
  There are obstacles in optimizing the power consumption of the BLE wireless terminal, because even if the RSL10 uses the Standby mode, it cannot communicate normally after the connection is successful. Finally, it is only allowed to work in normal mode, and the RSL10 has an operating current of 700~800 microamperes. However, the wireless terminal is a user interface and does not need to be turned on all the time.

4. Source Code

  As the forum post attachment is uploaded.
  The slave and host programs are developed based on the SDK's peripheral_server_sleep and central_client_uart examples respectively. The program framework has not changed, both are based on Event Kernel message drive.
  The code is organized using GNU Makefile and compiled using the arm-none-eabi-gcc tool chain. The code directories of the wireless sensor unit and BLE terminal are in the home_mon and central subdirectories respectively.

5. Demonstration video of the work’s functions

Upload to EE University: https://training.eeworld.com.cn/course/6120

  Use the acceleration sensor unit (RSL10+KX023) attached to the back of the door to detect vibration and movement, realize the event detection of door opening and door knocking, and exchange information with the terminal through BLE, and realize log viewing on the handheld terminal.
  The handheld terminal is also implemented by RSL10. After turning on, it automatically scans the target device and connects. After connecting, it obtains the time and date information of the device (which can be modified at this time), and then enters the log interface.
  In the video, the first knock on the door was not detected successfully.

6. Project Summary

  This project was finally hastily finished - there was really not enough time to complete it. I had originally planned the function of a wireless doorbell, and a buzzer was arranged on the PCB, but I didn't have time to implement the function in the software. Although it took two weeks longer than the original schedule, I didn't expect that I had to work on the LCD interface function until the last minute.
  It was not easy to get started with the RSL10 BLE part. In the early stage, I didn't understand the program structure, which delayed the progress. There was a lack of documentation for this part. Although I had written a BLE application program before, I didn't understand it so thoroughly, so I was stretched.

  Post sharing summary:

Door knock and door opening detection

https://bbs.eeworld.com.cn/thread-1171117-1-1.html

I2C operation of RSL10 and reading of acceleration measurement data of KX023

https://bbs.eeworld.com.cn/thread-1170822-1-1.html

RSL10 low power mode

https://bbs.eeworld.com.cn/thread-1170349-1-1.html

Code Analysis of Event Kernel in RSL10 SDK (Part 2)

https://bbs.eeworld.com.cn/thread-1168940-1-1.html

Code Analysis of Event Kernel in RSL10 SDK (Part 1)

https://bbs.eeworld.com.cn/thread-1168457-1-1.html

SDK BLE example project command line compilation (HeartRate device)

https://bbs.eeworld.com.cn/thread-1164617-1-1.html

Command line compilation of SDK example projects (blinky)

https://bbs.eeworld.com.cn/thread-1164611-1-1.html

On-chip memory resources of RSL10

https://bbs.eeworld.com.cn/thread-1164147-1-1.html

RSL10 Development Board Circuit Overview

https://bbs.eeworld.com.cn/thread-1163113-1-1.html

VII. Others

rsl10_cruelfox.zip

1.24 MB, downloads: 7

cruelfox_rsl10.doc

1.1 MB, downloads: 3

Latest reply

The home door electronic project is very practical. Although it does not fully realize the function of the wireless doorbell, the design process of the project is worth learning.   Details Published on 2021-7-19 14:15
 
 

6587

Posts

0

Resources
2
 

The home door electronic project is very practical. Although it does not fully realize the function of the wireless doorbell, the design process of the project is worth learning.

 
 
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list