BREAKING NEWS

04 November 2015

Thermometer / hygrometer with Arduino with sending data over Bluetooth



Components:
Any model Arduino 
Bluetooth Module HC05 
Sensor DHT11 
1602 LCD 
or trimmer potentiometer 10kohm

The Arduino is powered by a separate power supply, for example a 9V battery.
In peripheral Buletooth of mobile device you will find the HC-05 and type the password associate 1234.
On Android I used the program Blue SerialBeta click Search for paired devices, HC-05 will appear. Click Connect and you will see, every 5 sec, text with specified moisture and temperature.
IDE for Arduino:

#include <dht.h>
#include <LiquidCrystal.h>

#define dht_dpin A0 //Imposta il pin al quale va collegato il segnale del sensore
//Imposta i pin ai quali collegare il pannello LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;//comando legato all'uso della libreria dht.h
//Disegna i nuovi caratteri
//grado centigrado
byte newChar1[8] = {
  B01100,
  B10010,
  B10010,
  B01100,
  B00000,
  B00000,
  B00000,
  B00000
};
//a accentata
byte newChar2[8] = {
  B00100,
  B00010,
  B01110,
  B00001,
  B01111,
  B10001,
  B01111,
  B00000,
};

int i = 0;

void setup(){
  Serial.begin(9600);
  lcd.createChar(1, newChar1);//memorizza i nuovi caratteri
  lcd.createChar(2, newChar2);
  delay(300);//Attendi 0,3 secondi
  Serial.print("Umidita'");
  Serial.println(" e temperatura\n");
  delay(700);//Aspetta ancora 0,7 secondi prima di accendere il pannello LCD
  // definisce il numero di righe e colonne del pannello:
  lcd.begin(16, 2);
  //Stampa sul pannello
  lcd.print("Umidit");
  i = 2;
  lcd.write(i);//stampa la a accentata
  lcd.setCursor(0, 1);//Scrive sulla seconda riga
  lcd.print("Temperatura");
}//fine "setup()"

void loop(){

  DHT.read11(dht_dpin);//legge i valori dal sensore DHT11
  //Invia le stringhe alla seriale
  Serial.print("Umidita'");
  Serial.print(" = ");
  Serial.print(int(DHT.humidity));//valore intero dell'umidità
  Serial.print("% ");
  Serial.print("Temperatura = ");
  Serial.print(int(DHT.temperature));//valore intero della temperatura
  Serial.print("gradi");//carattere grado
  Serial.println("C");
  lcd.setCursor(9, 0);//posiziona il cursore sul pannello
  lcd.print(int(DHT.humidity));//Scrive
  lcd.setCursor(11, 0);
  lcd.print("%");
  lcd.setCursor(12, 1);
  lcd.print(int(DHT.temperature));
  lcd.setCursor(14, 1);
  i = 1;
  lcd.write(i);//Stampa il carattere grado
  lcd.print("C");
  delay(5000);//aspetta 5 secondi
}// fine loop()


Share this:

Post a Comment

 
Back To Top
Distributed By Blogger Templates | Designed By OddThemes