Tag Archives: ESP8266 project


ESP8266 weather forecaster with a beautiful enclosure (3D printed)

Artistic weather forecaster using ESP8266

Nick Koumaris from educ8s.tv has posted a new project of building a ESP8266-based weather forecast display using Wemos D1 mini board and a 1.8” Color TFT screen. Nick also shares the design files for his artistic 3d printed enclosure for this project. The ESP8266 on board Wemos D1 mini connects to the internet to retrieve the weather forecast for a particular location and displays it on the TFT screen.

Artistic weather forecaster using ESP8266

Artistic weather forecaster using ESP8266

Making a simple weather web server using ESP8266 and BME280

Weather web server using ESP8266 and BME280 environmental sensor

Since its launch in 2014, ESP8266 has revolutionized the IoT space by offering an extremely cost-effective and programmable WiFi-enabled microcontroller to hobbyists and professionals, thereby opening the doors to all kinds of everyday objects and sensors to the internet. In addition, with it’s built-in WiFi capability, the ESP8266 can also serve as a standalone web server on a local network, and can respond to the http GET commands received from an internet browser. This project illustrates how to construct a simple standalone weather web server utilizing NodeMCU development board for ESP8266 and Bosch’s BME280 environmental sensor chip. On receiving the web requests, the ESP8266 responds back by returning back an HTML webpage containing the ambient temperature, humidity and pressure measurements. With the help of refresh meta tags, the webpage automatically reloads every 15 seconds to get the latest environmental sensor data.

Weather web server using ESP8266 and BME280 environmental sensor

Weather web server using ESP8266 and BME280 environmental sensor

Hardware

This project requires minimal hardware components. You will need an ESP8266 development board, like NodeMCU that I am using here, a BME280 sensor module, a breadboard with some jumper wires, and a USB cable for programming the NodeMCU board.

BME280 is a fully integrated environmental unit from Bosch that combines sensors for pressure, humidity, and temperature in a tiny 8-pin metal-lid LGA package of size 2.5 x 2.5 x 0.93 mm³. Because of its compact size, ease of use (BME280 supports standard I2C and SPI interfaces), and availability of supporting open-source Arduino libraries, BME280 is very popular among weather enthusiasts. In this project, the I2C data (SDA) and clock (SCL) pins of the BME sensor module are connected to the NodeMCU pins D3 and D4, respectively.

setupserver

Weather web server setup on breadboard

Weather web server hardware setup on breadboard

Software

The ESP8266 firmware for this project is developed using Arduino IDE. You need to install the ESP8266 core to enable the Arduino IDE for ESP8266 programming. Instructions can be found in the ESP8266 core github page or here too. You will also need the following Adafruit libraries for reading data from the BME280 sensor.

Adafruit unified sensor library

Adafruit BME280 library

The I2C address for BME280 is hardcoded in the Adafruit_BME280.h file (look for the line #define BME280_ADDRESS  0x77) inside the Adafruit_BME280_Library folder. Adafruit’s BME sensor modules are hard-wired to use the I2C address of 0x77. But the BME280 can have a slightly different I2C address (0x76) if its external SDO pin is grounded. If you are using the sensor modules from other party, it is likely that it’s address would not match with the default value in the Adafruit library. For example, for most of the BME280 sensor modules available on eBay or Aliexpress, I have found their I2C address to be 0x76. So, if you didn’t get any response from the sensor using the default address set in the Adafruit_BME280.h file, you might need to change that to 0x76.

My complete code for this weather webserver project can be downloaded from the following link:

Download BME280_webserver_code

The code for a very basic HTML webpage with sensor output and auto refresh meta tag is included in the above ESP8266 firmware. Note that you need to edit the SSID name and password in the program to match with your WiFi network before uploading it to the NodeMCU board.

Output

After uploading the program to NodeMCU, when the ESP8266 restarts it prints out on the serial monitor the IP address it’s allocated in the local network. In order to access the ESP8266 web server, you need to open a web browser on any computer, tablet, or smartphone connected to the same WiFi network and type in the ESP8266 IP address in the URL field and hit enter. On receiving a client request, the ESP8266 serves a webpage containing the BME sensor readings, as shown below.

Standalone weather web server using ESP8266 and BME280

Standalone weather web server using ESP8266 and BME280

The HTML page is refreshed automatically every 15 second to get the latest sensor readings. The Dew Point is computed from temperature and humidity using the following approximation:

Source: Wikipedia

Source: Wikipedia

Weather web server broadcasting BME sensor readings

Weather web server broadcasting BME sensor readings

This is a very nice and handy way of monitoring the weather around us, as it allows to watch the environmental parameters on our tablets and smartphones that we are carrying all the time.

Smartphone

Weather data on smartphone

Acknowledgement

Thanks to Rui Santos from Random Nerd Tutorials for sharing his DS1820-based temperature web server code. I modified his code to incorporate the BME280 sensor readings, and also added auto-refresh Meta tag to reload the HTML page automatically in every 15 sec.

Wifi controlled FPV rover

DIY FPV rover

First Person View (FPV), also known as video piloting, provides a more exciting driver’s viewpoint for controlling a RC rover by mounting a video camera. This FPV two-wheeled robotic rover is controlled over a WiFi network via any internet browser using an HTML-based control interface. It features an Arduino Uno board that controls the movement of the rover by driving two stepper motors. Arduino gets the WiFi capability with the help of an ESP-01 module (ESP8266 board). The communication between the Arduino and ESP8266 is through a serial interface. An Android smartphone is mounted at the front of the rover for live audio/video broadcasting to the operator’s control interface.

DIY FPV rover

DIY FPV rover

When the Arduino is restarted, it will try to connect your wi-fi network automatically. Use the Serial Monitor to check if the connection was successfull, and to obtain which IP was assigned to your ESP-8266 by your router. Open the html file in an internet browser (Firefox) and inform this IP address in the textbox.

You might also user other means to find out which IP address you router assigned to your device.

Disconnect the the Arduino Uno from your computer and connect it to the power bank. Wait for it to connect again.

Launch IP Webcam app in the smartphone attached to the robot. Type the video/audio IP on your control interface and connect to the server and you’ll be ready to go. You might need to reduce the resolution of the video in the app to reduce the delay between during the transmission.

NTP synchronized analog wall clock

Hacking a IKEA analog wall clock to make it NTP-enabled

Analog wall clocks are an old invention. Besides telling time they also serve as a wall decoration. Most of the modern days inexpensive wall clocks are not good at keeping the time accurately. Also, they usually don’t have auto-adjustment for daylight saving time. Victor-chew shares his attempt to tether a cheap IKEA analog wall clock to the ESP8266 WiFi microcontroller and make it sync with a NTP server for accurate timekeeping as well as auto adjustment to daylight savings.

Hacking a IKEA analog wall clock to make it NTP-enabled

Hacking a IKEA analog wall clock to make it NTP-enabled

In this project, I connected a cheap $2 Ikea analog clock to the ESP-12/NodeMCU dev module and synchronized the clock time with NTP time (localized with Google Maps Timezone API). On startup, simply connect to the device configuration AP and configure your Wi-Fi login credentials and physical clock time. The config web page will capture your current location automatically using HTML5 Geolocation and use that to automatically figure the local time and DST offset via the Google Maps Timezone API.

The clock will sync within a few seconds of NTP time, take care of DST automatically and only cost a few dollars more due to the low cost of ESP12/ESP8266. The only problem that remains is the practical need to run this clock from the mains. Even when connected to a 10,000mha battery pack, it will only last for about 6 to 7 days.

For seven-segment LED based NTP clock, click here.

Another weather station using modular design approach

Modular weather station

Nevyn’s entry to the 2016 Hackaday Prize contest is a modular weather station built using a number of sensors mounted on a general purpose circuit board. The sensor readings are captured by ESP8266 and sent out to the internet.

Modular weather station

Modular weather station

The initial project supports the following measurements:
– Air temperature
– Air pressure
– Humidity
– Ground temperature
– Light intensity (luminosity)
– Ultraviolet light intensity
– Wind speed
– Wind direction
– Rain fall

The weather station will be designed to work off-grid with limited capacity to store data for upload at a later date should an Internet connection fail temporarily.

 

« Older Entries