14. Networking and communications

This week is to be communicated between multiple microcontroller boards by any network. Normally the networking needs a master and a slave board and the assignment was to establish a communication between master and slaves boards. The group project was to make a communication between two assignments.

Through the week

After referring the academy schedule i understood the following details.

For networking there are different types of communication Protocols.Eg UART,I2C and i Chose I2C Communication protocol for the networking assignment.

etc.communication means transport of information from one circuit to another circuit. Where the circuit which transmits the data is called Transmitter and the circuit who receive the data is called Receiver. At Least one Transmitter and a Receiver is required to establish the communication.

Communication may be in one direction or in both directions, there are different classifications according to this, basic classification is Synchronous and Asynchronous communication.

If briefing about this in one sentence, Synchronous means: sender and receiver use the same clock signal and Asynchronous Means: sender provides a synchronization signal to the receiver before starting the transfer of each message.

There are many communications protocols that are used everywhere in analog and digital communications. Communications devices have to agree on many physical aspects of the data to be exchanged before successful transmission can take place. Rules defining transmissions are called protocols. There are two main categories in this.

  1. Inter System Protocol

This is used to communicate between two different devices like a communication between a computer and microcontroller. It uses a dedicated bus to communication.

Examples for different Inter system protocol:

    UART Protocol

    USART Protocol

    USB Protocol
  1. Intra System Protocol

(Images taken from https://www.google.com/search?client=ubuntu&hs=uto&channel=fs&tbm=isch&sa=1&ei=gjTIXPn1ENWsrQG_0JvAAQ&q=images+for+uart+protocol&oq=images+for+uart+protocol&gs_l=img.12…0.0..2698…0.0..0.0.0.......1......gws-wiz-img.yGNqvCwNR14)

This is used to communicate two devices within the circuit. The circuit complexity, power consumption will be less in this.

Different Intra system protocol:

    I2C Protocol

    SPI Protocol

    CAN Protocol

With referring the idea of my project i came to a conclusion that i2c protocol will be much more suitable for my main project and i planned to make a Bridge board and 2 node board with i2c protocol for this networking week.

Executing the network

After referring the schedule I planned to make two boards.

1.Bridge board

2.Node boards

After estimating the components and with the experience I gained from the previous week I designed the board using Autodesk Eagle.

1.Bridge board

2.Node boards

Then I milled the board using modella .

After that the procedure contuined to soldering and the board was fabricated.

AFter that I tried as may times to program the board and communicated it.

The program was burned successfully but still the boards are not communicating.

Then it is understood that the program should function the attiny register change and that communication can be done accordingly like that node to node communication.but it was really hard for me as a beginner in programming slide

Then I referred one of my instructors page(GANADEV PRJAPATHY) and found out that the communication can be managed efficiently by using i2c protocol.

Then I designed a board using Atmega328 and milled it.

After that I entered a sample program to test the master and slave boards.

MASTER PROGRAM

// Wire Master Writer
// by Nicholas Zambetti < http://www.zambetti.com>

// Demonstrates use of the Wire library
// Writes data to an I2C/TWI slave device
// Refer to the "Wire Slave Receiver" example for use with this

// Created 29 March 2006

// This example code is in the public domain.


#include <Wire.h>

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

byte x = 0;

void loop() {
  Wire.beginTransmission(4); // transmit to device 4
  //  Wire.write("x is ");        // sends five bytes
  //  Wire.write(x);              // sends one byte
  Wire.write(x);
  Wire.endTransmission();    // stop transmitting

  x++;
  delay(500);
}

SLAVE program

  // This is a program for the slave board to receive variable 'x' and use the modulus operator to flash LEDs connected at digital pin 7.
  //  It is referred from the program below
  // Wire Slave Receiver
  // by Nicholas Zambetti < http://www.zambetti.com>

  // Demonstrates use of the Wire library
  // Receives data as an I2C/TWI slave device
  // Refer to the "Wire Master Writer" example for use with this

  #include <Wire.h>

  void setup() {
    Wire.begin(4);                // join i2c bus with address 4
    Wire.onReceive(receiveEvent); // register event
    Serial.begin(9600);           // start serial for output
  }
  void loop() {
    delay(100);
  }

  // function that executes whenever data is received from master
  // this function is registered as an event, see setup()
  void receiveEvent(int howMany) {
    //  while (1 < Wire.available()) { // loop through all but the last
      //    char c = Wire.read(); // receive byte as a character
      //    Serial.print(c);         // print the character
    }
    int x = Wire.read();    // receive byte as an integer
    //  Serial.println(x);         // print the integer
    //  Serial.println(x%5);
    if (x%5 == 0)
    {
      digitalWrite(7, HIGH);
    }
    else
    {
      digitalWrite(7, LOW);
    }
    }

At primary stage the LED connected to D7 pin was blinking,which shows the networking, but it was not so bright

Even I changed the resistor from 499ohm to 100 ohm to find the reason for it.

Then I Consulted with the instructor and he found out that i have not declared the D7 pin as output and the problem was rectified

I made the board as slave board

I planned to use the board used in output week as master board because it was built with 328p which enables i2c communication.

Working Video.

Working with serial monitor

Working

WORKING

By this I have Completed my networking week assignment.

Group project

Group project video

The group project was to make a communication between two assignments.For that we connected the Master borad of MANU MOHAN S and my Slave borad and it was communicated.by this our group project was completed.

FILES

CLICK HERE TO DOWNLOAD THE FILE

CLICK HERE TO DOWNLOAD THE FILE