Total Pageviews

Saturday, October 18, 2014

Old GPS receiver and Arduino = speedometer

   I made a speedometer with GPS coordinates and clock using: an old GPS receiver, Arduino board, alphanumeric LCD with 20 columns and 4 rows.
   To find offered datas from GPS receiver, I followed the information provided in article tronixstuffial – Arduino and EM406A GPS:
   After I study article named NMEA data and I selectet usefull datas for speed:
   I use TinyGPS++ library made by Mikal Hart and I extract speed:
TinyGPSCustom zdop(gps, "GPVTG", 7); // $GPVTG sentence, 7th element 
   I designed this schematic for tests:

   I write more sketches but last is 1.6.5 version:
// source: http://arduiniana.org/libraries/tinygpsplus/
// for see your position: http://www.gps-coordinates.net/
// for new article made by niq_ro: http://nicuflorica.blogspot.com/
// & http://arduiniq.blogspot.com/
#include <TinyGPS++.h>
#include <SoftwareSerial.h>

/*
   This sample code demonstrates the normal use of a TinyGPS++ (TinyGPSPlus) object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 4800;

// The TinyGPS++ object
TinyGPSPlus gps;

// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);

#include <LiquidCrystal.h>
// folosesc libraria pentru afisaje LCD simple
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
// indic modul de legare, vezi mai jos:
/*                                    -------------------
                                      |  LCD  | Arduino |
                                      -------------------
 LCD RS pin to digital pin 7          |  RS   |   D7    |
 LCD Enable pin to digital pin 6      |  E    |   D8    |
 LCD D4 pin to digital pin 5          |  D4   |   D9    |
 LCD D5 pin to digital pin 4          |  D5   |   D10   |
 LCD D6 pin to digital pin 3          |  D6   |   D11   |
 LCD D7 pin to digital pin 2          |  D7   |   D12   |
 LCD R/W pin to ground                |  R/W  |   GND   |
                                      -------------------
niq_ro adapted this sketch for see data on 2004 LCD
*/

/* A set of custom made large numbers for a 16x2 LCD using the 
 LiquidCrystal library. Works with displays compatible with the 
 Hitachi HD44780 driver. Made by Michael Pilcher, 2/9/2010
*/ 

int x = 0;
// the 8 arrays that form each segment of the custom numbers
byte LT[8] = 
{
  B00111,
  B01111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
byte UB[8] =
{
  B11111,
  B11111,
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000
};
byte RT[8] =
{
  B11100,
  B11110,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111
};
byte LL[8] =
{
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B01111,
  B00111
};
byte LB[8] =
{
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111,
  B11111
};
byte LR[8] =
{
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  B11110,
  B11100
};
byte UMB[8] =
{
  B11111,
  B11111,
  B11111,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111
};
byte LMB[8] =
{
  B11111,
  B00000,
  B00000,
  B00000,
  B00000,
  B11111,
  B11111,
  B11111
};


// for speed in knots (noduri) 
//TinyGPSCustom sdop(gps, "GPVTG", 5); // $GPVTG sentence, 5th element
// for speed in kilometers per hour
TinyGPSCustom zdop(gps, "GPVTG", 7); // $GPVTG sentence, 7th element 

void setup()
{
  Serial.begin(115200);
  ss.begin(GPSBaud);

  Serial.println(F("FullExample.ino"));
  Serial.println(F("An extensive example of many interesting TinyGPS++ features"));
  Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println(F("by Mikal Hart"));
  Serial.println();
  Serial.println(F("Sats HDOP Latitude   Longitude   Fix  Date       Time     Date Alt    Course Speed Card  Distance Course Card  Chars Sentences Checksum"));
  Serial.println(F("          (deg)      (deg)       Age                      Age  (m)    --- from GPS ----  ---- to London  ----  RX    RX        Fail"));
  Serial.println(F("---------------------------------------------------------------------------------------------------------------------------------------"));


lcd.begin(20, 4); // set up the LCD's number of columns and rows: 

// assignes each segment a write number
  lcd.createChar(8,LT);
  lcd.createChar(1,UB);
  lcd.createChar(2,RT);
  lcd.createChar(3,LL);
  lcd.createChar(4,LB);
  lcd.createChar(5,LR);
  lcd.createChar(6,UMB);
  lcd.createChar(7,LMB);

 lcd.clear(); // clear the screen
 lcd.setCursor(1, 0); // put cursor at colon x and row y
 lcd.print("GPS data - 7.2014"); // print a text
 lcd.setCursor(0, 1); // put cursor at colon x and row y
 lcd.print("ver 1.6.5 by niq_ro"); // print a text
 lcd.setCursor(1, 2); // put cursor at colon x and row y
 lcd.print("Craiova - Romania"); // print a text
 lcd.setCursor(0, 3); // put cursor at colon x and row y
 lcd.print("(TinyGPS++ library)"); // print a text
 
 delay (2000);
 lcd.clear(); // clear the screen
 
/* 
// testare la inceput mod afisare viteza
lcd.setCursor(2,0);
 lcd.print("niq_ro testeaza");
 lcd.setCursor(1,1);
 lcd.print("afisarea vitezei:"); 
for (int q=0; q<120; q=q++)
 {
 vitezamare(q); 
 lcd.setCursor(12,3); 
 lcd.print("km/h");
 delay(200);
 lcd.setCursor(0,2);
 lcd.print("           ");
 lcd.setCursor(0,3);
 lcd.print("           ");
}
*/
 lcd.clear(); // clear the screen
 delay(500);
}


void loop()
{
  // partea de ecran LCD 20x4
  afisareecran();


  // scot viteza 
 int viteza = atoi (zdop.value());
 //int viteza = 123;
 //int viteza = 456;
 //int viteza = 789;
 //int viteza = 92;
 //int viteza = 6;
 //int viteza = 0;
 vitezamare(viteza); 
 lcd.setCursor(12,3); 
 lcd.print("km/h");
  
  
  
  static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;

  printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
  printInt(gps.hdop.value(), gps.hdop.isValid(), 5);
  printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
  printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
  printInt(gps.location.age(), gps.location.isValid(), 5);
  printDateTime(gps.date, gps.time);
  printFloat(gps.altitude.meters(), gps.altitude.isValid(), 7, 2);
  printFloat(gps.course.deg(), gps.course.isValid(), 7, 2);
  printFloat(gps.speed.kmph(), gps.speed.isValid(), 6, 2);
  printStr(gps.course.isValid() ? TinyGPSPlus::cardinal(gps.course.value()) : "*** ", 6);

  unsigned long distanceKmToLondon =
    (unsigned long)TinyGPSPlus::distanceBetween(
      gps.location.lat(),
      gps.location.lng(),
      LONDON_LAT, 
      LONDON_LON) / 1000;
  printInt(distanceKmToLondon, gps.location.isValid(), 9);

  double courseToLondon =
    TinyGPSPlus::courseTo(
      gps.location.lat(),
      gps.location.lng(),
      LONDON_LAT, 
      LONDON_LON);

  printFloat(courseToLondon, gps.location.isValid(), 7, 2);

  const char *cardinalToLondon = TinyGPSPlus::cardinal(courseToLondon);

  printStr(gps.location.isValid() ? cardinalToLondon : "*** ", 6);

  printInt(gps.charsProcessed(), true, 6);
  printInt(gps.sentencesWithFix(), true, 10);
  printInt(gps.failedChecksum(), true, 9);

  // speed in km/h
  Serial.print(" ");
  Serial.print(zdop.value());
  int vitesa1 = atoi (zdop.value());
  Serial.print("/");
  Serial.print(vitesa1);
  Serial.println();
  
  smartDelay(1000);

  if (millis() > 5000 && gps.charsProcessed() < 10)
    Serial.println(F("No GPS data received: check wiring"));
}

// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
  unsigned long start = millis();
  do 
  {
    while (ss.available())
      gps.encode(ss.read());
  } while (millis() - start < ms);
}

static void printFloat(float val, bool valid, int len, int prec)
{
  if (!valid)
  {
    while (len-- > 1)
      Serial.print('*');
    Serial.print(' ');
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1); // . and -
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(' ');
  }
  smartDelay(0);
}

static void printInt(unsigned long val, bool valid, int len)
{
  char sz[32] = "*****************";
  if (valid)
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz[i] = ' ';
  if (len > 0) 
    sz[len-1] = ' ';
  Serial.print(sz);
  smartDelay(0);
}

static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
{
  if (!d.isValid())
  {
    Serial.print(F("********** "));
  }
  else
  {

    char sz[32];
   sprintf(sz, "%02d/%02d/%02d ", d.month(), d.day(), d.year());
//    sprintf(sz, "%02d/%02d/%02d ", gps.date.month(), gps.date.day(), gps.date.year());
    Serial.print(sz);
  }
  
  if (!t.isValid())
  {
    Serial.print(F("******** "));
  }
  else
  {
    char sz[32];
    sprintf(sz, "%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
//  sprintf(sz, "%02d:%02d:%02d ", gps.time.hour(), gps.time.minute(), gps.time.second());
    Serial.print(sz);

  }

  printInt(d.age(), d.isValid(), 5);
  smartDelay(0);
}

static void printStr(const char *str, int len)
{
  int slen = strlen(str);
  for (int i=0; i<len; ++i)
    Serial.print(i<slen ? str[i] : ' ');
  smartDelay(0);
}

static void afisareecran()
{
// lcd.clear(); // clear the screen

// partea de ora
// ora de vara a Romaniei - 
// trebuie sa pun un comutator pentru selectie de iarna si de vara
 int ora = 3 + gps.time.hour();
 if (ora ==24) ora=0;
 if (ora ==25) ora=1;
 if (ora ==26) ora=2;
 lcd.setCursor(12,2); // put cursor at colon 2 and row 2
 if (ora<10) lcd.print(" "); 
 lcd.print(ora); 
 lcd.print(":");
 if (gps.time.minute()<10) lcd.print("0"); 
 lcd.print(gps.time.minute()); 
 lcd.print(":");
 if (gps.time.second()<10) lcd.print("0"); 
 lcd.print(gps.time.second()); 


// parte de coordonate GPS
 lcd.setCursor(0,0); // put cursor at colon 0 and row 0 = left/up
 lcd.print("LAT:");
 lcd.print(gps.location.lat(),6);
 lcd.write(0b11011111);
 lcd.setCursor(0,1); // put cursor at colon 0 and row 1 
 lcd.print("LON:");
 lcd.print(gps.location.lng(),6);
 lcd.write(0b11011111);

// numar sateliti receptionati
 lcd.setCursor(16,0); // put cursor at colon 15 and row 2
 lcd.print(gps.satellites.value());
// if (gps.satellites.value() == 1) lcd.print(" satelit ");
// else
 lcd.print("sat");

// viteza
/*
lcd.setCursor(10,3); // put cursor at colon x and row y
double viteza = gps.speed.kmph(); 
// tests
// double viteza = 0.;
// double viteza = 5;
// double viteza = 14;
// double viteza = 104;
 if (viteza>100.0) lcd.print(viteza);
 else
 if (viteza>10.0) {lcd.print(" "); lcd.print(viteza);}
 else 
 if (viteza<10.0) {lcd.print("  "); lcd.print(viteza);}
// lcd.print(viteza);
// lcd.print(gps.speed.kmph());
 lcd.print("km/h");
*/

/*
// altitudine
  lcd.setCursor(16,0); // put cursor at colon 16 and row 0
  lcd.print("ALT:");
  int cota = gps.altitude.meters();
  lcd.setCursor(15,1); // put cursor at colon 15 and row 1
// cota=5;
//cota=15;
//cota=497;
//cota=2056;
 if (cota>1000) lcd.print(cota);
 else
 if (cota>100) {lcd.print(" "); lcd.print(cota);}
 else
 if (cota>10) {lcd.print("  "); lcd.print(cota);}
 if (cota<10) {lcd.print("   "); lcd.print(cota);}
 lcd.print("m");
*/

/* 
// viteza extrasa custom
 lcd.setCursor(0,3); // put cursor at colon x and row y
 lcd.print("viteza: ");
 int viteza = atoi (zdop.value());
// lcd.print(zdop.value());
 if (viteza>100.0) lcd.print(viteza);
 else
 if (viteza>10.0) {lcd.print(" "); lcd.print(viteza);}
 else 
 if (viteza<10.0) {lcd.print("  "); lcd.print(viteza);}
 lcd.print("km/h");
*/ 
 }  



 
void custom0O()  // uses segments to build the number 0
{ 
  lcd.setCursor(x, 2); 
  lcd.write(8);  
  lcd.write(1); 
  lcd.write(2);
  lcd.setCursor(x, 3); 
  lcd.write(3);  
  lcd.write(4);  
  lcd.write(5);
}

void custom1()
{
  lcd.setCursor(x,2);
  lcd.write(1);
  lcd.write(2);
  lcd.setCursor(x,3);
  lcd.write(4);
  lcd.write(255);
  lcd.write(4);
}

void custom2()
{
  lcd.setCursor(x,2);
  lcd.write(6);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 3);
  lcd.write(3);
  lcd.write(7);
  lcd.write(7);
}

void custom3()
{
  lcd.setCursor(x,2);
  lcd.write(6);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 3);
  lcd.write(7);
  lcd.write(7);
  lcd.write(5); 
}

void custom4()
{
  lcd.setCursor(x,2);
  lcd.write(3);
  lcd.write(4);
  lcd.write(2);
  lcd.setCursor(x+2, 3);
  lcd.write(255);
}

void custom5()
{
  lcd.setCursor(x,2);
  lcd.write(255);
  lcd.write(6);
  lcd.write(6);
  lcd.setCursor(x, 3);
  lcd.write(7);
  lcd.write(7);
  lcd.write(5);
}

void custom6()
{
  lcd.setCursor(x,2);
  lcd.write(8);
  lcd.write(6);
  lcd.write(6);
  lcd.setCursor(x, 3);
  lcd.write(3);
  lcd.write(7);
  lcd.write(5);
}

void custom7()
{
  lcd.setCursor(x,2);
  lcd.write(1);
  lcd.write(1);
  lcd.write(2);
  lcd.setCursor(x+1, 3);
  lcd.write(8);
}

void custom8()
{
  lcd.setCursor(x,2);
  lcd.write(8);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 3);
  lcd.write(3);
  lcd.write(7);
  lcd.write(5);
}

void custom9()
{
  lcd.setCursor(x,2);
  lcd.write(8);
  lcd.write(6);
  lcd.write(2);
  lcd.setCursor(x, 3);
  lcd.write(7);
  lcd.write(7);
  lcd.write(5);
}

// subrutina de afisare a numerelor
void afisarenumar(int numar)
{
  switch (numar)
  {
    case 0:
    custom0O();
    break;

    case 1:
    custom1();
    break;

    case 2:
    custom2();
    break;

    case 3:
    custom3();
    break;

    case 4:
    custom4();
    break;

    case 5:
    custom5();
    break;

    case 6:
    custom6();
    break;

    case 7:
    custom7();
    break;

    case 8:
    custom8();
    break;

    case 9:
    custom9();
    break;
  }
}

void vitezamare(int viteza)
{
  // sterg zona de afisare a vitezei
 lcd.setCursor(0,2);
 lcd.print("           ");
 lcd.setCursor(0,3);
 lcd.print("           ");
   
if (viteza>=100)
{
  x = 0;
  afisarenumar(int(viteza/100));
  viteza=viteza % 100;

  x = x + 4;
  afisarenumar(viteza/10);
  
  x = x + 4;
  afisarenumar(viteza % 10);
}
else
if (viteza>=10)
{
 lcd.setCursor(0,2);
 lcd.print("   ");
 lcd.setCursor(0,3);
 lcd.print("   ");
  
  x = 4;
  afisarenumar(viteza/10);
  
  x = x + 4;
  afisarenumar(viteza % 10);
}
else 
if (viteza<10)
{
 lcd.setCursor(0,2);
 lcd.print("       ");
 lcd.setCursor(0,3);
 lcd.print("       ");
  x = 8;
  afisarenumar(viteza);
}
}
   I made few pics with speedometer in moving car:
Also, I made few movies:

   Bibliography:


BMP180 sensor and Arduino

   BMP180 sensor can give us information about pressure an temperature.
   This sensor is delivered on small module with 4 pins: Vin (+3.3V), GND, SDA and SCL.
   For testing, schematic is very simple:
   For control BMP180 sensor I use Adafruit-BMP085-Library, them test the example sketch.
   For a stand alone weather station with information about temperature and presure, I put a alphanumeric LCD display with 16 colons and 2 rows (1602):
and test montage is:
   I use this sketch:
// adapted sketch by niq_ro from http://nicuflorica.blogspot.ro/ & http://arduinotehniq.blogspot.com/
// https://github.com/adafruit/Adafruit-BMP085-Library
#include <Wire.h>
#include <Adafruit_BMP085.h>

/*************************************************** 
  This is an example for the BMP085 Barometric Pressure & Temp Sensor
  Designed specifically to work with the Adafruit BMP085 Breakout 
  ----> https://www.adafruit.com/products/391
  These displays use I2C to communicate, 2 pins are required to  
  interface
  Adafruit invests time and resources providing this open source code, 
  please support Adafruit and open-source hardware by purchasing 
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.  
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)
// Connect GND to Ground
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
// EOC is not used, it signifies an end of conversion
// XCLR is a reset pin, also not used here

// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

/*                                    -------------------
                                      |  LCD  | Arduino |
                                      -------------------
 LCD RS pin to digital pin 7          |  RS   |   D7    |
 LCD Enable pin to digital pin 6      |  E    |   D6    |
 LCD D4 pin to digital pin 5          |  D4   |   D6    |
 LCD D5 pin to digital pin 4          |  D5   |   D4    |
 LCD D6 pin to digital pin 3          |  D6   |   D3    |
 LCD D7 pin to digital pin 2          |  D7   |   D2    |
 LCD R/W pin to ground                |  R/W  |   GND   |
                                      -------------------
*/



Adafruit_BMP085 bmp;
  
void setup() {
  lcd.begin(16, 2);
  // Print a logo message to the LCD.
  lcd.print("www.tehnic.go.ro");  
  lcd.setCursor(0, 1);
  lcd.print("creat de niq_ro");
  delay (2500);
  lcd.clear();

  // Print another message to the LCD.
  lcd.setCursor(2, 0);
  lcd.print("termometru -");  
  lcd.setCursor(0, 1);
  lcd.print("barometru ver1.0");
  delay (2500);
  lcd.clear();

  Serial.begin(9600);
  if (!bmp.begin()) {
 Serial.println("nu exita senzor compatibil BMP085 sau BMP180");
 while (1) {}
  }
}
  
void loop() {
    Serial.print("Temperatura = ");
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");
    
    Serial.print("Presiune = ");
    Serial.print(bmp.readPressure());
    Serial.print(" Pa / ");
    
 //   Serial.print("Presiune = ");
    float presiune1 = bmp.readPressure()/101.325;
    presiune1 = presiune1 * 0.760;
    Serial.print(presiune1);
    Serial.println(" mmHg");
    
    
    // Calculate altitude assuming 'standard' barometric
    // pressure of 1013.25 millibar = 101325 Pascal
    Serial.print("Altitudine = ");
    Serial.print(bmp.readAltitude());
    Serial.println(" m");

    Serial.print("Presiune la nivelul marii (calculata) = ");
    Serial.print(bmp.readSealevelPressure());
    Serial.print(" Pa / ");
    
    // http://en.wikipedia.org/wiki/Atmospheric_pressure#Mean_sea_level_pressure
  //  Serial.print("Presiure la nivelul marii (calculata) = ");
    float presiune = bmp.readSealevelPressure()/101.325;
    presiune = presiune * 0.760;
    Serial.print(presiune);
    Serial.println(" mmHg");
    

  // you can get a more precise measurement of altitude
  // if you know the current sea level pressure which will
  // vary with weather and such. If it is 1015 millibars
  // that is equal to 101500 Pascals.
    Serial.print("Altitudine reala = ");
    Serial.print(bmp.readAltitude(101500));
    Serial.println(" m");
    
    Serial.println();
    
    
   lcd.setCursor(1, 0);
   lcd.print("temp.=  ");
    if ( bmp.readTemperature() < 10)
   {
     lcd.print(" "); 
     lcd.print(bmp.readTemperature());
   }
   else
   {
   lcd.print(bmp.readTemperature(),1);
   }
   lcd.write(0b11011111);
   lcd.print("C   ");
   
   lcd.setCursor(1, 1);
   lcd.print("pres.= p");
   lcd.print(presiune,0);
   lcd.print("mmHg  ");
    
   delay(2500);
}
24.11.2014
   In last weak-end, I received 3 pics from Dave (http://g4rvh.wordpress.com/) with a shield for Arduino Uno, made after my schematic:
   He made with board with CNC Cutter:
   I change the sketch for present the temperature in Fahrenheit, not in Celsius degree, using information from article http://www.mathsisfun.com/temperature-conversion.html:

Weather station with Arduino Due on 2.2" TFT display

Note: This article is a rearrangement of article from http://arduinotehniq.blogspot.ro/2014/09/arduino-due-and-22-tft-display-with.html

   A usual weather station for domestic use must give us information about temperature and humidity, but a good weather station give us information about pressure, too.
   I design a weater station with 2.2" TFT display with ILI9341 driver.
 I did several experimets with Arduino Uno, then Arduino Mega and my conclusion is that development board are too slow for this display; so, I change classical Arduino board with next step, for me, Arduino Due.
   Arduino Due works with 3.3V logical level like ILI9341 driver, so in schematic we not need the logical level convertor (eg CD4050) from 5V to 3.3V as in case use Arduino Uno or Mega.
   For control the colour display with ILI9341, I use graphical library named ucglib, derivated from u8glib library for monochrome graphical display.
   I decided to use BMP180 sensor for give information about temperature and pressure & DHT11 sensor for give just humidity value, because is not accurate at temperature reading.
   My schematic for sensors at Arduino Due is:
   In my case, real ensemble is:
   For upload a sketch in Arduino Due must install a  new version of Arduino IDE, named 1.5.7 Beta (in future, version will be changed, but now 1.5.7 Beta is current version).
   For DHT11 sensor must use a new library compatible with Due, I found in a article named  Class for DHTxx sensors (xx = 11-21-22-33-44) and for BMP180 I use  Adafruit-BMP085.
   I write some original sketches for this weather station, and last is:
/*
original sketch by niq_ro from http://nicuflorica.blogspot.comhttp://arduinotehniq.blogspot.com using ucglib library
version for 2.2" TFT with ILI9341  - 2014.07.29, Craiova - Romania
use Universal uC Color Graphics Library from https://code.google.com/p/ucglib/
*/
#include <SPI.h>
#include "Ucglib.h"
//Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4); // at Uno
//Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 26 , /*cs=*/ 24, /*reset=*/ 22); // at Mega
//Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 52, /*data=*/ 51, /*cd=*/ 26 , /*cs=*/ 24, /*reset=*/ 22); //at Mega
//Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 76, /*data=*/ 75, /*cd=*/ 26 , /*cs=*/ 24, /*reset=*/ 22); //at Mega
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 26 , /*cs=*/ 24, /*reset=*/ 22); //at Mega or Due
/*

Due  |Mega | Uno | TFT - ILI9341
----------------------
D22  | D22 | D4  | RESET
D24  | D24 | D5  | CS
D26  | D26 | D6  | D/C
 ?   | ?   | LED (via 220 ohms resistor at 5V)
MOSI | D51 | D11 | MOSI
MISO | D50 | D12 | MISO
SCK  | D52 | D13 | SCK
-----------------------------
with CD4050 adapter or 10k resistor, power supply and logical levels is 3.3V
schematic: http://nicuflorica.blogspot.ro/2014/07/afisaj-grafic-color-qvga-de-22-cu.html
*/

#include <dht.h> 
// from http://playground.arduino.cc/Main/DHTLib
dht DHT;

// https://github.com/adafruit/Adafruit-BMP085-Library
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 bmp;

float t1, t2;
float t10, t20;
float t11, t21;
float t12, t22;
float t13, t23;
int h11, h12;
int p1, p2;

void setup() {
delay(1000);
bmp.begin();

ucg.begin(UCG_FONT_MODE_TRANSPARENT);
ucg.clearScreen();
ucg.setFont(ucg_font_ncenR14r);
ucg.setColor(255, 0, 255);
ucg.setColor(1, 255, 0,0);

  ucg.setRotate90();
  ucg.setColor(255, 255, 255); // culoare alba
  ucg.drawFrame(0,0,320,240); //   
  ucg.setFont(ucg_font_courB24); // 20 pixel height
  ucg.setColor(255, 0, 0); // culoare rosie
  ucg.setPrintPos(60,30);
  ucg.print("Ministatie");
  ucg.setColor(0, 255, 0); // culoare verde
  ucg.setColor(0, 255, 0);
  ucg.setColor(0, 0, 255); // culoare albastru
  ucg.setPrintPos(17, 60);
  ucg.print("meteo cu DHT11");
  ucg.setPrintPos(55, 90);
  ucg.setColor(5, 255, 0); // culoare verde
  ucg.print("si BMP180");
  ucg.setFont(ucg_font_fur17r); // 17 pixel height
  ucg.setColor(255, 255, 0); // culoare galbena
  ucg.setPrintPos(25,120);
  ucg.print("ecran grafic 2,2'' (5,6cm)");
  ucg.setFont(ucg_font_courB24); // 20 pixel height 
  ucg.setColor(0, 255, 255); // culoare bleo
  ucg.setPrintPos(10,150);
  ucg.print("QVGA cu ILI9341");
  ucg.setColor(255, 0, 255); // culoare mov
  ucg.setPrintPos(20,180);
  ucg.print("versiune 4.4.0");
  ucg.setFont(ucg_font_fur17r); // 17 pixel height
  ucg.setColor(255, 255, 255); // culoare alb
  ucg.setPrintPos(60,210);
  ucg.print("realizat de niq_ro");

delay(5000);
ucg.clearScreen();
t13=40.0;
h12=40.0;
p2 = 900;
}

void loop() {
 // BMP180 part 
 int p1 = bmp.readPressure()/101.325;
 p1 = p1 * 0.760;
     
 // DHT11 part
 int chk = DHT.read11(37);
 delay(1000);
// timeout;
 int h11 = DHT.humidity; 
 if (DHT.humidity < 0) h11 = 0;

// BMP180 part 2
t12 = bmp.readTemperature();
int t15 = t12;
float t16 = 10*t15;
t16 = t16/10;

t16 = t12;
if (t16 != t13) 
{
temperaturi(t16, t13, 20, 0); // temperature, old temperature, x,y
termometre(t16, 20);
}

if (h11 != h12) 
{
// umiditate(h11, h12, 115, 90); // humidity, old humidity, x, y
 umiditate(h11, h12, 40, 180); // humidity, old humidity, x, y
 barca (h11, h12);
}


if (p1 != p2) 
{
 presiune(p1, p2, 100, 60); // pressure, old pressure, x, y
// barca (h11, h12);
}



//}
delay (2000); 
t13=t16;
h12=h11;
p2=p1;
} // final de program, se revine de la inceput

void temperaturi(float t3, float t4, int ics, int igrec)
{
int t5 = t3;
int t6 = t4;
ucg.setFont(ucg_font_courB24);    
if (t3*t4 < 0)
{ucg.setColor(0, 0, 0); 
for (int qy = 39 ; qy < 60; qy++) 
{
 ucg.drawHLine(ics+7, qy + igrec , 105);
}
}
int t51 = t5/10;
int t61 = t6/10;
ucg.setColor(0, 0, 0); 
if (t51 != t61)
{
for (int qy = 39 ; qy < 60; qy++) 
{
ucg.drawHLine(ics+28, qy + igrec , 21);
}
}
t5 = t3 - t51*10;
t6 = t4 - t61*10;
if (t5 != t6)
{
for (int qy = 39 ; qy < 60; qy++) 
{
ucg.drawHLine(ics+49, qy + igrec , 21);
}
} 
for (int qy = 39 ; qy < 60; qy++) 
{
 ucg.drawHLine(ics+91, qy + igrec , 21);
}
ucg.setColor(255, 0, 0);  
ucg.setPrintPos(10 + ics, 30 + igrec);
//ucg.print("t  :"); 
ucg.print("temperatura:"); 
ucg.setPrintPos(10 + ics, 60 + igrec);
if (t3 > 10.0) ucg.print("+");
else
 if (t3>0.0) ucg.print(" +");
else
 if (t3<0.0)
{
 t3=-t3;
 if (t3 > 10.0) ucg.print("-");
else
 if (t3 > 0.0) ucg.print(" -");
}  
if (t3==0.0) ucg.print("  ");
ucg.print(t3,1); 
ucg.print(" C"); 
ucg.setFont(ucg_font_fur17r); 
ucg.setPrintPos(30 + ics, 35 + igrec);
//if (igrec == 0) ucg.print("int"); 
//else ucg.print("ext"); 
ucg.setPrintPos(115 + ics, 50 + igrec);
ucg.print("o"); 

ucg.setPrintPos(75 + ics, 60 + igrec);
ucg.print(",");


}

void termometre (float t, int ics1)
{
ucg.setColor(255, 255, 255);  
ucg.drawFrame(ics1-4,10,9,200); 
ucg.drawCircle(ics1,220,10,UCG_DRAW_ALL);  
for (int a = 0; a < 10; a++)
{
ucg.drawLine(ics1-5,20+20*a,ics1-7,20+20*a);
ucg.drawLine(ics1+5,20+20*a,ics1+7,20+20*a);
}
ucg.drawLine(ics1-10,140,ics1+10,140);  
ucg.setFont(ucg_font_courB24);    
ucg.setPrintPos(13 + ics1, 149);
ucg.print("0 C"); 
ucg.setFont(ucg_font_fur17r); 
ucg.setPrintPos(37 + ics1, 135);
ucg.print("o"); 
int lin = 140 - 2*t;
ucg.setColor(0, 0, 0);  // black 
ucg.drawBox(ics1-2,21, 5, lin+5);
ucg.setColor(255, 0, 0);  
ucg.drawDisc(ics1,220,8,UCG_DRAW_ALL);  
ucg.drawBox(ics1-2,lin, 5, 210-lin);
}

void umiditate(int h3, int h4, int zet, int igrec1)
{
  ucg.setFont(ucg_font_courB24); // 20 pixel height   

// sterg semnul ??
int h51 = h3/10;
int h61 = h4/10;

ucg.setColor(0, 0, 0); 

// sterg zeci daca e cazul
if (h51 != h61)
{
//ucg.setColor(255, 255, 0); 
ucg.setColor(0, 0, 0); 
for (int qy = 39 ; qy < 60; qy++) 
{
//  ucg.drawHLine(zet+28, qy + igrec1 , 21);
  ucg.drawHLine(zet+40, qy + igrec1, 42);
}
}
  int h5 = h3 - h51*10;
  int h6 = h4 - h61*10;

// sterg unitati daca e cazul
//if ((t5 != t6) || (t5-t6>0.2))
if (h5 != h6)
{
//ucg.setColor(0, 255, 0); 
ucg.setColor(0, 0, 0); 
for (int qy = 39 ; qy < 60; qy++) 
{
  ucg.drawHLine(zet+79, qy + igrec1 , 21);
}
} 

 ucg.setColor(0, 255, 255);  
 ucg.setPrintPos(zet, 30 + igrec1);
 ucg.print("umiditate:"); 


//ucg.setFont(ucg_font_fub42n); // 20 pixel height   
ucg.setPrintPos(40 + zet, 60 + igrec1);
//if (h3 > 10) ucg.print("+");
if (h3 > 10) ucg.print(" ");
else
{
//ucg.setColor(255, 255, 255); 
ucg.setColor(0, 0, 0); 
for (int qy = 39 ; qy < 60; qy++) 
{
  ucg.drawHLine(zet+40, qy + igrec1 , 42);
}
if (igrec1 <30) ucg.setColor(255, 255, 0);  
else ucg.setColor(0, 255, 255); 
ucg.setPrintPos(61 + zet, 60 + igrec1);
//ucg.print("+");
ucg.print(" ");
}
 ucg.print(h3); 
 ucg.print("%"); 
}


void barca (int h, int h2) // new humidity, old humidity.,
{
int xx = 280; 
int yy = 230;

//sterg barca
//ucg.setColor(100,100,100);  
ucg.setColor(0,0,0);  
ucg.drawBox(xx-25, yy-20-h2, 50, 30);


//sterg apa
//ucg.setColor(125, 125, 125);  
ucg.setColor(0, 0, 0);  
ucg.drawBox(xx-35, yy+10-h2, 70, h2-h);

//desenez apa
ucg.setColor(0, 255, 255);  
ucg.drawBox(xx-35, yy+10-h, 70, h);

//desenz barcuta;
//desenez carena
ucg.setColor(255, 255, 0);  
ucg.drawBox(xx-20, yy-h, 40, 10);
ucg.drawTriangle(xx-25, yy-h, xx-20, yy-h, xx-20, yy+10-h);
ucg.drawTriangle(xx+25, yy-h, xx+20, yy-h, xx+20, yy+10-h);
//desenez catarg
ucg.drawBox(xx-1, yy-20-h, 2, 20);
//desenez velele
ucg.setColor(0, 0, 255); // vela albastra  
ucg.drawTriangle(xx+2, yy-20-h, xx+2, yy-h, xx+20, yy-h);
ucg.setColor(255, 0, 0); // vela rosie  
ucg.drawTriangle(xx-2, yy-15-h, xx-2, yy-h, xx-20, yy-h);
}

void presiune (int p3, int p4, int zeti, int igreci)
{
  ucg.setFont(ucg_font_courB24); // 20 pixel height   

// sterg semnul ??
int p51 = p3/10;
int p61 = p4/10;

//ucg.setColor(0, 0, 0); 
ucg.setColor(100, 0, 0); 

// sterg zeci daca e cazul
if (p51 != p61)
{
//ucg.setColor(255, 255, 255); 
ucg.setColor(0, 0, 0); 
for (int qy3 = 39 ; qy3 < 60; qy3++) 
{
//  ucg.drawHLine(zet+28, qy + igrec1 , 21);
//  ucg.drawHLine(zeti+40, qy3 + igreci, 42);
  ucg.drawHLine(zeti+61, qy3 + igreci, 42);
}
}
  int p5 = p3 - p51*10;
  int p6 = p4 - p61*10;

// sterg unitati daca e cazul
//if ((t5 != t6) || (t5-t6>0.2))
if (p5 != p6)
{
//ucg.setColor(0, 255, 0); 
ucg.setColor(0, 0, 0); 
for (int qy4 = 39 ; qy4 < 60; qy4++) 
{
//  ucg.drawHLine(zeti+79, qy4 + igreci , 21);
  ucg.drawHLine(zeti+100, qy4 + igreci , 21);
}
} 

 ucg.setColor(255, 255, 0);  
 ucg.setPrintPos(zeti, 30 + igreci);
 ucg.print("presiune:"); 


//ucg.setFont(ucg_font_fub42n); // 20 pixel height   
ucg.setPrintPos(40 + zeti, 60 + igreci);
//if (h3 > 10) ucg.print("+");
if (p3 > 10) ucg.print(" ");
else
{
//ucg.setColor(255, 255, 255); 
ucg.setColor(0, 0, 0); 
for (int qy5 = 39 ; qy5 < 60; qy5++) 
{
//  ucg.drawHLine(zeti+40, qy5 + igreci , 42);
  ucg.drawHLine(zeti+61, qy5 + igreci , 42);
}
ucg.setColor(255, 255, 0); 
ucg.setPrintPos(61 + zeti, 60 + igreci);
//ucg.print("+");
ucg.print(" ");
}
 ucg.print(p3); 
 ucg.print("mm Hg"); 
}
   I made few movies in time of tests, and 2 are in (my) english:
weather station with Arduino Due on ILI9341 2.2" TFT display
weather station with Arduino Due on ILI9341 2.2" TFT display (2)
  All information on display are in roumanian language, by is easy to change "temperatura" in "temperature", "umiditate" in "humidity" and "presiune" in "pressure".


   Bibliography:
1)Afisaj grafic color QVGA de 2,2" cu integrat ILI9341 conectat la Arduino
2)Afisaj grafic color QVGA de 2,2" cu integrat ILI9341 conectat la Arduino (2)
3)Afisaj grafic color QVGA de 2,2" cu integrat ILI9341 conectat la Arduino (3)
4)Afisaj grafic color QVGA de 2,2" cu integrat ILI9341 conectat la Arduino (4)
5)Arduino Due si afisajul QVGA de 2,2" (5,6cm) comandat de ILI9341
6)How to Connect a ILI9341 Display
7)http://arduino.cc/ (whole site, includind forum