14. Networking and communications

Highlights of the week

A. Wifi: Temperature and humidity data being sent by wifi module on Thingspeak as part of final project.

B. Bluetooth: LED being controlled from the app using Bluetooth as part of Interfacing and Application Programming.

C. OLED: Temperature and humidity data displayed on OLED as part of Output Device week.

D. Bridge and slave boards: Hero shot of individual assigment, coordination in bridge and slave boards to blink LED.

E.Messaging using Bluetooth: Video of the group assignment where message typed on mobile being displayed on serial monitor using bluetooth.

Networking

It is the interconnection of multiple devices, using multiple paths for the sending or receiving data or media.These data transfer through cable or wires or optic cables, or wireless media such as Wi-Fi

Communication

Communication is passing the message or commands from one board to another board. The following are the types of communication.

1.Parallel Communication

Parallel interfaces transfer multiple bits at the same time. They usually require buses of data - transmitting across eight, sixteen, or more wires. Data is transferred in huge, crashing waves of 1’s and 0’s.It transmit multiple bits of data at same time.they require buses of data to transmitting across eight, sixteen, or more wires.

2. Serial Communication

Serial interfaces stream their data, one single bit at a time. These interfaces can operate on as little as one wire, usually never more than four. But this way of communication is slow, but its more reliable compare to Parallel.
A. Synchronous serial interface - synchronous serial interface means this both sender and receiver shares the same clock. This makes for a more straightforward, often faster serial transfer, but it also requires at least one extra wire between communicating devices. eg,SPI, and I2C.
2.Asynchronous serial interface - Asynchronous means that data is transferred without support from an external clock signal. This way of transmission method is perfect for minimising the required wires and I/O pins. This method established trough Rx and TX pins in MCUs.Device like GSM, GPS, Xbee etc. are connected using this mode.

Individual Assignment-

1. Serial Bus

A. Wifi: As part of my final project, “Weather Eye” will measure,record and analyze every minute weather data. It will sense the temperature using digital thermometer. Embedded microcontroller will calculate humidity on the basis of dry and wet bulb temperature whiich will be sent on cloud. Thingspeak, cloud service will record and collect the statistics.

B. Bluettoth: As part of Interfacing application, made an app in App Inventor which controls LED using bluetooth communication.

2. I2C Protocol

A. OLED: In input Devices weekly project, I have written the code for digital thermometer to show the data on OLED.
B. Master-Slave boards: Designed, milled and programmed 2 slave boards and 1 bridge board to blink LED.

1.A. Wifi-Wireless Serial Bus Communication

The procedure of design, milling, soldering and programming board to send wifi signal on Thingspeak is described on my project page.
The ESP8266 is a low cost Serial-to-WiFi module that interfaces nicely to any microcontroller. To communicate with the ESP8266 module, microcontroller needs to use set of AT commands. Microcontroller communicates with ESP8266-01 module using UART having specified Baud rate.

The module accepts commands via a simple serial interface.It then responds back with the operation’s outcome (assuming everything is running correctly). Also, once the device is connected and is set to accept connections, it will send unsolicited messages whenever a new connection or a new request is issued.

The gif below shows the graph on Thingspeak of tempearture and humidity with respect to time.

The final project stastics on Thingspeak communicated by wifi module.

1.B. Bluetooth- wireless Serial Bus Communication

The detailed procedure of making app and controlling led is on my Week 16-Interfacing and Application weekly project.

Bluetooth is a standardized protocol for sending and receiving data via a 2.4GHz wireless link. It’s a secure protocol, and it’s perfect for short-range, low-power, low-cost, wireless transmissions between electronic devices.

A. TXD: Connected with Microcontroller RXD pin of Microcontroller. Transmit Serial data (wirelessly received data by Bluetooth module transmitted out serially on TXD pin)

B. RXD: Connect with Microcontroller TXD pin of Microcontroller. Received data will be transmitted wirelessly by Bluetooth module.

Bluetooth networks (commonly referred to as piconets) use a master/slave model to control when and where devices can send data. In this model, a single master device can be connected to up to seven different slave devices. Any slave device in the piconet can only be connected to a single master.

The master coordinates communication throughout the piconet. It can send data to any of its slaves and request data from them as well. Slaves are only allowed to transmit to and receive from their master. They can’t talk to other slaves in the piconet.

Bonding and Pairing: Bonds are created through one-time a process called pairing. When devices pair up, they share their addresses, names, and profiles, and usually store them in memory. The also share a common secret key, which allows them to bond whenever they’re together in the future.

Below the Android mobile with the app is the master.It has no function to remember the last paired salve device. It can be made paired to any slave device.

2.A. OLED- I2C Protocol

Pease, refer my Week 11-Input Device and Week 12-Output Device for board design, fabrication and programming.

A.I2C-bus data signal (SDA): SDA pin is used to send or receive the information between the master and slave. This will also be used for sending the acknowledgement.

B.I2C-bus clock signal (SCL): The transmission of information in the I2C-bus is controlled by clock signal(SCL). One bit of information is transmitted/received during a single clock period of SCL.

Slave address bit (SA0): As the I2c communication depends on the slave address(ID) and will respond only if it matches. SSD1306 OLED device will respond to the slave address following the slave address bit (“SA0” bit) and the read/write select bit (“R/W#” bit) with the following byte format-

The I2C-bus interface gives access to write data and command into the device. Below is the image of my master board-

a.The master device initiates the data communication by a start condition. The start condition is established by pulling the SDA from HIGH to LOW while the SCL stays HIGH.

b.The slave address is sent immediately after the Start Condition.

c. The write mode is established by setting the R/W bit to logic “0”.

d. An acknowledgement signal will be generated after receiving one byte of data, including the slave address and the R/W bit.The acknowledge bit is defined as the SDA line is pulled down during the HIGH period of the acknowledgement related clock pulse.

e. After the transmission of the slave address, either the control byte or the data byte may be sent across the SDA.

f. Acknowledge bit is generated after receiving each control byte or data byte.

g. The write mode is finished when a stop condition is applied. The stop condition is established by pulling the “SDA in” from LOW to HIGH while the “SCL” stays HIGH.

Below image and video showing the room temperature and humidity data being displayed on OLED.

2.B. Bridge-Slave: I2C Protocol

I designed, milled, soldered and programmed 1 bridge and 2 slave boards to blink LED serially.

Design:

A. Schematic: Created new porject, selected components,connected and labeled them and shifted to next step after ERC check.

B. Board: Moved the bridge and slave board.Using manual route and when all the errors wee cleared after DRC check, saved mononchromatic image in .png format.

Operation:

A. End Mill in Collate: Inserted the end mill in the collate and moved to set X,Y origin. Here, I set the collate loose and allowed the end mill to touch the board.

B. Set Origin: Under user coordinate system and looking at the space on the FR1 board set the origin.

C.Added File: Selected the file to be milled from the local system.

D.Output Command: On pressing the output button SRM20 began milling the board.

E. Panel: VPanled software for SRM-20 showed spindle rpm, speed, X,Y,Z coordinates and button to pause or cancel the operation inbetween.

F. 1/64 end mill: The end mill with extremely fine end traced the board.

G.Board Cutting by 1/32 end mill: The end mill was changed from 1/64 to 1/32 for cutting the outline. I followed the same commands keeping the X,Y origin positions constant.The Z origin was marked again because the position may have slightly shifted while changing the end mill.

Master and slave boards design and rml files available here

Soldering:

Soldered ATtiny microcontrollers, ISP header, LED in slave boards, resistors, capacitors and FTDI header in the bridge board.

Programming:

A. Libraries: Downloaded TinywireM and TinywireS libraries for arduino.

B. Master Code:Here inside the code, I defined two different slave IDs to be detected by the micro-controller with specific ID.They will communicate each other by a definite time delay. This is the code for master board controller.

C. Slave Code 1:This is the code for slave I ID for define it,I place i2c node 1 as a slave 1 id.

D. Slave Code 2:This is the code for slave 2 ID for define it,I place i2c node 2 as a slave 2 id.

E. Functioning:The video below shows uploaded programme on Bridge and Slave boards while LED is blinking alternatively.

Arduino Codes available here

Group Assignment

Jaydip and me teamed up to use bluetooth HC-05 with arduino to send message which is displayed on Serial Monitor. I followed the tutorial by Mechatronics.

HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup. Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and baseband.

A. Below are the connections of Bluetooth model with arduino

B. Code: Pin 2 and 3 will Recieve(RX) and trasmit(TX) communication data. 9600 is the baud rate for software serial communication. Serial.write() will print character received on the serial monitor.

#include<SoftwareSerial.h>

/* Create object named bt of the class SoftwareSerial */ 
SoftwareSerial bt(2,3); /* (Rx,Tx) */  

void setup() {
  bt.begin(9600); /* Define baud rate for software serial communication */
  Serial.begin(9600); /* Define baud rate for serial communication */
}

void loop() {

    if (bt.available()) /* If data is available on serial port */
    {
     Serial.write(bt.read()); /* Print character received on to the serial monitor */
    }
}


C.Application:There are many application in the Play Store for this purpose which will work with the Arduino code that we uploaded I downloaded BLE Terminal and paired the mobile by default password of HC-05 module 1234.It worked successfully where the words written on mobile were reflected on serial monitor.