User Manual for ATtiny2313A based Serial/RS485 Controlled 6 channel Relay

Pinterest icon

i2c controlled 6 channel relay board for arduino

ATtiny2313A Serial/RS485 Relay Control board is a 6 channel SPDT relay board that can be controlled  by

  • RS485 Protocol
  • Serial(TTL)
  • SPI Protocol
  • I2C Protocol or TWI (Two Wire Interface)

 

Introduction

SPI controlled 6 channel relay board for arduino

ATtiny2313A Serial/RS485 Relay Control board is a 6 channel Relay board that can be controlled by RS485 ,Serial(TTL),SPI or I2C Protocols.The board helps the user to control upto 6 Electrical appliances through the above mentioned protocols using either a Linux /Windows PC or a Microcontroller development board like Arduino.The boards can be networked together to control more than 6 electrical appliances,(12,18,24, etc) using either RS485 or Serial protocols.

The RS485 protocol allow the device to be used in existing industrial networks with zero or minimal effort.The board contains an onboard microcontroller ATtiny2313A which can be used for decoding industrial protocols like Modbus or Profibus , eventually turning the board into a Modbus Controlled 6 channel relay or Profibus Controlled Relay Board.

Block Diagram

block diagram of RS485 controlled 6 channel relay

The above figure shows the block diagram of the Relay control board.

The board is powered by a standard 12V DC adapter.The onboard LM7805 ic converts the 12V to 5V, to be used by the ATtiny and the 6 Relays on the board.

Please note that when all 6 Relays are ON the board pulls close to 1 Amps which would make the LM7805 IC quite hot.Please exercise caution while handling the LM7805 heat sink while the board is ON.

The TXD and RXD pins of the ATtiny2313A are connected to the DI and RO pins of the MAX485 through the jumpers JP2 and JP1.You can access the serial pins of ATtiny by removing the jumpers on JP2 and JP1. 

The jumpers JP3,JP4 and JP5 are used as 3 bit address selection when using the board in an RS485 network.The jumpers helps to set the pins PD6,PD5,PD4 as either a 1 or 0. 

All 6 of the relays are connected to its corresponding 3 pin screw terminals, allowing the user to easily connect electrical appliances to the board.

Programming

The onboard microcontroller ATtiny2313A can easily be programmed using any AVRISP compatible programmer like USBtinyISP or USBasp.Please note that you have to use a 6 pin AVR isp connector.

High Voltage precautions

The board is used for controlling high voltage electrical appliances through RS485 or Serial Protocols.

The NO NC and C terminals of the Relays will be at the same potential as the electrical device which is being controlled.If you are controlling a 220V AC bulb using the relay, the contacts will be at 220V AC

Please exercise caution and take necessary steps to prevent electrocution while handling the board when connected to High Voltage electrical devices.

xanthium entereprises (www.xanthium.in) will not be liable for any damages caused due to improper use of the device.

RS485 section

modbus controlled 6 channel relay

The RS485 section of the Relay control board is build around MAX485 from MAXIM and the UART of ATtiny2313A Microcontroller.

ATtiny interfaced with MAX485

The TXD and RXD pins of the ATtiny2313A are connected to the DI and RO pins of the MAX485 through the jumpers JP2 and JP1.

The pins PD3 and PD2 of ATTiny are used to put the MAX485 in Receive and Transmit mode respectively.

You can access the serial pins of ATtiny by removing the jumpers on JP2 and JP1. 

The jumpers JP3,JP4 and JP5 are used as 3 bit address selection when using the board in an RS485 network.The jumpers helps to set the pins PD6,PD5,PD4 as either a 1 or 0. 

RS485 Networking

PC controlled RS485 networked 6 channel relay for industrial automation

The Relay Control boards can be networked using 2/3 wire RS485 cables and can be used to control multiple electrical devices.

The devices can be easily interfaced to a Linux/ Windows PC using a USB to RS485 converter and few lines of code.

The C# code for controlling the Relay control board using RS485 protocol can be downloaded from our Github Repo.
 

I2C section

The 6 channel relay board can also be controlled using I2C (or TWI) Protocol.The SDA and SCL pins required for communicating to the board are available on connector P4.

i2c controlled 6 channel relay for arduino,raspberry pi,atmel avr

Since I2C lines are shared between SPI on ATtiny2313.The pull up resistors required for I2C have to be separately enabled using jumper JP9.

ATtiny controlling  6 relays using i2c protocol

To enable the pull up resistors move the jumper towards EN as shown below.

Enabling I2C for 6 channel I2C controlled relay

When I2C is not required put the jumper away from EN to NC.

You can then connect the I2C lines from your microcontroller or Arduino to Connector P4 and control the relays.

 

SPI section

You can use the board as an SPI controlled 6 channel Relay.All the signals required for SPI (MISO,MOSI and SCK ) are available on the connector P4.

Here the Relay control board behaves as an SPI slave.When you are using SPI,make sure that I2C pull up resistor is not enabled,by putting the jumper JP9 towards NC position. 

 

Serial Section

You can access the serial port pins(RXD and TXD) of ATtiny2313 by removing the jumpers on JP1 and JP2.

You can then connect the RXD and TXD signals of your Arduino or Microcontroller  to JP1 and JP2 to control the six relays.