How to Receive Arduino Sensor-Data on Your Android-Smartphone

In default the Arduino is not equipped with a display to visualize measuring-data, for example from your temperature or your pressure Sensor. If you want to get the data shown you need a PC, printing the data to the console or mounting a display directly to the Arduino. So there is no simple way to WIRELESSLY visualize measuring-data.

In this instructable i will show you, how to transfer measured Sensor-datain realtime from your Arduino-Mikrocontroller to your Android-Smartphone via Bluetooth.

Step 1: Preparing HC-05/HC-06 and Arduino

Requirements:

-Arduino

-Bluetooth-Module (HC-05, HC-06, ...)

-Android-Device

-App "Arduino Bluetooth Data"

The Bluetooth-Module HC-05/HC-06 is communicating with the Arduino via the UART-Interface. Every message the Arduino wants to send, is first given to the Bluetooth-Module, which sends the message wirelessly. To avoid problems with the UART, Arduino and Bluetooth-Module have to use the same baud-rate (in default 9600). It is possible to change the baud-rate and the password (and many other things) of the HC-05/HC-06, but this is not part of this instructable.

At first we have to do the wiring. The HC-05 has to be connected as descripted.

Wiring HC-05:

-GND of HC-05 to GND Arduino

-VCC of HC-05 to 3.3V Arduino

-TX HC-05 to Arduino Pin 10 (RX)

-RX HC-05 to Arduino Pin 11 (TX)

Important: HC-05 RX ist not connected to Arduino RX and vice versa.

Connect the Arduino to your PC and upload the following Code:


/*Developer: Frederik Hauke

Important Notices:

This Arduino-Code is written for Visualizating measurement data from a microcontroller via Bluetooth.

Before starting this application, the Bluetooth-Modul (HC-05) has to be coupled to the Smartphone.In the special case of the HC-05 the default PinCode for initiating the Coupling-Process is "1234".

Wiring: GND of HC-05 to GND Arduino, VCC of HC-05 to VCC Arduino, TX HC-05 to Arduino Pin 10 (RX) RX HC-05 to Arduino Pin 11 (TX) */

#include <SoftwareSerial.h>

SoftwareSerial BTserial(10, 11); // RX | TX

int sensorPin = A0;

int sensorValue = 0;

void setup() {

BTserial.begin(9600); }

void loop() {

sensorValue = analogRead(sensorPin);

//IMPORTANT: The complete String has to be of the Form: 1234,1234,1234,1234;

//(every Value has to be seperated through a comma (',') and the message has to

//end with a semikolon (';'))

BTserial.print("1234");

BTserial.print(",");

BTserial.print("1234.0");

BTserial.print(",");

BTserial.print("1234 hPa");

BTserial.print(",");

BTserial.print("500 ml/s");

BTserial.print(",");

BTserial.print(sensorValue);

BTserial.print(";");

//message to the receiving device

delay(20);

}

Step 2: Android App "Arduino Bluetooth Data"

The following app intents to process the incoming measuring-data and visualisates them:

https://play.google.com/store/apps/details?id=com....

Before using the app the Bluetooth-Module (HC-05/HC-06) has to be coupled to the Android in the system-preferences. In the special case of the HC-05 the default PinCode for initiating the Coupling-Process is "1234" or "0000".

If both devices are coupled, go to the app, pick the HC-05/HC-06 and click the red connect-button. "Arduino Bluetooth Data" should establish a serial connection.

In the Arduino-Code you determine on your own which values you want to send to the Android-Device. Just change these lines and fit in your own values:

BTserial.print(yourownValue);

Besides you can set a higher sampling-rate by lowering the delay: delay(yourownValue);

Feel free to do some experiments! Please, let me know, if something is not explained precisely enough!

2 People Made This Project!

Recommendations

  • Epilog X Contest

    Epilog X Contest
  • Comfort Food Challenge

    Comfort Food Challenge
  • Safe and Secure Challenge

    Safe and Secure Challenge

51 Discussions

0
None
logon_saral

Question 27 days ago

I am using esp32 which have ble and wifi inbuilt. can i use this code to transmit data

0
None
malqutub

1 year ago

hello, i have been trying to send data to my phone using an arduino pro min and the HC-06 module. The data is not showing up on the app/phone. The change I made is:

SoftwareSerial BTserial(1, 0); // RX | TX

Your help would be greatly appreciated.

1 reply
0
None
Wajhee uddinmalqutub

Reply 7 weeks ago

I am also wondering to do the same!!!
What about your problem is it solved?

0
None
DhirajS36

Question 3 months ago on Step 2

can we get a voice outputt from this app under certain high cnditions of sensors

0
None
neerajk73

7 months ago on Step 2

I have connected multiple sensors but I am getting only one sensor's value.

can you please help me ?

0
None
SindhuY1

Question 9 months ago

Can anyone tell me how the output would be looking. Will those 1234,1234.0 etc be visible too.... If that's the case then why are we printing these values when we want only the sensor reading

0
None
ravi3011

Question 9 months ago

how can i get BMP 180 value through HM 10

0
None
Bassusour

10 months ago

I was wondering what the code is for the arduino to receive instructions from the phone?

Thanks!

0
None
HassanN30

Question 10 months ago on Step 2

can you please tell me which plateform you used to build android application and can you please give me the source code of android application or just tell me how i can recieve data from arduino to smart phone via bluetooth ? thanks

0
None
MichaelW678

1 year ago

is there a way to receive sensor data on android via Wi-Fi or module sim800l?

2 replies
0
None
NoorA65MichaelW678

Reply 1 year ago

Try to implement websockets with the ESP8266 for wifi.

0
None
nfrancisco4NoorA65

Reply 11 months ago

How to implement websockets with esp8266? How can we send the sensor data to the smartphone? Is there any way that the esp8266 can send sensor data locally (without using the web/internet) to smartphone?

0
None
albnar

1 year ago

Hi,

I installed this app, but it does not work as Receiver, just as Terminal. why?

0
None
megan_stapley

1 year ago

Hi There, I'm outputting things correctly in the terminal on the Android, however, having trouble getting my values in the:

Sensor 1:

Sensor 2:

Sensor 3:

etc...

Can you elaborate more on how I do this? Thanks!

2 replies
0
None
megan_stapleymegan_stapley

Reply 1 year ago

sensorValue = analogRead(sensorPin);

^Can you explain what this line of code means?

0
None
kinsleykmegan_stapley

Reply 1 year ago

this means reading from a pin for example pin 0 or pin 1 .... pin 5 so you can have ean expression saying analogRead(0);

0
None
DaveC278

1 year ago

please share the android code as much as possible.