Experiment 6: Data Logging Using ESP32 and Excel (Cloud Communication)
Objective
To log real-time sensor data from an ESP32 connected to an LM35 temperature sensor into an Excel sheet using a cloud server over Wi-Fi communication. The system will enable remote data collection, storage, and visualization through the cloud.
Task
- Write ESP32 code to read temperature data from the LM35 sensor and send it to a cloud server using Wi-Fi.
- Develop a method to export or sync stored data to Excel for analysis and visualization.
- (Optional) Plot real-time or historical temperature data in Excel or a web-based dashboard.
⚠️ Disconnect your ESP32 from the computer while making or removing component connections.
Setting Up Cloud
![]()
Step 1
Visit www.cognifront.com and scroll down to the footer section.
![]()
Step 13
Return to the home page and click View App to launch your application. Congratulations! Your cloud app is now ready.
![]()
Step 14
Open the program folder — you will find two files: eecit-exp-06-data-logger.ino (main program) and cogcloudesp.h (library header file). Open the .ino file in Arduino IDE.
Circuit & Board Connections
Connections
| LM35 Pins | ESP32 Pins |
|---|---|
| GND | GND |
| VCC (3.3V) | 3.3V |
| DATA | GPIO34 |
ESP32 Code
// © 2026, Cognifront. Member of The IoT Kits Family.
//Experiment 6: Data Logging Using ESP32 and Excel (Cloud Communication)
#include "cogcloudesp.h"
//int cogLed = 15;
const int lm35_pin = 34;
String ssid = "********"; // wifi/hotspot name
String pass = "********"; // wifi/hotspot password 2.4 hz band only
String apikey = "YOUR_API_KEY_HERE"; // API key from app. Keep the "" (quotes)
void setup ()
{
// pinMode (cogLed,OUTPUT);
pinMode (lm35_pin, INPUT);
Serial.begin(115200);
while (!Serial)
delay(100);
cogInitCloud (ssid,pass,apikey);
// cogBindPin (cogLed, "LED");
}
void loop ()
{
cogAppLoop();
int voltage_mv = analogReadMilliVolts(lm35_pin);
float temp_val = voltage_mv / 10.0; // LM35 = 10 mV per °C
// Send value to cloud
cogStoreCloudVariable("LM35", String(temp_val, 2));
delay(2000);
}
⬇ Click Here to Download Code File
(Contains ESP32 source code)
![]()
Connect your ESP32 to your computer and upload the code make sure right port selected.
Observation
- The ESP32 successfully reads temperature data from the LM35 sensor.
- Data is stored in a CSV file on the cloud at two-second intervals.
- Using PLX-DAQ or Python, data can be visualized in real time in Excel.
Conclusion
This experiment demonstrates how to log real-time sensor data from ESP32 to a computer using cloud communication. Storing data in CSV format enables easy analysis and plotting in Excel or any other data-processing tool.
Real Life Example
Condition Monitoring in Machines and Data Logging: Sensors collect data such as vibration, temperature, or pressure from mechanical systems, which is logged and analysed in Excel for predictive maintenance and fault diagnosis. Also this data can be fed for training a machine learning model.