Project tutorial
Bluetooth Temperature Monitor

Bluetooth Temperature Monitor © GPL3+

Remote temperature monitor using a Bluetooth module and an NTC thermistor. An Android app made with App Inventor is used to read data.

  • 1,993 views
  • 5 comments
  • 10 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
Optional
3drag
3D Printer (generic)
Optional

Apps and online services

About this project

In this tutorial I'm going to show you how to set up an Arduino temperature controller that send values to an Android app by Bluetooth connection.

Let's start with the material you will need to build this project:

  • Arduino nano.
  • NTC thermistor, check the 25°C resistance as this will be needed in the arduino code to correctly evaluate the temperature using the beta formula.
  • Resistors, 2k, 1k and one of the same magnitude of the thermistor.
  • HC 06 bluetooth module.
  • Various jumpers.

First of all you will need to start assembling the voltage divider used for the thermistor, figure 1 shows the connection you will need to make in order to calculate the unknown resistance of the thermistor as a fuction of temperature.

Figure 1 Voltage divider for thermistor resistance evaluation.

This circuit allows the Arduino to determine the voltage drop after the unknown resistor. Using the other resistance value, we are able to calculate the value of the unknown resistor using the following part of the code (figure 2).

raw= analogRead(analogPin);
if(raw) {
 ratio = raw * Vin;
 Vout = (ratio)/1024.0;
 ratio = (Vin/Vout) -1;
 R2= R1 * ratio;

Figure 2 Arduino code for thermistor resistance evaluation.

The obtained resistance is then converted to temperature using the beta formula (figura 3).

NOTE: the beta value of you thermistorand Ro at 25°C are available on the datasheet of your thermistor! Check it out before running the code!

Temp = Beta/log(R2/(Ro*exp(-Beta/To)));
Temp = Temp -273.15;

Figure3 Arduino code for temperature convertion.

You will then need to set up your Bluetooth module, figure 4 will show how to connect a Bluetooth module like the one I used in this project to the previous. A voltage divider is required to connect the TX1 pin of Arduino to RX pin of the module since this accept online 3.3V as input.

Figure 4 Arduino schematics with HC 06 module.

Data can then be sent trough bluetooth module by initializing the serial door and printing the wanted values. In this example I needed the device to measure the temperature in the range 25 -75°C, to start counting approximately 300 seconds at high temperature and then changing the printed message (figure 5).

void setup()
{
Serial.begin(9600); 
}
  
void loop(){
  
if(Temp >= 74) {
   for (int i = 0; i <= 30; i++) {
     Serial.print("Temperature >= 74 °C");
     delay(10000);
   }
   Serial.print("Heating Complete");
   delay(10000);
 } else if (Temp <= 26){
     Serial.print("Temperature <= 25 °C");
     delay(10000);
   } else {
     Serial.print("Temperature: ");
     Serial.println(Temp);
     delay(10000);
 }
}

Figure 5 Arduino Code per serial initialization and value printing.

The final device assembled on a breadboard can be seen in figure 6.

Figure 6 Full device on a breadboard.

The final step is the connection of the Bluetooth module to an Android phone for data visualization. A simple app has been programmed using MIT AppInventor 2. Figure 7 and figure 8 show respectively the user interface and the programming blocks.

Figure 7 User interface made with AppInventor2.

Figure 8 Programming blocks of AppInventor2.

The proposed app is available on App inventor gallery at the following link: http://ai2.appinventor.mit.edu/#5876233188016128

Anyway using the simple and intuitive block programming system of app inventor many other app can be built to fulfill any purpose you want. For example I needed the app to notify me with a sound if temperature gets lower than 25°C in order to perform some measurement and to notify after 5 minutes at 75°C that my heating cycle is complete.

Optional: A final step could be the soldering of the components and 3D print some box to keep the parts together. Figure 9 shows the result of such approach.

Figure 9 Full device ready to be used.

A hole has been made on the side of this box in order to power the Arduino with the mini usb cable. The long cable red and black has been added just to increase the distance between the thermistor and the rest of the device (I need the thermistor in order to check solutions temperature, so I wanted the electronic components as far as possible).

I hope this simple project will help you understand the basics for serial communication with bluetooth module in order to apply this to your own project.

If you find some errors or simply you want to ask something please let me know.

EDIT: I found an error in schematics wiring for the voltage divider need for the bluetooth module. It has been solved.

EDIT2: If you have problems uploading your code on the board try by disconnecting the bluetooth module.

Code

Temperature monitor with bluetooth moduleArduino
In order to calculate the resistance of the NTC thermistor, 5V are applied to it in series with a know resistor of roughly the same magnitude ( in this example 10kohm). Through the analog pin A0 the voltage of the voltage divider made from the series resistance is calculated and using the known value of one resistance, the NTC resistance is calculated. This value is then converted to temperature using the beta equation (change the beta to the one you are using) and sent to the Android app using the Bluetooth module.
The code can be changed to monitor specific range of temperature, in this example I needed to monitor between 25 and 75°C and wait 5 minutes at the higher temperature.
// Temperature monitor with bluetooth module

int analogPin= 0;
int raw= 0;
int Vin= 5;
float Vout= 0;
float R1= 10000; //change to your system
float Ro= 10000; //change to your system
float R2= 0;
float ratio= 0;
float Temp = 0;
float Beta = 3694; //change to your system
float To = 298.15;

// thermistor goes from 10k at 25°C. Choose reference resistance accondingly

void setup()
{
Serial.begin(9600);
}

void loop()
{
raw= analogRead(analogPin);
if(raw) {
  ratio = raw * Vin;
  Vout = (ratio)/1024.0;
  ratio = (Vin/Vout) -1;
  R2= R1 * ratio;
  Temp = Beta/log(R2/(Ro*exp(-Beta/To)));
  Temp = Temp -273.15;
  if(Temp >= 74) {
    for (int i = 0; i <= 30; i++) {
      Serial.print("Temperature >= 74 °C"); //change to your system
      delay(10000);
    }
    Serial.print("Heating Complete");
    delay(10000);
  } else if (Temp <= 26){
      Serial.print("Temperature <= 25 °C"); //change to your system
      delay(10000);
    } else {
      Serial.print("Temperature: "); //change to your system
      Serial.println(Temp);
      delay(10000);
  }
}
}

Schematics

Arduino Schematics
Resistance R2 should be changed accordingly to the resistance of the thermistor you are going to use. The error in temperature reading increase with the bias (Runknow - R2).
Schematics uzj0lxq1c3

Comments

Similar projects you might like

Temperature Monitor with DHT22 and I2C 16x2 LCD

Project tutorial by

  • 1,639 views
  • 0 comments
  • 9 respects

Jar Temperature Detector and Cooling Fan

Project tutorial by Kutluhan Aktar

  • 990 views
  • 0 comments
  • 6 respects

Mobile Weather Station Being Powered by Solar Energy

Project tutorial by Kutluhan Aktar

  • 2,552 views
  • 0 comments
  • 12 respects

Otto DIY+ Arduino Bluetooth Robot Easy to 3D Print

Project tutorial by Team Otto builders

  • 60,801 views
  • 123 comments
  • 190 respects
Add projectSign up / Login