Quick Reference For WIZio-RTU
WIZio-RTU is a high-performance industrial control board developed by WIZnet’s W55MH32Q chip, specifically designed for industrial field applications. With its flexible power supply options, extensive interface configurations, and reliable control core, it meets diverse industrial automation control requirements.
Visit WIZio-RTU for more information about the board.
The below pinout is for WIZio-RTU.
Note
CAN transmission and 4G Module are currently not supported. Please look forward to updates in the nearby future.
Basic Setup
Important
You will need STM32CubeProgammer before using MicroPython on WIZio-RTU.
Connect the RS-232 terminal to your PC using a USB port.
Open STM32CubeProgrammer and select UART from the connection dropdown menu on the right panel.
To connect the board to STM32CubeProgrammer:
- Press and hold the BOOT0 button.
- While holding BOOT0, press and release the RESET button.
- Click Connect in STM32CubeProgrammer.
- If connected succesfully, release BOOT0 and RESET.
Go to the Erasing & Programming tab.
Select Full chip erase to clear the chip memory.
Choose the firmware file from your PC, then click Start Programming.
After programming is complete, disconnect STM32CubeProgrammer.
Press RESET on the WIZio-RTU board.
Open your preferred MicroPython REPL tool. You should see the MicroPython terminal. Test it with:
print("hello world!")
HTTP Configuration
Important
Visit WIZio-RTU HTTP Configuration for the source code of ths project.
The WIZio-RTU HTTP Configuration Server runs a lightweight web server on the board, allowing users to configure and control the device from a web browser or HTTP client.
Through the web interface, users can configure network settings, control I/O channels, read analog values, send and receive serial data, and access EEPROM storage.
After cloning the WIZio-RTU HTTP Configuration Server repository to your PC, upload all project files to the device. Once the upload is complete, reset the device to start the HTTP configuration program.
Warning
Sometimes Syntax Error may arise due to bad file writes. If you found this error, just reupload the given file and it should be good to go.
When the board boots, main.py enables garbage collection, imports http_app.py, and calls start(). The start() function then runs the HTTP server. After the network is initialized, the console prints the board address in this format:
Welcome to MicroPython WIZio-RTU. Visit http://<board-ip>:80 to configure your board.
Open that address in a browser to access the web interface.
Startup Flow
main.pyenables garbage collection and importshttp_app.py.http_app.pycreates aDeviceobject for hardware access.http_app.pyalso creates aServerobject and registers all HTTP routes.server.run()initializes the WIZnet network interface.The server listens on TCP port
80.For every HTTP request, the server reads the header, reads the body if a
Content-Lengthis present, matches the route, and sends a response.
Web Page Demonstration
Network Config
DHCP:
Static:
The Network Configuration tab allows users to view and change network details of the WIZio-RTU board.
When accessed, the tab first retrieves the current network settings from the device.
If DHCP mode is selected, the network information cannot be edited manually.
If Static mode is selected, you need to enter the correct network addresses before submitting the configuration.
After submission, the redirect behavior depends on the selected mode:
In DHCP mode, click the URL shown in the MicroPython REPL terminal to open the new web page.
In Static mode, the web page will automatically redirect to the new IP address.
Digital I/O
Upon entering the I/O Control interface, you can click each relay button to change its output state.
When a relay is activated, the corresponding relay LED on the WIZio-RTU board will turn on, and a clear clicking sound can be heard from the relay.
For digital inputs, the web interface continuously polls the input channel states. When an input circuit is active, the corresponding input LED on the WIZio-RTU board will turn on, and the channel status will be displayed as ON in the web interface.
Note
Reading Inputs: Each fetch interval queries the
/dinAPI endpoint to retrieve the real-time status of the input pins.Controlling Relays: Pressing the toggle button dispatches a
POSTpayload to the/ioAPI endpoint to update the relay states.
Analog I/O
On the Analog I/O page, you may view the ADC values of your board.
The acquisition mode must match the board’s actual operating mode.
In the ADC section, the webpage automatically sets the operating mode according to the board’s software configuration. See device.py for the implementation details.
To view or change the acquisition mode, install the required resistors in the operating-mode circuits. For guidance, visit WIZio-RTU, download the WIZio-RTU user manual, and refer to Section 2.7.
Note
/analog_out uses a POST request to send the desired DAC output value to the device.
/analog_input/state retrieves the current ADC input values from the device.
Serial
On the serial page, you can send and receive data through the UART transmission line using pins A2, B2, and GND. This connection corresponds to RS485 interface 2.
The webpage continuously polls for UART data. When data is received from the device, it is displayed in the webpage terminal.
You can use the WIZnet Serial Debugging Tool located on the index page for this test. Make sure all serial parameters match the UART_CONFIG settings in config.py.
Storage
On the WIZio-RTU, the on-board EEPROM is connected to the board’s I2C line. You can read data from, or write data to, the EEPROM.
See eeprom.py for detailed usage of the EEPROM device.
Note
The EEPROM may be used to store binary data. Therefore, data that cannot be decoded as UTF-8 is displayed as � on the webpage. This is expected behavior.
Customizing the HTTP Application
The HTTP server uses http_app.py to define the web routes and the behavior behind each page or API request.
Edit http_app.py if you need to customize the HTTP application for your own peripheral needs. For example, you can change what happens when a relay is switched, when an input value is read, when a UART message is received, or when a new HTTP request is handled.
The lower-level files should normally be kept unchanged:
server.pyhandles the HTTP connection, request parsing, response sending, and route dispatching.device.pyprovides the basic hardware control functions for the WIZio-RTU board.
For most user customizations, only http_app.py needs to be edited.
Below you can find a more detailed explanation of each section of the HTTP webpage.
MQTT Device
Important
Visit WIZio-RTU MQTT Device for the source code of ths project.
Similar to the HTTP configuration interface, the MQTT-enabled application allows the WIZio-RTU to be monitored and controlled remotely through an MQTT broker.
With the MQTT interface, users can:
Control relay outputs by switching individual relays on or off
Monitor digital inputs and receive updates when an input state changes
Measure analog inputs in either current mode or voltage mode
Generate analog output voltages of up to approximately
10 VSend and receive serial data through the onboard UART interface
Access the onboard EEPROM, including write, read, and wipe operations
Monitor device states remotely using retained MQTT state messages
Integrate the WIZio-RTU with dashboards, automation systems, and IoT platforms
Visit MQTT Topics Summary for the default topics.
The MQTT application is suitable for remote monitoring, industrial control, equipment testing, and automation projects where the WIZ-RTU needs to exchange data with other devices or software services.
Note
To test the MQTT functionalities of the board, you can run the MQTTDashboard script under the above repo.
Make sure you download Eclipse Mosquitto on your PC and start your MQTT Broker.
MQTT Demonstration
Network Config
DHCP to Static
Static to DHCP
WIZio-RTU uses two MQTT topics for network configuration:
network_config/statepublishes the current network settings.network_config/setapplies new network settings submitted by the user.
After a new configuration is submitted, the network interface is updated and a restart flag is set. DeviceMQTT.run() detects this flag, restarts the MQTT connection, and reconnects to the broker using the updated network settings.
Digital I/O
For WIZio-RTU’s MQTT digital outputs, when a value is submitted through the dashboard, it is published to the digital_output/+/set topic, where the + wildcard represents the selected relay pin RY[1-8].
After receiving the command, the device updates the relay and publishes its current state to digital_output/+/state.
A value of 1 (HIGH) turns the relay on, while 0 (LOW) turns it off.
Note
When the relay is activated successfully, you should hear an audible click and see the corresponding relay LED turn on.
For WIZio-RTU’s MQTT digital inputs, the device polls under device._poll_din() and checks whether there are changes in the pin.
When a change is detected, the device publishes to the corresponding pin IN1-8 under digital_input/+/state with message
{
"value": 1
}
Note
When the input forms a complete circuit, you should see the corresponding input LED turn on.
Analog I/O
For WIZio-RTU’s MQTT analog outputs, when a value is submitted through the dashboard, it is published to the analog_output/+/set topic, where the + wildcard represents the selected relay pin AO0 or AO1.
After receiving the command, the device updates the analog output and publishes its current state to analog_output/+/state.
Both the command and state messages use the following JSON format:
{
"voltage": 1
}
The range of voltage must be in between (0 - 10) V.
Note
To verify the voltage, you can use a multimeter to measure across AOx to the GND terminal.
The WIZio-RTU board provides four analog inputs, from AI0 to AI3. The device periodically measures all analog inputs and publishes their current readings to:
analog_input/state
The published message uses the following JSON format:
{
"AI0": {
"value": 12.3,
"mode": 1
},
"AI1": {
"value": 11.8,
"mode": 1
},
"AI2": {
"value": 2.5,
"mode": 0
},
"AI3": {
"value": 3.1,
"mode": 0
}
}
AI0 and AI1 operate in current mode and report values in milliamperes (mA), while AI2 and AI3 operate in voltage mode and report values in volts (V).
Important
The dashboard updates automatically based on each 10 readings and submits a average value among the 10 values.
Serial/UART
WIZio-RTU MQTT UART communication uses the following topics by default:
uart/write— Sends data from the MQTT client to the WIZio-RTU UART interface.uart/read— Publishes data received by the WIZio-RTU UART interface.
Use the WIZnet Serial Debugging Tool during testing to send and receive serial data and verify that UART communication is working correctly.
Storage/EEPROM
For WIZio-RTU MQTT EEPROM, there consist of four important topics regarding to normal R/W operations.
eeprom/writeeeprom/read/requesteeprom/read/responseeeprom/wipe
The write and wipe operations are straightforward. Data published to eeprom/write is converted to bytes and stored in the EEPROM, while publishing the expected command to eeprom/wipe clears the stored EEPROM data.
Reading data requires a request-and-response process. First, publish a message to eeprom/read/request using the following payload:
{"index": integer}
The index value specifies the EEPROM location from which reading should begin. After processing the request, the device publishes the retrieved data as bytes to eeprom/read/response. Any MQTT client subscribed to this topic can then receive the EEPROM contents.
Note
To receive updated EEPROM data, subscribe to the eeprom/read/response topic is enough.
Customizing MQTT Behavior
The MQTT application uses mqtt_app.py to define the topics that the device subscribes to and the functions that are executed when messages are received.
Edit mqtt_app.py when you need to customize the MQTT commands for your own peripheral or application requirements. For example, you can:
Add a new subscribed topic.
Change an existing subscribed topic.
Define what happens when a relay-control message is received.
Process commands for custom sensors or peripherals.
Change how incoming UART, EEPROM, analog-output, or network-configuration messages are handled.
Subscribed topics and their corresponding handler functions are registered using the add_topic() decorator:
@client.add_topic("custom/topic")
def handle_custom_topic(msg):
print("Received:", msg)
When a message is received on custom/topic, the MQTT application automatically calls handle_custom_topic() and passes the received payload to the msg argument.
The lower-level files should normally be kept unchanged:
device_mqtt.pymanages the MQTT connection, topic subscriptions, message dispatching, publishing, device polling, and standard state updates.device.pyprovides the basic hardware-control functions for the WIZio-RTU board.mqtt.jsonstores the MQTT broker address, port, username, and password.main.pystarts the MQTT application by importing and runningmqtt_app.py.
For most MQTT application customizations, only mqtt_app.py needs to be edited.
In the default application structure,
mqtt_app.pymainly defines the subscribed command topics and the functions that handle their incoming messages, whiledevice_mqtt.pyhandles the functions for published state topics . The published topics report the current device state to the MQTT broker and connected applications.
Modify device_mqtt.py only when you need to change the underlying MQTT behavior, such as:
How the MQTT client connects or disconnects.
How topics are subscribed to and dispatched.
How device inputs are polled.
How frequently analog inputs are sampled.
How state messages are published.
How MQTT wildcard topics are matched.
How the MQTT run loop behaves.
Modify device.py only when you need to change the underlying hardware-control behavior, such as GPIO, ADC, DAC, UART, I2C, or EEPROM operations.
Below you can find a more detailed explanation of the available MQTT topics, their payload formats, and the corresponding device behavior.
- MQTT Application Overview
- Network and Broker Configuration
- MQTT Topic Summary
- Initial State and Retained Messages
- Network Configuration Topics
- Digital I/O Topics
- Analog I/O Topics
- Serial UART Topics
- EEPROM Topics
- Runtime, Restart, and Error Behavior
- Customizing the MQTT Application
- Example Usage With Mosquitto
General Board Controls
You can find similar scripts as in W55MH32L-EVB.
Network
See Networking.
Delay and timing
See Delay and timing.
Pins and GPIO
Since some pins are being attached already to input/output/analog circuit, Most pins are being limited to its own functions.
for example, since IN1 is binded to an input circuit,
from machine import Pin
pin = Pin('IN1', Pin.OUT)
This will causes error:
>>> Pin('IN1', Pin.OUT)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid pin mode: 1
Timer
See Timers.
RTC (real time clock)
ADC
See ADC (analog to digital conversion).
Note
ADC pins are only available on AI0/PA0, AI1/PA3, AI2/PA6 and AI3/PA7.
DAC
See DAC (digital to analog conversion).
Note
DAC pins are only available on AO0/PA4 and AO1/PA5.
SPI
See SPI bus
Attention
SPI is not available on the board except for the network interface of the W55MH32 chip.
I2C
There is a total of 2 sets of I2C pins on the board.
One is used for the onboard EEPROM, and one is not attached.
Please connect the onboard resistor in order to enable the second set of I2C pins.
See I2C bus