Data Logged LM35 temperature sensor values into Excel spreadsheet through Arduino

Hi, this post is about data logging your sensor values into Excel. Here I’m using LM35 temperature sensor with Arduino Uno, 16×2 LCD screen, resistor and jumper wires. Full list of hardware, software as per below:

  • Arduino Uno
  • LM35 temp. sensor
  • 16×2 LCD
  • 330Ω resistor for LCD backlight anode
  • 10kΩ pot for LCD matrix contrast
  • Jumper wires
  • Arduino IDE
  • Microsoft Excel with Data Streamer ( It is a Add-ins feature in MS Excel 360(Goto File -> Options -> Add-ins -> Under Manage dropdown list choose ‘COM Add-ins’ -> click GO -> tick Microsoft Data Streamer for Excel -> click OK. )

Left: Hardware circuit (ignore right side of breadboard). Right: Data Streamer tab will appear after Add-ins

The circuit diagram:

LM35 with Arduino circuit diagram

A video for the Excel data recording process:

The tab for the Excel Data Streamer cannot be seen, please refer to the top picture.

The Arduino sketch:

#include <LiquidCrystal.h>
int rs = 2;
int e = 3;
int d4=4, d5=5, d6=6, d7=7;
LiquidCrystal lcd(rs,e,d4,d5,d6,d7);
int sensorInput = A0;
float vout ;
float tempDegC;
void setup() {
  // put your setup code here, to run once:

 Serial.begin(9600);      //Initialize serial monitor

 lcd.begin(16,2);        //using both rows and all columns
 lcd.setCursor(1,1);     //text for below row, start from column 1
 lcd.print("Degree Celsius");

 pinMode (sensorInput , INPUT); //initialize Pin A0 as a input pin
void loop() {
  // put your main code here, to run repeatedly:
  lcd.setCursor(5,0);      //text for top row, start from column 5
  vout = analogRead(sensorInput);
  tempDegC = vout;
  //Serial.println(" Degree Celsius");

Using Excel VBA macros to provide the Date and Time of the temperature sensor Readings

You will notice that the Excel sheet does not logged the date and time of the sensor reading. You can use a RTC (Real Time Clock) module like the DS3231 to assist the MCU to provide the time and date.

But here I will use Excel VBA macro to record the date and time together with the temperature values. 👍 In this way you do not need a RTC.

Video to show and explain the outcome

The VBA script ↓

Private Sub Worksheet_Change(ByVal Target As Range)

Dim NowDate As String
Dim NowTime As String

NowDate = Date
NowTime = Time

If Not Intersect(Target, Worksheets("Data In").Range("A5")) Is Nothing Then

ActiveRowDate = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row + 1
ActiveRowTime = Worksheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Row + 1
ActiveRowData = Worksheets("Sheet1").Range("C" & Rows.Count).End(xlUp).Row + 1

Worksheets("Sheet1").Range("A" & ActiveRowDate).End(xlUp).Offset(1, 0).Value = NowDate
Worksheets("Sheet1").Range("B" & ActiveRowDate).End(xlUp).Offset(1, 0).Value = NowTime
Worksheets("Sheet1").Range("C" & ActiveRowData).End(xlUp).Offset(1, 0).Value = Worksheets("Data In").Range("B5").Value

End If

End Sub
Finally we got a time series of temperature readings. 👍