Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
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.
In order to facilitate the development of Pico/Pico2 boards using MicroPython on a computer, it is recommended to download the Thonny IDE
【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
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.
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
Here are two methods for flashing firmware
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.
set(PICO_BOARD pico CACHE STRING "Board type")
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
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 description
Code 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
parameterif else
statement to perform different operations based on the value of index
: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.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.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.index
does not match the above commands, the prompt message of receiving non-command data will be outputDemo description
Code 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
parameterif else
statement to perform different operations based on the value of index
: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.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.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.index
does not match the above commands, the prompt message of receiving non-command data will be outputYou can refer to the RP2350-E9 section in the RP2350 Datasheet
Please move the jumper cap to 120R and try again. Some RS485 devices require a 120R resistor to be connected in series
Monday-Friday (9:30-6:30) Saturday (9:30-5:30)
Email: services01@spotpear.com