Difference between revisions of "Pico-Relay-B"
m (Text replacement - "{{#urlget:amazon|default}}=display" to "{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display") |
|||
Line 7: | Line 7: | ||
|category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]] | |category=[[:Category:OLEDs / LCDs|OLEDs / LCDs]], [[:Category:LCD|LCD]] | ||
|brand=Waveshare | |brand=Waveshare | ||
− | |{{#urlget:amazon|default}}=display | + | |{{#ifeq: {{#urlget:amazon|0}}|{{#urlget:Amazon|0}}| default|}}=display |
|website_cn=[https://www.waveshare.net/shop/ 官方中文站点] | |website_cn=[https://www.waveshare.net/shop/ 官方中文站点] | ||
|website_en=[https://www.waveshare.com/pico-relay-b.htm Waveshare website] | |website_en=[https://www.waveshare.com/pico-relay-b.htm Waveshare website] |
Revision as of 02:00, 13 May 2022
| ||
Overview
Industrial 8-Channel Relay Module For Raspberry Pi Pico, Power Supply Isolation, Photocoupler Isolation.
Features
- Onboard unibody power supply isolation, provides stable isolated voltage, needs no extra power supply for the isolated terminal.
- Onboard photocoupler isolation, prevent interference from external high-voltage circuit connected to the relay.
- High-quality relay, contact rating: 10A 250V AC or ≤10A 30V DC.
- ABS protection enclosure with rail-mount support, easy to install, safe to use.
- Breakout USB port and BOOT pin, make it easy to debug without disassembling the enclosure.
- PWR indicator, RGB LED, and passive buzzer outside the enclosure.
Specifications
- Operating voltage: 5V
- Communication Protocol: USB
- Communication interface: Micro USB
- Relay channel: 8 ch
- Contact form: 1NO 1NC
- Dimension: 88(H)x 122(V) mm
Pinout
Pico User Guide
Hardware connection
Relay B | Pico | Description |
VCC | VSYS | Power input |
GND | GND | Ground |
CH1 | GP21 | Control pin of Channel 1 |
CH2 | GP20 | Control pin of Channel 2 |
CH3 | GP19 | Control pin of Channel 3 |
CH4 | GP18 | Control pin of Channel 4 |
CH5 | GP17 | Control pin of Channel 5 |
CH6 | GP16 | Control pin of Channel 6 |
CH7 | GP15 | Control pin of Channel7 |
CH8 | GP14 | Control pin of Channel 8 |
RGB | GP13 | Control pin of RGB LED |
BUZZER | GP6 | Control pin of buzzer |
Connection
Download the SSCOM serial port debugging assistant and open it on the computer, open the corresponding port number, set the baud rate to 115200, and click the corresponding function to send the corresponding command.
Setup environment
1. For the Raspberry Pi environment setting, please refer to link.
2. For the Windows environment setting, please refer to link.
Raspberry Pi
1. Open a terminal of Raspberry Pi.
2. Download and unzip the demo codes to the directory Pico C/C++ SDK.
sudo apt-get install p7zip-full cd ~ sudo wget https://files.waveshare.com/upload/a/a1/Pico-Relay-B_code.7z 7z x Pico-Relay-B_code.7z -o./Pico-Relay-B_code cd ~/Pico-Relay-B_code cd c/build/
C
1. Hold the BOOTSEL button of Pico, and connect the USB interface of Pico to Raspberry Pi then release the button.
2. Go into the build directory and add the SDK path.
cd ~/Pico-Relay-B_code/c/ cd build export PICO_SDK_PATH=../../pico-sdk
3. Run the command cmake to generate the Makefile file.
cmake ..
4. Run the command make to build and generate the executable file.
make -j9
4. after building, a uf2 file is generated. Press and hold the button of the Pico board, connect it to Raspberry Pi by USB cable, and then release the button. Copy the main.uf2 file generated to the recognized movable disk (RPI-RP2).
cp main.uf2 /media/pi/RPI-RP2/
Send hexadecimal commands to Relay via serial port for control of:
01: Relay switch #1 02: No.2 relay switch 03: No.3 relay switch 04: Relay switch #4 05: No.5 relay switch 06: No.6 relay switch 07: No.7 relay switch 08: No.8 relay switch 09: Relay fully off 0A: Relay fully open
Python codes
Use in Windows
- 1. Press and hold the BOOTSET button on the Pico board, connect the Pico to the USB port of the computer through the Micro USB cable, and release the button after the computer recognizes a removable hard disk (RPI-RP2).
- 2. Copy the rp2-pico-20210418-v1.15.uf2 file in the python directory to the recognized removable disk (RPI-RP2).
- 3. Open Thonny IDE (Note: Use the latest version of Thonny, otherwise there is no Pico support package, the latest version under Windows is v3.3.3).
- 4. Click Tools -> Settings -> Interpreter, and select Pico and the corresponding port as shown in the figure.
- 5. File -> Open -> the corresponding .py file, click to run, as shown in the following figure:
- After running, you can send the command directly in the Shell, the command is as follows:
1: Relay switch No. 1 2: Relay switch No. 2 3: Relay switch No. 3 4: Relay switch No. 4 5: Relay switch No. 5 6: No. 6 relay switch 7: Relay switch No. 7 8: No. 8 relay switch 9: The relay is fully closed 10: The relay is fully open
Run in Raspberry Pi
- Hold the BOOTSET key of the Pico board, then connect the Pico to Raspberry Pi by USB cable, then release the key.
- Once the removable disk (RPI-RPI2) is recognized, copy the rp2-pico-20210418-v1.15.uf2 file to pico.
- Open the Thonny IDE in Raspberry Pi, update it if it doesn't support Pico.
- Configure the port by choosing MicroPython(Raspberry Pi and ttyACM0 port) in Tools -> Options... -> Interpreter.
If your Thonny doesn't support Pico, you can update it with the following command:
sudo apt upgrade thonny
- Choose File -> Open...-> python/ and select the corresponding .py file to run the codes.
- After running, you can send the command directly in the Shell, the command is as follows:
1: Relay switch No. 1 2: Relay switch No. 2 3: Relay switch No. 3 4: Relay switch No. 4 5: Relay switch No. 5 6: No. 6 relay switch 7: Relay switch No. 7 8: No. 8 relay switch 9: The relay is fully closed 10: The relay is fully open
Support
If you require technical support, please go to the Support page and open a ticket.