I’ve just finished putting together my Arduino-based weather station on breadboard.

I’ve removed the Arduino Mega 2560r3 and put the ATmega328P-PU on the breadboard with some capacitors, a 16MHz crystal, some LED’s, an LM7805 voltage regulator (takes 9V from battery down to 5V) and of course the Nokia 5110 LCD, BMP085 barometric pressure sensor and DHT11 temperature sensor.

I thought the temperature values were a bit off, but both the DHT and BMP give similar readings, so I guess my house thermostat is a couple of degrees out.

I found that when programming the 328 with the CP2102 USB UART, it absolutely needed a 100nF capacitor on the DTR line, otherwise the upload would fail.

I initially used the Arduino IDE to upload the code, but then switched to arduino-mk with the following Makefile (commented out the 2560 settings):

ARDUINO_DIR        = /usr/share/arduino
ARDMK_DIR          = /usr
AVR_TOOLS_DIR      = /usr
#BOARD_TAG          = mega2560
#ARDUINO_PORT       = /dev/ttyACM0
BOARD_TAG          = uno
ARDUINO_PORT       = /dev/ttyUSB0
ARDUINO_SKETCHBOOK = /home/user/arduino
ARDUINO_LIBS       = Adafruit_GFX Adafruit_PCD8544 Adafruit_BMP085 Wire Wire/utility DHT

include /usr/share/arduino/Arduino.mk

The Arduino C++ code was pretty straightforward, the “driver” work was done using the Adafruit libraries with my fixes to the PCD8544 and GFX libraries.

#include <Wire.h>
#include <DHT.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
#include <Adafruit_BMP085.h>

// dht11
#define DHTPIN 8
#define DHTTYPE DHT11
int odd = 1;

// clk (lcd=5, ard=6), din (4/5), dc (3/4), ce (2/3), rst (1/2), led (7/9)
Adafruit_PCD8544 display = Adafruit_PCD8544(6, 5, 4, 3, 2, 9);
Adafruit_BMP085 bmp;
DHT dht(DHTPIN, DHTTYPE);

void setup() {
    // init nokia5110
    display.begin();
    display.clearDisplay();

    // contrast - try also 0xBF, 0xB8
    display.setContrast(50);

    // text properties
    display.setTextSize(1);
    display.setTextColor(BLACK);
    display.setCursor(0,0);

    // loop bmp085
    if (!bmp.begin()) {
        while (1) {}
    }

    // loop dht11
    dht.begin();
}

void loop() {
    // print 2x temp and humidity on odd page
    if (odd) {
        // reading temperature or humidity takes about 250ms
        float h = dht.readHumidity();
        float t = dht.readTemperature();

        // check if returns are valid
        if (!isnan(t) && !isnan(h)) {
            display.print("Humidity:  "); 
            display.print(int(h));
            display.println("%");
            
            display.print("Temp11: "); 
            display.print(t);
            display.println("C");
        }

        // temperature in degrees centigrade
        display.print("Temp85: ");
        display.print(bmp.readTemperature());
        display.println("C");

        // switch page for next loop
        odd = 0;
    } else {
        // barometric pressure in pascal converted to psi
        display.print("Pres: ");
        display.print(bmp.readPressure()/6894.757293168);
        display.println("psi");
        
        // altitude based on 1 atmosphere = 101325 Pa
        display.print("Alt1: ");
        display.print(bmp.readAltitude());
        display.println("m");
        display.println();

        // accurate based on 1004.7 millibars = 100470 Pascals
        display.print("Alt2: ");
        display.print(bmp.readAltitude(100470));
        display.println("m");

        // switch page for next loop
        odd = 1;
    }

    // clear screen and restart
    display.display();
    delay(5000);
    display.clearDisplay();
    delay(1000);
}

Video, CP2102 details, standalone Uno details.