ESP8266

ESP32 CAM and ESP8266 with Google sheets, Google Drive, MLX90614,& Ultrasonic Sensor

ESP32 CAM and ESP8266:

 

ESP32 CAM and ESP8266 with Google sheets, Google Drive, MLX90614,& Ultrasonic Sensor- By the way, I should have made this project during the time of COVID, but well, even now you can use this project. Or you can modify it into a completely different project.

ESP32 CAM and ESP8266

Anyway, as you can see this project is based on the ESP32 Cam and ESP8266 WiFi module. MLX90614 non-contact infrared temperature sensor and the HC-SR04 Ultrasonic sensor are connected to the ESP8266 WiFi Module. Ultrasonic Sensor measures the distance of the person standing in front of the MLX90614 Temperature sensor. The MLX90614 is used to measure the person’s temperature. If the person distance is within the defined range then the ESP8266 WiFi Module sends the person’s measured temperature and distance to the Google sheets or Google spreadsheet. And at the same time it also triggers the ESP32 Cam to capture the image and send it to the Google Drive. This is a completely contactless iot based temperature monitoring system.

You may find this project a little difficult, but it’s not like that. This project is actually very easy if you follow my instructions.

Look, ESP32 Cam has its code and the ESP8266 has its own code. The only link between these two is that when a person comes in front of the Ultrasonic Sensor and the person distance is within the defined range, the ESP8266 WiFi Module triggers the I/O pin of the ESP32 Cam Module.

For the ESP32 CAM, it’s just like if you have connected a button or a digital sensor to its I/O pin. Anyway, as soon as the I/O pin on the ESP32 Cam module is triggered, it captures an image and sends it to the Google Drive.

If you want to completely understand and quickly build this project then for this you will have to watch my previous getting started videos on the ESP32 Cam Module and the Google Spreadsheet.

  1. I used ESP32 CAM to send images to the Google Drive whenever the Infrared Sensor would detect the presence of a human or any other object. In this project, the infrared sensor has the same job, it triggers the ESP23 Cam i/o pin. Now, instead of using the IR sensor I am using the ESP8266 Wifi module to trigger the I/O pin. So, if you watch this video then your ESP32 Cam and Google drive part will be covered.
  2. And to completely understand how to setup your Google Spreadsheet for the data logging then you will have to read this article. In this project, I have used the DHT11 temperature and humidity sensor. Just forget about the sensor and concentrate on the Google spreadsheet part only. Once you learn how to setup your Google spreadsheet account for the data logging then you can monitor almost anything. In my case, I simply replaced the Temperature and humidity values with the Temperature and distance values.

So, without any further delay, let’s get started!!!




Amazon Links:

Nodemcu ESP8266 WiFi Module

MLX90614 non-contact infrared temperature sensor

HC-SR04 Ultrasonic Sensor

ESP32 Cam Module

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*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!

The DFrobot MLX90614:

Temperature measurement can be divided into two types: contact and non-contact. Contact measurement requires the testing object and the sensor to reach thermal equilibrium in order to accurately measure temperature. This means that the sensor must physically touch the object being measured. However, this approach has some limitations. The process of reaching thermal equilibrium can take time, resulting in longer response times for temperature readings. Moreover, factors such as ambient temperature can introduce inaccuracies in the measurements.

In contrast, non-contact temperature measurement techniques utilize infrared radiation to determine the temperature of an object without requiring direct physical contact. The sensor detects the infrared radiation emitted by the object and translates it into temperature readings. This method offers several advantages. Firstly, it eliminates the need for physical touch, which is particularly useful when measuring the temperature of delicate or sensitive objects. It also allows for measurements to be taken at a safe distance, which is beneficial in situations where contact with the object may not be possible or desirable.

One of the key advantages of non-contact measurement is its speed and accuracy. The readings can be obtained quickly, allowing for real-time monitoring and analysis. Additionally, this method reduces the influence of ambient temperature on the measurements, leading to more precise results.

The applications of non-contact temperature measurement have expanded significantly in recent years. In the medical field, it is used for non-invasive temperature monitoring, particularly in situations where direct contact may be impractical or uncomfortable for the patient. Environmental monitoring systems employ non-contact measurement techniques to assess temperature variations in ecosystems, industrial settings, and weather forecasting. In home automation, non-contact temperature sensors are integrated into smart devices to enable temperature control and energy efficiency. Automotive electronics rely on non-contact temperature measurement for monitoring engine temperature, exhaust systems, and various vehicle components. Aerospace and military applications leverage this technology for temperature monitoring in aircraft, missiles, and other critical equipment.

The adoption of non-contact measurement methods has revolutionized temperature sensing, offering flexibility, accuracy, and safety across a wide range of industries and applications.

ESP32 CAM and ESP8266

Model: MLX90614-DCC

Operating Voltage: 3.3V – 5V

Interface Type: I2C

Interface Line Sequence: VCC, GND, SCL, SDA

FOV: 35°

Weight: 15g

Temperature Range: -70.01℃ to +380℃, with a resolution of 0.01℃

Measurement Accuracy: ±0.2℃ (body temperature range)/±0.5℃

Dimensions: 31.5*18 mm/1.24 x 0.7 inches

Here is another model:

SEN0263 (MLX90614-DCI)

Operating Voltage: 3.3V-5V

Operating Current: 1.2mA

Temperature: -70.01℃ to +270℃,(0.01 ℃ resolution)

Interface Type: IIC

Interface Line Sequence: VCC,GND,SCL,SDA

FOV: 35°

Dimensions: 31.5*18mm/1.24 x 0.7 inches



HC-SR04 Ultrasonic Sensor:

ESP32 CAM and ESP8266

The HC-SR04 Ultrasonic Range Finder is an immensely popular sensor used in various applications that require distance measurement and object detection. Taking inspiration from the echolocation abilities of bats and dolphins, this ultrasonic sensor utilizes sonar technology to determine the distance to objects.

This Ultrasonic Sensor module incorporates a transmitter, a receiver, and a control circuit, all conveniently packed into a single unit. With its compact and user-friendly design, it offers exceptional range accuracy and stable readings. Unlike Sharp rangefinders, this sensor is not affected by sunlight or black materials, although it may face challenges in detecting acoustically soft materials like cloth.

The Trigger and Echo pins of this module serve as input/output pins and can be easily connected to microcontrollers or Arduino boards. When the receiver detects the return wave, the Echo pin goes high for a specific duration, equivalent to the time taken for the wave to travel back to the sensor.

The Ultrasonic Ranging Module HC-SR04 provides non-contact distance sensing capabilities in the range of 2cm to 400cm. It boasts impressive ranging accuracy, with measurements accurate up to 3mm.

The versatility of the HC-SR04 makes it an indispensable component in various applications, including robotics, security systems, automated navigation, obstacle avoidance, and much more. Its reliable performance, easy integration, and precise distance measurements make it a popular choice among electronics enthusiasts and professionals alike.

Wiring:

  • +5V(positive)
  • Trig(control)
  • Echo(receive)
  • GND(negative)

Features:

  • Measures the distance within a wide range of 2cm to 400cm
  • Stable performance
  • Accurate distance measurement
  • High-density
  • Small blind distance



ESP32 CAM and ESP8266 interfacing:

ESP32 CAM and ESP8266

Connect the 5V and GND pins of the ESP32 Camera module to the 5V and GND pins of the regulated 5V power supply. This 5V regulated power supply is based on the 7805 Voltage regulator which is ok for the basic testing but if you are planning on using this project for hours then I would recommend you should build my designed 5V and 3A power supply. As you might know, ESP32 Camera module draws more current and if along with the ESP32 Camera module you also power up the ESP8266 and all the other sensors then the 7805 voltage regulator will really get hot and the ESP32 Camera module will keep disconnecting. So, my recommendation is build yourself this 5V and 3A power supply. Which is more than enough for powering all these electronics.

Anyway, connect D6 of the ESP8266 to the IO13 on the ESP32 Cam module. The IO13 pin look at the D6 pin as the push button or a digital sensor. I have already explained this in detail.

The VCC and GND pins of the MLX90614 non-contact infrared temperature sensor are connected to 3.3V and GND pins on the ESP8266. Whereas the SCL and SDA pins of the MLX90614 are connected to the ESP8266 D1 and D2 pins. D1 is the SCL and D2 is the SDA.

Connect the VCC and GND pins of the Ultrasonic Sensor to the 5V and GND. Connect the Trigger and Echo Pins to D4 and D5 respectively.

So, that’s all about the connections and now, let’s go ahead and start with the Google Drive Setup for the ESP32 Cam Module.

What is Google Drive?

Google Drive is a cloud-based storage and file synchronization service provided by Google. It allows users to store their files, including documents, photos, videos, and more, securely in the cloud and access them from any device with an internet connection.

The primary purpose of Google Drive is to provide users with a convenient and reliable platform for storing and managing their digital files. It offers several features and benefits that enhance productivity and collaboration:

File Storage and Organization: Google Drive provides a generous amount of free storage space (15GB at the time of writing) and options to upgrade for additional storage. Users can upload files of various formats, create folders to organize their files, and easily search for specific documents using keywords.

Accessibility and Cross-Device Syncing: Files stored in Google Drive can be accessed from any device with an internet connection, including computers, smartphones, and tablets. Google Drive offers seamless syncing across devices, ensuring that the latest version of a file is always available.

Collaboration and File Sharing: Google Drive allows users to share files and folders with others, enabling seamless collaboration. Multiple users can work on the same document simultaneously, making real-time edits and comments. Permissions can be set to control who can view, edit, or comment on the shared files.

Document Creation and Editing: Within Google Drive, users have access to a suite of productivity tools, including Google Docs, Sheets, Slides, and Forms. These web-based applications enable users to create, edit, and collaborate on documents, spreadsheets, presentations, and forms directly within the Drive environment.

Integration with Other Google Services: Google Drive integrates seamlessly with other Google services such as Gmail, Google Photos, and Google Calendar. This integration allows for easy attachment of files in emails, automatic backup of photos and videos, and scheduling events directly from Drive.

Data Backup and Recovery: Google Drive serves as a reliable backup solution for important files, protecting them from data loss due to hardware failures, accidental deletions, or device theft. Deleted files can often be restored from the Trash folder, offering a safety net for unintentional deletions.

In summary, Google Drive is a cloud storage service that offers users a secure and accessible platform for storing, organizing, and collaborating on files. Its features and seamless integration with other Google services make it a popular choice for individuals, businesses, and teams seeking an efficient and collaborative file management solution. In this project I, am going to send my images from the ESP32 Cam module to the Google Drive. So, let’s go ahead and setup our Google Drive.



ESP32 Cam and Google Drive Setup:

Make sure you are on the google.com/script/start/. On the right side you can see Start Scripting, just click it.

ESP32 CAM and ESP8266

While you are signed in with your registered Gmail ID. Open the Apps Script Page and click on the New project.

ESP32 CAM and ESP8266

Enter project name.

ESP32 CAM and ESP8266

After writing the project name. You can see function myFuntion() {   }

Just delete it paste the following Google Script Code.




Google Script code:

Save this code.

Next, Go to the Publish Menu and click Deploy as web app.

ESP32 CAM and ESP8266

Under who has access to the app, select Anyone, even anonymous and click the Deploy button.

ESP32 CAM and ESP8266

Click on Review Permissions.

ESP32 CAM and ESP8266

Select the email id.

ESP32 CAM and ESP8266

Click on the Advanced and then click on your project. In my case “ESP32_CAM.

ESP32 CAM and ESP8266

On the next page, scroll down and click Allow.

ESP32 CAM and ESP8266

You will get this Current web app URL.

ESP32 CAM and ESP8266

Copy this link and paste it in a new web browser.

ESP32 CAM and ESP8266

Copy this part of the URL as you can see in the image above. Open the ESP32 cam programming, which is given below. And replace this part with the new one that we just copied.

ESP32 CAM and ESP8266

Make sure you also download the Base64.cpp and Base64.h files.

After you download the Base64.cpp and Base64.h files; make sure you keep these files with the main programming .ino file in the same folder.



ESP32 Cam Google Drive Code:

Our Google drive and ESP32 Cam setup is completed and now we can upload the program.



Upload Code to ESP32 Cam:

You can upload the code to the ESP32 Cam using two methods.

1st Method:

The first method is using the Arduino Uno or Arduino Nano. Connect your ESP32 Cam module to the Arduino Uno or Arduino Nano by following this circuit diagram.

ESP32 CAM and ESP8266

  • Connect the 5V of the Arduino Nano with the 5V of the ESP32 CAM
  • Connect the ground of the Arduino Nano with the ground of the ESP32 CAM
  • Connect the TX pin of the Arduino Nano with the VOT of the ESP32 CAM
  • Connect the RX pin of the Arduino Nano with the VOR of the ESP32 CAM
  • Connect the reset pin with the ground in the Arduino Nano.
  • Connect IOO of the ESP32 CAM with the Ground

Now, before you click on the upload button, make sure you do the following settings in the Arduino IDE.

  • Board: ”ESP32 Wrover Module”
  • Upload Speed: “115200”
  • Flash Frequency: “40MHz”
  • Flash Mode: “Q10” >
  • Partition Scheme: “Huge APP (3MB No OTA/1 MB SPIFFS)” >
  • Core Debug Level: “None” >
  • Port: “COM port’ > According to your port connection

ESP32 CAM and ESP8266

Finally, you can click on the upload button.



2nd Method:

ESP32 CAM and ESP8266

The 2nd method is using this Development board. All you need is to simply plug in the ESP32 Cam, connect it to your laptop, and upload the program.

ESP32 CAM and ESP8266

If you want to save time and to avoid any risk of damaging your ESP32 Cam module then I highly recommend, get yourself this development board. Anyway, after uploading the program; now we can start with the Google spreadsheet.

Altium Designer + Altium 365 + Octopart:

Arduino LoRa Free SMS

Altium 365 lets you hold the fastest design reviews ever. Share your designs from anywhere and with anyone with a single click. it’s easy, leave a comment tagging your teammate and they’ll instantly receive an email with a link to the design. Anyone you invite can open the design using a web browser. Using the browser interface, you’re able to comment, markup, cross probe, inspect, and more. Comments are attached directly to the project, making them viewable within Altium designer as well as through the browser interface. Design, share, and manufacture, all in the same space with nothing extra to install or configure. Connect to the platform directly from Altium Designer without changing how you already design electronics. Altium 365 requires no additional licenses and comes included with your subscription plan.

Get real-time component insights as you design with Octopart built into Altium 365. Octopart is the fastest search engine for electronic parts and gives you the most up-to-date part data like specs, datasheets, cad models, and how much the part costs at different amounts etc. Right in the design environment so you can focus on your designs. Start with Altium Designer and Activate Altium 365. Search for electronic parts on Octopart.




What is Google Sheets or Google Spreadsheet:

Google Sheets, also known as Google Spreadsheets, is a powerful web-based application provided by Google that allows users to create, edit, and collaborate on spreadsheets in a cloud environment. With its user-friendly interface and robust functionality, Google Sheets has become a go-to tool for individuals, businesses, and teams needing efficient data management and analysis.

In this introduction, we highlight the key features and benefits of Google Sheets:

Boost Your Productivity with Google Sheets: Google Sheets offers a wide range of tools and functions that streamline data organization and manipulation. Whether you’re crunching numbers, analyzing data trends, or creating dynamic charts, Google Sheets provides a user-friendly platform that enhances your productivity.

Collaborate Seamlessly: Google Sheets enables real-time collaboration, allowing multiple users to work simultaneously on the same spreadsheet. With just a few clicks, you can invite team members, clients, or partners to collaborate, making it easy to gather input, track changes, and maintain version control.

Data Access Anywhere, Anytime: As a cloud-based application, Google Sheets provides the convenience of accessing your spreadsheets from any device with an internet connection. Whether you’re at the office, on the go, or working remotely, you can securely access and edit your spreadsheets, ensuring data consistency and real-time updates.

Intuitive and Versatile Functions: From basic calculations to complex data analysis, Google Sheets offers a wide array of formulas, functions, and formatting options. With its intuitive interface, even users with limited spreadsheet experience can leverage its capabilities to perform calculations, manipulate data, and generate meaningful insights.

Seamless Integration with Google Services: Google Sheets seamlessly integrates with other Google services, such as Google Drive, Gmail, and Google Calendar. You can easily import data from various sources, attach spreadsheets to emails, and schedule automatic data updates, saving you time and effort.

Data Security and Backup: Google Sheets ensures data security by providing robust encryption and access control features. Additionally, your data is automatically saved as you work, reducing the risk of data loss due to hardware failures or accidental deletions.

This is the main reason, I am using Google sheets for the temperature and distance data logging. If anything happens on the hardware side, the data is still going to be available on Google sheets.

Google Sheets or Google spreadsheet setup:

While you are logged in into your registered Gmail id, click on sheets.

ESP32 CAM and ESP8266

Click on Start a new spreadsheet then enter your project name, and set the column names.

ESP32 CAM and ESP8266

Go to the Extensions menu and click on the Apps Script.

ESP32 CAM and ESP8266

Enter the project name. R

ESP32 CAM and ESP8266

Remember it has nothing to do with the ESP32 Cam module, this time we are doing it for the ESP8266 WiFi module. Copy the following script. And paste in the Code.gs.



Script Code:

Go to your Google Spreadsheet and copy this part of the URL as you can see in the image below.

ESP32 CAM and ESP8266

ESP32 CAM and ESP8266

Then go to the Publish Menu and click on Deploy as web app…

ESP32 CAM and ESP8266

Under the Who has access to the app: select Anyone even anonymous and click the Deploy button.

ESP32 CAM and ESP8266

Then on the Authorization, click Review Permissions.

ESP32 CAM and ESP8266

Now click on the advance option

ESP32 CAM and ESP8266

Then click on  Go to mlx and Ultrasonic sensor monitoring.

ESP32 CAM and ESP8266

And finally, click on the Allow.

ESP32 CAM and ESP8266

Now, go back to Google script and copy this part of the URL as you can see in the image given below.

ESP32 CAM and ESP8266

And paste it next to the GAS_ID in the programming given below.



Google Spreadsheet ESP8266 Programming:

Required Library:

First of all, we will install the MLX90614 library for this open your Arduino IDE, then go to the Sketch Menu, then to Include Library, and click on Manage Libraries. Wait for a few seconds and when the loading is done; then in the search box type MLX90614 as you can see in the image below.

ESP32 CAM and ESP8266

The whole process is completed. And don’t forget to change your SSID and password. Finally, you can upload the program.



Practical Demonstration:

I Powered up the ESP8266, ESP32 CAM, and all the other sensors. I asked my cousin to come in front of the sensor.

ESP32 CAM and ESP8266

The ESP8266 WiFi module successfully sent the temperature and distance values to the Google sheet or Google spreadsheet. And at the same time, the ESP32 CAM captured the image and sent it to the Google Drive.

ESP32 CAM and ESP8266

For the better understanding and practical demonstration watch video tutorial on my YouTube channel Electronic Clinic. The link is 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

One Comment

  1. Hello Shahzada Fahad! I hope you are in good health, I have read your whole project and it is very nice how you integrated several sensors and the ESP32 CAM module. I would like to use this same module for a personal project but I would like to implement it in a different way, I want the picture taken to be sent to a specific column of a google sheet and the next pictures to be grouped in the rows along with the sensed data.

    And I would like to ask you more questions since you have knowledge in these topics: what happens when using the maximum number of rows in Google Sheets? Can I make that every (example: 1500) rows are automatically deleted to continue writing on the same Google Sheet?

Leave a Reply

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

Back to top button