PUSR USR-M100-ARD User manual

USR-M100-ARD User Guide
pusr.com
1
- 2 -
Content
1. Introduction ...............................................................................................................................................- 4 -
1.1. Overview...........................................................................................................................................- 4 -
1.2. Parameters table...............................................................................................................................- 4 -
1.3. Pin Mapping......................................................................................................................................- 5 -
1.4. Indicators..........................................................................................................................................- 6 -
1.5. Dimension ........................................................................................................................................- 6 -
1.6. Development Environment ................................................................................................................- 6 -
2. Development Environment Setup................................................................................................................- 6 -
2.1. Main steps to set up a development Environment ..............................................................................- 6 -
2.2. Specific Step Instructions...................................................................................................................- 7 -
2.2.1. Download and install Arduino IDE ............................................................................................- 7 -
2.2.2. Add Boards Manager URLs .......................................................................................................- 7 -
2.2.3. Install ESP32 Boards.................................................................................................................- 7 -
2.2.4. Install the Needed library file ...................................................................................................- 8 -
2.2.5. Add AWS_IOT library file...........................................................................................................- 9 -
3. Program burning........................................................................................................................................- 9 -
3.1. Hardware connection........................................................................................................................- 9 -
3.2. Programming via Arduino ...............................................................................................................- 10 -
3.2.1. Downloading parameters settings..........................................................................................- 10 -
3.2.2. Download Program................................................................................................................- 11 -
3.3. Programming via ESP32 download tool ...........................................................................................- 11 -
3.3.1. Export compiled binary file.....................................................................................................- 12 -
3.3.2. Load BIN file .......................................................................................................................... - 12 -
4. Function introduction and testing .............................................................................................................- 15 -
4.1. Get starting.....................................................................................................................................- 15 -
4.2. IO Interface ..................................................................................................................................... - 15 -
4.3. STA setting......................................................................................................................................- 15 -
4.4. TCP mode setting ............................................................................................................................- 16 -
4.5. MQTT mode setting .........................................................................................................................- 16 -
4.6. Connecting to AWS platform............................................................................................................- 18 -
5. Contact Us................................................................................................................................................ - 21 -

USR-M100-ARD User Guide
pusr.com
1
- 4 -
1. Introduction
1.1. Overview
USR-M100-ARD is an open source IoT gateway powered by Espressif’s ESP32 module equipped with low
power Xtensa® 32-bit LX6 MCU 240 MHz processor with 4MB pSRAM and up to 8MB SPI flash memory on-board. It
integrates rich hardware interface: RS485/232, DO*2, DI*1, AI*1, downloading port, Wi-Fi, Ethernet port and BLE.
PUSR provides basic source code demo for users to develop their own application. For the rich hardware
interface and networking methods, this device can be applied in a variety of scenarios, especially scenarios
where users need to collect or control serial devices and IO devices simultaneously, such as: Wastewater
Treatment, Agricultural Irrigation, Solar Energy, Intelligent Farming etc.
1.2. Parameters table
USR-M100-ARD Parameters
Chipset
ESP32-WROVER-E
Professor
Dual-core Xtensa® 32-bit LX6 MCU, 1.2GHz
RAM
8M
Flash
4M
Power Supply
9~36V
Hardware Interface
RS232/485
1*RS232/485
Default parameter: 115200, N, 8, 1
DI
1*digital input, (0 - 2 V detected as logic low, 9 - 36 V detected as logic high)
DO
2*digital output
DC contacts rating @R(at resistive load)10A / 28V DC, NC
AC contacts rating @R(at resistive load)10A / 277V AC,NC
AC contacts rating @R(at resistive load)5A /250V AC, NO
AI
1*analog input(4~20mA)
Wi-Fi
Standard
IEEE802.11b/g/n
Speed
Up to 150Mbps
Frequency
2412 ~ 2484 MHz
Others
BLE
Compatible with BEL4.2
Table 1. Parameters of USR-M100-ARD

USR-M100-ARD User Guide
pusr.com
1
- 5 -
1.3. Pin Mapping
The table shows the corresponding relationship between the hardware interface pins of M100 and the pins
of the main control ESP32.
Users can also download the schematic diagram corresponding to the M100. Download link:
https://www.pusr.com/support/download/Schematic-Diagram-Hardware-schematic-diagram-Of-USR-M100-
ARD.html
Pins of M100
Pins of ESP32
Function
No.
Interface
Pin
Pin Name
No.
Description
1
RMII Interface
RMII_MDIO
IO18
30
For Ethernet port
2
RMII_MDC
IO23
37
3
RMII_REF_CLK
IO0
25
4
RMII_TXD0
IO19
31
5
RMII_TXD1
IO22
36
6
RMII_RX0
IO25
10
7
RMII_RX1
IO26
11
8
RMII_TXEN
IO21
33
9
RMII_CRS_DV
IO27
12
10
PHY Reset
PHY_RESET
IO5
29
11
RS485/232
UART1_TX
IO32
8
For serial port
12
UART1_RX
IO33
9
13
RS485_EN1
IO12
14
14
Reserved RS485
UART2_TX
IO13
16
Reserved, for IO expansion
machine
15
UART2_RX
IO34
6
16
RS485_EN2
IO14
13
17
Latch control
OE
IO4
26
Register input/control pin
18
LE
IO15
23
IO2
24
19
DO
DO1
DO1
Q1
Digital output(Not connect to
ESP32 directly)
20
DO2
DO2
Q2
21
DI
DI1
SENSOR_VN
5
Digital input
22
AI
ADC1
IO35
7
Analog input
23
Watchdog
MCU_WDI
RXD0
34
Pin for feeding watchdog
24
Reload
Reload
SENSOR_VP
4
1. Reset to factory settings
2. Enable program flashing mode
25
LED
LED_WORK
U0_RX
34
Work indicator
26
Reset
RESET
EN
3
Reset pin for watchdog
27
Flashing
SWCLK
U0_TX
35
Program Flashing
28
SWDIO
U0_RX
34

USR-M100-ARD User Guide
pusr.com
1
- 6 -
1.4. Indicators
USR-M100-ARD provides 2 indicators in total, the specific description is as follows.
Table 2. LED indicator
Name
Description
PWR
Steady on: power supply is normal.
Off: No power supply or abnormal power supply.
WORK
Blinking: The system works normally.
1.5. Dimension
➢DIN-Rail mounting and wall mounting supported.
➢79.6*58*110.0mm (L*W*H, accessories not included)
Figure 1. Dimension of USR-M100-ARD
1.6. Development Environment
Users can use the Arduino IDE provided by Arduino for development, or they can use the ESP-IDF tool
provided by ESP32 for development. This document is introduced based on the Arduino IDE development
environment.
2. Development Environment Setup
2.1. Main steps to set up a development Environment
For the steps to build a secondary development environment, refer to the picture below. The specific
operation steps will be introduced in detail in the following chapters.

USR-M100-ARD User Guide
pusr.com
1
- 7 -
2.2. Specific Step Instructions
2.2.1. Download and install Arduino IDE
Download and install Arduino IDE: https://www.arduino.cc/en/Main/Software
2.2.2. Add Boards Manager URLs
After installing the IDE, add additional boards manager URLs:
https://dl.espressif.com/dl/package_esp32_index.json
File->Preference-> Add Additional Boards Manager URLs
2.2.3. Install ESP32 Boards
Tools->Board Manager->Search “ESP”

USR-M100-ARD User Guide
pusr.com
1
- 8 -
2.2.4. Install the Needed library file
If users test the demo code provided by the PUSR, the following Library files need to be installed first:
•ESPAsyncWebServer
•ArduinoRS485
•ArduinoModbus
•PubSubclient
•OneButton
•Sketch->Library Manager->Search ”ESPAsyncWebServer”->Install
Users can also download the other libraries needed on Arduino IDE.

USR-M100-ARD User Guide
pusr.com
1
- 9 -
2.2.5. Add AWS_IOT library file
PUSR offers library source code of AWS, users can download from:
https://www.pusr.com/support/download/Library-File-AWS-IOT-File-Provided-by-PUSR.html
The downloaded libraries should be copied to the installation path of Arduino IDE.
Note: If the AWS code is needed, users are strongly encouraged to use the AWS libraries we provide.
3. Program burning
There are two main ways of burning firmware: through Arduino IDE and the tool provided by ESP32. The
specific usage methods of the two burning tools are introduced below.
No matter which method is used to burn, the download cable needs to be connected in advance.
3.1. Hardware connection
Before you start, some preparations is needed.
•USR-M100-ARD*1
•USB to TTL converter *1
•Wi-Fi antenna*1
•USB to RS485/232 Cable*1
•12V/1A Power Adapter*1
The hardware connection is like this:

USR-M100-ARD User Guide
pusr.com
1
- 10 -
3.2. Programming via Arduino
3.2.1. Downloading parameters settings
Tools-->Board-->”ESP32-WROOM-DA Module”
Tools-->Board-->Port-->Select the right COM. Users can check the COM port in device manager like the
following picture. If there is not this COM port in device manager, users can install the serial port driver.
Download link: https://www.pusr.com/support/download/Serial-Driver-USB-To-Serial-Driver.html

USR-M100-ARD User Guide
pusr.com
1
- 11 -
3.2.2. Download Program
Users could edit, compile, and download code on the Arduino IDE.
Click the “Upload” button to compile the code first, When the compilation is about to be completed, press
and hold the reload button, power on the USR-M100-ARD. Do not release the reload button during the program
download process, otherwise the program will fail to be burned.
Note: The
3.3. Programming via ESP32 download tool
Users can export the BIN file through Arduino or other tools, and then download the BIN file through
FLASHDOWNLOAD TOOL.

USR-M100-ARD User Guide
pusr.com
1
- 12 -
3.3.1. Export compiled binary file
•Users can edit code on Arduino IDE, and export compiled binary file.
•Open flash_download_tool, Chipset—ESP32
3.3.2. Load BIN file
xxx.ino.bin Start register address:0x10000
xxx.ino.bootloader.bin Start register address:0x1000
xxx.ino.partitions.bin Start register address:0x8000
The xxx.ino.bin file is the binary file exported above. The bootloader and partitions can be downloaded

USR-M100-ARD User Guide
pusr.com
1
- 13 -
from our official website:
https://www.pusr.com/support/download/Reference-Document-USR-M100-ARD-Demo-and-Reference-
Document.html
Select COM port, BAUD is 921600.
SPIFlashConfig: 40MHz,DIO,DoNotChgBin
1> Power off the USR-M100-ARD, hold on the reload button, power on the USR-M100-ARD device, click
“START” button, it starts to programming.

USR-M100-ARD User Guide
pusr.com
1
- 15 -
4. Function introduction and testing
PUSR provides a simple demo program to facilitate customers to test various hardware interface functions.
The main functions of the Demo program include: IO port testing, setting AP/STA mode, data transparent
transmission over TCP/MQTT protocol.
Note: All the following tests in this section are based on code provided by PUSR.
4.1. Get starting
The default parameter of USR-M100-ARD is shown in the following table.
Item
Value
SSID
usriot
Password
012345678
IP Address
192.168.4.22
Users can connect to M100-ARD via Wi-Fi. Then enter 192.168.4.22 in URL blank of browser.
4.2. IO Interface
Click the first button on the webpage, it will navigate to the following page. Users can control the on and off of
DO through the switch on this interface.
4.3. STA setting
Click the second button, and enter the SSID and password of the router which USR-M100-ARD will connect to.
With this demo code, the length of the SSID and password should be less than 10 characters.
The setting will take effect after restarting. To improve efficiency, users can set all parameters at once and then

USR-M100-ARD User Guide
pusr.com
1
- 16 -
restart.
4.4. TCP mode setting
Click button, then set the server IP and port. In TCP mode, the device work at TCP client
mode only for now.
Server IP: 172.16.11.221
Server port: 8081
On TCP server side,
Local Host: 172.16.11.221
Local port: 8081
From the following picture, we can see the data can be transmitted between the serial port and TCP server.
4.5. MQTT mode setting
In MQTT mode, users can set server IP, username and password to connect the MQTT server to communicate.

USR-M100-ARD User Guide
pusr.com
1
- 17 -
The setting will take effect after restarting. To improve efficiency, users can set all parameters at once and then
restart.
In this document, we set the parameters like the following:
Server IP: 123.233.249.74
Username: mqtt_10
Password: USR-test
Publish: songhuioutTopic
Subscribe: mqtt_to_rs485
Settings of M100-ARD
Settings of MQTTx software

USR-M100-ARD User Guide
pusr.com
1
- 18 -
4.6. Connecting to AWS platform
To use this code connecting to the AWS platform, you need to ensure that the M100-ARD is connected to a
router that can connect to the Internet through Wi-Fi.
M100-ARD can connect to the AWS platform through the MQTT protocol, and the corresponding parameters
have been encapsulated in the demo code. Users do not need to care about the parameter settings on the M100-
ARD side. Users can use MQTTfx.exe to test this function.
➢Open MQTTfx.exe
Broker Address: awwis0u7xuagf.ats.iot.cn-north-1.amazonaws.com.cn
Broker Port: 8883
Client ID: Generate
SSL/TLS:Load the certificates, check the PEM Formatted
Publish/Subscribe topic: m100_ard
The needed certificate file can also downloaded from the official website:
https://www.pusr.com/support/download/SSL-Certificate-SSL-Certificate-Files-for-AWS.html
Other manuals for USR-M100-ARD
1
Table of contents
Other PUSR Gateway manuals