Measure humidity and temperature with a DHT11 sensor and an Arduino
In this example we are going to use a DHT11 temperature and humidty sensor connected to an Arduino to stream data using the PLX-DAQ protocol into LibreOffice Calc.
We need the following components:
- DHT11 (or similar) sensor
- 4k7 Ohm resistor
- Arduino UNO
- Breadboard
- Jumper wires
- USB cable
You also need the following software (next to LibreOffice)
The library can be installed by using the Library Manager in the IDE.
The hardware
Wire up the sensor as shown in the image below.

Setting up the Arduino software
Fire up the Arduino IDE and flash the following example onto the Arduino.
#include "Grove_Temperature_And_Humidity_Sensor.h"
#define DHTPIN 2
DHT dht(DHTPIN, DHT11);
void setup() {
Serial.begin(9600);
Serial.println("CLEARSHEET");
Serial.println("LABEL,TIME,TEMP (c), HUMIDITY (%)");
dht.begin();
}
void loop() {
static size_t count = 0;
float sensor_data[2] = {0};
if (!dht.readTempAndHumidity(sensor_data)) {
Serial.print("DATA,TIME,");
Serial.print(sensor_data[1]);
Serial.print(",");
Serial.println(sensor_data[0]);
count++;
if (count % 50 == 0) {
count = 0;
Serial.println("CLEARDATA");
}
}
delay(750);
}
Creating the Calc document
Open up a new spreadsheet in LibreOffice.
Start the DAELOC extension and make sure you set the following
- Data Source -> Serial, choose your Arduino and set 9600 as baudrate
- Protocol -> PLX-DAQ
- Control -> Start
Now data from the sensor should start flowing into Calc.
If you want to create a realtime chart, you can select the range the data gets written to (A1:C50).
Now choose Insert -> Chart, select Lines as Chart Type.
The chart is now drawn using the actual data that streams into Calc.
The Arduino sketch clears the data range after 50 data points and starts writing from row 1 again.