mLink 1ch (HCMODU00182), 2ch (HCMODU0183), And 4ch (HCMODU0184) I2C / Parallel Relay Modules

mLink serial I2C modules
Post Reply
admin
Site Admin
Posts: 799
Joined: Sun Aug 05, 2012 4:02 pm

mLink 1ch (HCMODU00182), 2ch (HCMODU0183), And 4ch (HCMODU0184) I2C / Parallel Relay Modules

Post by admin » Thu Oct 07, 2021 3:48 pm

*** COMMING SOON ****

[IMAGE TBA]



The mLink relay modules are a range of 5V relay modules that have been designed to be controlled either manually or via a microcontroller. For manual control there is a set of digital pin(s) that can be toggled to directly control the relay. For controlling via a microcontroller there is a serial I2C interface minimising the amount of pins required to control multiple relays or relay modules.

For Arduino users you can use the mLink library (see below) to control any type of mLink module. Only one single instance of the library is needed to control multiple types of mLink modules resulting in very little resources overhead and therefore making it great for Arduinos with small amounts of memory and pin counts.



Module specifications:
Module code: 							HCMODU0182 (1ch relay module)
									HCMODU0183 (2ch relay module)
									HCMODU0184 (4ch relay module)
Supply Voltage (VDD): 					4.5V to 5.5V
Current consumption (relay(s) off):			5.5mA
Current consumption (relay(s) on):			70mA (1ch), 125mA (2ch),  235mA (4ch)
Interfaces:							I2C, relay digital input(s), NO-COM-NC relay screw terminals.
I2C Interface speed: 						400kbits/s (fast mode)
I2C default address (HEX): 				0h52
Relay input (RL0 to RL3) low level voltage: 	0V to 1.5V 
Relay input (RL0 to RL3) high level voltage: 	3.5V to 5V
Relay contact rating (resistive load): 			5A max at 28VDC or 240VAC
Maximum number of modules: 				5 with pullups fitted, 112 with pullups removed*
Module dimensions (inc headers):			48.5mm x 38mm x 19.2mm (1ch relay module)
									63.5mm x 38mm x 19.2mm (2ch relay module)
									96.5mm x 38mm x 19.2mm (4ch relay module)

*Note the maximum number of connected modules will depend on cable lengths and power requirements of each module. Do not exceed 5 mLink modules connected in series with all fitted to all modules.





Standalone Control Example:

The mLink relay modules can be used standalone just like most other types of relay module. They provide a set of digital input pins (RL0 to RL3) to control each relay independently. Pulling a pin high (connecting it to 3.5V to 5V) will turn the relay on, pulling it low (0V/GND), or leaving it disconnected will turn the relay off.

Image





Arduino Connection Example:

When used with microcontollers such as Arduino the mLink relay modules can be controlled via a serial I2C interface.

Image

Image


Because the modules use an I2C interface this also means multiple modules can controlled from a single Arduinos I2C interface simply by daisy-chaining them together. Note to control multiple mLink modules of the same type requires changing the default I2C address of the additional modules. See mLink Library Quick Start Guide for how to do this.


Image




Toggle relay 0 example

Arduino Toggle Relay Example:

The following example will toggle (blink) relay 0 on and off every 10 seconds. If your module has more than one relay you can use SET_RLY1 for relay 1, SET_RLY2 for relay 2, or SET_RLY3 for relay 3 instead.

  1. #include "mLink.h"
  2.  
  3. mLink mLink;
  4.  
  5. #define I2C_ADD 0x52 // Default I2C address
  6.  
  7. void setup()
  8. {
  9.   mLink.init();
  10. }
  11.  
  12.  
  13. void loop()
  14. {  
  15.   mLink.SET_RLY0(I2C_ADD, HIGH);     // Turn relay 0 ON.
  16.   delay(10000);
  17.  
  18.   mLink.SET_RLY0(I2C_ADD, LOW);     // Turn relay 0 OFF
  19.   delay(10000);
  20. }

Read relays state example

Reading The State Of Relay 0 Example:

If you need to check the current state of a relay, for instance to check if its state has been changed via the external RL pin header, this can be done by reading the appropriate bit from the modules relay status register. As with the previous example the mLink library has macros to make this straightforward:

The following example will read the current state of relay 0 and will output the state to the serial monitor. If your module has more than one relay you can use READ_RLY1 for relay 1, READ_RLY2 for relay 2, or READ_RLY3 for relay 3 instead.

  1. #include "mLink.h"
  2.  
  3. mLink mLink;
  4.  
  5.  
  6. #define I2C_ADD 0x52 // Default I2C address
  7.  
  8.  
  9. void setup()
  10. {
  11.   Serial.begin(9600);
  12.  
  13.   mLink.init();
  14.  
  15.   boolean state = mLink.READ_RLY0(I2C_ADD); // Get the current state of relay 0
  16.  
  17.   Serial.print("Relay 0 state = ");
  18.  
  19.   if(state == 1)
  20.     Serial.println("ON");
  21.   else
  22.     Serial.println("OFF");
  23. }
  24.  
  25.  
  26. void loop()
  27. {
  28.  
  29. }
  30.  

Relay timer mode

Setting Relay 0 On Time Example:

Putting a relay into timer mode allows you to specify the minimum amount of time a relay will stay energised for when triggered via either the I2C interface or its external RL trigger pin. To put a relay into timer mode its on time in seconds needs to be set by writing to the appropriate modules on time registers. Using the mLink library this can be easily done with one of its predefined macros:


The following example sets the on time for relay 0 to 10 seconds. The maximum on time for a relay is 65535 second. Setting the on time to 0 will disable timer mode and the relay will operate as normal. If your module has more than one relay you can use RLY1_SetOnTime for relay 1, RLY2_SetOnTime for relay 2, or RLY3_SetOnTime for relay 3 instead.

  1. #include "mLink.h"                                
  2.  
  3. mLink mLink;        
  4.  
  5. #define I2C_ADD 0x52 // Default I2C address
  6.  
  7. void setup()
  8. {
  9.   mLink.init();    
  10.  
  11.   mLink.RLY0_SetOnTime(I2C_ADD, 10); // Set the on time for relay 0 to 10 seconds
  12. }
  13.  
  14.  
  15. void loop()
  16. {
  17.  
  18. }





Image

mLink Arduino library
viewtopic.php?f=58&t=3001


mLink Library Quick Start Guide For Arduino Users
https://hobbycomponents.com/downloads/m ... _Guide.pdf


mLink Library Reference Guide For The Relay Modules
https://hobbycomponents.com/downloads/m ... _Guide.pdf


mLink Specifications and Register Map For The Relay Modules
https://hobbycomponents.com/downloads/m ... er_Map.pdf


Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Post Reply