Interface and application

I have tried sending data through mobile app into the arduino to control motions of robots before, so this week, I wanted to work on recieving data from arduino into an app interface that i am building through MIT app inventor. I will build an app to understand the voltage comming from a potentiometer using a HC-05 bluetooth module. Here I will read the analog value of a potentiometer between 0 and 5 volts and save the data in a float format so it can have decimals as well. Next we establish a bluetooth connection with the smartphone and send the read data in a text format to the app.

HC-05 Bluetooth module


Arduino Uno
MIT app inventor

Front end of the application

For the front end, I have used a listpicker to select and connect to the HC-06 module connected to the arduino. And did some basic changes like adding images and resizeing the button to make the app look nicer. After connecting, we will be able to see the data changes in the app if there is some changes in the potentiometer's voltage in the real time.

Non-visible components.

This components play important roles behind the graphical USER interface. Bluetooth client is a non visible component that is used to connect and communicate with the arduino The clock helps to synchronise in the recieving data in this project


I started by adding the before list picker and set it to the name and address of the bluetooth client. This will select the ble device.

after picking listpicker block is used to connect to the selected address of the bluetooth device.

to recieve data , I used 'initialized gobal' value block and I named it to received data and initial data is set using text box to 'o.o'.

Now, we will use timer to receive data, Now every loops of the timer at 100 mili secs, the app will check if the bluetooth connections is established, if the bluetooth connections is established, if yes, the app will look out for incomming data by checking for byte which are higher than 0 as we already specified in the gobal initialize value. If that happens, then the received data is changed into recieved text.

As we already set the clock speed to 100 miliseconds, the code will check if any data is being sent or received by the arduino board after every 100 miliseconds and it loops again to repeat. This speed is enough for this project




Tx and Rx pins are connected on to the arduino board to communicate via bluetooth, also remember than arduino uses this pins to burn the code uploaded into it. so remove the connection from the HC-05 module to these pins before uploading the code.

Below, you can see the code I used with explaination.


Analog read is being used to read data from the analog sensor that is the potentiometer which is connected to pin 0 of the arduino.