browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

Mini tracker Arduino

Posted by on 21 marzo, 2013

Con un GPS Bluetooth, un módulo HC05 maestro, un sensor DHT11 y un Arduino Mega :)


/*MiniTracker

2013 EA1NK – Juan J. Lamas

Arduino Mega2560
DHT11 Sensor
HC-05 Bluetooth RS232 module

*/

#include “DHT.h”
#include “TinyGPS.h”

TinyGPS gps;
DHT dht(8,11);

int anio;
byte mes, dia, hora, minuto, segundo, centesima;
float latitud, longitud, temperatura, humedad;

void setup(){

Serial.begin(57600);
Serial3.begin(4800);
delay(3000);
}

void loop(){

while(Serial3.available()){

int c = Serial3.read();
if(gps.encode(c)){

humedad = dht.readHumidity();
temperatura = dht.readTemperature();

Serial.println(“—————————————————-“);
gps.crack_datetime(&anio,&mes,&dia,&hora,&minuto,&segundo,&centesima);
delay(500);

Serial.print(dia,DEC);
Serial.print(“/”);
Serial.print(mes,DEC);
Serial.print(“/”);
Serial.print(anio,DEC);
Serial.print(” “);
Serial.print(hora,DEC);
Serial.print(“:”);
Serial.print(minuto,DEC);
Serial.print(“:”);
Serial.print(segundo,DEC);
Serial.print(“\n”);

gps.f_get_position(&latitud,&longitud);
Serial.print(“Lat/Long: “);
Serial.print(latitud,2);
Serial.print(“,”);
Serial.print(longitud,2);
Serial.print(” Alt: “);

Serial.print(gps.f_altitude(),0);
Serial.print(” “);

if(isnan(humedad)||isnan(temperatura)){

Serial.print(“No WX data”);
} else {

Serial.print(“Moist. “);Serial.print(humedad);Serial.print(” %”);
Serial.print(” Temp. “);Serial.print(temperatura);Serial.print(” C \n”);

}
delay(5000);

}

}

}

Comments are closed.