Close
0%
0%

Bin Monitored

Has your bin been blown over in the wind? Did the delivery person leave a parcel in it? These and more questions answered with Bin Monitored

Similar projects worth following
Bin Monitored is a small internet connected device that sits inside of your wheelie bin lid and keeps an eye on your bin for you.

On a windy day Bin Monitored can tell if your bin has fallen over and your rubbish or recycling is about to be blown down the street.

With lid lift sensing Bin Monitored can notify you if the lid has been opened. Maybe a delivery person has left a parcel for you in your bin, or perhaps one of your neighbours is putting their rubbish in your bin!

Using a laser distance sensor Bin Monitored can tell how full your bin is, combined with a backend service, you can track if your recycling to landfill ratio is improving.

The Bin Monitored system is intended to be self contained and mounted on the inside of a wheelie bin lid. It should be easily removable so it can be removed before rubbish collection, hopefully preventing the possible loss of the unit.

  • It has Internet connectivity via onboard WiFi through an ESP-12.
  • If the lid is opened it can notify you in case a parcel has been left in the bin, or somebody is putting their rubbish in your bin.
  • It can measure how full the bin is using an Infra Red TOF laser sensor.
  • On a windy day, it can notify you if the bin has fallen over, hopefully being rescued before the contests are all down the street.
  • It can measure environmental conditions, and if in a sealed case, warn of moisture ingress.
  • EEPROM memory allows detailed logging of environmental conditions if required.
  • A volatile organic compound sensor could warn of rubbish being placed in the bin that isn't permitted (i.e. paint in a recycling bin).
  • It is designed to have air flow around it, whilst also protecting the PCB from water during cleaning of the bin.
  • Low power consumption (being in deep sleep mode most of the time and only transmitting via WiFi when needed) for long life battery power.
  • LED indicators can be used to indicate if the bin needs to be taken out for collection. (i.e. open the lid and the "Bin Day" LED will light if the bin is due for collection).

BinMonitored.zip

Source code (Compile in Arduino IDE with generic ESP8266 module selected).

x-zip-compressed - 12.73 kB - 10/01/2018 at 02:57

Download

BinMonitoreLidFull.dxf

Laser cutting file for a full width lid

AutoCAD DXF - 79.69 kB - 10/01/2018 at 00:04

Download

BinMonitoreLid.dxf

Laser cutting file for the smaller lid which fits inside the enclsure lip.

AutoCAD DXF - 80.03 kB - 10/01/2018 at 00:04

Download

BinMonitoreLid.svg

SVG original for Laser cutting file

svg+xml - 3.93 kB - 10/01/2018 at 00:04

Download

BinMonitoreLidFull.svg

SVG original for Laser cutting file

svg+xml - 4.12 kB - 10/01/2018 at 00:04

Download

View all 16 files

  • 1 × VL53L1 TOF distance sensor.
  • 1 × MMA8452Q Accelerometer
  • 1 × 2mm JST SMD battery connector
  • 1 × Blue LED 1206
  • 1 × Red LED 1206

View all 15 components

  • Results So Far...

    Stephen Harrison10/01/2018 at 02:55 0 comments

    I've had two bins fitted with a Bin Monitored for 10 days or so, one is fitted to my blue (recycling) bin, and another on my black (general rubbish) bin.

    Unfortunately with the blue bin monitor I believe I broke the accelerometer whilst debugging my code, or maybe it was one from the duff AliExpress batch and never really worked well. Either way it doesn't appear fully functional and often "latches" in a certain orientation.

    The Black bin unit has been running in high power mode, sending data via WiFi ever minute, so the battery has been going flat regularly, and annoyingly I fitted the battery monitor resistors the wrong way around so it always reports a full battery!.

    I've not as yet deployed a unit to my green bin, this is still on my desk for firmware development.

    Dashboard:

    I created a little dashboard in Tinamous so I could see how full my bins were. I'm sure you'll appreciate the blue line used for the black bin, and black line used to indicate the blue bin, this is some unfortunate default colours applied to the chart which plots the primary field (PercentageFull) for any device tagged "BinMonitored".

    Bin Opened Notifications

    The screen shot below shows the Tinamous timeline for the black bin monitor which posts notifications when it detects the lid is opened or it thinks the bin has fallen over (in this case, it is me removing the unit to replace the battery). Tinamous can be configured to send a text message, email or other notification when a status post is published containing certain text, so we can use "Lid has been opened" to trigger the sending of a text message to myself so I know a parcel may have been left for me.

    Rubbish Level Tracking

    The rubbish level sensor has work well, unfortunately the chart is not so interesting, as you can see a week ago my blue bin was full!

    I was a little unsure how the rubbish level in the black bin would register as I use black bags for my rubbish in that bin, however the IR sensor appears to work well with that, the chart below shows when I added some more rubbish to my black bin...

    Environmental Monitoring

    I didn't fit a BME680 to the black bin unit as I wanted to asses the impact on battery life without that sensor, however the blue bin sensor has been working well, I'm not sure it's any use for bin monitoring, but it does make a nice outside "weather" sensor.

    I still have no idea if the VOC gas sensor will be any use for Bin Monitored, I've not yet deployed a unit into my green (compost) bin which might be a little more interesting. However Bin Monitored may be suited to a garage monitor system, attached to the door it could detect of the car is in the garage, if the garage door is up, and using the gas sensor, if their are any dangerous vapours in the atmosphere, for example if the car was leaking petrol, or if the engine was running with the doors closed. (I don't know how it would respond to CO, and I've got no intention of finding out!).

    Overall I'm pleased with how well it is working, especially for a first version. Battery life is a problem, but I'm currently running both my units in a fairly high frequency wake and send pattern so it should improve. 

  • Low Power - I Stuffed Up!

    Stephen Harrison10/01/2018 at 02:22 0 comments

    The ESP8266 features a very nice deep sleep mode where the entire module sleeps, consuming only nano-amps until woken, either by the on-board RTC or some external factor, this is ideal for Bin Monitored, it could sleep all day long, waking only occasionally to send an "Im still alive" signal and how full the bin is, or be woken by the accelerometer if something interesting happens.

    This was my first time trying to use the ESP12 in low power mode and I got a few things wrong. Quite a few things...

    I connect GPIO16 to the reset pin to allow the RTC to wake the ESP when in deep sleep mode as per the datasheet, this works well....

    So I figured I'd do the same with the accelerometer. I could program INT2 to go low and reset the ESP, so waking it when an interesting event occurred...

    Yep, you guessed the obvious problem, the MMA8452 latches the interrupt output, it's not pulsed and is only cleared when you read the appropriate register, so if INT2 ever gets asserted it will keep the ESP in a reset state. Not so great. 

    I had also planned to route this via a 0R resistor link so I could remove it if my plan failed. I forgot that! Fortunately as long as the firmware never configures INT2 it doesn't affect the processor, but I'm only ever one bad firmware deployment away from making a brick, one square inch in size :-)

    Going forward, I can either modify the circuit so the asserted interrupt causes only a pulse on the reset line, or try and use the enable pin (pin 3 - CH_PD) on the ESP to wake the device.

    Mostly Sleeping...

    However for now I have no way to wake the ESP from deep sleep when an interesting even occurs, so instead I sleep the ESP for a short time (1 minute in this case), when it wakes the startup routine checks the ACCEL_INT pin (GPIO13), if it is asserted then the accelerometer has registered an event (lid opened) and further investigation is needed.

    The accelerometer is configured so that an interrupt is generated if motion is detected in the Y axis. When the lid is opened the accelerometer is orientated such that acceleration due to gravity is through the Y axis (it's normally through the Z giving -1G). This "motion" caused by gravity is enough to tell the lid has been opened. Additionally the sample rate of the accelerometer is slowed down to save on power.

    Detecting if the bin has fallen over is a little more tricky so I decided to do this detection only on occasional intervals and keep the interrupt strictly for the lid being opened.

    The initial part of setup code for the ESP is below. It checks to see if the accelerometer has interrupted, then it checks the time to see if the bin level / environment should be checked and then updates the fake RTC to track time. If no action is required the ESP goes back into a deep sleep as fast as possible. This takes a few hundred milliseconds and still contains (as you can see) a lot of debugging code!

    void setup() {   
      pinMode(ACCEL_INT, INPUT_PULLUP);
        
      pinMode(BIN_DAY_LED, OUTPUT);
      digitalWrite(BIN_DAY_LED, LOW);
    
      pinMode(STATUS_LED, OUTPUT);
      digitalWrite(STATUS_LED, LOW);
    
      // TODO: Only use serial during debugging.
      Serial.begin(115200);
      Serial.println("");
      Serial.println("====================================================");
      
      bool shouldSleep = true;
    
      Wire.setClock(400000);
      Wire.begin();
    
      // Read the configuration early.
      readConfiguration();
      
      // Check accelerometer interrupt to see
      // if something interesting has happened.
      if (hasAccelerometerInterrupt()) {
        // Handle accelerometer event...
        // most likely lid opened.
        // Motion setting lost when accelerometer is initialised.
        shouldSleep = false;
        lidOpenedCount++;
        // Cap at 100 to keep the number within a byte
        // so we don't overflow to 0.
        if (lidOpenedCount>100) {
          lidOpenedCount = 100;
        }
        // Only connect/send on the first open.
        shouldConnect = lidOpenedCount == 1;
        lidOpened = true;
      } else {
        // Lid closed, reset the counter.
        lidOpenedCount = 0;
      }
    
      // read the RTC value from EEPROM,...
    Read more »

  • Enclosure - Quality Product, defiantly not a bomb...

    Stephen Harrison10/01/2018 at 01:26 0 comments

    After a number of tries I finally settled on a 3D printed enclosure. This design has an outer lip so either a 3D printed lid can sit inside or a 3mm acrylic can, then a 3D printed lid on top of that. I've used heatfit M2.5 brass inserts to allow the lit to be removed easily to recharge/replace the battery.

    With this lid. This isn't water proof as the hole in the lid goes directly to the PCB.

    Alternative acrylic lid, you can see the PCB here doesn't have the BME680 fitted, I was trying a few variants to try and reduce power. The acrylic made no noticeable affect on the IR distance sensor, but provides a nice splash resistant covering. With this design I've created a larger lid to go over the top. As much as I like seeing inside, it may well look very suspicious to somebody else!

    One of my concerns with Bin Monitored is it surviving the bin being emptied and then pressure washed clean. I'm in no hurry to find this out so opted to mount the Bin Monitored in my bins with Velcro. I cleaned the bin lid first with IPA to ensure the Velcro had a good surface to attach to.

    I attached the other side of the Velcro to the back of the Bin Monitored enclosure and mounted the unit. This allows me to easily remove it to replace the battery and to remove it on bin days.

    My other concern was that the waste collectors may mistake the device for an explosive device, we recently had a bomb scare in Cambridge city caused by a students improvised air quality monitor, I don't want a repeat of that so removing the device before rubbish collection works well!!!

  • AliExpress Special Accelerometers

    Stephen Harrison10/01/2018 at 01:09 0 comments

    As I described in my previous build log, I messed up on the first PCB, however I reworked this to correct my mistake, but when I powdered the board up it was tripping the current limit on my bench PSU (set to 100mA), I assumed (incorrectly) I had messed up the distance sensor when I rotated it. As it turns out, the accelerometer was faulty.

    Moments after sending the files to OSH Park for this project I went to order the parts only to discover the accelerometer I used was out of stock everywhere. I knew I had one in my parts bins but I wanted more. Fortunately, or unfortunately as the case should be, I managed to source 20 from a seller on AliExpress. I took no notice when assembling the first PCBs to the state of the pads on the accelerometer, but after some fault finding I decided to take a closer look. Photos below with AliExpress sources accelerometers on the left, and the new one i had from Farnell.

    As seen through a little microscope...

    The accelerometers have clearly been used and then removed, they were repackaged in tape to look original, I got lucky on the second one, but the first never worked, and to make matters worse, I found a stash of 10 new ones when I went to assemble a few more boards so I didn't even need the ones I ordered from AliExpress in the first place!

  • PCB Assembly.

    Stephen Harrison10/01/2018 at 00:53 0 comments

    Before:

    After (I only made up 2 boards initially):

    I'd like to say PCB assembly went easily and the PCB worked first time, it almost did, except shortly after I started reflowing the first PCB I noticed I had the distance sensor the wrong way around so I immediately put that PCB to one side. However the second PCB came out a treat and did work first time :-)

    As you can tell from the very purple colouring of the PCBs (and the sticker!) I got the PCBs from OSHPark, I had a stencil made for the top layer at OSHStencils. Each PCB is 25.4mm x 25.4mm (it's almost as if I'd designed them to fit within the Hackaday Square Inch Contest....). 

    The accelerometer, distance sensor and environment sensor are not at all hand solderable so this was always going to be a job for a stencil and reflow. Theirs only a few easy components on the bottom layer so I hand soldered that.

    I carefully aligned the PCB with the stencil and applied solder paste.

    And used the Steve-Pick-And-Place-Machine to populate the PCB (i.e. me and a pair of tweezers) .

    Then I used my ReflowR to reflow the PCB...

    The nice thing about the ReflowR is you can set it to hot and then remove / rework components if needed. Some time later I did this to the first PCB that I had the distance sensor the wrong way around on. Sadly shortly after that my ReflowR stopped working.

    Populating the bottom layer of the PCB is much easier and I did this by hand soldering. The JST socket is probably a little overkill but it was handy during development and testing, however for a final product the battery holder is probably just as well soldered to the PCB. Notice also the solder pads for TX, RX, D0 and GND used to program the ESP 8266.

  • Perfect Timing

    Stephen Harrison09/18/2018 at 09:15 0 comments

    I've been after a photo of wheelie bins on their side for this project since I started and didn't really feel like staging it, whilst playing with lower power standby this morning the familiar sound of wheelie bins falling over came through the window...

    Indeed, my neighbours bins are on the floor, fortunately freshly emptied so no litter getting blown down the street, had this been the day before it would have been a different story. 

    Bin Monitored could have saved the day notifying my neighbours their bins had fallen over....

  • Design Introduction

    Stephen Harrison09/13/2018 at 02:19 0 comments

    There are plenty of bin monitor projects around, however none of them really matched my requirements, so I decided to make my own, this log hopefully gives an insight to my thinking.

    Schematic:

    Distance sensor:

    Most bin monitoring projects I've seen use ultrasonic sensors to sense how full the bin is. I don't really like these because my bin gets washed once a month and those sensors need an opening for the sound waves to travel through which will result in water ingress to the sensor and the whole system. 

    I decided to use the VL53L1 Time of Flight sensor, that uses an Infra Red laser to sense up-to 4 meters in distance, this can be placed behind something (IR) transparent which would allow the system to be sealed (although at this time I've not tested this, however I plan to use something like acrylic as the enclosure cover so it should be OK and I'm not bothered by accuracy, just an approximate relative change).

    The down side is my general rubbish (black) wheelie bin has the rubbish in black bags in it, these may not reflect IR well enough for the sensor. However I'm mainly interested in monitoring my recycling (blue) wheelie bin which contains loose recycling (cardboard, bottles, cans, tubs etc.), and I'm sure I could switch to different bags for the general rubbish.

    Lid Lift Sensor:

    My blue bin is used for recycling so it's generally clean on the inside, this makes it a good place for delivery people to leave parcels, not all do, but if I'm expecting a parcel and I've gone out I leave a note to get the delivery left in my blue bin rather than disturbing my neighbours, or missing the delivery and this works well for me.

    Whilst I'm not too bothered about knowing when the parcel arrives, it would be very easy for the delivery person to leave a parcel in one of my bins and forget to put a note through the door to tell me, this could easily result in my parcel getting put out for rubbish collection by mistake. With the lid lift sensor I can get a notification if the lid has been lifted which hopefully means I've got a parcel waiting for me!

    Alternatively it may also mean that my neighbour is using my bin for their rubbish, given we have limited space in our bins this could be very frustrating so this also would prove useful.

    I chose a MMA8452Q accelerometer, purely because I've used one before and had a few breakout boards for it, it's got a good range (0-2 to 0-8G) acceleration sensing and a couple of interrupts so it can be used to sense a change in acceleration without the micro controller having to run constantly, which is great for a low power solution. (Side note: I sent the PCB design to OSH Park off before ordering these, and it turns out none of the usual suppliers (Farnell, Mouser, etc.) expected to have them to be in stock before the square inch contest deadline - Epic Fail!, fortunately I managed to pick up some from a seller on AliExpress!

    Normally the lid being closed would result in a -1G being registered on the Z axis, when the lid is lifted this acceleration should increase (more +ve) and would then move to the the X or Y axis depending on part orientation, then possibly to +1G on the Z axis as the lid is at 180° and again to the X or Y axis if the lid goes all the way back (i.e. this typically happens when  it is being emptied). By sensing the transition from -1G Z to +VE Z and then X or Y acceleration we can tell if the lid has been opened, it should be possible to set the accelerometer to sense the change in acceleration and then register this in the micro-controller.

    Bin Down Sensor:

    This uses the same accelerometer as the lid lift sensing, again by sensing acceleration in an axis other than the Z axis it can be determined if the bin has fallen over and may be allowing all the contents to get blown down the road in the wind. Notification from the system would allow me to rescue my bin before the street is a mess (I don't always have a direct view of my bin, so the obvious,...

    Read more »

View all 7 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates