A few weeks ago, I entered a small design competition with a group of friends. I was responsible for the prototype. Essentially, we had to design a mechanism for garbage bins (you know, those bins you place outside your house filled with garbage). Thing is, the garbage is actually an all-you-can-eat buffet for prowling masked rodents – a.k.a. raccoons – at night. So the mechanism had to be designed in a way which would prevent raccoons from creating a mess on your front lawn by toppling over your garbage bin and spilling the contents. Interesting problem, I suppose. Before I describe the prototype, here is a quick video demonstrating its operation:
Alright, so as you can probably tell, the prototype is fairly straightforward. I will describe this device in a little more detail now.
In terms of the physical construction of the device, all I used was foam and some clear acrylic sheet. Foam is very easy to form, and the acrylic was just scored and snapped – simple. It is important to note that I completed this entire project within about 6 hours – which was definitely not enough time to do things comfortably … for me anyway. I think I will have to start getting used to these rapid engineering/prototyping projects, because doing these things with schoolwork in tandem is not easy. But I digress.
In terms of the electronics, I used:
- Microcontroller: ATmega8 (any microcontroller will do, I just had this one lying around)
- Programmer: USBasp
- Servo: HXT900 (from Hobbyking, though any small servo will do)
- 1x Light Dependent Resistor
- 2x Tactile Push Button Switches
- 1x Green LED
- 1x L7805 Voltage Regulator
- 1x 10uF Capacitor
- 1x 100uF Capacitor
- 1x 9V Battery
- 1x 470 ohm Resistor
- 2x 1.2K ohm Resistors
Pretty common stuff for any engineer. I used the WinAVR/avrdude toolchain to program the microcontroller in a Windows environment. Here’s a snap of the inside of the ElectroBin Lock:
Here is a link to the code I whipped up for this project. Feel free to use it!
Description of Design
Alright, so what does this funky lock do, exactly? Well, we know that it is supposed to stop raccoons from entering the bin (i.e. knocking it over, and opening the lid). So in reality, the two buttons you see on the prototype would be placed on either side of the bin. That way, for a human it would be easy to actuate the mechanism by holding the bin with both hands, but since raccoons don’t have that kind of dexterity or wingspan, it’s not possible for them to press both buttons at once. Ian Malcolm may argue that “life finds a way”, but I’m not banking on it Interestingly enough, the only way to open the lock is by pressing both buttons! So problem solved there. Before I explain the purpose of the LDR, let me describe where the inspiration for this came from.
In one of my classes, a professor was telling us that in factories or facilities with dangerous equipment, there usually are two mechanisms to turn the equipment on. The two mechanisms (say, two key operated switches) are placed too far apart for just one person to activate both at once. In other words, you must have two people authorize the operation of the equipment – whatever it may be. I tired to mimic that exact concept in this design.
Back to the LDR. The LDR basically detects whether it is day or night outside – that’s it. So the purpose of this feature is that if the home owner accidentally forgets to lock the bin, as soon as night falls, the bin will automatically lock itself. Being the silly guy I am, I forgot to implement an override system. So the current design will not even allow the home owner to open the bin at night – unless they take the bin into a lighted environment. This is really easy to fix with a single line of code – but maybe some other time.
A question I was often asked about this system was the power consumption and the power source. Although I am using a 9V battery here, I would actually use a LiPo. The bin’s battery could be easily recharge at home (it really only needs to be active one day a week). Also, I would use a MCU which consumes a lot less power – maybe something like the MSP430. Using a more appropriate power source would eliminate the need for the voltage regulator as well, which wastes power.
Lastly, the economics. I must admit, having this setup in an actual bin may makes it prone to theft. I mean, if you were a student like me and noticed a reprogrammable microcontroller, servo, LiPo, LDR, and buttons nicely placed on everyone’s front lawn every a week … well, you can guess the rest! Seriously though, the electronics used would be far cheaper and optimized for minimal energy usage. This device, as it is, is too expensive for garbage bins in my opinion. I have several ideas which would bring the cost down though, so let me know if you are interested in them.
So, that’s the ElectroBin!
There was really only one problem I experienced with this design – and it was purely a result of my stupidity and the limited time I had to make this. I noticed that this prototype, even when it was “off” was eating through batteries like there was no tomorrow. What gives? I mean, the device is turned off! Realistically, the device would always be on in low-power mode, but this prototype was only supposed to be on and consuming power when I pressed the button on the left.
I then took a quick look at the design again, and discovered the problem. I placed the on/off switch after the voltage regulator circuit! What this meant was the battery was charging/discharging the capacitors in the voltage regulator circuit constantly (these aren’t ideal capacitors, of course, so energy is lost). Anyway, I had no time to fix this as I had to leave town for a conference the next morning, and left it as is. Since I did not breadboard this circuit (it was all soldered to a perfboard), and everything was already affixed to the interior of the enclosure, it would take some time to solve the problem. I also did not want to risk anything else going wrong, as the device was working as expected for demonstration purposes.
- Allow the bin to be opened at night (i.e. implement a manual override)
- Use a lower power MCU (i.e. MSP430)
- Use a LiPo (rechargeable) instead of a bulky and useless 9V
- Use an RTC (real time clock)
This is actually an interesting idea. The RTC could be programmed when the city delivers the garbage bins with the times at which the bin should be locked (i.e. between 2200 and 0600) preloaded. Of course, there would have to be a way to reprogram this easily, because timings do change. Also, the RTC should not use a lot of power. This is just an idea, but probably not very feasible or necessary.
- Use something other than a servo (bulky, expensive, wears out eventually – perhaps a magnetic lock?)
Thanks for reading! Don’t forget, you can download the code for this project too, or check it out below: