Introduction: Wifi Wheelie Bins & Google Calendar
This project was inspired by videos by Andreas Spiess (You Tube).#185 ESP8266 - Google Calendar Reminder: How To Make Your Wife/Girlfriend happy (Arduino) & # 189, an updated version.
The project in Andreas's case was to ensure he had completed all of the tasks his wife had asked him to do.
He uses Google Calendar to record the tasks. Google Calendar sends an email as a remin der for a specific event, at the time and date specified. In our case, an event is a task.
Andreas's project uses the reminder to turn on an LED! The LED will remain on, regardless of the state of Google Calendar until the LED is manually switched off when the task is complete (e.g he has loaded the washing machine).
I used the code to remind me which wheelie bin to put kerbside each week as they are emptied on alternate weeks, blue bin (recyclable) one week then the black bin(general waste) the next.
Being lazy, I did not want to press a button to switch off the LED, so now, when I tilt my wheelie bin to take it to the kerbside, it connects to the internet, writes to Google Calendar which switches off the LED for me!
Step 1: How It Works
An event (task) is created in Google Calendar.
A script is created in Google Calendar
Google Calendar is checked every so often by an ESP8266-E12 wifi chip.
If either the word 'blue' or 'black' is returned by the script, an LED is switched on.
Pressing a switch will turn the LED off
In my case, tilting my wheelie bin powers up an ESP8266, which connects to Google Calendar & checks to see if the words 'blue' or 'black' exist.
If 'blue' is returned, the wheelie bin writes 'Azure_OK' and the battery voltage to the calendar, this then turns the LED off.
If 'black' is returned, the wheelie bin writes 'Noir_OK' and the battery voltage to the calendar, this then turns the LED off.
Step 2: The LED & Switch Hardware
Project box glued to an old phone charger for a 5v supply.
1 x ESP8266-12e
1 x 5v to 3v step down (AMS1117) device
2 x 180 ohm resitors for LED current limiting ( I just happened to have these values)
2 x Tactile Push Button Switch Momentary Tact 12X12X7mm With LED lights (eBay)
Hot melt glue gun.
The LEDs are connected to pins 4 & 5 (via limiting resistors) and the switches to pins 12 & 13 of the ESP8266.
The other side of the switches & LEDs go to 0v.
Because the ESP8266 is so versatile, very few components are required !
The 5v from the phone charger is stepped down to 3v via the AMS1117.
The software does the rest - see Reminder_org_TR_instruct.ino
The tactile switches with built in LEDs are great, but the only method of mounting them in the project box is with hot melt glue !
Step 3: The Wheelie Bin Hardware
1 x project box ( I 3D printed my final version)
1 x ESP8266 - eBay
1 xCR2 battery (3v) - Amazon
1 x set battery springs/connectors - eBay
1 x tilt switch - I originally used mercury tilt switches but they were a tad temperamental so I opted for the ball bearing type. - eBay
1 x PNP general purpose transistor - I used a bc557 but pretty much any pnp will do ! - eBay
1 x Self latching relay 3v twin coil -RS Online 683-9873 ** NOTE** the picture on the RS website shows this as a 24v relay, however, the description clearly states 3v (I've had 5 in total) ! Also, this is a surface mount relay. I did manage to find a pcb mount but it was twice the cost !! This relay has two coils, one coil to set the relay and another to reset it.
There are other self latching relays on the market, however, the set / reset is usually done using just one coil by reversing the polarity of the operating pulse - doable, but a little more hardware required.
The circuit draws zero current when in standby ! ( I have used this circuit several times and it is great for battery operated projects which use any form of non electronic switching, eg magnetic reed relay switch, tilt switch, momentary action switch).
When the tilt switch is activated, the relay is 'set' thus supplying power to the ESP8266 and sets pin 5 of the ESP8266 high which keeps the transistor turned off. After the ESP8266 has connected to the wifi and sent information to Google Calendar, Pin 5 of the ESP8266 is pulsed low which turns the transistor on which resets the relay and powers the unit down!
NOTE - I made these units last August (2018), the circuit diagram has been drawn from memory, but it looks ok :-)
The units are attached to the bottom of the wheelie bins, fortunately there is a recess in the bottom of the bins which makes a nice safe weatherproof home.
Step 4: The Sofware
Well, here is where my ignorance shines through !!
The .ino files attached are a modified version of Andreas Spiess. Lots of the unnecessary code has been commented out. I have attached copies of my .gs files too. Most was trial and error!
I strongly recommend you watch these videos Video #185 & Video #189 if you intend to do something similar as he has a Google Script file which is available on his GitHub site along with his .ino files which will be easier to read and modify than mine!
As of a few months ago, my wife and I have to order our medications on line, my memory is not great so I intend to set a task on Google Calendar which will switch on a bedside LED to remind me when to reorder.
If this project is accepted in the REMIX contest and you think its worthy, please give me a vote !
Many thanks :-).
Participated in the