Tag Archives: ESP8266 project


WiFi deauthentication attacker using ESP8266

Deauthentication attacker using ESP8266

The IEEE 802.11 (Wi-Fi) protocol contains a so-called deauthentication frame that are used as management frames to disconnect the links between stations and access points. Because management frames are often unencrypted, it is fairly easy to perform deauthentication attacks using a WiFi device by spoofing the MAC address of the access point. Alternatively, it can also be done by sending deauthentication frames to the access point with a clients’ MAC address as a destination. Spacehuhn has shared his ESP8266 based implementation of a deauthentication attacker on Github. It can disconnect any client from a network by repeatedly sending fake deauthentication frames. The attacker does not even need to be connected to the same network.

Deauthentication attacker using ESP8266

Deauthentication attacker using ESP8266

Basically it’s a device which performs a deauth attack. You select the clients you want to disconnect from their network and start the attack. As long as the attack is running, the selected devices are not able to connect to the network.

PC stat monitor using ESP8266/Arduino

ESP8266 PC stat monitor

There are tons of PC applications you can install on your PC for monitoring essential stats for CPU, disk, memory, system temperature, etc. Here is a standalone hardware project that would receive the PC stat via USB port and display it on a dedicated 2.8″ TFT display. The project uses an ESP8266 hardware and a touchscreen-enabled ILI9341-based color LCD. On the PC side, a Python script gathers PC stats and send the data to the ESP8266 via USB-UART interface. With the built in WiFi capability of ESP8266, the PC stat can also be broadcasted over WiFi to a remote cloud server. The firmware is developed using Arduino IDE, so the standalone LCD version of this project would still be compatible with Arduino boards.

ESP8266 PC stat monitor

ESP8266 PC stat monitor

 

Tutorial 6: ESP8266 and BME280 make a local/remote weather station

dsds

In previous tutorials, we explored how to connect an SSD1306-based I2C OLED to ESP8266 for displaying texts and graphics, as well as to setup an ESP8266-based web server. This tutorial combines the knowledge gained before to make a standalone weather station that will display the local weather data on an OLED screen. In addition, the weather station will also run a web server that would allow a remote computer to access the weather data via web browser.

dsds

BME280 weather station

Hardware Setup

This project uses the EasyESP-1 board and the following hardware devices.

BME280 sensor module: 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. You can buy a BME280 sensor module in Grove form factor from Elecrow.

SSD1306 I2C OLED module: As described in Tutorial 3, the SSD1306 OLED controller supports both SPI and I2C interfaces. We will use an I2C version with a 0.96″ diagonal length and 128×64 monochrome pixels OLED Grove board. Despite its small size, the readability is pretty good due to its high contrast.

For this experiment, the 4-pin Grove connectors of BME280 and OLED modules are directly plugged into the two I2C ports on the EasyESP-1 board, as shown below. This connects the the SDA and SCK pins of BME280 and OLED modules to D2 and D1 pins of EasyESP-1, respectively.

Complete project setup

Complete project setup

BME280 and OLED connect to I2C Grove ports

BME280 and OLED connections to I2C Grove ports

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 here. You will also need the following Adafruit libraries for reading data from the BME280 sensor. The I2C address of BME280 sensor on Elecrow’s sensor board is 0x77, which is also the default address set in the Adafruit’s library.

Adafruit unified sensor library

Adafruit BME280 library

Besides, you also need Daniel Eichhorn‘s OLED library for ESP8266. Read Tutorial 3 for more details on this.

The complete code for this weather station project can be downloaded from the following link:

Download BME280 Weather Station Code

The code for a very basic HTML webpage with the BME280 sensor output and auto refresh meta tag is included in the code. 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 EasyESP-1 board.

Output

After uploading the program to EasyESP-1, when the ESP8266 restarts it prints out on the serial monitor the local IP address that was allocated to it in the WiFi network. The BME280 sensor readings for temperature, pressure and humidity are displayed on the OLED screen. In order to access these data over the 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.

BME280 local weather station

BME280 local weather station

Web

Weather data displayed on client’s browser

Buy EasyESP-1 board

Buy BME280 sensor module 

Buy SSD1306 I2C OLED module

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266
TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS
TUTORIAL 5: SETTING UP AN ESP8266 WEB SERVER

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.

« Older Entries