Networking and Communications


For this assigment, we have to:

- (DONE) Design and build a wired &/or wireless network connecting at least two processors.

All the files created for this assigment can be found on the link bellow:


---> DOWNLOAD FILES<---



Have you:

- Described your design and fabrication process using words/images/screenshots.
--> yes
- Explained the programming process/es you used?
--> yes
- Outlined problems and how you fixed them?
--> yes
- Included original design files and code?
--> yes




Bluetooth Communication

Bluetooth communication is a wireless technology for exchanging data over short distances.
For establishing a communication via bluetooth betweeen two devices, a bluetooth socket needs to be created. One of the devices should act as a server, this means that it should create the bluetooth socket and wait for incomming connections. And the other device should act as a client, this means that it should detect the bluetooth devices which act as servers. For pairing the client device with the server device, the client has to provide a pin number (a password) to the server and the server accepts the connection if the pin number is correct.

All of this process can be done with the HC05 Bluetooth module, which is a module that can act as a client, if it is configured as Master, or act as a server if it is configured as Slave. This Module is configured by serial comunication in Hayes commands (AT commands)



Configuring the Slave Module

For configuring the Slave Module, I used an Arduino uno and the Software Serial Library. So that, I could program the module by the virtual UART and read on the computer the messages sent by the module by printing them on the Physical UART.

For configuring the bluetooth module in slave mode I did the next steps:

1. I conected the TX and RX pins of the module on the pin 4 and 5 of the arduino.

2. Then, on the Arduino IDE, I started programming by including the software serial library, creating a virtual UART port on the pins 4 and 5, and defining a global variable that contains the messages sent by the HC05 Module

3. After that, I copied the function readvscp from my 13th assigment and pasted it on the code,

4. After that, on the void setup, I defined the baud rate of serial commnunitacion for the virtual UART (pins 4 and 5) and the physisical UART (pins 0 and 1)

5. Then, I sent the command "AT" to the HC05 module by its serial communication port. This command waits for an "OK" response of the module to see if it is working properly.

6. So, I read the module response and printed it on the physical UART with the function readvcsp.

7. Then, I cofigured the module to work in Slave mode (as server) and waited to an "OK" response by inserting the next command and reading its response with the readvcsp function:

8. Then, I setted the module name:

9. And setted the pin number that the client needs to give to this module for pairing:

10. Then, I defined the bluetooth serial comunication speed of the module, the quantity of parity bits and the quantity of Stop bits

11. The HC05 module can only be configured on its AT Mode 1, at a previously definned serial communication on the module or on its AT Mode 2, at 38400 bits per second. In my case I programmed the module on the AT Mode 2. For doing this, I pushed the button, and connected the arduino to the PC. Once the arduino was powered I released the button and the led on the module started to blink slowly.

12. Finally, I uploaded the program to the arduino by clicking on upload.




Configuring the Master Module

For configuring the Master Module, I used an Arduino uno and the Software Serial Library.

For configuring the bluetooth module in master mode I did the next steps:

1. I conected the TX and RX pins of the module on the pin 4 and 5 of the arduino.

2. Then, on the Arduino IDE, I started programming by including the software serial library, creating a virtual UART port on the pins 4 and 5, and defining a global variable that contains the messages sent by the HC05 Module

3. After that, I copied the function readvscp from my 13th assigment and pasted it on the file

4. On the void setup, I defined the baud rate of serial commnunitacion for the virtual UART (pins 4 and 5) and the physisical UART (pins 0 and 1)

5. Then, I sent the command "AT" to the module and waited for an "OK":

6. Then, I cofigured the module to work in Master mode (as a client) and waited to an "OK" response by inserting the next command and reading its response with the readvcsp function:

8. Then, I setted the module name:

9. And setted the pin number that the server requires for pairing:

10. Then, I defined the connection mode as 1, this means that the bluetooh module can connect to any bluetooth device

11. Then, I defined the bluetooth serial comunication speed of the module as 115200 bits per sencond, the quantity of parity bits as zero and the quantity of stop bits as one

12. After that, I programmed the module on the AT Mode 2. For doing this, I pushed the button, and connected the arduino to the PC. Once the arduino was powered I released the button and the led on the module started to blink slowly.

13. finally, I uploaded the program to the arduino by clicking on upload.




Testing the bluetooth connection

For my 13th assigment I did a wired communication between my input device board and an Arduino for controling a servo motor. So the idea for this assigment was to do it wirelessly.

So, with the aid of a protoboard I connected the slave module to the input device board, the Master module to the arduino and suplied voltage to all the boards and devices.

Then, I connected the arduion to the PC and uploaded the code for moving the motor on the arduino.

This is the final result.