You can create your own Bluetooth Thermometer by just using a few components.
Some things you will need:
1. Arduino (Uno, Nano or Micro)
We will be using the Uno for this demo.
2. HC-05 module
3. DS18B20 thermal sensor
4. Some wires for connecting them
(male to male, male to female and female to female)
5. a 4.7k resistor
6. an Android phone
7. and finally the Arduino IDE from Here
Connecting all components
Connect everything up as shown in the diagram below
Required Libraries
Make sure to import the OneWire or 18b20 Library from Dallas Instruments
The Code to Run the project
Copy and paste the following code into your Arduino IDE or into the IDE of your choice
// Include the libraries #include <OneWire.h> #include <DallasTemperature.h> // Data wire goes to pin 2 on the Arduino #define ONE_WIRE_BUS 2 // Setup a oneWire instance OneWire oneWire(ONE_WIRE_BUS); // Pass the oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); void setup(void) { // start serial port with a baudrate of 9600 Serial.begin(9600); Serial.println("Temperature Demo started"); // Start up the sensor library sensors.begin(); } void loop(void) { //request temprature sensors.requestTemperatures(); // get the first sensors data Serial.print(sensors.getTempCByIndex(0)); // finalize the string Serial.println("\r\n"); //wait for 1 second before it reads again delay(1000); }
Click the Verify button to make sure there are no code errors
and if it’s successful Click the Upload.
When the upload is successful, the program will start running on the Arduino.
Testing
When the upload is successful, open your serial monitor by pressing “Ctrl+Shft+M”
If everything is working as expected you should see an output on the serial monitor every second.
Connecting to your Bluetooth Device
Once you have verified that the Arduino is getting data from your ds18b20, you are ready to connect your phone to your Bluetooth Module.
Download our app from the Google Play Store.
Once the app is installed, pair your Bluetooth Device(HC-05) with your phone.
Open the app on your phone and have a look for the paired device that you have just added to your phone and select it from the list.
Once you have selected the device it will connect to it and you should shortly start seeing the data updating on the app.