• sales

    +86-0755-88291180

RP2350-Relay-6CH User Guide

Overview

Introduction

RP2350-Relay-6CH is an industrial-grade 6-channel relay based on RP2350B controller and supports RS485, Pico 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 connector, easier to use
  • High quality relay, contact rating: ≤10A 250V AC or ≤10A 30V DC
  • Onboard isolated RS485 interface, for connecting to various RS485 Modbus industrial modules or sensors
  • Onboard Pico compatible interfaces can be adapted to some Raspberry Pi Pico HAT, for expanding more functions such as RTC / CAN / RS232 / LoRa / sensor, etc.
  • Onboard power supply screw terminal, supports 7~36V wide voltage input, suitable for industrial applications
  • 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
  • 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 using mass storage over USB
  • 34 × multi-functional GPIO pins
  • 2 × I2C, 2 × UART, 8 × 12-bit ADC and 24 × 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


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

In order to facilitate the development of Pico/Pico2 boards using 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, the language and motherboard environment need to be configured 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 Configture 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

    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 cross-compilation chain, 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 Ninjaversion

  6. Select the development board

  7. Click Complie 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


    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 > Board > Board Manager > Search pico, as my computer has already been installed, it shows that it is installed


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 > Raspberry Pi Pico or Raspberry Pi Pico 2


  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

Demo description


  • This example implements the control of six relay switches through RS485

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 < 6, 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 = 6, i.e., for the ALL_ON command, all GPIO pins (corresponding to 6 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 = 7, i.e., for the ALL_OFF command, all GPIO pins (corresponding to 6 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

MicroPython Demo

Demo description


  • This example implements the control of six relay switches through RS485

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 < 6, 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 = 6, i.e., for the ALL_ON command, all GPIO pins (corresponding to 6 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 = 7, i.e., for the ALL_OFF command, all GPIO pins (corresponding to 6 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

External Expansions


RS485 Extended Relay Channels

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

Extend Timer Switch Function with Pico Port

  • Use Pico-RTC-DS3231 to extend timer switch function
  • Connect the Pico-RTC-DS3231 to the Pico port of RP2350-Relay-6CH
  • The demo will toggle all relay states every 5s
Collapse

Extend CAN Port with Pico Port


  • Data transmission: Use the serial debugging assistant to view the printed data


Expand Environmental Monitoring Function


Extend RS485 Port with Pico Port

  • Please note, when using Pico-2CH-RS485 to expand the RS485 port, only channel 0 is supported, and channel 1 cannot be used
  • Connect Pico-2CH-RS485 to the Pico port of RP2350-Relay-6CH
  • Connect the channel 0 of Pico-2CH-RS485 to the Pico port of RP2350-Relay-6CH
  • The demo will perform data transmission and reception loopback testing to verify the data transmission and reception function of the on-board RS485 interface and the extended RS485 interface


Resources

Supporting Resources

Demos

Schematic Diagram

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: Luckfox Pico SPI LCD RV1103 Raspberry Pi 5inch Display 1024x600 HDMI Capacitive TouchScreen 5 inch LCD B Wide-Cover For Mini PC Raspberry Pi Pico 2 RP2350 Pico2 ARM Cortex-M33 And RISC-V Hazard3 520KByte 4MByte QSPI Flash ESP32 ST7789 tutorial Electronic EYE 0.71 inch Round LCD Display Screen For Arduino Raspberry Pi ESP32 Pico STM32 Raspberry Pi Pico 2 RP2350 1.69 inch LCD TouchScreen Development Board 240x280 1.69inch Display QMI8658 6-Axis AV to TTL SpotPear spotpear ESP32 P4 Development Board WIFI6 3.4 inch LCD Round Display 3.4inch TouchScreen 800×800 Dual Microphones Milk-V Duo RJ45 TVBOX Kit Luckfox Pico Ultra And 4inch LCD RGB Captive TouchScreen Display NVIDIA USB TO M.2 Key B 5G DONGLE For SIM8202/SIM8262/RM520/RM530 ADXL354C Development Board Raspberry Pi 5 PD Induction Milk V Pi5 Pure-Copper Active Cooler NVIDIA Jetson Orin Nano Developer Kit Official Original 8GB AI 40Tops For Embedded and Edge Systems