Embedded Communication
Embedded communication is the process of sending information between two MCUs or from one circuit to other. For a communication to happen there needs to be a transmitter and a receiver. Communication may be in one direction or in both directions, there are different classifications according to this, but the basic classification is Synchronous and Asynchronous communication.
Synchronous: means sender and receiver use the same clock signal. Asynchronous: means sender provides a synchronization signal to the receiver before starting the transfer of each message.
Assignment:
Individual
- Design and build a wired &/or wireless network connecting at least two processors
Group
-Send a message between two projects
Software :
-Eagle
-Thunkable
-Arduino IDE
Materials :
-FR1 Board
-Electronic Components
-Bluetooth
Accomplised
-Understood the communication protocol between devices
-Explored wired and wireless communication
-understood Charlieplexing
-Created an app to use with Bluetooth
-Combined application interface and networking together.
Communication protocol
Communication protocols are formal descriptions of digital message formats and rules. They are required to exchange messages in or between computing systems and are required in telecommunications.
Communications protocols cover authentication, error detection and correction, and signaling. They can also describe the syntax, semantics, and synchronization of analog and digital communications. Communications protocols are implemented in hardware and software. There are thousands of communications protocols that are used everywhere in analog and digital communications. Computer networks cannot exist without them.
1.Inter System Protocol: The inter system protocol using to communicate the two different devices. Like communication between computer to microcontroller kit. The communication is done through a inter bus system.
Different categories of Inter system protocol:
UART Protocol
UART stands for universal asynchronous transmitter and receiver .UART Protocols is a serial communication with two wired protocol .The data cable signal lines are labeled as Rx and Tx. Serial communication is commonly used for transmitting and receiving the signal. It is transfer and receives the data serially bit by bit without class pulses. Ex: Emails, SMS, Walkie-talkie.
USART Protocol
USART stands for universal synchronous and asynchronous transmitter and receiver. It is a serial communication of two wire protocol. The data cable signal lines are labeled as Rx and TX. This protocol is used to transmitting and receiving the data byte by byte along with the clock pulses. It is a full-duplex protocol means transmitting and receiving data simultaneously to different board rates. Different devices communicate with microcontroller to this protocol.
Ex:-Telecommunications.
USB Protocol
USB stands for universal serial bus. Again it is a serial communication of two wire protocol. The data cable signal lines are labeled D+ and D-.This protocol is used to communicate with the system peripherals.USB protocol is used to send and receive the data serially to the host and peripheral devices.USB communication requires a driver software which is based on the functionality of the system.USB device can transfer data on the bus without any request on the host computer.
Ex: Mouse, Keyboard, Hubs, switches, pen drive.
2.Intra System Protocol: The Intra system protocol is used to communicate the two devices within the circuit board. While using this intra system protocols, with out going to intra system protocols we will expand the peripherals of the microcontroller. The circuit complexity and power consumption will be increases by using intra system protocol. Using intra system protocols circuit complexity and power consumption, cost is decrease and it is very secure to accessing the data.
Different categories of Inter system protocol
I2C Protocol
I2C stands for inter integrated circuit. I2C requires only two wires connecting all peripherals to microcontroller.I2C requires two wires SDA (serial data line) and SCL (serial clock line) to carry information between devices. It is a master to slave communication protocol. Each slave has a unique address. Master device sends the address of the target slave device and read/write flag. The address is match any slave device that device is ON, remaining slave devices are disable mode. Once the address is match communication proceed between master and that slave device and transmitting and receiving the data.
SPI Protocol
SPI stands for serial peripheral interface. It is one of the serial communication protocol developed by Motorola. Some times SPI protocol is also called a 4-wire protocol. It requires four wires MOSI, MISO, SS, and SCLK.SPI protocol used to communicate the master and slave devices. The master first configures the clock using a frequency. The master then selects the particular slave device for communication by pulling the chip select button. That particular device is selected and starts the communication between master and that particular slave. The master select only one slave at a time. It is full duplex communication protocol. Not limited to 8 bit words in the case of bit transferring.
CAN Protocol
CAN stands for controller area network .It is a serial communication protocol. It require two wires CAN High (H+) and CAN low (H-). It was developed by the Robert bosh company in 1985 for in vehicle networks. It is based on a message oriented transmission protocol.
Making an App
There are several different ways to make an android app these days. As days progress, makers have `come up with simpler solutions to create apps. As I am new to programming and have almost had zero knowledge I had to use a method that involved less coding, and the only viable option for that, which I knew of was MIT app inventor. But then I googled in the attempt to find out any other software that offers the same. That's when I came across Thunkable. Thunkable runs on MIT app inventor. It is the same as MIT app inventor because the makers of thunkable belonged to the team that made MIT app, they broke off to make their own platform.
The software works exactly the same as MIT app but the there certain (minor) differences between the two, like the user interface, some features etc making the Thunkable app slightly better. I went on to use Thunkable for my purpose and the tutorials for thunkable is also great.
To explain the user interface of the app,(Refer image above)
1.The palette:
This is where all the blocks are. The blocks are categorized into their functions like user interface, connectivity, sensors. Etc. To use them one has to simply drag and drop onto the screen.
2.Screen.
This is an imitation of the phone screen itself. All user interface blocks that are placed here is what will make the app. The look of the app has to be arranged here.
3.Components
All the blocks that are used in the making of the app are displayed here in the component section. If they are nested, that also is displayed here.
4.Properties.
The properties of each block can be controlled from here. The controls include color, size, orientation, images etc.
5.Menu bar
Here the app menu provides an option with, saving the app, creating a new app etc while the test menu provides real-time testing options. The export option is to export the app as apk or provide a QR code that helps to download the app. The help sections are linked to the docs.
6.UI and Programming
This bar helps to shift between designing the app and working of the app. The blocks shifts to a new window where the functioning of the app is configured.
Placing block
First I started with making the Bluetooth connection. I Couldn't understand the Bluetooth connection myself. So I had a few references to educate myself.
Charlieplexing
I tried to do Charlieplexing in my output week but failed. I was determined to correct it this time and find out where I went wrong. So I started reading about Charlieplexing and found these two profiles on fabacademy who had done excellent documentation on Charlieplexing.
Programming
The rest of the assignment is solely depended on programming. First I needed to check if the LED array is working. I used my FabISP to program and YAY I was able to upload the bootloader. Then I uploaded the following program and it was a delight to watch.
Networking
Now to do network communication I decided to use my TRI board that I made during week 7. The idea is to communicate with using Bluetooth to the TRI board and led array board, which will be controlled using the app that I had made. Now that I already have all the boards, it's just about programming them and connecting them together.
The LED array is already programmed, I didn't change much In the program, but I wanted to program the TRI board to light up different colors when even numbers are present. So the LED would light up when 2, 4 and 6 are pressed. This is the code for that
Update:
Now that I was able to talk to two boards, I decided to add another board to the set. But this time I had a problem with Programming. Took me a while to figure out the problem. I made my MISO and MOSI pins as RX and TX by doing so I had to sacrifice the RGB LED's function. I was able to power up only one color led and not all of them. Anyhow, I was able to communicate with all the three boards. Here I the schematic connection of all the boards and the video for the same.
Networking Update:
Networking between boards has not been completely achieved using the wireless methods that I have tried above. Hence I'm trying out a new program and method with reference from the following student's assignment.
Programming
As I had done earlier I used the boards of my previous weeks to complete the assignment. I used one master and 2 slaves and controlled the slaves using the LDR on the master board.
The master board has an Attiny 45 and slave 1 has Attiny 45 and slave 2 had Attiny 44. The idea is when the LDR is at a certain range it sends out a character and if the not it sends another character. This is addressed to each slave board depending on the condition.
Master Code:
The first part of the code is declaring the pins. Then when LDR is great than the given value then it sends out the character "d" which would be the address of Slave 1 and if it below the range then it would send character "r" which is the address of Slave 2.
Slave 1 & 2:
The slave codes are pretty much the same except for the address and the input pins. First, we set the Rx and Tx pins and then the address of the slave is set. Inside the loop, we read for the incoming byte. Of the bite is the same as the address of the salve then the led glows else it remains low. The RGB LED is of common anode type hence it's always high, giving it a low signal is what will turn it on. The code has Print.ln which will display the data on the serial monitor.
Conclusion
My assignment for this week was slightly different from what was expected. I combined last week assignment with this week. I made an app, designed an led array and used Bluetooth for wireless communication and also wired communication to talk my slave board. It was a culmination of output week, Programming and interface week and networking and communication week. It was hard to put everything together, but it was quite rewarding in the end. It was really great to see how things come together and interact with each other. I believe this is the beginning of making greater things, as they don't involve just one process but a synchronous performance of multiple processes.
The assignment was to send a message between two projects. The boards that were used in the assignment was a modification of my original board that I had designed in output week. We decided to use an IR sensor and when an object is within a certain range one LED blinks and when the object gets closer both the LED glow. My contribution to the group work included, helping in programming the boards and making the circuit diagram for documentation.