Simple Access Control System: Use Barcode Scanner RTMU86 Control The Lock Directly, Without Use Access Control Panel.

RTMU86 uploads the scan data to the server and controls the door lock


In most cases, the composition of the access control system is like this: barcode scanner / NFC reader + access control panel + lock + control software/server.

However, if you use our RTMU86, we can make the system more simple.

Firstly, connect use RTMU86 scanner with the lock, and then connect RTMU86 to the server via Ethernet. The scanned content is sent to the server through the Ethernet. After the server verifies the content and sends the unlock command to the RTMU86, the RTMU86 directly controls the lock to be opened. So the solution becomes:

barcode scanner / NFC reader+ lock + control software/server.


Through this solution, we do not need to use the access control panel, thereby reducing the cost and greatly simplifying the difficulty of system integration. So


  1. If you use this solution, customers need to develop/build their own access control management software.
  2. In this article, we introduce a solution without the use of an access controller, but you can also use the RTMU86 to work together with the access controller and then connect with the lock. To learn more about this solution, please read:

Below, we describe the hardware connection and scanner configuration in detail.


1. Hardware connection

(1) RTMU86 connection with a lock

12V is connected to the RTMU86 com terminal input, and NO is connected to the positive pole of the electromagnetic lock power supply. After mu86 receives the unlock command, the com and no ports are turned on, and the electromagnetic lock is energized and unlocked.

Door lock connection diagram

(2) RTMU86 network port connection

The RTMU86 Ethernet version (the other version is the Wiegand version) directly leads out four network cable pins, which can be connected to four of the standard eight-core network cables according to the color. The network cable adopts the 568B connection method. Please refer to the table for wiring according to the color.

RTMU86 pins Pin4 Pin3 Pin2 Pin1
Network cable color Orange Orange white Green Green white
Network cable color icon


2.RTMU86 Configuration

(1).Select RTMU86

Click next

(2)Setup work mode

work mode:Develop,

Output: Ethernet


WIFI/Ethernet/2G output: TCP

(3) Set NET

SuccessAction:flash Green (Optional)

FailAction:flash red(Optional)

Set the service address and port to which the data is uploaded (*necessary settings)

Address: server address, such as

Port num: server port

IP mode setting

Dynamic IP: dynamic IP, IP address is automatically assigned by the router

Static IP: manually specify the IP address, when set to static IP, you must specify the IP address, Subnet mask, Gateway, the format is as follows

(4) Device scan code configuration

Click config code to generate configuration code. Device scan code configuration code to complete the configuration

For detailed usage of the configuration tool, please refer to “ScannerConfig Configuration Tool User Manual”.

After the configuration is complete, the device automatically connects to the specified server, and then reports the scan data after scanning the code.

3. Connect to the server

As a client, the MU86 scanner can establish a long TCP connection to the server and process the response returned by the server. The interface specification is defined as follows

TCP/TCP protocol

The format of the requested TCP/IP server IP address is:

The format of the requested TCP/IP server port is: 0-65535

The scanner sends the original scanned data to the server


4. Register account and control door lock

Use the server to build TCP server, accept the data reported by the scanner, determine the uploaded data, and issue the unlock command

Relay control command: (command is a hexadecimal array)

Command header Command word Data length Byte 1 Byte 2 Check word
2Byte 1Byte 2Byte 1Byte 1Byte 1Byte
0X55 0XAA 0x2a 0X02 0X00 0x01 On

0x00 Off

Duration (unit: 50MS) 0x00: Default time


55 aa 2a 02 00 01 02 d4 Relay on 100ms

55 aa 2a 02 00 00 02 d5 off relay

More instructions reference<>

In this test, the server side uses python to build tcpsever, reads the data uploaded by the device, and judges whether it meets the registered id and is in compliance with the issued unlock instruction

Run py

The device establishes a connection

Uploaded data received

ID is the same as the saved id, issue the unlock command

Reference source code

import binascii

from quopri import HEX

from socket import *

from time import ctime

HOST = ''

PORT = 8888

BUFSIZ = 1024


tcpSerSock = socket(AF_INET, SOCK_STREAM)



id_list = ["12345678", "abcdefg"]

def calculate_bbc(data, len):
    bbc = 0
    for i in range(len):
        bbc ^= data[i]
    return bbc

def detection_id(data):
    data_len = len(data)
    if data_len < 8:
        return 0

    if data[0] == 0x55 and data[1] == 0xaa and data[2] == 0x30 and data[3] == 0x00:

        bbc = calculate_bbc(data, data_len - 1)

        if bbc == data[data_len - 1]:
            id_len = data[4] + data[5] * 256
            read_id = data[6:6 + id_len]
            print("read id=", read_id)

            for cid in id_list:
                if read_id == cid.encode("UTF-8"):
                    return 1
                    print("Id not registered:", read_id)
                    return 0
    return 0

def send_lock_open(client, ms):
    buf = [0x55, 0xaa, 0x2a, 0x02, 0x00, 0x01, 0x00, 0x00]

    if ms < 50:
        ms = 50

    buf[6] = int(ms / 50)
    buf[7] = calculate_bbc(buf, 7)

    # print("send:", bytes(buf))


    recv = client.recv(BUFSIZ)

    if not recv:
        return -1

    # print(recv)

    if recv == b'\x55\xaa\x2a\x00\x00\x00\xd5':
        return 1
        return 0

def send_lock_close(client):
    buf = [0x55, 0xaa, 0x2a, 0x02, 0x00, 0x00, 0x00]

    buf[6] = calculate_bbc(buf, 6)


while True:

    print('waiting for connection...')

    tcpCliSock, addr = tcpSerSock.accept()

    print('...connnecting from:', addr)

    while True:

        data = tcpCliSock.recv(BUFSIZ)

        if not data:

        # print(data)

        if detection_id(data):

            print('open the door')

            if send_lock_open(tcpCliSock, 1000):
                print('open the door success')



Related Products:

For any questions, please consult our sales engineer or support team



Read More

WI-FI Wireless or Ethernet Barcode Scanner Solution


Wireless or Ethernet access control will be more and more popular in the future. Most traditional barcode scanners or NFC card reader without wireless or Ethernet feature. So RTscan developed a kit board that can convert a common USB barcode scanner or NFC reader into a Wi-Fi barcode scanner/Ethernet barcode scanner or a Bluetooth barcode scanner.

The barcode scanner is connected to RT001 via a USB cable, RT001 is connected to the router via WIFI or Ethernet (or connected to table/cell phone terminals via Bluetooth). And then transfer to read data to MQTT topic via remote MQTT server by the Internet.

This article takes the RT870 barcode scanner as an example, introduces how to use the RT870 barcode scanner together with RT001 to upload barcode decoded data via Wi-fi or Ethernet (MQTT server).


Connection diagram


Hardware preparation

    1. RT870 Barcode Scanner
    2. RT001 WIFI/Ethernet kit
    3. 5V power supply, it can be a mobile phone charger or other DC 5V power supply

Hardware connection


  1. RT870 connects to RT001 via USB cable

  1. RT001 connects to the router via network cable or WIFI

  1. Connect the power supply to RT001

Software prepare

1. RT001 configuration software:

RTSCAN Config ToolV1.2

Later, we can scan the configuration code generated by RTSCAN Config ToolV1.2 to set RT001 parameters.

2. MQTT server

Here we use a public MQTT server (MQTT Public Brokers), you can fill in your own MQTT server address port and other parameter information as needed.

Here we use the server, the official website is, the MQTT TCP port is 1883, and the MQTT WebSocket port is 8000

Its server requirements are as follows:

  • The server address is:
  • Port: 1883
  • No username and password required
  • Custom client id
  • Free subscription to publish topics

According to this rule, the parameters we fill in are:

  • Address:
  • Port: 1883
  • ClientID: Generate random id
  • Username: (NULL) leave it blank
  • UserPSW: (NULL) Leave it blank without filling in
  • Publish: /rtscan/rt870/pubtopic can be customized
  • Subscribe: /rtscan/rt870/subscribe can be customized

Scanner settings

You need to set the RT870 scanner to USB-CDC output: from the user manual, scan the USB-CDC setting code will be ok.

If you need others setting, please use RT870 to scan the corresponding settings codes from the RT870 user manual.

RT001 terminal parameter setting

RT001 provides a variety of connection methods. Here we use WIFI connection routing to establish an MQTT connection with

  1. Output mode is WIFI or Ethernet


2.When setting to Wi-Fi mode, you need to configure wireless router SSID and password

The encryption method is WPA2, no password, WIFI PSW does not fill in the content

For WIFI connection, fill in your Wi-Fi name (SSID) and password

3. In IP mode, it is recommended to obtain IP dynamically, and the router will assign IP. When set to static IP, three parameters need to be set correctly


Here we use the dynamic acquisition of IP

  1. NET Mode is set to MQTT mode

4. Enter the relevant parameters required by the MQTT server, address port client publish-subscribe option is required, Username, the user password is optional.

  • Address:
  • Port: 1883
  • ClientID: Generate random id
  • Username: (NULL) leave it blank
  • UserPSW: (NULL) Leave it blank without filling in
  • Publish: /rtscan/rt870/pubtopic can be customized
  • Subscribe: /rtscan/rt870/subscribe can be customized

5. Generate setting code

6. Use the device to scan the QR setting code to complete the configuration

Connect the scanner to RT001, scan the generated QR code, RT001 completes the configuration after receiving the configuration data sent by the scanner, and the device automatically connects to the set MQTT broker

7.Transparently transmit the scan code information to the MQTT server

Scan any barcode, the device uploads the barcode data to the set publishing topic and controls the device to upload data to the subject of the device subscription.

Receive data released by the device

After the device is set up, it will automatically connect to the MQTT server, subscribe to the set topic, and upload messages to the set topic.

To receive the scanned code data uploaded by RT001, we need to connect to the same MQTT Broker as RT001. The user can receive the scan code content uploaded by RT001 by subscribing to the topic published by RT001. When a command is sent to the scanner, the user publishes a message to RT001 subscription After receiving the data, RT001 transparently transmits it to the scanner.

MQTT test tool recommends online and PC software, such as:

Online tools

Pc software Mqtt. fx



Easylink uses MQTT Websocket to connect to MQTT broker, the MQTT Websocket port of is 8000

After connection, Subscribe to the topic published by the device

Publish messages to topics subscribed by the device

The device scans the 2d code, and the subscribed topic receives the data sent by the device


MQTT FX uses MQTT TCP to connect to MQTT broker, the MQTT TCP port of “” is 1883

Subscribe to the topic published by the device after connection /rtscan/rt870/pubtopic

The device scans the 2d code, and the subscribed topic receives the data sent by the device

Publish the message to the topic subscribed by the device: /rtscan/rt870/subscribe

Important tip

You need to set the barcode scanner to USB-CDC output first to successfully communicate with RT001

For any questions, please consult our sales engineer or support team



Read More