Giuliano Pisoni
Published © MIT

AAESP - A Micro Weather Station

Monitor pressure, humidity, and temperature over WiFi with an AA battery-sized device.

AdvancedProtip2 hours2,327
AAESP - A Micro Weather Station

Things used in this project

Hardware components

ESP8266 ESP-01
Everything ESP ESP8266 ESP-01
×1
SparkFun Atmospheric Sensor Breakout - BME280
SparkFun Atmospheric Sensor Breakout - BME280
×1
DC DC 0.8-3.3V to 3.3V Step UP Boost Voltage Converter Module
×1
4xAA battery holder
4xAA battery holder
×1

Software apps and online services

Blynk
Blynk

Story

Read more

Code

Simple code for the test

Arduino
#include <Arduino.h>
#include <ESP8266WiFi.h>
ADC_MODE(ADC_VCC); //vcc read-mode
#include <BlynkSimpleEsp8266.h>
#include <Wire.h> // I2C library
#include <stdint.h>
#include "SparkFunBME280.h"
#include "Wire.h"

//Global sensor object
BME280 mySensor;
char auth[] = "KEYFORBLYNK";

void setup() {
  //***Driver settings********************************//
   //For I2C, enable the following and disable the SPI section
  mySensor.settings.commInterface = I2C_MODE;
  mySensor.settings.I2CAddress = 0x76;
//***Operation settings*****************************//
Wire.pins(0, 2); //on ESP-01.

//renMode can be:
  //  0, Sleep mode
  //  1 or 2, Forced mode
  //  3, Normal mode
  mySensor.settings.runMode = 3; //Normal mode 
//tStandby can be:
  //  0, 0.5ms
  //  1, 62.5ms
  //  2, 125ms
  //  3, 250ms
  //  4, 500ms
  //  5, 1000ms
  //  6, 10ms
  //  7, 20ms
  mySensor.settings.tStandby = 0;
  
  //filter can be off or number of FIR coefficients to use:
  //  0, filter off
  //  1, coefficients = 2
  //  2, coefficients = 4
  //  3, coefficients = 8
  //  4, coefficients = 16
  mySensor.settings.filter = 0;
  
  //tempOverSample can be:
  //  0, skipped
  //  1 through 5, oversampling *1, *2, *4, *8, *16 respectively
  mySensor.settings.tempOverSample = 16;

  //pressOverSample can be:
  //  0, skipped
  //  1 through 5, oversampling *1, *2, *4, *8, *16 respectively
    mySensor.settings.pressOverSample = 4;
  
  //humidOverSample can be:
  //  0, skipped
  //  1 through 5, oversampling *1, *2, *4, *8, *16 respectively
  mySensor.settings.humidOverSample = 4;

  Serial.begin(115200);
Serial.println(mySensor.begin(), HEX);   
  delay(300);
Blynk.begin(auth, "SSID", "PASSWORD");

while (Blynk.connect() == false) {
    // Wait until connected
    Serial.print("trying...");
  }  
}


void loop() {
   Serial.println((ESP.getVcc()));
   Serial.println(mySensor.readTempC());
   Serial.println(mySensor.readFloatPressure());
   Serial.println(mySensor.readFloatHumidity());
  Blynk.run();
    Blynk.virtualWrite(0, String(mySensor.readTempC(), 2)); // virtual pin
    Blynk.virtualWrite(1, mySensor.readFloatPressure()); // virtual pin  
    Blynk.virtualWrite(2, mySensor.readFloatHumidity()); // virtual pin 
    Blynk.virtualWrite(3, ESP.getVcc()); // virtual pin  
 delay(1000);
ESP.deepSleep(1 * 60 * 1000000);  
}

Credits

Giuliano Pisoni

Giuliano Pisoni

1 project • 9 followers
Almost System Engineer. Sometimes Coder. Monthly Podcaster. ESP8266 Addicted. Never end Maker

Comments

Add projectSign up / Login