Excel data logger using PIC16F877A and DHT11 sensor

Building a temperature and relative humidity data logger using PIC16F877A, DHT11 and Microsoft Excel is very easy where data are sent serially from the PIC16F877A microcontroller to the Excel sheet.

Related project:
Interfacing DHT11 sensor with PIC16F877A – CCS C compiler

Hardware Required:

  • PIC16F877A microcontroller
  • DHT11 digital humidity and temperature sensor (RHT01)  — datasheet
  • 8 MHz crystal oscillator
  • 2 x 22pF ceramic capacitors
  • 10K ohm resistor
  • 4 x 10uF polarized capacitor
  • MAX232 chip  — datasheet
  • Female RS232 connector
  • 4.7k ohm resistor
  • Power source with 5 VDC
  • Breadboard
  • Jumper wires

The Circuit:
Project circuit schematic is shown below.

PIC16F877A Excel data logger DHT11 sensor

(All grounded terminals are connected together)

As shown above, the circuit is very simple we need the DHT11 sensor only and there is no need for a real time clock chip (DS3231, DS1302, DS1307 …) because Microsoft Excel can get data and time information from Windows.

The DHT11 sensor has 4 pins (from left to right): VCC (5V), data, NC (not connected pin) and GND. Data pin is connected to pin RD4.

The MAX232 integrated circuit is used to interface the microcontroller with the PC.

CCS C code:

Functions used in the code:
void Start_Signal(): used to send start signal to the DHT11 sensor.
int1 Check_Response(): used to detect the response signal which comes from the DHT11 sensor, this function returns 1 (TRUE) if OK and 0 (FALSE) if error.
int1 Read_Data(int8* dht_data): this function reads 1 byte (8 bits) from the sensor, data are saved in the variable dht_data. Returns 0 (FALSE) if OK and 1 (TRUE) if error (time out error).

In order to send data serially from the Arduino board to Excel we need a small software named PLX-DAQ (Parallax Data Acquisition tool). This software is just an add-in for Microsoft Excel. PLX-DAQ download link can be found in the page below:

After downloading and installing you will see a new folder created in your PC desktop named: PLX-DAQ which contains two shortcut files: PLX-DAQ Help File and PLX-DAQ Spreadsheet. Double click (or open using Excel) on the second file (PLX-DAQ Spreadsheet) gives a window as the one shown in the picture below. If there is a security warning (macros have been disabled) just click on Options –> check: Enable this content –> OK . Note that this plugin was tested with Microsoft Office 2007 and it should work with Office 2010, but unfortunately it doesn’t work with Office 2013.

PLX-DAQ Excel startup window

To start receiving data just choose the COM port and baud rate then click on Connect.

C code:

The result:

excel plx-daq datalogger temperature humidity

If you have a problem with time column (column B) just select that column –> right mouse click –> Format Cells (a new window will open) –> select Time (from a list on the left) –> OK .

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.