• sales

    +86-0755-88291180

RP2350-ETH-8DI-8RO User Guide

Overview

Introduction

RP2350-ETH-8DI-8RO is an industrial-grade 8-channel network relay based on RP2350B microcontroller and supports RS485, Ethernet port and other peripheral interfaces. It features built-in power isolation and optocoupler isolation and other protection circuits, which is safe, stable and more reliable.

Features

  • RP2350B microcontroller chip officially designed by Raspberry Pi
  • Unique dual-core and dual-architecture design, equipped with dual-core ARM Cortex-M33 processor and dual-core Hazard3 RISC-V processor, flexible clock running up to 150 MHz, supporting flexible switching between the two architectures
  • Built-in 520KB of SRAM and 16MB of on-chip Flash
  • Type-C port, easier to use
  • High quality relay, contact rating: ≤10A 250V AC or ≤10A 30V DC
  • The digital inputs feature bidirectional optocoupler isolation, supporting both passive and active switch inputs. The relay outputs can be controlled via a switch interlock (linkage) mode
  • Onboard isolated RS485 interface, for connecting to various RS485 Modbus industrial modules or sensors
  • Onboard pin header, allowing access to other devices
  • Onboard power supply screw terminal, supports 7~36V wide voltage input, suitable for industrial applications
  • Onboard RTC clock chip, supports timing tasks
  • Onboard W5500 Ethernet chip, extending 10/100Mbps network connectivity via SPI interface
  • PoE network port version supports external PoE module for Power over Ethernet (IEEE 802.3af compliant)
  • Onboard optocoupler isolation to prevent interference with control chip from external high-voltage circuit connected to the relay
  • Onboard digital isolation to avoid external signal interference with the control chip
  • Onboard integrated power isolation, providing stable isolation voltage, no extra power supply required for the isolated terminal
  • Onboard TF card slot, supporting external TF card storage for pictures or files
  • Built-in buzzer, RGB colorful LED, power supply and RS485 TX/RX indicators for monitoring the operating status of the module
  • Rail-mounted ABS protective enclosure, easy to install, safe to use
  • USB1.1 host and slave device support
  • Low-power sleep and dormant modes
  • Drag-and-drop programming via USB mass storage
  • 15 × multi-functional GPIO pins
  • 2 × SPI, 2 × I2C, 2 × UART, 8 × 12-bit ADC and 12 × controllable PWM channels
  • Accurate clock and timer on-chip
  • Temperature sensor
  • On-chip accelerated floating-point library
  • 12 × Programmable I/O (PIO) state machines for custom peripheral support

Pinout Definition


Dimensions


Electrical Safety Precautions

  • This product should be operated by professional electricians or technical personnel. During use, please ensure electrical safety and take protective measures such as anti-leakage and insulation.
  • Before installing, maintaining, or replacing relay device, make sure to turn off the power and unplug the device.
  • Do not attempt to dismantle relay device to avoid damaging the device or risking electric shock.
  • Please properly install and place the relay device. Avoid using it in damp, overly hot, or flammable environments to prevent safety accidents due to improper installation or use.

Pico Getting Started

Firmware Download

Collapse
  • MicroPython Firmware Download


Collapse
  • C_Blink Firmware Download


Basic Introduction

Raspberry Pi Pico Basics

MicroPython Series

Install Thonny IDE

To facilitate the development of Pico/Pico2 boards with MicroPython on a computer, it is recommended to download the Thonny IDE

  • Download Thonny IDE and follow the steps to install, the installation packages are all Windows versions, please refer to Thonny's official website for other versions
  • After installation, configure the language and motherboard environment for the first use. Since we are using Pico/Pico2, pay attention to selecting the Raspberry Pi option for the motherboard environment


  • Configure MicroPython environment and choose Pico/Pico2 port
    • Connect Pico/Pico2 to your computer first, and in the lower right corner of Thonny left-click on the configuration environment option --> select Configure interpreter
    • In the pop-up window, select MicroPython (Raspberry Pi Pico), and choose the corresponding port


Raspberry-Pi-Pico-Basic-Kit-M-3.png

Flash Firmware

  • Click OK to return to the Thonny main interface, download the corresponding firmware library and burn it to the device, and then click the Stop button to display the current environment in the Shell window
  • Note: Flashing the Pico2 firmware provided by MicroPython may cause the device to be unrecognized, please use the firmware below or in the package
  • How to download the firmware library for Pico/Pico2 in windows: After holding down the BOOT button and connecting to the computer, release the BOOT button, a removable disk will appear on the computer, copy the firmware library into it
  • How to download the firmware library for RP2040/RP2350 in windows: After connecting to the computer, press the BOOT key and the RESET key at the same time, release the RESET key first and then release the BOOT key, a removable disk will appear on the computer, copy the firmware library into it (you can also use the Pico/Pico2 method)


MicroPython Series Tutorials

【MicroPython】 machine.Pin class function details
【MicroPython】machine.PWM class function details
【MicroPython】machine.ADC class function details
【MicroPython】machine.UART class function details
【MicroPython】machine.I2C class function details
【MicroPython】machine.SPI class function details
【MicroPython】rp2.StateMachine class function details

C/C++ Series

For C/C++, it is recommended to use Pico VSCode for development. This is a Microsoft Visual Studio Code extension designed to make it easier for you to create, develop, and debug projects for the Raspberry Pi Pico series development boards. No matter if you are a beginner or an experienced professional, this tool can assist you in developing Pico with confidence and ease. Here's how to install and use the extension.

  • Official website tutorial: https://www.raspberrypi.com/news/pico-vscode-extension/
  • This tutorial is suitable for Raspberry Pi Pico, Pico2 and the RP2040 and RP2350 series development boards developed by Waveshare
  • The development environment defaults to Windows11. For other environments, please refer to the official tutorial for installation

Install VSCode

  1. First, click to download pico-vscode package, unzip and open the package, double-click to install VSCode
    Pico-vscode-1.JPG
    Note: If vscode is installed, check if the version is v1.87.0 or later


Install Extension

  1. Click Extensions and select Install from VSIX

  2. Select the package with the vsix suffix and click Install

  3. Then vscode will automatically install raspberry-pi-pico and its dependency extensions, you can click Refresh to check the installation progress

  4. The text in the right lower corner shows that the installation is complete. Close VSCode

Configure Extension

  1. Open directory C:\Users\username and copy the entire .pico-sdk to that directory

  2. The copy is completed

  3. Open vscode and configure the paths for the Raspberry Pi Pico extensions

    The configuration is as follows:
    Cmake Path:
    ${HOME}/.pico-sdk/cmake/v3.28.6/bin/cmake.exe
    
    Git Path:
    ${HOME}/.pico-sdk/git/cmd/git.exe    
    
    Ninja Path:
    ${HOME}/.pico-sdk/ninja/v1.12.1/ninja.exe
    
    Python3 Path:
    ${HOME}/.pico-sdk/python/3.12.1/python.exe             
    

New Project

  1. The configuration is complete, create a new project, enter the project name, select the path, and click Create to create the project
    To test the official example, you can click on the Example next to the project name to select

  2. The project is created successfully

Compile Project

  1. Select the SDK version

  2. Select Yes for advanced configuration

  3. Choose the toolchain, 13.2.Rel1 is applicable for ARM cores, RISCV.13.3 is applicable for RISCV cores. You can select either based on your requirements

  4. Select Default for CMake version (the path configured earlier)

  5. Select Default for Ninja version

  6. Select the development board

  7. Click Compile to compile

  8. The uf2 format file is successfully compiled

Flash Firmware

Here are two methods for flashing firmware

  1. Flash firmware using the pico-vscode plugin
    Connect the development board to the computer, click Run to flash the firmware directly

  2. Flash the firmware manually
    1. Press and hold the Boot button
    2. Connect the development board to the computer     
    3. Then the computer will recognize the development board as a USB device.
    4. Copy the .uf2 file to the USB drive, and the device will automatically restart, indicating successful program flashing.
    

Import Project

  1. Select the project directory and import the project

  2. The Cmake file of the imported project cannot have Chinese (including comments), otherwise the import may fail
  3. To import your own project, you need to add a line of code to the Cmake file to switch between pico and pico2 normally, otherwise even if pico2 is selected, the compiled firmware will still be suitable for pico

    set(PICO_BOARD pico CACHE STRING "Board type")
    

Update Extension

  1. The extension version in the offline package is 0.15.2, and you can also choose to update to the latest version after the installation is complete

Arduino IDE Series

Install Arduino IDE

  1. First, go to Arduino official website to download the installation package of the Arduino IDE.

  2. Here, you can select Just Download.

  3. Once the download is complete, click Install.

    Notice: During the installation process, it will prompt you to install the driver, just click Install

Arduino IDE Interface

  1. After the first installation, when you open the Arduino IDE, it will be in English. You can switch to other languages in File --> Preferences, or continue using the English interface.

  2. In the Language field, select the language you want to switch to, and click OK.

Install Arduino-Pico Core in Arduino IDE

  1. Open the Arduino IDE, click on the file in the top left corner, and select Preferences

  2. Add the following link to the attached board manager URL, and then click OK
    This link already includes board versions such as RP2040 and RP2350. Please visit arduino-pico for the latest version files
    https://github.com/earlephilhower/arduino-pico/releases/download/4.5.2/package_rp2040_index.json

    RoArm-M1 Tutorial II05.jpg
    Note: If you already have an ESP32 board URL, you can use a comma to separate the URLs as follows:

    https://dl.espressif.com/dl/package_esp32_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/4.5.2/package_rp2040_index.json
  3. Click Tools > Development Board > Board Manager > Search pico, as my computer has already been installed, it shows that it is installed
    Pico Get Start 05.png
    Pico Get Start 06.png

Upload Demo at the First Time

  1. Press and hold the BOOTSET button on the Pico board, connect the pico to the USB port of the computer via the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).

  2. Download the program and open D1-LED.ino under the arduino\PWM\D1-LED path
  3. Click Tools --> Port, remember the existing COM, do not click this COM (the COM displayed is different on different computers, remember the COM on your own computer)

  4. Connect the driver board to the computer using a USB cable. Then, go to Tools > Port. For the first connection, select uf2 Board. After uploading, when you connect again, an additional COM port will appear

  5. Click Tools > Development Board > Raspberry Pi Pico > Corresponding models (Raspberry Pi Pico, Raspberry Pi Pico 2, etc.)


  6. After setting it up, click the right arrow to upload the program

  • If issues arise during this period, and if you need to reinstall or update the Arduino IDE version, it is necessary to uninstall the Arduino IDE completely. After uninstalling the software, you need to manually delete all contents within the C:\Users\[name]\AppData\Local\Arduino15 folder (you need to show hidden files to see this folder). Then, proceed with a fresh installation.

Open Source Demos

MircoPython video demo (github)
MicroPython firmware/Blink demos (C)
Raspberry Pi official C/C++ demo (github)
Raspberry Pi official MicroPython demo (github)
Arduino official C/C++ demo (github)


Demo

C/C++ Demo

01_RS485

Demo description


  • This example implements the control of 8 relay switches via RS485 and 8DI digital inputs

Code analysis


  • Relay_Control(): This function mainly executes the corresponding relay control operation and outputs the corresponding status prompt information according to the array index passed through the parameters
    • Parameter analysis
      • uint8_t index: In the main function, the program will parse the received RS485 data and match it with the preset control command array. When a match is found, the Relay_Control function is called, and the index position of the matching command in the array is passed via index parameter
    • Logical flow
      • Use the if else statement to perform different operations based on the value of index:
        • In the case of index < 8, that is, for the CH1~CH6 commands, the DEV_Digital_Write function is used to switch the level status of the corresponding GPIO pin (such as RELAY1_PIN, etc.), and at the same time, the corresponding relay_status array element is updated to record the change of the relay status, and the corresponding on or off prompt information is output according to the final state of the relay. Finally, in the main function, the Beep function is called to control the buzzer.
        • For the case of index = 8, i.e., for the ALL_ON command, all GPIO pins (corresponding to 8 channel relays) are set to high level (on state). Using the memset function, all elements of the relay_status array are set to 1, indicating that all relays are turned on. A message indicating that all relays are turned on is then output. Finally, in the main function, the Beep function is called to control the buzzer.
        • For the case of index = 9, i.e., for the ALL_OFF command, all GPIO pins (corresponding to 8 channel relays) will be set to low level (off state). Using the memset function, all elements of the relay_status array will be set to 0, indicating that all relays are off. A message indicating that all relays are off will be output. Finally, in the main function, the Beep function will be called to control the buzzer.
        • If the value of index does not match the above commands, the prompt message of receiving non-command data will be output
  • gpio_irq_handler(): The function controls relay switches through IO interrupts, with digital interfaces DI1~DI8 corresponding to relays CH1~CH8. For example, when the digital interface DI1 is low, the relay CH1 is on, and when the digital interface DI1 is high, the corresponding relay CH1 is off

02_MQTT

Demo description


  • This example implements network connection through an Ethernet interface and achieves remote control of 8 relays via the MQTT communication protocol

Precautions


  • Devices need to be created in Waveshare Cloud
  • MQTT related parameters in the program need to be modified

Code analysis


  • Function description
    • ConnectNetwork(): Connect to the network via Ethernet port
    • MQTTClientInit(): Initialize MQTT
    • MQTTConnect(): Connect to MQTT server
    • MQTTSubscribe(): Subscribe to MQTT topic
    • MQTTPublish(): Publish MQTT message
  • Parameter description
    • MQTT parameters
      • MQTT_CLIENT_ID: Client ID
      • MQTT_USERNAME: Username
      • MQTT_PASSWORD: Password
      • MQTT_SUBSCRIBE_TOPIC: Name of the subscribed topic
      • MQTT_PUBLISH_TOPIC: Name of the published topic
    • Network connection parameters
      • g_net_info.mac: MAC address
      • g_net_info.ip: IP address
      • g_net_info.sn: Subnet mask
      • g_net_info.gw: Gateway
      • g_net_info.dns: DNS server
  • Logical flow
    • Device Initialization: Initialize the SPI interface of MQTT and Ethernet ports, call ConnectNetwork()MQTTConnect() to connect to the network and MQTT server, and call MQTTSubscribe() to subscribe to MQTT topics
    • Control relay switch: Wait for MQTT messages in the main loop. When it is determined that the received MQTT message g_mqtt_client.msg.payload is not empty, parse the MQTT message and control the corresponding relay switch
    • Send relay status: In order to determine whether the relay switch operation is successful from the server, the development board will call MQTTPublish() to send the latest relay status to the server after controlling the relay switch

Waveshare Cloud Control


MicroPython Demo

01_RS485

Demo description


  • This example implements the control of 8 relay switches via RS485 and 8DI digital inputs

Code analysis


  • relay_control(): This function mainly executes the corresponding relay control operation and outputs the corresponding status prompt information according to the array index passed through the parameters
    • Parameter analysis
      • index: In the main function, the program will parse the received RS485 data and match it with the preset control command array. When a match is found, the relay_control function is called, and the index position of the matching command in the array is passed via index parameter
    • Logical flow
      • Use the if else statement to perform different operations based on the value of index:
        • In the case of index < 8, that is, for the CH1~CH6 commands, the relays[index].value function is used to switch the level status of the corresponding GPIO pin, and at the same time, the corresponding relay_status array element is updated to record the change of the relay status, and the corresponding on or off prompt information is output according to the final state of the relay. Finally, the beep function is called to control the buzzer.
        • For the case of index = 8, i.e., for the ALL_ON command, all GPIO pins (corresponding to 8 channel relays) are set to high level (on state), and all elements of the relay_status array are set to 1 through the for loop, indicating that all relays are turned on. A message indicating that all relays are turned on is then output. Finally, the beep function is called to control the buzzer.
        • For the case of index = 9, i.e., for the ALL_OFF command, all GPIO pins (corresponding to 8 channel relays) will be set to low level (off state). Using the for loop, all elements of the relay_status array will be set to 0, indicating that all relays are off. A message indicating that all relays are off will be output. Finally, the beep function will be called to control the buzzer.
        • If the value of index does not match the above commands, the prompt message of receiving non-command data will be output
  • gpio_irq_handler(): The function controls relay switches through IO interrupts, with digital interfaces DI1~DI8 corresponding to relays CH1~CH8. For example, when the digital interface DI1 is low, the relay CH1 is on, and when the digital interface DI1 is high, the corresponding relay CH1 is off

02_MQTT

Demo description


  • This example implements network connection through an Ethernet interface and achieves remote control of 8 relays via the MQTT communication protocol

Precautions


  • Devices need to be created in Waveshare Cloud
  • MQTT related parameters in the program need to be modified

Code analysis


  • Function description
    • ethernet_init(): Connect to the network via Ethernet port
    • mqtt_connect(): Connect to MQTT server
    • mqtt_subscribe(): Subscribe to MQTT topic
    • mqtt_publish(): Publish MQTT message
  • Parameter description
    • MQTT parameters
      • MQTT_SERVER: Server IP
      • MQTT_PORT: Server port number
      • MQTT_CLIENT_ID: Client ID
      • MQTT_USERNAME: Username
      • MQTT_PASSWORD: Password
      • MQTT_SUBSCRIBE_TOPIC: Name of the subscribed topic
      • MQTT_PUBLISH_TOPIC: Name of the published topic
  • Logical flow
    • Device Initialization: Initialize W5500 and MQTT, call ethernet_init()mqtt_connect() to connect to the network and MQTT server, and call mqtt_subscribe() to subscribe to MQTT topics
    • Control relay switch: Set the MQTT receive callback function through client.set_callback(), wait for the MQTT message in the main loop, call mqtt_recv_callback() after judging the received MQTT message, parse the MQTT message and control the corresponding relay switch
    • Send relay status: In order to determine whether the relay switch operation is successful from the server, the development board will call mqtt_publish() to send the latest relay status to the server after controlling the relay switch

Waveshare Cloud Control


External Expansions


RS485 Extended Relay Channels

  • Use Modbus RTU Relay to extend 6-ch relay
  • Connect Modbus RTU Relay to the RS485 port of RP2350-ETH-8DI-8RO
  • The demo will turn on CH1~CH6 of Modbus-RTU-Relay one by one, and then turn them off one by one

Resources

Supporting Resources

Demo

Schematic Diagram

Datasheets

Official Resources

Raspberry Pi Official Documents

Raspberry Pi Open Source Demos

Development Softwares


FAQ

Question: Raspberry Pi Pico 2 GPIO is configured as a pull-down input, why does reading IO show a high voltage level when the pin is left unconnected?

 Answer:

You can refer to the RP2350-E9 section in the RP2350 Datasheet


Question: When controlling other devices using RS485, it is not sensitive or communication fails?

 Answer:

Please move the jumper cap to 120R and try again. Some RS485 devices require a 120R resistor to be connected in series

Support

Monday-Friday (9:30-6:30) Saturday (9:30-5:30)

Email: services01@spotpear.com

TAG: Development Board DeepSeek AI Voice Chat ESP32 C6 Development Board 1.69 inch LCD Display 240x280 1.69inch TouchScreen Programmable Watch AV to RGB Raspberry Pi Pico 2 Plus RP2350 Board RP2350A UART MiniPCIe Interface 2 CH CAN Card USB CAN Multiple Protection Circuits For Linux/Windows Raspberry Pi Camera Case Raspberry Pi LCD Raspberry Pi 12.3 inch HDMI LCD Captive TouchScreen Display 1920x720 For Jetson Series/Computer PC Metal Case Lazy Keyboard DeepSeek XiaoZhi AI Chat Robot ESP32-S3 1.54 inch LCD N16R8 MUMA Development Board Display Screen Wifi Weather Station TimeClock Milk-V Duo S Usage of USB Type A interface Raspberry Pi 5 Audio Jack Raspberry Pi LCD Arduino 0.85inch LCD RK3566 Industrial RJ45 Ethernet To 16-ch Relay Module Modbus RTU TCP With Protection and guide rails RP2040 LoRa-HF ESP32-S3 ST7789