Bluetooth

In this section we will discuss the bluetooth connection between the arudino and the phone app that our team created. The electrical and software components of the bluetooth module consist of the bluetooth module, arduino and code within the arduino and phone application. Each of these components must interact correctly to make communcation between the user and the robot as smooth as possible.

Bluetooth Module

During the first sprint we had a single bluetooth module that we had borrowed from another student. The module worked perfectly well for our purposes and did not cause us any problems. We bought four of our own bluetooth modules during the second sprint because we ambitiously believed that we would be able to create four robots. We had a difficult time getting the modules to work at first because we were unaware that they needed to be put into slave mode in order to recieve data. We used these four modules for the rest of the project.

Arduino Code

At first, we had the arduino code read the serial terminal for the string that was sent by the phone app to the bluetooth module. Since we used a third party app to communicate with the bluetooth module, it was very easy to know that the issues were being caused by the arduino code. The code respnded well because the arduino only searched for the voice commands and executed movements, and there were no other functions to slow it down. The code became more complex during the next sprint because we needed a higher baudrate for the bluetooth modules we had bought. Then the third sprint brought a lot of issues involving power and timing. We had added more functions to the code so that the robot would collect data from its IR sensors and turn on the IR LED at a certain rate.

After adding this functionality, the arduino began to have a harder time picking up commands from the bluetooth module and would often become overloaded with a huge backlog of commands that either were not recieved or were recieved and not acted upon. We did not managed to fix the problem involving a backlog of commmands. An issue with power arose when we started to integrate all the pieces of the robot together. The visible laser we used to aim drained too much current from the rest of the circuit which caused the bluetooth module to shut off. This was fixed by using nickel metal hydride batteries, which produce more current than commonly used batteries. We were, sadly, unable to fix the issue with the backlog of commands.

Application Code

For the phone application, we chose to use an app called IOTboys to communicate with the bluetooth module. We believed that using an app that provided most of the functions that we wanted would be a good place to start before we tried to make our own app. The biggest issue we saw with using this app was the long delay between recognizing the words the user said and relaying it to the bluetooth module. The bluetooth connection with the IOTboys app relied on bluetooth connections that the phone had previously made. When we began to devolop our own app, we decided to first focus on being able to relay data and made the app connect directly to the speceific UID of one of the bluetoth modules. We ended up keeping this for the rest of the project and created buttons for connecting to each robot. At one point there was an issue where the app would crash if the phone tried to send data while it was not connected to one of the robots, but we resolved it by using try and catch functions.

So in conclusion ...

There is not of lot of issues or changes with the implementation of bluetooth connection in our project. The majority of our issues did not involve the connection itself, but there were a lot of issues with using the data that was transferred. We successfully got the phone app to communicate to the arduino though a bluetooth module, but the arduino had a hard time keeping up with the number of commands that it recieved. Also the arduino would sometimes skip commands because it would only check for the voice commands once during the entire loop.

Bluetooth module

The HC-05 bluetooth module we used