Step3 Setting up network connection and MQTT function.
The objective of this experiment is to set up a network and connection that will enable the transmission of data from each door opening to a temporary cloud storage area via the MQTT protocol. The setup will be done using WiFi. MQTT is a messaging protocol based on the 'publish/subscribe' mechanism, which is analogous to the video posting and subscribing mechanism of social media or YouTube.
In MQTT, the sender of messages is analogous to a YouTube channel or an Instagram account. Once a movie has been released or an Instagram post has been made, it is not sent directly to subscribers. Instead, it is handed over to a server or third party (broker), which coordinates and manages the release and subscription issues. Each source of content (e.g., a movie or an article) is assigned a unique topic name (e.g., the title of the movie or article), and the proxy is a server software. The entity that transmits the topic to the server is the publisher, and the entity that receives the topic from the server is the subscriber.
Firstly, please set up the WiFi connection function of the Access Control Core. To do this, open the Advanced menu of Uiflow, select 'Connect to Wi-Fi SSID' and enter the password in Network. You will then be prompted to enter the name and password of the access point at the location where you intend to set up the access control system. Please select 'Connect to Wi-Fi SSID' and enter the name and password of the access point (AP) that can be connected to the location where you want to set up the access control system.
To confirm whether the WiFi is online or not, add a judgment logic function and the screen UI scroll component. When the WiFi is online, it will show green, and when it is offline, it will show red. This completes the network online setting. Uiflow uses the following function columns: The following functions have been included: Judgment Logic, WiFi Setting, and UI Component.
The MQTT Broker used by the access control system is a free broker provided by HiveMQ to all users.Open your browser and go to Public Broker to check the Host and TCP Port of the Broker.
Next, open the Advanced menu of UiFlow, use the MQTT host to set and enable MQTT function, fill in the TCP port and server of the broker, and set a user name for the client, after the setting is completed, Core will enable MQTT service under Wifi connection.Uiflow uses the following functions.
To set up a cell phone to receive/send MQTT messages, search for IoT MQTT Panel in GOOGLE PLAY or Apple app store and download it to open it. IOT MQTT Panel is a lightweight and easy to use MQTT tool with many Ui templates already set up, and the paid version provides real-time notifications on the cell phone to pop up notifications when new messages are received. notifications when new messages are received.
After opening the App, first according to the previously set CORE broker TCP Port and server (BrokerWeb) in order to fill in the Client also set a user's name, here remember to add a function Dashboard otherwise it can not be created!
After the creation of a good Dashboard and then build the UI function module (Add panel), we have to build a total of two attributes of the function module, one is the record of access control triggered by the Text Log, and one is the remote control of the Switch switch.
Step4 Access Control Log
Create an access control record function, when the access control system triggered to confirm the identity of the function to send the confirmation results to this record, the principle of work is to create a Topic (I set here as M5Stack_Log), to provide the access control system Core to send a message to this Topic. function module settings: adjust the number of messages displayed and the font size, the timestamp, the cell phone real-time notification function ( Enable notification) must be paid to use. Enable notification) must be paid to use, after the setting is completed, press SAVE to complete the creation.
Step5.Access Control Function--Remote Unlocking
Remote Switching : The working principle is to set a Topic on the cell phone, according to the UI switch status (ON/OFF) on the cell phone to send a msg (I take it as unlock/lock), the Core on the door lock will read the msg by subscribing to the Topic on the cell phone, and then it can control the door lock switch.
Below the hook function column, you can put the bottom of the Show received timestamp and Show sent timestamp hook up to record the time point, cell phone real-time notification function (Enable notification) must be paid to use, set up after the completion of the SAVE that is to complete the creation.
Please ensure that Uiflow is enabled, that the remote control function is configured, and that the access control CORE subscription broker's Topic (Lock_Action) is set up. When the cell phone is activated, the unlocking subroutine (UNLOCK) should be executed to open the door lock and the access control record transmitted to the cell phone's Topic (M5Stack_Log) with the name Remote_OPEN. Please note that the name must be entered correctly, as an incorrect case will result in failure to receive and transmit the message. The message name is 'Remote_OPEN'. Please note that the name must be entered correctly, as an incorrect topic will result in the message not being received or transmitted. Uiflow uses the following function columns: The MQTT function, judgment logic function, text import subroutine and other functions are available for use.
Remote control results in a successful solenoid valve actuation and is displayed on the Core screen. The logging module on the cell phone displays data with a time stamp.
Step6 Access Control Function--RFID
To set up the RFID access control function, first add a Main loop under the current MQTT setting function, as the main program to trigger the judgment, and add the function to trigger the function when there is an RFID card close to the function.Uiflow uses the function columns: MAIN function creation, judgment logic function, RFID function library.
Create RFID judgment function (RFID_decision), RFID subroutine (RFID_OK), and RFID subroutine (RFID_Denied). The judgment function (RFID_decision) is used as the execution subroutine (RFID_OK) plus the system subroutine (UNLOCK) when RFID is correct, or the execution subroutine (RFID_Denied) plus the system subroutine (LOCK) when RFID is incorrect.
Remember to add MQTT push function in the two RFID subroutines after completion, no matter correct or error will push the message to the Topic (M5Stack_Log), RFID UID can be obtained through the Uiflow RFID function.Uiflow use to the function column : build RFID subroutine function, judgment logic function, RFID function library, UI components, MQTT functions, text, import subroutine functions.
Successful RFID recognition of the solenoid valve will act once and display the correct card on the Core, and the card that senses an error will display the error.
The logging module on the cell phone displays the correct and incorrect (with time stamps) information.
Step6 Access Control Function--Keystroke Password Entry
To set the keystroke password function, add a keystroke function trigger function under the main program (Main) loop, which is triggered when the number of digits entered into the keypad is greater than or equal to 7. Uiflow uses the following function columns: Function, Judgement Logic Function, Text, Keypad Module Function.
The following functions and subroutines should be created: Password_decision, RFID_OK, and RFID_Denied. The Password_decision subroutine is used as an executable subroutine (Type_OK) plus a system subroutine (UNLOCK) when the password is entered correctly, or as an executable subroutine (Type_Denied) plus a system subroutine (LOCK) when the password is entered incorrectly.
Once you have completed the password input subroutines, please add the MQTT push function to both, regardless of whether the password was entered correctly or incorrectly. The message will then be pushed to the Topic (M5Stack_Log). Uiflow uses the following function columns: The following functions are to be created: Password Input Subroutine, Judgment Logic, Keyboard Module, UI Component, MQTT, Text, and Import Subroutine.
The solenoid valve acts once and displays correctly on the Core if the password is entered correctly, and displays incorrectly if the password is entered incorrectly.
The logging module on the cell phone displays the data of correct and incorrect passwords (with time stamps).
Conclusion
This real-life access control system employs a range of technologies, including
RFID, fingerprint recognition, keystroke and other modules, to rapidly develop robust hardware solutions. It utilises MQTT communication protocols to remotely unlock door locks and generate access control records. Due to the advanced functionality of Blocky, features such as AI face recognition are not currently available on UiFlow. However, we will be introducing advanced YOLO detection functions after image streaming in the near future.