One interesting branch of robotics is making existing objects smarter which helps in our everyday life. This domain is known as domotics (especially for home) and IoT (Internet of Things)
Here is a small domotic project that consists in measuring your home temperature and collect the data on your smartphone. It is a simple project in which we use Bluetooth module, serial communication with a way to deal with multidata and a smartphone Android application made withh App Inventor 2.
Material
- Smartphone
- Arduino UNO
- 5V Battery
- Temperature sensor LM35
- Bluetooth module HC-06
Wiring
N.B.: The module displayed in Fritzing is a HC-05 but it has the same pinout as HC-06.
Code
We search the datasheet of the sensor LM35 to find the temperature range and the conversion rule between voltage and temperature. To be able to convert the measured voltage into a physical value. Once the temperature is measured it is sent to the smartphone via the Bluetooth module. To deal with multi-data, the data are concatenated into a String with a separator which make it easier to decipher.
#include <SoftwareSerial.h> SoftwareSerial HC06(2,3); // Constants #define DELAY 1000 // Delay between two measurements in ms // Parameters const int sensorPin = A0; // Pin connected to sensor // Variables float voltage, temperature; void setup(void) { Serial.begin(9600); HC06.begin(9600); } void loop(void) { voltage= analogRead(sensorPin) * (5.0 / 1023.0); // Convert digital value to voltage temperature=100*voltage; // conversion from V to °C Serial.print("Sensor reading = "); Serial.println(temperature); // the temperature reading // Send voltage and temperature value to app HC06.print(voltage); HC06.print("x"); HC06.print(temperature); delay(DELAY); }
Home Measurement App
We created a simple application using App inventor 2.The data from the Arduino is sent as a text to the Android application. To obtain the values from the sensor, the text need to be split according to the separator “x”. The resulting list items are then displayed in the corresponding labels.
The Bluetooth module must be stored in the list of Bluetooth devices in your phone. The Bluetooth module HC-05 or HC-06 should paired once before using the app.
You can find the aia project in the ZIP file here.
If you want more information on this project or if you think of one related project that should be on this site, do not hesitate to leave a comment or to send us a message.
Source
Learn how to read sensor value
Thanks men, me ha servido!
hi i have a question. where did u get the app?
Hi,
I made it with App Inventor 2.
Check the tutorial
Custava colocar o arquivo aia?
Added. Sometimes you just need to ask nicely.