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.

W55MH32L-EVB

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.

  1. Connect the RS-232 terminal to your PC using a USB port.

  2. Open STM32CubeProgrammer and select UART from the connection dropdown menu on the right panel.

  3. To connect the board to STM32CubeProgrammer:

    1. Press and hold the BOOT0 button.
    2. While holding BOOT0, press and release the RESET button.
    3. Click Connect in STM32CubeProgrammer.
    4. If connected succesfully, release BOOT0 and RESET.
  4. Go to the Erasing & Programming tab.

  5. Select Full chip erase to clear the chip memory.

  6. Choose the firmware file from your PC, then click Start Programming.

  7. After programming is complete, disconnect STM32CubeProgrammer.

  8. Press RESET on the WIZio-RTU board.

  9. 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

  1. main.py enables garbage collection and imports http_app.py.

  2. http_app.py creates a Device object for hardware access.

  3. http_app.py also creates a Server object and registers all HTTP routes.

  4. server.run() initializes the WIZnet network interface.

  5. The server listens on TCP port 80.

  6. For every HTTP request, the server reads the header, reads the body if a Content-Length is present, matches the route, and sends a response.


Web Page Demonstration

Network Config

DHCP:

static-to-dhcp

Static:

dhcp-to-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

IO Control

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 /din API endpoint to retrieve the real-time status of the input pins.

  • Controlling Relays: Pressing the toggle button dispatches a POST payload to the /io API endpoint to update the relay states.

Analog I/O

Analog I/O Control

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

UART Serial Test

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

EEPROM Storage Test

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.py handles the HTTP connection, request parsing, response sending, and route dispatching.

  • device.py provides 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 V

  • Send 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

MQTT dhcp-to-static Test

Static to DHCP

MQTT static-to-dhcp Test

WIZio-RTU uses two MQTT topics for network configuration:

  1. network_config/state publishes the current network settings.

  2. network_config/set applies 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

MQTT DOut Test

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

MQTT AOut Test

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

MQTT serial Test

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

MQTT storage Test

For WIZio-RTU MQTT EEPROM, there consist of four important topics regarding to normal R/W operations.

  1. eeprom/write

  2. eeprom/read/request

  3. eeprom/read/response

  4. eeprom/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.py manages the MQTT connection, topic subscriptions, message dispatching, publishing, device polling, and standard state updates.

  • device.py provides the basic hardware-control functions for the WIZio-RTU board.

  • mqtt.json stores the MQTT broker address, port, username, and password.

  • main.py starts the MQTT application by importing and running mqtt_app.py.

For most MQTT application customizations, only mqtt_app.py needs to be edited.

In the default application structure,

  • mqtt_app.py mainly defines the subscribed command topics and the functions that handle their incoming messages, while

  • device_mqtt.py handles 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.


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)

See 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