Typing allon or alloff will turn all relays on or off.Typing 1off, 2off, 3off, or 4off and pressing enter will cause the specified relay to turn off.Typing 1on, 2on, 3on, or 4on and pressing enter will cause the specified relay to turn on.When prompted for input, you’ll type commands to turn the relays on and off: To run the test application, open a terminal window, navigate to where you’ve extracted the sample application and run the application using the following command: ![]() Grab the code from there and you’ll be able to easily complete the following step. Please use the test code from github repository. Each switch has a high and a low setting, so the following table will lay out how to use them to set an I2C address for the board: A0 There are four switches, three labeled A0 through A2, and one labeled NC. You’re supposed to be able to use switches on the relay board to set the I2C address, there are 4 DIP switches on the board, let’s see what happens when you change them. You’ll see how this value is important later in this article. In this example, there’s only one I2C board on the system, the relay board configured at an address of 20. The application will display a dump of the recognized I2C devices as shown in the following figure. Open a terminal window on the Pi and execute the following command: With the I2C interface enabled, it’s time to make sure the Raspberry Pi sees the relay board. In the next section, we’ll verify that the Pi sees the relay board.įigure 3 Validating the Raspberry Pi Sees the Relay Board ¶ When you reboot the PC, the Pi should see the relay board. Enable the option next to I2C as shown in the figure and click the OK button to continue. In the window that opens, select the Interfaces tab as shown in the following figure. When it’s up and running, open the Pi menu, select Preferences, then Raspberry Pi Configuration as shown in the following figure: Power up the Pi and let it boot to the graphical interface. This interface is disabled by default in the Pi’s Raspbian OS, so you’ll have to turn it on before you can use the board. The relay board communicates with the Raspberry Pi through an I2C interface. If you don’t align the pins correctly, you’ll have problems later as it simply won’t work. The relay board is configured for an older Raspberry Pi with a 26 pin header, so when you connected it to a Raspberry Pi with 40 pin headers, you’ll need to shift it all the way to the side like We’ve shown in the figure. If you mount the board without using standoffs (as I’ve done in the example figure below), there’s a chance the board will make contact with the Ethernet port housing and cause a problem.įor a production project, We’d definitely recommend using standoffs to hold the two boards in place. We recommend you putting some electrical tape on top of the Raspberry Pi Ethernet port before mounting the board. Note: You’ll have to add male headers to the Raspberry Pi Zero to use the board. Mounting the board is easy, it comes with the appropriate female headers you need to mount it on any Raspberry Pi board with male headers. Run some Python code to exercise the board Validate that the Raspberry Pi recognizes the board Enable the Raspbian I2C software interface Mount the Relay board on the Raspberry Pi ![]() The steps for installing the board and verifying that it works includes the following steps: Please click here to visit the original document on his website. ![]() We have amended the original text a little to fit it in the whole Seeed's document. Wargo, here we would like to express our gratitude to John's contribution. COM, NO (Normally Open), and NC (Normally Closed) relay pins for each relay.LED working status indicators for each relay.Relay screw terminals for easy connection.I2C interface with three hardware SW1 (1, 2, 3) to select the fixed I2C-bus address.Compatible with Raspberry Pi 1, 2, 3, 4.High-quality SPDT (single pole - double throw) relays.The standardized shield form factor enables smooth connection with a Raspberry Pi and it also has four LED indicators that show the on/off state of each relay.Ĥ-Channel SPDT Relay HAT for Raspberry Piġ.Replaced components for better stability This means it could be a nice solution for controlling devices that can't be directly controlled by the I2C bus. The 4-Channel SPDT Relay HAT for Raspberry Pi utilizes four high-quality SPDT (single pole - double throw) relays and provides NO/NC (Normally Open/ Normally Closed) interfaces that can control the load of high current. Edit 4-Channel SPDT Relay HAT for Raspberry Pi
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |