Skip to content

Seeed-Studio/Multi_Channel_Relay_Arduino_Library

Repository files navigation

Multi_Channel_Relay_Arduino_Library Build Status

This is the Arduino library for Seeed multi channel relay.

How to use this library

you can download from Arduino Library Manager or directlly download from this repository. Connect the 8-channel Solid state relay v1.0 to Arduino board's I2C port, compile and upload four_channel_relay_control.ino. Open the serial monitor the relay should go as expected some massage should show as below:

Channel 1 on
Channel 2 on
Channel 3 on
Channel 4 on
Turn all channels on, State: 1111
Turn 1 3 channels on, State: 101
Turn 2 4 channels on, State: 1010
Turn off all channels, State: 0
  • Upload eight_channel_relay_control.ino, open the serial monitor and show the below logs:
Channel 1 on
Channel 2 on
Channel 3 on
Channel 4 on
Channel 5 on
Channel 6 on
Channel 7 on
Channel 8 on
Turn all channels on, State: 11111111
Turn 1 3 5 7 channels on, State: 1010101
Turn 2 4 6 8 channels on, State: 10101010
Turn off all channels, State: 0

  • This module can be set I2C address by software, open change_i2c_address.ino modify new_i2c_address as you want; compile and upload the sketch, open the serial monitor and show the below logs:
Scanning...
I2C device found at address 0x11  !
Found 1 devices
Address 0x21 has been saved to flash.
  • Read firmware version of the module by example read_firmware_version.ino. Serial logs as below:
firmware version: 0x1

Functionalities

  • The relay board is an I2C device, device address is changeable, refer to changeI2CAddress(uint8_t new_addr, uint8_t old_addr) .
  • Use getChannelState() to know the state of every channel.
  • Use getFirmwareVersion() to recognize firmware burn in the on board MCU.
  • Use channelCtrl(uint8_t state) to change all channel immediately, the state parameter represents channel 1 to 8.
  • Use turn_on_channel(uint8_t channel) to turn on single channel.
  • Use turn_off_channel(uint8_t channel) to turn off single channel.
  • External functionality scanI2CDevice(), use for scan device address.

This software is written by lambor for seeed studio and is licensed under The MIT License.

Contributing to this software is warmly welcomed. You can do this basically by
forking, committing modifications and then pulling requests (follow the links above
for operating guide). Adding change log and your contact into file header is encouraged.
Thanks for your contribution.

Seeed is a hardware innovation platform for makers to grow inspirations into differentiating products. By working closely with technology providers of all scale, Seeed provides accessible technologies with quality, speed and supply chain knowledge. When prototypes are ready to iterate, Seeed helps productize 1 to 1,000 pcs using in-house engineering, supply chain management and agile manufacture forces. Seeed also team up with incubators, Chinese tech ecosystem, investors and distribution channels to portal Maker startups beyond.

About

This is the Arduino library for Seeed Grove module 4 and 8 channel rely.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages