ESP8266IOT Projects

Google Spreadsheet or Google Sheets with ESP8266 Nodemcu for Data Logging

ESP8266 and Google Spreadsheet

Google Spread Sheet with ESP8266, Description:

 

Google Spreadsheet or Google Sheets with ESP8266 Nodemcu for Data Logging, Temp & Hum DHT11- So far I have covered majority of the IoT platforms for monitoring different types of sensors and for controlling different types of electrical devices. Usually for the real-time sensors monitoring I display the sensors values on the Gauges and for this I mostly use Blynk IoT platform, Ubidots, and Thingspeak etc. In majority of the cases only displaying the sensor values is not enough. There are guys who are interested in the data logging for the post analysis. The sensors data logging service offered by majority of the IoT platforms isn’t as impressive as offered by the Google which is absolutely free, highly secured, fast, and reliable. In this article, I will be using Nodemcu ESP8266 WiFi module with Google Sheets for the sensor data logging. Google Sheets is a spreadsheet program included as part of the free, web-based Google Docs Editors suite offered by Google.

Read my latest Article on How to send data from Google Spreadsheet to ESP8266 or ESP32.

allpcb circuit


Since this is my first time using the Google sheets for the Sensors data logging; so, I will try my level best to explain each and every detail. I will be using DHT11 Temperature and Humidity sensor as this is the most basic and easily available sensor. Once you learn how to send the temperature and humidity values to the Google Spreadsheet then you can replace this sensor with any other sensor of your choice. So, before, I am going to explain the circuit diagram, programming, and how to get started with the Google sheets, first let me explain; how this projects works.

Google Spreadsheet

I am using my homemade 4S lithium Ion battery pack for powering up my Nodemcu ESP8266 Development board. Read my article on how to make 3S and 4S lithium Ion batteries pack, if you want to make the same battery pack. As soon as I powered my Nodemcu ESP8266 module, after a few seconds I started to receive the data. The temperature and humidity values are stored along with the date and time information. For the demonstration purposes I am using a short delay in the programming, if you want you can increase the delay time. It’s totally up to you whether you want to send data after every 1 minute or 10 minutes, or 1 hour.

Google Spreadsheet

Anyways, you can also open the Google spreadsheet using your laptop or computer; again it’s up to you whether you want to use your computer or your cell phone for the monitoring and post analysis. Since this is an IoT based project so, you can monitor the temperature and humidity values from anywhere in the world. One thing that I really liked about the Google sheets is that; if you share the same Google account with multiple users then all the users  can monitor the same sensor from anywhere in the world.

As this is a getting started tutorial, that’s why I only started with the DHT11 temperature and Humidity sensor, if you want you can use multiple sensors, just go ahead and give it a try and if you face any issues then let me know in a comment. Anyways, now you have got the idea of what exactly you are going to learn after reading this article. Without any further delay, let’s get started!!!



Amazon Links:

12v Adaptor:

Nodemcu ESP8266 WiFi Module:

DHT11 Temperature and Humidity Module:

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


ESP8266 NodeMCU:

ESP8266 is a highly integrated chip designed for the needs of a new connected world. It offers a complete and self-contained Wi-Fi networking solution, allowing it to either host the application or to offload all Wi-Fi networking functions from another application processor.
ESP8266 has powerful on-board processing and storage capabilities that allow it to be integrated with the sensors and other application specific devices through its GPIOs with minimal development up-front and minimal loading during runtime. Its high degree of on-chip integration allows for minimal external circuitry, and the entire solution, including front-end module, is designed to occupy minimal PCB area.

Google Spreadsheet

Specifications:

Serial/UART baud rate: 115200 bps
Input power: 3.3V
I/O voltage tolerance: 3.6V Max
Flash Memory Size: 1MB (8Mbit)
WiFi security modes: WPA, WPA2

DHT11 Sensor:

  • DHT11 digital temperature and humidity sensor is a digital signal output with a calibrated temperature and humidity combined sensor.
  • It uses a dedicated digital modules and acquisition of temperature and humidity sensor technology to ensure that products with high reliability and excellent long term stability.
  • Sensor consists of a resistive element and a sense of wet NTC temperature measurement devices, and with a high-performance 8-bit microcontroller connected.
  • The product has excellent quality, fast response, anti-interference ability, high cost and other advantages.

The single-wire wiring scheme makes it easy to be integrated to other applications and the simple communication protocol greatly reduces the programming effort required.

Google Spreadsheet


Nodemcu ESP8266 and DHT11 Circuit Diagram:

Google Spreadsheet

If you are just getting started with the Nodemcu ESP8266 and DHT11 Temperature and Humidity sensor then these are the minimal connections which you will need for this project. You can power up your Nodemcu module using your laptop. Connect the VCC and GND pins of the DHT11 sensor with the 3.3V and GND pins of the Nodemcu Module; and connect the Data pin of the dht11 sensor with the digital pin D1 of the Nodemcu module. Don’t forget to add a 10k ohm resistor between the VCC and Data pins of the DHT11 sensor. Now, let’s take a look at the other circuit diagram.

Nodemcu esp8266 power supply Circuit Diagram:

Google Spreadsheet

This circuit diagram is for those guys who want to power up the Nodemcu module using an external power supply. As you can see the DHT11 sensor connections with the Nodemcu ESP8266 WiFi module remains exactly the same. On the left side is the regulated 5v power supply which is based on the 7805 voltage regulator. J1 is the DC female power jack and this is where we connect a 12v adaptor, battery, or a solar panel. Don’t forget to add these 470uF decoupling capacitors.

Google Spreadsheet

Here is my Nodemcu ESP8266 WiFi module based development board which I use for testing my IoT based projects. If you want to make the same development board then you can read my previous article. Anyways, I interfaced my DHT11 sensor with the Nodemcu module as per the circuit diagram. My connections are completed and now let’s start with the Google sheets, there is nothing complicated just follow the same exact steps.


Creating Google Spreadsheet:

First of all we will create the Google Spreadsheet for which we will click on the Google apps and in which we will click on the Sheets.

Google Spreadsheet

After that we will click on the blank in order to create a new spreadsheet.

Google Spreadsheet



After that we will give the title name of the project and then in columns we will write the date, time, temperature, and humidity.

Google Spreadsheet

In the date column which is “A” we will receive the date, in column “B” we will receive the time, in column “C” we will receive the temperature, and in the column “D” we will receive the humidity. After that we will open the script editor in the previous versions of spread sheet it was found in the tools but in the new versions of the spread sheet it is in the extensions with the name Apps Script click on it.

Google Spreadsheet

After that we will click on the untitled project and give the name to the project which is DHT_monitoring and click on the ok.

Google Spreadsheet


After that paste the following code in it.

In the above code we will make several changes in the var_sheet id we will paste the code copied from the spread sheet main page which is shown below in the diagram.

Google Spreadsheet

We can change the time by changing the command

As the Pakistan time is based on the Karachi so we will write Asia/Karachi. If you are living in India then you will write Asia/New Dehli. You can search the time zone of your country and replace it. After that we will click on the publish and then click on the deploy as web.

Google Spreadsheet


Then we will select the “anyone even anonymous” and click on the Deploy.

Google Spreadsheet

Then click on the review permission

Google Spreadsheet

Then choose the account the g-mail account with which you have created the spread sheet. After that we will click on the advance.

Google Spreadsheet

Then click on the go to dht_monitoring

Google Spreadsheet

 

After that we will click on the allow button.

Google Spreadsheet


After that we will copy the script url and click on the ok.

Google Spreadsheet

Now the process of the Google spreadsheet is completed and we will open the Arduino IDE. If this is your first time using the Nodemcu ESP8266 WiFi module then you will need to install the Nodemcu board. I have a very detailed article on how to install the Nodemcu board. You will also need to install the DHT11 library for this click on the Sketch Menu then go to the Include Library and then click on the Manage Libraries. Type dht in the search box and then install the dht sensor library.

Google Spreadsheet Nodemcu ESP8266 Code:

Upload the above. Power up your Nodemcu ESP8266 module, next open your spreadsheet App on your cell phone or computer and you should be able to receive the temperature and humidity values along with the date and time information.

Google Spreadsheet

For detailed explanation and practical demonstration watch video given below.



Watch Video Tutorial:

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

21 Comments

  1. In the code for google script,there are many misleadingly concatenated words like dofunctionget, varsheet etc. Would be nice if the script worked out of box. Otherwise, great article.

  2. Great tutorial! Thank you for putting it together! I have modified parts of it to send RFID data from an RC522 to google sheets, but I keep getting the “esp8266/Arduino CI has failed” error. Any insight as to what usually causes that?

  3. Thanks for the nice and great tutorials.
    great article.
    I am from INDIA, i have tried this tutorial, working fine.
    Thank you

  4. I am having a problem that the code is not being able to fetch the headers but it is reding the data sucessfully but data is not going to sheet

  5. Excellent tutorial, I followed each step and received all values, but when i added more variables upto seven, google sheet only displayed five of them, can you please tell me about this problem?

  6. Initially got a “Cache-Control: private, max-age=0” error and then a “esp8266/Arduino CI has failed” error. never uploaded any data

  7. hello i am using the Arduino uno and sim800l GSM module to send data on google sheet using the GPRS how to send can anyone help me thank you ?

Leave a Reply

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

Back to top button