Week 16 : Networking and Communications


Assignment :

Design and build a wired or wireless network connecting at least two processors.


My Plan

To modify Neil's bridge board, add button on one of the pins of microcontroller. I'm using my input board as bridge board and designing a board for the node board. Networking is all about making the boards talk each other just like the boards talk with the computer. The idea is to program both the boards such that when PIR sensor senses a motion, it makes changes in the node board as well as in the node board too. Depending on the way you program the boards you can interchange between node and bridge or master and slave functions. So, here master board is PIR board and Slave board is the board I've designed.


Networking Method/ Protocols

Basically, there are three methods: Serial, SPI and I2C.

Serial

Here data is send one bit at a time, sequentially, over a communication channel or computer bus.

SPI

Serial Peripheral Interface or in short SPI is an interface bus commonly used to send data between microcontrollers and small peripherals such as shift registers, sensors, and SD cards. It uses separate clock and data lines, along with a select line to choose the device you wish to talk to.

I2C

The Inter-integrated Circuit or I2C Protocol is a protocol that intends to allow multiple “slave” digital integrated circuits (“chips”) to communicate with one or more “master” chips. Just like the Serial Peripheral Interface (SPI), it is only intended for short distance communications within a single device.


I'm using Wired Serial communication

Serial communication is the process of sending data one bit at a time, sequentially, over a communication channel or bus. This is in contrast to parallel communication, where several bits are sent as a whole, on a link with several parallel channels. For this assignment i'm using a node and a bridge board.


Design of Slave Board

I changed neil's board, connected button over second pin and LED over third pin. I also took out MOSI, VCC and Gnd pins to an external connector, so that the board can be used again.


circuit diagram


traces


outline cutboard


Design File in eagle

Schematic Files

Board Files

stuffed board


I had a wire not connected in the eagle while autorouting. That was the problem I encountered while designing the board. I added a jumper wire while stuffing the board, which solved this problem.


Programming

I programmed each board seperately. PIR sensor detects motion and sends serially a value. If this value is recieved by the slave board then the LED in there turns on. This is the logic and this involves serial communication. The TX and RX pins can be any of the I/O pins in the microcontroller. Just that you should specify the pin numbers while doing serial programming. Also Tx of master board connects to Rx of slave board.

Program at a glance


stuffed boards being programmed


Programming File (.ino)

PIR board (master)program

Node board (slave)program


On programming the boards talked with each other

Even though the boards talk to each other, what I was missing was the device ID. Device ID sets the identity of the board. So, you can add any number of node board and the node board whose ID called shows the output. I modified the code as below to achieve this.


Now, only when the node board is called, it checks for output from the bridge board and then shows the output. From the computer we are sending a message in the serial communication channel. This message is the name of the node, both the nodes listen to it but the one board whose name is the called responds by blinking differently.

Programming File updated(.ino)

PIR board (master)program

Node board (slave)program


What I learnt from this week's schedule...

What is networking all about?

Wired Networking of boards