Remote Bluetooth Thermometer using an Arduino

This project uses the Universal Bluetooth Receiver with LCD display here. A TMP36 analogue temperature sensor, described here, is used and the data is sent via Bluetooth HC05 Bluetooth, set as a Master (described here). The temperature is displayed on the remote receiver.


The receiver is built as described in the link above, but a small change is made to the sketch to allow it to show temperature. Upload the following sketch

Universal Bluetooth receiver with LCD Display

Uses a 1602a 2 line by 16 character display
and a HC06 Bluetooth Slave. Allows temperature to be displayed.

The LCD circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K variable resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)

The Bluetooth circuit:
* Vcc and Gnd on HC06 to Arduino +5volts and Gnd
* HC06 Tx to Arduino pin 6, through a logic level convertor
* HC06 Rx to Arduino pin 7, through a logic level convertor

// include the libraries:
#include <softwareSerial.h>
SoftwareSerial mySerial(6,7); // RX, TX
#include <LiquidCrystal.h>

// Initialize the LCD library with the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
Serial.begin(9600); // used to debug
// set up the LCD's number of columns and rows
lcd.begin(16, 2);
mySerial.begin(9600); // default baudrate for the HC06
lcd.setCursor(0,0); // set cursor at the start of the first line
lcd.setCursor(0,1); // set cursor at the start of the first line
lcd.print("Serial Receiver");

void loop() {
if (mySerial.available()) {
// wait a bit for the entire message to arrive
// clear the screen
// Print a message to the LCD
lcd.setCursor(0,0); // set cursor at the start of the first line
lcd.print("Remote Temp:");
lcd.setCursor(0, 1); // first character line 2
// read all the available characters
while (mySerial.available() > 0) {
// display each character to the LCD
lcd.print((char)223); // the degree symbol

To check everything is working correctly the LED on the HC06 should be blinking and the display should show the Universal Serial Receiver. Use your mobile phone, or other device, to connect to the HC06   And send a number for example 30.5, the LCD display should change and show Remote Temp: 30.5*C try sending other values. Once all is working well build the Bluetooth Master (link shown at the top of the page), adding a TMP 36 temperature sensor (link shown at the top of the page). The output of the TMP36 should be connected to A1 (pin 15).

Upload the following sketch
// Remote Bluetooth Thermometer
// Connect RX from the HC05 to pin 2 on the Arduino.
// Connect TX from the HC05 to pin 3 on the Arduino
// Connect Gnd on the TMP 36 to Arduino Gnd
// Connect Vcc on TMP 36 to Arduino 3.3v
// Connect Arduino 3.3 v to Arduino ARef
// Connect Output on TMP36 (centre pin) to A1 (pin 15)

#include <softwareserial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
#define keyPin 4 // connects to HC05 KEY
String buildString = ""; // Stores response of bluetooth device
// which simply allows \n between each response.

// TMP36
#define aref_voltage 3.3 // we tie 3.3V to ARef and measure it with a multimeter!

//TMP36 Pin Variables
int tempPin = 1; //the analog pin the TMP36's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade with a
//500 mV offset to allow for negative temperatures
int tempReading; // the analog reading from the sensor

void setup()
// Open serial communications and wait for port to open:
// Hardware Serial port set to 9600
// SoftwareSerial "com port" data rate. 38400.
mySerial.begin(9600); // default speed in AT mode
// TMP36
// set the aref to something other than 5v
pinMode(keyPin, OUTPUT);
digitalWrite(keyPin, LOW); // puts HC05 into communication mode
digitalWrite(keyPin, HIGH); // put HC05 into AT mode
// reset bluetooth module to factory settings
// Note: the delay blocks are necessary to allow the commands to take place

// this will take about 25 seconds to link up with HC06
Serial.println("Initialising this will take about 25 seconds...");
mySerial.write("AT+LINK=13,1,41254\r\n"); // insert your address here
Serial.println("HC-05 set as a Master, trying to connect to slave");

void loop() {
tempReading = analogRead(tempPin);
// converting that reading to voltage, which is based off the reference voltage
float voltage = tempReading * aref_voltage;
voltage /= 1024.0;

// Send temperature in Centigrade
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree with 500 mV offset
//to degrees ((volatge - 500mV) times 100)
Serial.print(temperatureC); Serial.println(" degrees C");

/* Un REM this code if Farenheight is required and REM out the above Centigrade Code
// Send temperature in Farenheight
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree with 500 mV offset
float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
Serial.print(temperatureC); Serial.println(" degrees C");

The way that this sketch sets the HC05 as a master and links to the HC06 Slave unit is described in the blog post on how to set up the HC05 ( link shown at the top of this page).

Apply power to the Slave Unit and the Master Unit, the LEDs on both Bluetooth units will start to blink. after 25 to 30 seconds the two units will pair and the LEDs will stop blinking. The temperature will be displayed on the LCD.


In the event that the setup does not work you will have to systematically check everything. First make sure the receiver is working by pairing it with a mobile phone using an app like Blueterm. If all is well check the wiring on the Master, run through the pairing routine and check you have the right address for your Slave unit. Try running everything again with the Serial monitor connected to the master unit.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s