In this illustration we will going to wire the 16×2 i2C lCD Screen with 4 channel relay to monitor each channel of the relay, please refer to this link if you need to know and understand how i2c works. Basically driving the 4 channel relay it is very simple and good thing about i2c it works only 4 wires to be connected to the i2C SCL (Serial Clock Line) protocol is clock stretching. An addressed slave device may hold the clock line (SCL) low after receiving (or sending) a byte, indicating that it is not yet ready to process more data and the i2C SDA(Serial Data Line) Every master monitors the bus for start and stop bits, and does not start a message while another master is keeping the bus busy. However, two masters may start transmission at about the same time; in this case, arbitration occurs. Slave transmit mode can also be arbitrated, when a master addresses multiple slaves, but this is less common. In contrast to protocols (such as Ethernet) that use random back-off delays before issuing a retry, I²C has a deterministic arbitration policy. Each transmitter checks the level of the data line (SDA) and compares it with the levels it expects; if they do not match, that transmitter has lost arbitration, and drops out of this protocol interaction. Below are the required components for this lab all can be purchase at souq.
Required Components
- Arduino Board
- 2 or 4 channel relay
- 16×2 I2C Driven LCD Display
- Solder less bread board.
- Jumper Wires / DuPont Wires
Wiring Diagram and Pinouts
Arduino Sketch
Note: Mostly use address is 0x27, 0x3f, 0x38
[crayon-673f5585461c5821504811/]
Required Code Library
Download LiquidCrystal_I2C.h Library here | Zip
Download Wire.h Code Library here | Zip