Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
FREEDOM251

Freedom251 › Blog › Arduino

How to Build an ESP32 Temperature Web Server with Historical Charts and Statistics

By Freedom251 Team · · 9 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

An ESP32 can host a browser dashboard that records BME280 temperature, humidity, and pressure readings, stores timestamped rows on a FAT32 microSD card, and turns that history into interactive charts and temperature statistics. The reference design samples every 60 seconds, serves the page on the local network, and keeps the data available after a browser is closed.

This guide explains the hardware, wiring, software pieces, data flow, dashboard behavior, statistical calculations, and the limits you should understand before adapting the build.

As an Amazon Associate I earn from qualifying purchases.

What the ESP32 temperature web server does

The build combines four jobs that are often treated separately:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Measurement: a BME280 reports temperature, relative humidity, and barometric pressure over I2C.
  • Logging: the ESP32 adds a timestamp and appends each reading to a CSV file on a microSD card.
  • Presentation: an ESP32-hosted web page reads the stored history and draws temperature, humidity, and pressure charts.
  • Analysis: the page derives extrema, threshold durations, daily swings, and hourly averages from the loaded records.

The tutorial configuration takes one reading every 60 seconds. That interval belongs to this project; it is not a universal ESP32 or BME280 requirement. A shorter interval creates a denser history and uses more storage, while a longer interval reduces writes and captures fewer short-lived changes.

#1 Best Overall
ESP-WROOM-32 ESP32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi + Bluetooth Dual Cores Microcontroller Processor Integrated with Antenna RF AMP Filter AP STA Compatible with Arduino IDE (3PCS)
  • 2.4GHz Dual Mode WiFi + Bluetooth Development Board
  • Support LWIP protocol, Freertos
  • SupportThree Modes: AP, STA, and AP+STA
  • Ultra-Low power consumption, Compatible with Arduino IDE
  • ESP32 is a safe, reliable, and scalable to a variety of applications

The sample page is intended for a browser connected to the same local network as the ESP32. Entering the board’s IP address opens the dashboard. The demonstration does not automatically provide authenticated or encrypted access from the public internet.

Parts and wiring

Bill of materials

Part Purpose Notes
ESP32 development board Reads the sensor, writes the card, and serves the web page Use the pinout and voltage requirements for the exact board.
BME280 sensor module Measures temperature, humidity, and pressure The breakout must support the electrical levels supplied by your board.
microSD card module Provides removable storage for CSV history Check its logic-level and power requirements.
microSD card Stores timestamped readings Format it as FAT32 for this reference implementation.
Jumper wires and breadboard Temporary assembly and connections Optional for a soldered, permanent build.

BME280 I2C connections

The reference pin table assigns GPIO 21 to SDA and GPIO 22 to SCL:

BME280 signal ESP32 pin in the reference build
SDA GPIO 21
SCL GPIO 22
Power and ground Connect according to the breakout’s documented voltage requirements.

I2C addresses and power pins can differ between BME280 breakout boards. If your module has selectable address pins or a regulator, follow its documentation rather than assuming every board is wired identically.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

microSD SPI connections

The reference wiring uses these SPI signals:

microSD signal ESP32 pin
Chip select (CS) GPIO 5
MOSI GPIO 23
Clock (SCK) GPIO 18
MISO GPIO 19
Power and ground Match the module’s documented requirements.

These assignments describe the cited example, not a mandatory ESP32 layout. Verify that GPIO 5 is available on your board and that the SD module is compatible with the board’s voltage levels before powering the circuit.

Software stack and project setup

The tutorial is written for the Arduino IDE and names these libraries:

Rank #2
ELEGOO 3PCS ESP-32 Dev Boards, ESP-WROOM-32, USB-C, WiFi Bluetooth 4.2 | Low-power IoT Applications, Smart Devices, Automation, Wireless Communication, GPIO Headers, Simplifying Development
  • Dual-Core Performance Up to 240 MHz: Run sensor processing, wireless communication, automation logic and connected-device tasks on a 32-bit dual-core ESP32 platform designed for responsive embedded and IoT projects
  • Built-in Wi-Fi and Bluetooth 4.2: Connect to 2.4 GHz Wi-Fi networks or use Bluetooth Classic and BLE for wireless sensors, smart devices, remote controls, home automation and other connected projects
  • Flexible Power-Saving Modes: ESP32 power-management features support dynamic clock scaling and low-power operating modes, helping developers reduce energy use in compatible sensing, monitoring and connected-device applications, suitable for battery-powered Internet of Things (IoT) devices.
  • USB-C Programming with CP2102: Connect through USB-C for power, sketch uploads and serial monitoring, while GPIO, UART, SPI and I2C interfaces support sensors, displays, motor drivers and other modules (USB-C cable not included)
  • Over-the-Air Update Support: Configure OTA functionality through a compatible ESP-32 software framework to update deployed firmware over Wi-Fi without reconnecting the board by USB for every revision
Library or facility Role
ESPAsyncWebServer Serves the dashboard and handles web requests asynchronously.
AsyncTCP Provides the asynchronous TCP layer used by the web server on ESP32.
Adafruit_BME280 Reads the BME280 sensor.
Adafruit_Sensor Provides the common sensor interface used by the Adafruit driver.
Wi-Fi, SD, SPI, and time facilities for ESP32 Connects to the network, accesses the card, communicates over SPI, and supplies timestamps.

Install the board support package and libraries through the Arduino IDE’s normal library-management tools, then select the correct ESP32 board and serial port. Library maintenance and compatibility change over time, so treat the names above as the components required by the reference code, not as a promise that a particular version or installation screen will remain unchanged.

Build the data pipeline step by step

  1. Assemble and inspect the circuit. Connect the BME280 on the I2C pins and the card module on the listed SPI pins. Check for shorts, loose breadboard rows, and a shared ground.
  2. Prepare storage. Format the microSD card as FAT32, insert it into the module, and make sure the card can be mounted before attempting to log measurements. Keep a backup of any existing files because the project includes a delete control.
  3. Initialize the sensor. The firmware should start the BME280 over I2C and stop with a clear diagnostic if the device is not detected. A missing sensor cannot produce meaningful chart values.
  4. Connect the ESP32 to Wi-Fi. The board receives an address on the local network. Record that address or print it to the serial monitor so a browser can reach the server.
  5. Take scheduled readings. The reference loop waits 60 seconds between samples, reads all three BME280 quantities, obtains the current time, and appends a row to the CSV file. Keep the interval in one clearly defined setting if you later change it.
  6. Serve the page and data endpoints. The asynchronous server returns the dashboard assets and the stored data needed by the charts. The browser then renders the visualizations and statistic cards.
  7. Verify a complete cycle. Confirm that a new CSV row appears, reload the page, and check that the latest-reading cards and chart history both change as expected.

A timestamp is part of the value of this project: without it, the page could show a sequence of readings but could not reliably determine which observations belong to the last 24 hours or seven days. If the displayed times are wrong, inspect the ESP32 time-source configuration before trusting duration statistics.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What appears on the dashboard

Three sensor charts

The reference page plots temperature, humidity, and pressure separately. Keeping the quantities in separate charts avoids putting values with very different units on one misleading axis. The temperature chart initially uses Celsius and includes a Fahrenheit switch. Changing units affects the temperature presentation; it does not change the stored measurement history.

Interactive inspection

Readers can zoom a chart and inspect individual points. Zooming is useful when a day-long view hides a short spike, while point inspection helps connect a visible change to its timestamp and the corresponding CSV row.

Latest-value cards

Cards on the page show the most recent temperature, humidity, and pressure values. These cards are a current snapshot, whereas the charts and statistics depend on the historical records loaded from the card.

Rank #3
ELEGOO ESP-32 Super Starter Kit with Tutorial Compatible with Arduino IDE | Development Board, USB-C Dual Core Microcontroller Support AP/STA/AP+STA, CP2102 Chip, WiFi, Bluetooth, 200+ parts for IoT
  • Powerful ESP-32 Board: Unlock the world of Internet of Things (IoT) and advanced electronics with the heart of this kit: the ESP-32 board. It features a powerful dual-core processor, integrated Wi-Fi and Bluetooth 4.2, making it perfect for building connected, smart devices that communicate with your phone or the cloud. It's fully compatible with the Arduino IDE for easy programming.
  • Super Starter Kit: This kit contains over 35 different modules and electronic components, including sensors, displays, motors, and input devices. From LEDs and buttons to an OLED screen, servo motor, and keypad, you have everything needed to explore a vast range of projects in one box.
  • Step by Step Online Tutorial: Jump right in with our detailed, beginner-friendly tutorial. Access 30+ projects with complete code, clear circuit diagrams, and step-by-step instructions. Learn the fundamentals of electronics, coding, and how to utilize the ESP-32's unique capabilities without any prior experience.
  • Hands-on Learning for All Skill Levels: Perfect for students, makers, engineers, and hobbyists. Start with basic circuits and coding, then progress to intermediate and advanced IoT applications. Build practical projects like weather stations, smart home controllers, remote-controlled devices, and interactive gadgets. The skills you learn are the foundation for real-world innovation.
  • Quality & Great Support: Elegoo is committed to quality. We provide a clear, detailed tutorial guide, refined code, and a well-organized component kit. All modules are carefully selected for reliability and ease of use. Our dedicated technical support team and active online community are ready to help you succeed in your learning journey.

CSV download and deletion

The page exposes controls to download the CSV file and to delete it. Download is a convenient way to archive or analyze the history elsewhere. Delete removes the logged data; use it only after saving a copy if the records matter. A deleted file cannot supply the previous seven-day calculations until new readings accumulate.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Temperature statistics calculated from history

The statistics are not generic capabilities of every ESP32 web server. They are features implemented by this reference page, and they depend on the timestamps and values in the loaded CSV history.

Minimum and maximum over 24 hours

The page filters records whose timestamps fall within the previous 24-hour window, then reports the lowest and highest temperatures found. This answers how cold and hot the recent day was, provided the card contains enough readings to cover that period.

Minimum and maximum over seven days

A second filter covers the previous seven days and returns the extrema for that longer window. The result is only as complete as the retained log: gaps, a recently erased file, or a board that was powered off leave the calculation with fewer observations.

Time above and below thresholds

You can configure temperature thresholds and have the page estimate how long the recorded temperature stayed above or below them. The calculation relies on the time between observations, so it describes intervals represented by the samples rather than continuously measuring every instant between them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
ESP-WROOM-32 ESP32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi + Bluetooth Dual Cores Microcontroller Processor Integrated with Antenna RF AMP Filter AP STA Compatible with Arduino IDE (1 PCS)
  • 2.4GHz Dual Mode WiFi + Bluetooth Development Board
  • Support LWIP protocol, Freertos;ESP32 is a safe, reliable, and scalable to a variety of applications
  • SupportThree Modes: AP, STA, and AP+STA
  • Ultra-Low power consumption, Compatible with Arduino IDE
  • 1PCS 30Pin ESP32 Development Board 2.4GHz WiFi Dual Cores Microcontroller Integrated with Antenna RF Low Noise Amplifiers Filters

Elapsed time from minimum to maximum and back

The page identifies a low point, finds a later high point, and reports the elapsed time between them; it also calculates the return interval from the high back toward the minimum. These values help describe warming and cooling cycles, but they are event timings derived from recorded points, not a laboratory response-time test of the sensor.

Daily temperature swings

For each day in the last seven days, the page compares that day’s highest and lowest temperatures and reports the swing. A day with missing readings can understate the true range because an unobserved peak or low may have occurred during the gap.

Average temperature by hour of day

The hourly view groups all loaded records by clock hour and averages the temperatures in each group. Because it uses the entire history supplied to the page, adding older files or retaining more days changes the result. It is a pattern summary, not a forecast.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why CSV retention matters

A live-only chart can draw points arriving after the page opens, but that alone does not prove that observations survive a reboot or remain available for seven-day analysis. Writing each timestamped reading to the microSD card gives the dashboard a durable history that can be loaded when the browser connects later.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Retention also determines how useful the statistics are. The card needs enough free space for the chosen cadence and the length of time you intend to keep records. The reference material does not establish a storage-endurance rating, a maximum history length, or a sensor-accuracy benchmark, so those should be evaluated separately for a long-running deployment.

Best Value
HiLetgo ESP-WROOM-32 ESP32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi + Bluetooth Dual Cores Microcontroller Processor Integrated with Antenna RF AMP Filter AP STA for Arduino IDE
  • 2.4GHz Dual Mode WiFi + Bluetooth Development Board
  • Ultra-Low power consumption, works perfectly with the Arduino IDE
  • Support LWIP protocol, Freertos
  • SupportThree Modes: AP, STA, and AP+STA
  • ESP32 is a safe, reliable, and scalable to a variety of applications

Choosing between live polling and retained history

Decision axis Reference project Live-only alternative
Sensor BME280 measures temperature, humidity, and pressure. Depends on the sensor selected.
Sampling One reading every 60 seconds. Depends on the browser and firmware schedule.
Storage Timestamped CSV on microSD. No durable history unless another store is added.
Charts Browser loads stored data and displays three charts. Browser can plot newly received values.
Statistics 24-hour, seven-day, threshold, swing, and hourly calculations. Limited to the observations retained by the live session.
Access ESP32 page on the same local network. Depends on the chosen transport and network design.

Espressif’s official Arduino-ESP32 FSBrowser example demonstrates a separate polling pattern in which browser JavaScript requests an endpoint and updates graphs. That pattern illustrates a different update mechanism; the available material does not establish that it is faster, more reliable, or better overall than the CSV-history approach.

Troubleshooting the common failure points

The BME280 is not detected

  • Recheck SDA on GPIO 21 and SCL on GPIO 22 for this wiring arrangement.
  • Confirm power and ground, then verify that the breakout’s voltage requirements match the ESP32 circuit.
  • Check the module’s I2C address if it provides an address selector.

The card will not mount or rows never appear

  • Reformat the card as FAT32 and test with another known-good card if necessary.
  • Inspect CS, MOSI, SCK, and MISO against the reference assignments: 5, 23, 18, and 19 respectively.
  • Check the SD module’s power and logic-level compatibility; an incorrectly powered module can fail intermittently.

The page does not open

  • Ensure the ESP32 and browser are connected to the same Wi-Fi network.
  • Read the board’s current IP address from the serial output or connection diagnostics.
  • Confirm that the web-server initialization completed after Wi-Fi and storage setup.

Charts are empty or statistics are missing

  • Open the CSV download and confirm that rows contain timestamps and sensor values.
  • Allow enough time for records to accumulate; a fresh card cannot provide a full seven-day window.
  • After using delete, remember that all earlier calculations are gone until new history is written.

Values look plausible but time windows are wrong

Inspect the ESP32 clock setup and the timestamp written with each row. A correct sensor value paired with an incorrect time can place a reading outside the intended 24-hour or seven-day filter.

Network and safety boundaries

The demonstrated arrangement is a local-network dashboard. Do not treat the board’s local IP address as secure remote access, and do not expose it directly to the internet without designing authentication, encryption, updates, and network controls separately. The reference project does not establish those protections.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Likewise, the charts should not be presented as calibrated instrumentation. The supplied material describes the BME280 readings and the page’s calculations, but it does not provide an independent accuracy study, storage-endurance test, long-term reliability result, or benchmark comparing chart libraries.

A practical verification checklist

  • The BME280 responds on I2C and reports all three measurements.
  • The microSD card is FAT32 and accepts a test file.
  • The ESP32 joins Wi-Fi and exposes a reachable local IP address.
  • A new timestamped CSV row appears at the configured interval.
  • The dashboard shows the latest cards and all three charts.
  • The Celsius/Fahrenheit switch changes the temperature display.
  • Zoom and point inspection reveal timestamps and values.
  • CSV download produces an archive before any deletion.
  • Statistics are interpreted with the available history length and any sampling gaps in mind.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

ArduinoBME280ESP32IoTmicroSDTemperature Monitoringweb server

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.