Skip to content

14. Networking and communications

The task for this week was

  • Design, build, and connect wired or wireless node(s) with network or bus addresses.

The project description

The idea was simple. Send the signal from keyboard to LCD via two boards connected together.

I have decided to use Arduino interface to program boards. Due to lack of free time, I have decided to use wire connection. Therefore, I have used I2C connection.

Simple theoretical information about I2C bus

The I2C bus is the communication interface that allows interconnecting several devices. Each device in the network should have its name or address. It this case the master device can send the command to a specific device or group of devices.

The schematic is shown in the following picture.

This is a very simple solution. The devices should share a common line for each SCL and SDA pins.

I2C protocol is useful as the master board can be connected to various slave boards and specify the command for each of these boards. Therefore, a particular board can be controlled. For this purpose, the signal that sends to the network should include the address. In my case, I had just one slave board. But it is still required to have a specific address for each command.

You can see the scheme on the picture.

In my case, I2C connection was working without an additional connection of VCC line to SCL and SDS bus.

There were two boards. The master board is connected to keypad. And the slave board has an LCD as an output device.

Both boards had connected SDA and SCL cables. Moreover, both boards should share common ground.

The code

The logic was simple: the Master Board should receive the signal from the input device and convert it to certain information. Then this information should be transferred to Slave board.

The slave board should recognize that the signal was sent to it and transfer received information to the LCD.

For this project we need to use external libraries Wire.h and LiquidCrystal.h

Master board code

#include <Wire.h>
#include <Keypad.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
char keys[ROWS][COLS] = {

byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {9, 8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup() {
  Wire.begin(); // join i2c bus (address optional for master)

void loop() {

  char key = keypad.getKey();

  if (key){
  Wire.beginTransmission(8); // transmit to device #8
  Wire.write(key);      // sends five bytes

  Wire.endTransmission(); // stop transmitting

Slave board code

#include <Wire.h>
#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
  Wire.begin(8);                // join i2c bus with address #7
  Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
    // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("I am ready!");

void receiveEvent() {
    char c =; // receive byte as a character
    Serial.print(c);     // print the character
    lcd.begin(16, 2);

void loop() {


I have not met significant problems.


Board. Eagle Files


The video explanation. There is a manufactured Arduino board connected to a breadboard. I used it only as a power supply because the FTDI cable connected to my boar did not have enough current. Therefore, we can ignore its presence in the scene.