RPi Garbage Bin Reminder

Updated 02 August 2018

Our local council picks up recycling bins one week and green waste the following week. Sometimes people forget which bins go out each week and perhaps they mistakenly put the wrong bins out. Not that that has ever happened to me of course!

I decided to put together a simple circuit and write a Python script for my Raspberry Pi to remind me whether it is recycling week or green waste week. A few LEDs, a resistor, a switch and a small breadboard are all that are required for this handy dandy bin night reminder!

Components

  • A Raspberry Pi (any type will do, so long as you have some spare GPIO pins free)
  • A 1k Ω resistor
  • A Red LED, Yellow LED and Green LED
  • A momentary button
  • Five jumper wires

Instructions

There's really not much to the electronics of this project. They all fit on a small breadboard of almost any size - I actually created my initial prototype on a 5x5 breadboard, but 7x5 or larger would be better. (If you have some stripboard or Veroboard you could solder this to make a more permanent circuit too.)

I have used three LEDs which are the same colour as the bin lids my council uses - Red for general waste, Yellow for recycling and Green for green waste. If your council uses a different colour scheme, just replace appropriately coloured LEDs.

The following Fritzing diagram shows the breadboard layout:

It may not be entirely clear in the above diagram, but the short leg of each LED is connected to the same row of breadboard pins and the resistor is also connected to the same row. The other leg of the resistor should connect to the ground pin (the black jumper in the diagram). The long legs of each LED should connect to different breadboard rows. Make sure that you connect the correct legs of your button - some buttons may be wider. so just shift the orange jumper to the correct column for your button.

I used jumper wires the same colours as the LEDs to make things easier for me to see what goes where and I suggest you do the same if you can. As you can see, I used the right-most five pins on my Pi Zero, but you can use other pins if you want - just remember to change the code to reflect the pins you have used!

Raspberry Pi GPIO pins are numbered in a funny way - counting back from the top, rightmost pin, the pins are GPIO21, GPIO20, GPIO16, Ground and GPIO12. If you choose to use different pins (maybe you have something else attached to these pins?) you will need to modify a few lines of the supplied Python code - just be careful to make sure you use a Ground pin for the black jumper. (The ground pins are marked in green in the above diagram.)

I used a Raspberry Pi Zero for my prototyping, but the final product will be used on my Raspberry Pi 3 B+. This should work fine on any model Pi so long as you have four GPIO pins and one Ground pin free.

Code

Download the attached code and copy it to your Pi. Make sure you change the RECYCLE_START variable at the top of the file! It currently has my recycling day set, but your day is bound to be different. The code assumes that one week is recycling collection, the following week is the green waste - hopefully, your council has a similar schedule! Set the value of RECYCLE_START to one day that is a recycling day. The recycling day I started this project on was the 27th of June 2018 and this is the date I have used in the code.

RECYCLE_START = datetime.datetime(2018, 6, 27)

If your recycling day was Tuesday the 3rd of July 2018, then change the line of code to:

RECYCLE_START = datetime.datetime(2018, 7, 3)

You can put any date of a recycling collection - even one from months or years ago and the code will still work. It just counts weeks from the RECYCLE_START date to the current day and works out which bins are due this week.

Usage

When you run the code, it will wait for a button press and will then light or flash the LEDs depending on what bins should go out this week. When checking whether it is bin day, the code counts how many weeks between RECYCLE_START and the current day - if that number is even, then it must be a recycling week, so the yellow LED will be lit. If the number of weeks is odd, it must be green waste week and the green LED will be lit. In either case, the red LED will be lit as well.

If the collection day is the next day, the LEDs will flash slowly as a reminder to put your bins out tonight. If the collection day is today, the LEDs will flash at a faster rate - you may be too late to put your bins out!

I have this code running all the time on my Raspberry Pi 3 B+ which I use as a media server, so with a simple press of a button, I can see which bins are due out this week, or if I need to put them out tonight. Not that I would ever forget... ;^)

Here are some pictures of my demo board:

This is the finished breadboard

Finished Bin Minder breadboard

This week is recycling week (yellow bins).

(The red LED appears a lot brighter in this photo that it really is - because of the angle it is sitting it is shining right at my camera.)

Putting it All Together

Now that the prototype is working, it is time to make it a bit more permanent. I have several Raspberry Pis to play around with and the Zero in the pictures above is one of my "development and hacking" machines. I also have a Raspberry Pi 3 B+ which I use as a file server, Git server and a few other roles. This Pi 3 B+ sits on my desk and is always running, so it is the ideal machine to add this Bin Reminder to. I have this really nifty, fan-cooled case which keeps my Pi 3 B+ nice and cool, so I decided to mod the case to hold the LEDs for my Bin Reminder.

First, I carefully drilled some mounting holes for the LEDs and using some LED Holders to make it look pretty. Depending on the size LED you choose, I would recommend either the 3mm Plastic Bevel LED Holders or the 5mm Plastic Bevel LED Holders, as these add a nice, professional look to the project. (Plus they help hide any rough edges if your drilling is not so neat.)

Next, I soldered some wires to the long legs of the LEDs. For this, I used some spare jumper wire I had - the kind with the female headers on the end (like these) - so I could easily plug the wires into the GPIO header when I was done. I cut the long legs of the LEDs short first and slipped a piece of heat shrink tubing over the wire so I could make sure there was nothing that could short out. (If you don't have heat shrink tubing, some electrical tape will do.)

Once the jumper wires were soldered on, I inserted the LEDs into the LED holders and then bent the remaining legs over so they touched each other. Trimming the legs to size, I applied a little dab of solder, connecting all the legs together. Then I soldered my resistor to one end of the LED legs and another piece of the jumper wire to the other end of the resistor. My soldering is not the neatest, but it does the job. Here's what the finished LEDs construction looks like inside my case:

You may notice that I appear to have left out the button. I am not going to mount a button in my case. Instead, I will feed the wires for the button through a slot in the side of the case and use that as a temporary solution. I hope to get a capacitive touch sensor and will try to work out how to mount that inside the case, so I can just touch the side of the case to trigger the code. So, for now, I am willing to live with some bodge wires coming out the side of my case.

The final wiring looks like this:

You can see my "floating button" hovering in the front. When I closed the case up, it looks nice and neat (with the exception of the button, but that is only temporary.) Hey look - the green waste bins go out this week!

Now my little Raspberry Pi 3 B+ server can tell me which bins are due to go out this week at the press of a button.

Other Options

There is a multitude of different options you can take with this project. You might want a dedicated Pi Zero in a small case, or if you have a PiStop, you can use that for your display. The PiStop looks really cool, and the LEDs are very bright!

Another option might be to try modifying the project to work with the Tower Light - Red, Yellow and Green alert lights! This would look awesome mounted outside above your bins, however, you would need to be careful hooking the Tower Light up to your Pi as the Tower Light requires 12V and you would need an external power supply for the lights.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.