One More Arduino Weather Station (ESP-01 & BMP280 & DHT11 & OneWire)

Introduction: One More Arduino Weather Station (ESP-01 & BMP280 & DHT11 & OneWire)

About: Its something

Here you can find one iteration of using OneWire with the very few pins of an ESP-01.
The device created in this instructable connects to the Wifi network of your choice
(you must have the credentials...)
Collects sensory data from a BMP280 and a DHT11, and sends the collected data to the ThingSpeak channel provided.
I am assuming that you know how to upload a sketch to your ESP-01, so i am not going into those details.
Without a voltage regulator, the circuit has to be powered with max 3.3V DC.
Not much text is added, tutorial should be straightforward from this point.

Step 1: Step 1: BOM


1 x Wifi module: ESP-01 (i am using the 1024 KB version)

1 x Pressure and Temperature sensor: BMP280

1 x Humidity and Temperature sensor: DHT11

1 x Voltage Regulator AMS1117 (optional for direct powering, or you can use any other capable of regulating your input voltage down to a fixed 3.3V)

Step 2: Step 2: Wiring

ESP-01 VCC to 3.3V
ESP-01 GPIO0 to BMP280 SDA
ESP-01 GPIO2 to BMP280 SCL
DHT11 VCC to 3.3V
BMP280 VCC to 3.3V

Step 3: Step 3: Code

#include <DHT.h>
#include <OneWire.h> #include <Adafruit_BMP280.h> //CHECK #define BMP280_ADDRESS mine works with (0x76) #include <ESP8266WiFi.h> #define DHTPIN 1 //GPIO1 (Tx) #define DHTTYPE DHT11 #define ONE_WIRE_BUS 3 // GPIO3=Rx const char* ssid = "asd"; //YOUR WIFI SSID const char* password = "asd"; //YOUR WIFIPASS const char* host = ""; const char* writeAPIKey = "asd"; //YOUR APIKEY //DHT11 stuff float temperature_buiten; float temperature_buiten2; DHT dht(DHTPIN, DHTTYPE, 15); //BMP280 Adafruit_BMP280 bmp; void setup() { //I2C stuff Wire.pins(0, 2); Wire.begin(0, 2); //DHT1 dht.begin(); //BMP280 if (!bmp.begin()) { // Serial.println("No BMP280"); // while (1) {} } //Connect to WiFi network WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } } void loop() { //DHT11 float humidity = dht.readHumidity(); float temperature = dht.readTemperature(); if (isnan(humidity) || isnan(temperature)) { return; } //BMP280 String t = String(bmp.readTemperature()); String p = String(bmp.readPressure()); //TCP CONNECTION WiFiClient client; const int httpPort = 80; if (!client.connect(host, httpPort)) { return; } String url = "/update?key="; url += writeAPIKey; url += "&field1="; url += String(temperature); //DHT11 CELSIUS url += "&field2="; url += String(humidity); //DHT11 RELATIVE HUMIDITY url +="&field3="; url +=String(bmp.readTemperature()); //BMP280 CELSIUS url +="&field4="; url +=String(bmp.readPressure()/100); //BMP280 MILLIBAR url +="&field5="; url +=String(bmp.readAltitude(1013.25)); //BMP280 METER url +="&field6="; url +=String((temperature+bmp.readTemperature())/2); //DHT11 + BMP280 AVERAGE CELSIUS url += "\r\n"; // Send request to the server client.print(String("GET ") + url + " HTTP/1.1\r\n" + "Host: " + host + "\r\n" + "Connection: close\r\n\r\n"); delay(1000); }

Step 4: Step 4: Result



    • Creative Misuse Contest

      Creative Misuse Contest
    • Water Contest

      Water Contest
    • Fix It! Contest

      Fix It! Contest

    4 Discussions

    Nice project! Just curious though, why two separate sensor rather than just a BME280?

    3 replies

    I needed to measure humidity and pressure as well.

    My point was that the BME280 (an upgrade of the BMP280 that you used) does all three, pressure, temperature and humidity, eliminating the need for the DHT11.

    Yes, you are right about that, primarily in my case it was just pure economics, didn't want to buy one more sensor. Secondarily demonstrating/trying OneWire was a goal too. Basically its a simplified howto for OneWire and esp-01. And i know there are some tutorial regarding that topic out there, but i believe that for absolute greenhorns, those are hard to comprehend at first. Just replace my two sensors with any other sensor of you liking, adapt the code, and there you go.