Introduction
Keeping track of the recycling schedule apparently is hard. I must have missed the card-board pick-up so many times in a row, we could have easily build a sizable carboard-fortress. As I am obviously not entirely up to the task, I needed a little helper to save the planet - meet BinPal.
I started by researching the web for bin reminders and stumbled upon a Google calendar reminder project by Andreas Spieß. (https://m.youtube.com/watch?v=sm1-l5-z3ag)
Although I liked the way he used Google calendar to keep track of the pick-up times, I thought it was lacking in a few ways which I could improve upon.
- Needs to be small-ish and look nice, bulky plastic boxes not allowed
- No cable, battery operated with a few weeks of battery life
- Kid friendly interface
- Drop resistant
- Needs to notify visually, no beeping
- Ideally needs to live in the kitchen as it is the centre of the house
- ESP32 based as I still have a few Lolin32 lites
- Charging via USB, battery monitoring would be cool
What I ended up with is an extremely simple design that just comprises of 4 components:
- ESP32 Lolin32 lite
- HX1230 display (this is a display that was all over Aliexpress a year ago and is similar to the Nokia 5110 monochrome LCD). Not sure if is is still available but I have a few of theses still laying around and they are perfect for a low power, always on display
- Two TTP223 capacitive touch modules
- Some old LiPo batteries I still had from my PlaySport Camera - actually one of the first action cameras back when Kodak was still alive
As I am using the backlight of the LCD for notification there are no extra components needed.
The case is built from a few piece of laser-cut plywood but it could be built from mostly any material - only one cut-out for the display is needed. The capacitive touch buttons work reliably through a few millimetres of anything (apart from metal).
So how does it work?
The basic operation of BinPal is to connect to Google App Script every morning to check if there is a new task to be done and show it on the display. If there is a new task one of the 4 corresponding icon is highlighted (bio, paper, plastics, trash).
The user has the ability to select any icon (banana button) and delete the active reminder (bin button). If the reminder has not been deleted by 8pm, the backlight of the display starts to blink to draw even more attention to the open task.
Although this sounds rather simple, It required some trickery to pull off.
Get the tasks from Google:
Ideally one would like to pull the calendar directly from Google calendar but this proves to be rather difficult with ESP32. Instead we use a short Google App script that checks the Calendar for new recycling duties and provides the information via a REST API. This work-around also has the advantage that we can synchronize the time simultaneously without using an additional NTP service.
Sleeping beauty:
To be able to run a few weeks on battery at a time, the ESP32 needs to sleep as much as possible. However, the maximum sleep duration of the ESP32 is just over an hour so we need to make sure that if we wake up, we go right back to sleep again until it is time to fetch the calendar again. Additionally, the user might wake up the device in order to delete a notification or to check the battery monitor. All this combined makes it rather difficult to keep accurate time throughout the day. The solution for me was to heavily utilize the ULP processor of the ESP32 for time keeping as it can perform simple operations while the ESP32 is asleep. I use the ULP for blinking the LCD backlight and counting the seconds during sleep.
Although the ULP is supposed to run at 8MHz, the corresponding oscillator appears to be not that accurate. I therefore chose to calibrate the delay-loop within my ULP code at start-up to get a rather accurate one second count.
Battery monitoring:
To check the charging state of the battery and how much power we are using over time I added a simple battery monitoring screen that can be accessed by pressing both buttons at once. It adds one data point every 24 hours whereas the sketch randomizes all data on boot. So the picture shows about 14 pixels = 2 weeks of battery data.