loading

Hello, everyone ! Time ago I saw this Weather Station by Aleator777 and I got inspired to make my own weather station. I saw that the Intel Edison is too expensive in my country, so I decided to find something cheaper, and I found that the Adafruit HUZZAH is a lot cheaper. So I ordered one.

When the breakout arrived I started my IoT Weather Station, and now I will show you how to make one like mine and how to stream the data from it to Adafruit IO.

The weather station currently have a DHT11, for measuring air humidity, a TMP102, for measuring air temperature a BMP180, for measuring the pressure and a prototyping PCB to build it. I know I am using too much sensors but that is because I had them, and if you ask I should use DHT22 and BMP180 or just one BME280 which reads - temperature, humidity, pressure and altitude.

It measures the temperature in Celsius(it could be changed to Fahrenheit), the pressure in PSI - Pounds per square Inch and humidity in percentage. The weather station has deep sleep mode that can be controlled, by default is set on 5 minutes.

You can see the readings from my weather station here, they are for my home town - Polski Trambesh. - OFFLINE

Step 1: Info about Adafruit HUZZAH ESP8266 (ESP-12E)

The ESP8266 processor from Espressif is an 80 MHz microcontroller with a full WiFi front-end (both as client and access point) and TCP/IP stack with DNS support as well.

Technical details:

  • Reset button,
  • User button that can also put the chip into bootloading mode,
  • Red LED you can blink,Level shifting on the UART and reset pin,
  • 3.3V out,
  • 500mA regulator (you'll want to assume the ESP8266 can draw up to 250mA so budget accordingly)
  • Two diode-protected power inputs (one for a USB cable, another for a battery)
  • Two parallel, breadboard-friendly breakouts on either side give you access to:
  • 1 x Analog input (1.8V max)
  • 9 x GPIO (3.3V logic), which can also be used for I2C or SPI2 x UART pins
  • 2 x 3-12V power inputs,
  • reset,
  • enable,
  • LDO-disable,
  • 3.3V output


Features:

  • 802.11 b/g/n
  • Integrated low power 32-bit MCU
  • Integrated 10-bit ADC
  • Integrated TCP/IP protocol stack
  • Integrated TR switch, balun, LNA, power amplifier and matching network
  • Integrated PLL, regulators, and power management units
  • Supports antenna diversity
  • WiFi 2.4 GHz, support WPA/WPA2
  • Support STA/AP/STA+AP operation modes
  • Support Smart Link Function for both Android and iOS devices
  • SDIO 2.0, (H) SPI, UART, I2C, I2S, IR Remote Control, PWM, GPIO
  • Deep sleep power <10uA, Power down leakage current < 5uA
  • Wake up and transmit packets in < 2ms
  • Standby power consumption of < 1.0mW (DTIM3)
  • +20 dBm output power in 802.11b mode
  • Operating temperature range -40C ~ 125C
  • FCC, CE, TELEC, WiFi Alliance, and SRRC certified
<p>fatal error: ESP8266WiFi.h: No such file or directory</p>
<p>fatal error: ESP8266WiFi.h: No such file or directory</p>
<p>For deep sleep to work properly:</p><p>&quot;Everything behaves as expected, however, when i put my HUZZAH board into deep sleep (yes GPIO16 has to be connected to RST for this to work).&quot;</p><p>I couldn't find this in the instruction, can you give me some feedback for this?</p>
<p>how often do you read sensors and how does the battery you choose last, with your setup, before recharging?</p>
<p>I read the sensors on every 5 minutes and I dont know how long it will take for the battery to discharge. I will tell you when this happens.</p>
<p>thanks</p>
<p>The battery lasted for 3 days and 11 hours. </p><p>3.7V 2900mah</p>
<p>not so great, in the end... maybe updating online data a less often, or disabling wifi if not needed, or some low power optimization, will enhance the time...</p>
<p>Actually the ESP8266 module enters Deep sleep mode which turns of the wi-fi and consumes 10 uA, but the TMP102 keeps working. The power consumption would drop if I use only one sensor, BME280 for example.</p><p>I read that the module can work for over 2 months with 2 regular AA batteries by sending data once on every 15 minutes, in the ESP8266 forum.</p><p>Also I am not sure how much of the battery was charged, cause I removed the protection board (It was damaged) and I am afraid of overcharging it.</p>
<p>I am not able to open the Ino-file in my Arduino IDE ? i only get an unformattet textfile. Can anybody help me ?</p>
<p>That is strange, can you give me more details ?</p>
I can show you how i look vhen i try to open the file:<br>/********************************************************** Adafruit Huzzah IoT weather station with: DHT11 - For humidity BMP180 - For pressure TMP102 - For temperature I2C - pins - 5(SDA) and 4(SCL) DHT pin - 2 by KonstatinDimitrov ***********************************************************/ /*******************LIBRARIES**************************/ // Libraries #include #include #include #include #include #include /********************SENSORS***************************/ //TMP102 sensor address int tmp102Address = 0x48; //Pressure sensor SFE_BMP180 pressure1; char status; double T,P,p0,a; #define ALTITUDE 44.80 //DHT11 sensor #define DHTPIN 2 #define DHTTYPE DHT11 DHT dht(DHTPIN, DHTTYPE, 15); /********************SLEEP MODE**********************/ const int sleepTimeS = 300; // Sleep mode time in seconds /* 60s - 1min, 120s- 2min, 180s - 3min 300s - 5min */ /****************************************************/ // WI-FI PARAMETERS #define WLAN_SSID &quot;NAME&quot; //WLAN NAME #define WLAN_PASS &quot;PASSWORD&quot; //WLAN PASSWORD // Adafruit IO #define AIO_SERVER &quot;io.adafruit.com&quot; #define AIO_SERVERPORT 1883 #define AIO_USERNAME &quot;USERNAME&quot; //Your Adafruit IO user name #define AIO_KEY &quot;YOU KEY HERE&quot; //Your IO key // Functions void connect(); // Create an ESP8266 WiFiClient class to connect to the MQTT server. WiFiClient client; // Store the MQTT server, client ID, username, and password in flash memory. const char MQTT_SERVER[] PROGMEM = AIO_SERVER; // Set a unique MQTT client ID using the AIO key + the date and time the sketch // was compiled (so this should be unique across multiple devices for a user, // alternatively you can manually set this to a GUID or other random value). const char MQTT_CLIENTID[] PROGMEM = AIO_KEY __DATE__ __TIME__; const char MQTT_USERNAME[] PROGMEM = AIO_USERNAME; const char MQTT_PASSWORD[] PROGMEM = AIO_KEY; // Setup the MQTT client class by passing in the WiFi client and MQTT server and login details. Adafruit_MQTT_Client mqtt(&amp;client, MQTT_SERVER, AIO_SERVERPORT, MQTT_CLIENTID, MQTT_USERNAME, MQTT_PASSWORD);/****************************** Feeds ***************************************/ /******************** Setup feeds ***********************/ const char TEMPERATURE_FEED[] PROGMEM = AIO_USERNAME &quot;/feeds/temperature&quot;; Adafruit_MQTT_Publish temperature = Adafruit_MQTT_Publish(&amp;mqtt, TEMPERATURE_FEED); const char PRESSURE_FEED[] PROGMEM = AIO_USERNAME &quot;/feeds/pressure&quot;; Adafruit_MQTT_Publish pressure = Adafruit_MQTT_Publish(&amp;mqtt, PRESSURE_FEED); const char HUMIDITY_FEED[] PROGMEM = AIO_USERNAME &quot;/feeds/humidity&quot;; Adafruit_MQTT_Publish humidity = Adafruit_MQTT_Publish(&amp;mqtt, HUMIDITY_FEED); /***************************Sketch Code******************/ void setup() { // Wire.begin (5, 4); // setting up the SDA(5) and SCL(4) pins dht.begin(); //reads data from DHT sensor pressure1.begin(); //reads data from BMP180 Serial.begin(115200); Serial.println(F(&quot;IoT weather station&quot;)); // Connect to WiFi access point. Serial.println(); Serial.println(); delay(10); Serial.print(F(&quot;Connecting to &quot;)); Serial.println(WLAN_SSID); WiFi.begin(WLAN_SSID, WLAN_PASS); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print(F(&quot;.&quot;)); } Serial.println(); Serial.println(F(&quot;WiFi connected&quot;)); Serial.println(F(&quot;IP address: &quot;)); Serial.println(WiFi.localIP()); // connect to adafruit io connect(); } /***********************TMP102 BLOCK********************/ float getTemperature() { Wire.requestFrom(tmp102Address,2); byte MSB = Wire.read(); byte LSB = Wire.read(); //it's a 12bit int, using two's compliment for negative int TemperatureSum = ((MSB &lt;&lt; 8) | LSB) &gt;&gt; 4; float TempC = TemperatureSum*0.0625; if (TempC &gt; 128) { TempC = TempC - 256; // for negative temperatures } else TempC; return TempC; } /*******************************************************/ void loop() { if(! mqtt.ping(3)) { // reconnect to adafruit io if(! mqtt.connected()) connect(); } /***********************TMP102*******************/ float TempC = getTemperature(); if (! temperature.publish(TempC)) Serial.println(F(&quot;Failed to publish temperature&quot;)); else Serial.println(F(&quot;Temperature published!&quot;)); delay(500); /**********************Pressure******************/ status = pressure1.startPressure(3); status = pressure1.getPressure(P,T); if (! pressure.publish(P*0.01450377)) Serial.println(F(&quot;Failed to publish pressure&quot;)); else Serial.println(F(&quot;Pressure published!&quot;)); delay(500); /******************DHT Humidity*******************/ int humidity_data = (int)dht.readHumidity(); if (! humidity.publish(humidity_data)) Serial.println(F(&quot;Failed to publish humidity&quot;)); else Serial.println(F(&quot;Humidity published!&quot;)); delay(500); /*******************SLEP MODE***********************/ Serial.println(F(&quot;ENTERING SLEEP MODE!&quot;)); ESP.deepSleep(sleepTimeS * 1000000); //Sleep mode, for power save } /**************************************************/ void connect() { Serial.print(F(&quot;Connecting to Adafruit IO... &quot;)); int8_t ret; while ((ret = mqtt.connect()) != 0) { switch (ret) { case 1: Serial.println(F(&quot;Wrong protocol&quot;)); break; case 2: Serial.println(F(&quot;ID rejected&quot;)); break; case 3: Serial.println(F(&quot;Server unavail&quot;)); break; case 4: Serial.println(F(&quot;Bad user/pass&quot;)); break; case 5: Serial.println(F(&quot;Not authed&quot;)); break; case 6: Serial.println(F(&quot;Failed to subscribe&quot;)); break; default: Serial.println(F(&quot;Connection failed&quot;)); break; } if(ret &gt;= 0) mqtt.disconnect(); Serial.println(F(&quot;Retrying connection...&quot;)); delay(5000); } Serial.println(F(&quot;Adafruit IO Connected!&quot;)); } /*************** END OF FILE ******************/
<p>Could it be that you have the file-association for the .ino extension to a text-editor?</p><p>Plse try the following:</p><p>Find the .ino file in your microsoft explorer.</p><p>Right-mouseclick on the file and choose &quot;open with&quot;</p><p>Now select the Arduino IDE to be the standard exe to open when a .ino file is selected.</p><p>This should do the trick assuming my impression is correct.</p><p>Happy Arduining!</p>
<p>That the code, I see no problem in it.</p>
<p>Nice 'ible. I've added it to my favorites.</p><p>Any plans on getting the data over to wunderground?</p>
<p>Thanks ! </p><p>I dont know how to thank you about Wunderground, definitely I will get the data there.</p><p>Thank again !</p>
<p>I haven't gotten my weather station built yet. But it will be on wunderground when it is. That's where I go for all my weather needs.</p><p>If you click on the name of the weather station, a lot of the people will put descriptions of their setup. Helps when designing your own station.</p>
<p>Thats nice !</p>

About This Instructable