To achieve a serial communication between two microcontrollers, we need to take care of two parts:
In the individual assignment, I decided to test various types of Networking and Communication processes. We already tested wired serial communication between two boards, so the next step was to test other types of communication.
So in this week's assignment i tested all the following:
The I2C communication or Inter-Integrated Circuit is usually used when we want to share the workload of on microcontroller with another, or when we want mor digital or analog inputs/outputs.
To achieve this communication, we mainly need the I2C pins, that are SCL and SDA pins of the micro-controller. However, in my produced board, the MPU-6050 module occupies those pins and it is hard to use those pins.
So I chose to use Arduino UNO boards in this test, as they have the same processing power of my board.
To connect 2 or more Arduino Boards using I2C communication, we need to use the A4 (SCL) and A5 (SDA) pin, an connect them all in paraller, meaning we use the same pins on the other one.
Note that the GND line has to be common between all arduino boards that are communicating.
The video represents how the Master Arduino Board was communicating with the other two Arduino boards, and controlling the built in LED on pin 13.
Below is the Master code and Slave code used to communicate between the boards using I2C.
Master code
Bluetooth communication appeared to be easier than expected. In this test, I used the ZS-40 Bluetooth module which is known as HC-06.
The concept behind the communication is very easy. Technically, the Bluetooth module works as a middle man that carries the commands recieved wirelessly through bluetooth from any device that has buetooth connectivity to the serial pins of the Microcontroller.
In this test, I used an My Board with a Bluetooth module connected to its Serial Pins (Rx and TX). The idea was to be able to control an LED wirelessly.
So to do that, I followed the following steps:
After testing the Serial, I2c and Bluetooth communication procedures, i wanted to test another way of communication that is based on traditional logic on and off commands, close to using a push-button.
So the theory is mainly communicating between two boards using Digital Inputs/Outputs pins. On the first board i used two digiatal pins, one that is set to be an input and the other to be an output. At the input pin, I connected a pushbutton. On the other hand, the putput pin is connected tot the input pin of the other Arduino board.
On the other board, one pin is set to be an input and the other is set to be an output. The input pin is connected to the output pin of the first board. As for the output pin, it is connected to an LED.
So the logic goes as the following: