Battery Powered Simple Waste Auditing Data Logger ♻️

I wanted a way to keep track of how much waste I was generating just to be more environmentally conscious. So I created this project as an automated way to help keep track of waste accumulation through fullness measurements while also taking pictures of the objects thrown away.

To achieve this, I use the HC-SR04 ultrasonic sensor along with the ESP32-CAM. Doing this type of waste tracking is called a waste audit, which is a common practice used by universities to keep track of waste goals while also looking for opportunities increasing waste diversion rates.

I’ve actually done a couple in-person waste audits before at my University, it was actually pretty fun and insightful. With this concept I was also able to deploy sensors on 9 bins on campus with a research group called ZotBins. These types of devices helped provide useful insights such as bin usage and fullness trends. I hope to use this project to find my own insights about my own waste stream. This device could have a lot of potential as an IoT device, see the Further Discussion Section below for more details about this.

Step 1: Supplies ????????

Materials Needed

*Let’s be sustainable and use rechargeable ones 🙂

**8 mm screws are sufficient, but if you want two bolt the end of the screw you need at least a 12 mm screw (see 3D Printing the Case for a better idea of where the screws will go)

Tools Needed

A lot of the materials and tools I linked could be found cheaper prices if bought from other vendors such as Ali Express or Banggood.

Step 2: Solder Components on Prototyping Board ????

  1. Use a 4cm x 3cm prototyping board. This will be approximately the same size as the ESP32 CAM. I cut a 4cm x 6cm board in half to get that size.
  2. Use two 8-pin female headers and place it on the center of board for the ESP32-CAM. I just cut a 20 pin female header piece to get the 8-pin female headers.
  3. (Optional) Place a 2-pin screw terminal block connector near the top. You can use this to conveniently plug in my battery pack of 3 AA batteries. If you don’t follow this step just solder the wires from your battery pack directly into the prototyping board.
  4. Solder wires for HC-SR04 and the 5V Boost Converter. These wires will be used to connect the components to the prototyping board.
  5. Solder Components. Once everything is placed, just solder those components in place. See image above of my setup for reference.
  6. Plug in your ESP32 CAM into the female headers for reference. Helps you see which pins for the female headers correspond to which pin on the ESP32 CAM.
  7. Solder connections according to wiring diagram above.


Circuit Explanation

I decided to use the female headers because I wanted to reuse my ESP32-CAM for other projects as well. If you don’t mind, you can directly solder everything on the ESP32-CAM.

Step 3: Power Analysis ⚡

Current Draw Values

ESP32-CAM Active Mode 1 = 60-260 mA

ESP32-CAM Deep Sleep = 10uA

HC-SR04 Working Current = 15 mA

Explanation

With the values above I settled on using three 2,800 mAh capacity rechargeable AA batteries. I determined this by doing some quick calculations. I first did a high power consumption calculation where the ESP32-CAM is always in active mode, the battery lasted only 30.5 hours. Then I did a low power consumption calculation where the ESP32-CAM was always in deep sleep, the battery lasted 559.62 hours. I know that my code is in deep sleep most of the time so my estimates on how long this will power the sensor module will probably just be a couple hours less than 559.62 hours. So definitely enough to power the project for at least a week!

Step 4: Download the Arduino IDE and Add ESP32 Package ⬇️

I was going to write my own instructions for this, but mine was really just going to be a derivative of the one on Random Nerd Tutorials. Their content is really amazing and informative so big thank you and acknowledgement to the blog creators Sara and Rui for making these resource available to the public. So instead, please follow the instructions by watching their video or by following their tutorial, but please stop once you havethe Arduino IDE and the ESP32 by Espressif Systems package installed. I will give specific instructions for setting up the ESP32 CAM that varies from the tutorials in the next step.

Video Tutorial: Install the ESP32 Board in Arduino IDE in less than 1 minute (Windows, Mac OS X, and Linux)

Written Tutorial: Installing the ESP32 Board in Arduino IDE (Mac OS X and Linux instructions)

By the end of this tutorial you should have the following:

  1. An Arduino IDE
  2. The correct esp32 library added in the Preferences from this source: https://dl.espressif.com/dl/package_esp32_index.json
  3. esp32 library by Espressif Systems installed from Tools > Board > Boards Manager

Step 5: Select AI Thinker ESP32-CAM As Board in Arduino IDE ✅

Refer to picture above for reference.

  1. Near the top left of the Arduino IDE select Tools
  2. Then go to Board > ESP32 Arduino > AI Thinker ESP32-CAM
  3. You might have to scroll down a bit to select AI Thinker ESP32-CAM

Step 6: Installing the NTP Client Library ????

We’ll be using Wifi and connecting to a NTP server to keep automatically determine the date-time stamp of when the fullness data was collected and when the image was taken. The NTP server is in UTC time, you can add offsets in the code to match your timezone, I explain this in the Code Explanation section.

  1. Download the NTP Client Library from GitHub here: https://github.com/taranais/NTPClient/archive/master.zip
  2. Unzip the file and go into the folder. Rename the folder NTPClient-master to NTPClient
  3. Move the folder to your Arduino IDE installation libraries folder. On Windows, I move the folder here: C:\Users\REPLACE_WITH_YOUR_USERNAME\Documents\Arduino\libraries
  4. Restart the Arduino IDE

Source: Battery Powered Simple Waste Auditing Data Logger 


About The Author

Muhammad Bilal

I am a highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

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

Scroll to Top