Internet of Trash

Trashcan sending the data to the internet!

Similar projects worth following
We are not going to automate entire process of garbage disposal just yet.
In this project, we are going to collect the data from a trashcan, and publish them to the internet.
The information provided can be used to vastly improve garbage collection over a city.
In particular, we are going to internetize one container for five types of assorted garbage.

The device is consists of ultrasonic rangefinder(s), arduino uno, SIM808 GPS/GSM module, LiIon battery, backed by a solar panel, and a temperature sensor for good measure.

So, the device's sonar pings at least once a day, connects to GSM network, and sends measured distance to the server - the information on how much garbage is collected.
Other must-have information are GPS location of the device, and unique ID.

We are going to develop a server to receive the data, and we are going to display the collected data on a map, on the web.
All open source, AGPL license.

So, is the trashcan full?

First thing we need to know is the height of an empty trashcan, so the first thing to do when the device is turned on for the first time is send a few pings and remember the distance to the bottom. Subsequent pings will show shorter and shorter distance. Once the distance goes back to around what we measured as empty, we know that the can was emptied. Sherlock stuff right there.

We use cheap and simple to use HC-SR04 ultrasonic rangefinder sensor modules to measure the distance. Arduino sends the impulse, measures the time to echo, and calculates the distance from average speed of sound.

Where is the trashcan?

Built in GPS device gives quite precise directions. AT+CGNSINF command sent to SIM808 returns a total of 21 comma-separated values, most importantly run status (is it on), fix status (did it find out it's poisition), UTC time, longitude and latitude. Things like altitude, speed, course and such are less important in this case, as we are working with stationary objects. UTC time comes in handy though - we don't need an RTC.

SIM808 module is connected to Arduino's general data pins, and controlled via software serial. This setup leaves hardware serial available for debugging.

Is it really working?

Now that's a tricky question. Moisture is a big issue for electronics, and trash inside a tin can is sure to get some condensation going. But this is out of scope for our prototype.
The other issue is temperature: while Arduino and SIM808 are declared to work in -40 C to +85 C range, HC-SR04 works from about -15 C to +70 C. So, leave your trashcan in a sunny spot on a sunny day, and our device might measure whatever. But the temperature also affects the speed of sound, and we need to take it into account for distance calculations. So we added a temperature sensor brick, based on TTC3A103.

Power sources

Main power source is a 1200 mAh Li-Ion battery, plugged to SIM808 module, that also powers up Arduino. It should allow for more than two hours of peak consumption during data transfer. Supposing the station works a minute every day, it should have enough juice for 200+ days of data collection.

But yet another nice thing with SIM808 is, it's got a micro USB plug, and we got an USB solar panel. Battery charging is enabled by a simple AT command, and it's smart enough to charge the battery only when solar panel provides enough voltage.
And there you go, we got self-sufficient electronics.

Sending the data

SIM808 includes a GSM module, with HTTP available via AT+HTTPPARA command. To make things real easy, we are using simple HTTP GET to deliver all the data.
Request parameters are:

stationId - some unique station identifier, preferably MSISDN read from SIM card
gpsInfo - whatever was returned by AT+CGNSINF
temp - temperature measured
can[1-5] - distance measured in containers 1 to 5.

For example,,1,20160808171812.123,10,20,100,0,0,0,0,0,1,1,1,0,5,3,0,10,100,100&can1=10&can2=20&can3=30&can4=40&can5=50&temp=31&stationId=HackadayTest

Collecting the data

A simple Java servlet listens for incoming HTTP requests and stores everything to the database. Request is parsed and parameters stored to a single database table. We use Hibernate, so it should work with any database, though we use posgresql.
To make things easier for anyone willing to experiment, the servlet is open to public at our server: - all request parameters are optional, but make sure to include stationId, or you won't be able to fetch the data.

Getting the data

There's a few more servlets to display the data, and all require stationId parameter.
Download servlet makes a CSV file containing all the available data for a station.
Last servlet returns last data for a station, as a JSON string.
StationList servlet returns the list of all known stations, as text, one station per line.

Again, they are available to public:

Read more »

Pin mapping.pdf

Table of pin connections and short remarks

force-download - 369.33 kB - 08/22/2016 at 10:25



Controller box floor plan

Adobe Portable Document Format - 64.09 kB - 08/19/2016 at 16:48



Logical organization of parts

pdf" - 72.32 kB - 08/17/2016 at 12:24


  • 1 × Seeeduino Stalker v3.1 A cheap Arduino UNO derivative with adjustable logic level (3.3v or 5v)
  • 1 × Sensor shield Convenient breakout for arduino pins with electronic brricks interfface
  • 1 × Mini USB cable Gotta program it somehow
  • 1 × SIM808 GSM GPS GPRS module (Itead) Breakout for the sim808 chip with a battery charger, antenna connectors and control pins
  • 1 × GSM antenna GSM antenna with u.FL cable

View all 17 components

  • after 5th prototype

    mikrotron07/26/2017 at 13:18 0 comments

    After 5 prototypes built and field-tested, here are the conclusions.

    One thing wrong with our hardware setup was battery: a half-empty 1200 mAh battery doesn't give enough juice to power-up SIM 808. So we upgraded to 4400 mAh, and our device became fully self-sufficient.

    A few bugs in firmware fixed, wake-up timer set to 4-hour period.

    There's a couple of bad things specific to GSM networks and modules though.
    While we cannot do anything to fix them, we can do a couple of things to live with them.

    First of all, SIM cards have PINs. Makes sense for human-operated devices, but for stand-alone self-sufficient things, not so much. Bottom line, PIN has to be hardcoded in the firmware. Easiest way to get rid of PIN is to insert SIM into a smart phone and disable the PIN, exact steps are specific to device model.

    Then, we used prepaid SIM cards of various mobile operators, and they all wasted all available credits on very first day.

    You wouldn't expect sending a few kB of HTTP requests cost a few EUR eh?

    Well, that's how bastards steal from their customers: you have to register SIM for data traffic, or else!
    Registration itself is sending a specific SMS from device containing SIM card to some proprietary number.

    Again, do that while SIM is in your phone.

    But of course, that kind of issues is why we have LoRa and Sigfox and stuff.

    In our case, GPS is must have, and HTTP is very nice to have, and SIM 808 has them both.

    That would be all for the time being. You may still hear from us improving software eventually.

  • Steps towards a commercially viable device

    Tomislav Mamić12/06/2016 at 13:05 0 comments

    Over the past few weeks, both good and bad things about the current hardware configuration of ecotron became apparent. Electronics turned out to be very reliable, method of mounting the thing into actual trash cans proved vital for our long-term mental health, power turned out to be a big issue.

    During the summer, I conclude, the device could operate for long periods of time, but as the days grow shorter and sun drops lower, the amount of power our solar panel collects just isn't enough to cover for the losses in idling hardware. I've tried to minimize the idle current, but down to about 10-15mA is as low as I dropped with the current hardware. The pieces used just aren't meant for low power applications, so saving power would require a complete redesign of the device. This has to, and will happen at some point in the future, but not immediately.

    Furthermore, since the battery chosen for testing purposes barely cuts the peak current draw, choosing a bigger one with more leeway in maximum current is a must. To make up for the idle power loss, choosing a bigger solar panel will work as a band-aid solution.

  • Stalker 3.1 testing

    Tomislav Mamić11/02/2016 at 11:56 0 comments

    After running the device over the weekend, sending reports every hour, we finally got some battery data from the new Stalker 3.1. While there is a noticeable improvement (roughly 25%), taking into account the effect of our solar panel during cloudy weather, we were still losing 0.66% battery per hour on average. During the summer, we'd easily make up for lost power via solar, but it just won't suffice in these long winter days.

    That said, we are yet to test where the power loss is coming from on the new board - for all we know it could be mostly sending! More data coming soon.

  • Back to work!

    mikrotron10/19/2016 at 10:11 0 comments

    Hooraaay, we just received new stalkers!
    And, our friends from Veta started making enclosure for our electronics.
    We'll be back soon with more news, in the meantime, check out how box making looks like:

  • Conclusions for now

    Tomislav Mamić09/29/2016 at 12:52 0 comments

    After two months of on and off development, we decided to put this project on hold. The entire code base for our system is in place - with minor adjustments and quality of life improvements, it is a finished product. Our hardware, however, is not up to the task. It was and still is great for prototyping and testing and we learned a lot in the process, but the parts used are simply not tailored for this design.

    We came to a conclusion that, should we continue to develop the hardware, a custom-made pcb with strict power control is a must. Design as it is is simply sub-optimal and we can do better. We will try out the new v3.1 of the stalker board though, as an intermediate step.

    A big part of why our tests didn't go as far as we thought they would turned out to be the base for it all - the Seeeduino stalker. A while back, they offered a great deal - v3.0 stalkers 70% off. That's when we got this board. It was sitting in the office unused until we picked it up for it's fabled efficiency in outdoor applications... But it turns out there's a story behind why they were 70% off - a series of poor design choices including a cheaper RTC chip without temperature compensation (quite disastrous for any long-term applications though that doesn't bother us too much because we can readjust it from the server) and a poorly optimized regulator which burns over 3mA under certain loads. This burn happened to hit us while the device was in idle state, greatly hurting its battery life.

    Reading around about the stalker 3.0, it turns out we were not the only ones unhappy with what they did with the board. It's not terrible, but at some point, we will have to part with it for a better solution.

    Graph below shows our enthusiasm for hardware used.

    It actually plots battery charge % over 3 days. Green humps are times when battery was being charged by the solar cells.

  • It's all turned off

    Tomislav Mamić09/13/2016 at 10:35 0 comments

    After trying out some switching transistors, I settled for 2SJ200 - a lovely, though somewhat expensive switching P-FET. I made this choice mainly due to its very low switching treshold - it is important we achieve saturation when switching 3.3v with 3.3v control signal (refer to Vds and Vgs on 1st figure on page 3 of datasheet). Power-wise, this FET is significantly over the top, but it is the best one that works and is readily available at this point. Later down the road we may replace it with a cheaper one.

    It is very important that for this particular application, P-FET be used as arduino signal pins can (and will!) ground. Since positive supply line is common, it only makes sense to put the switch there.

    Initial tests have shown no problems, and a long-term test is already underway. Look forward to pretty pictures!

  • We're still leaking current

    Tomislav Mamić09/09/2016 at 09:43 0 comments

    So after shutting down sim808 and putting the stalker to sleep, results improved somewhat... But the improvement was just not good enough for what we expected. Measuring current draw from the battery yields a whooping 15mA - what in the world could be causing this?

    The one thing we never suspected would dissipate much power when left unused - HC-SR04. The idle current we measure amounts to anywhere between 2.5 and 2.6mA, and since we got 5 of them, as well as a temperature sensor which leaks 0.6mA, things quickly get out of hand.

    It is obvious that these sensors must also be turned on and off on demand. For this, we need an efficient, low power electronic switch. No such thing built in, of course, so we decided to hack one in ourselves.

    The plan is simple - install a mosfet (2N7000) switch between the stalker 3.3v power output and the sensor shield power input pins, and control it using arduino pin 3 (literally the last free pin we got).

    With this in place, we expect to drop down to 1mA ranges and finally be fully viable as a self-sufficient device with low maintenance cost.

  • Some battery tests

    Tomislav Mamić09/06/2016 at 09:57 0 comments

    Finally the sleep code is up and running. I've set the device to power on every hour and do its full sending cycle to test battery life. Here's what the time span from yesterday afternoon until this morning looks like.

    The green line on the bottom indicates whether the battery is charing (10), not charging (0), or full (20).

    Weather is pretty bad too, so these are truly ideal test conditions. It seems that per hour, around 2% battery is lost. Next thing to determine is whether (or rather, how much of) this loss comes from the sending process (great result) or idle state (not so great result). This will be tested by gradually increasing the sending interval and comparing results for different intervals.

    Another possible issue I've noticed is that solar panel wakes up the sim808 module from time to time due to its reaction to getting power over USB. It could be that the module still chugs down current instead of staying put when we finish sending.

  • Trash can's new brain

    Tomislav Mamić08/31/2016 at 12:40 0 comments

    Realizing that using a vanilla-ish arduino board will not yield good energy savings without heavy modding, we opted for a slightly more expensive, but function-packed option: Seeduino Stalker. The one we have is v3.0, arguably the windows 98 of the whole Stalker series according to some reviews. Thus far we encountered no problems migrating to the new, frugal platform. In fact, we were given a built-in RTC and power circuitry designed for a li-po battery from the get-go.

    The best part about this migration is that, save for moving one pin to free the I2C interface, it is perfectly compatible with the sensor shield we used with Iteaduino. A pretty small price to pay for literally 100 times less idle current draw at 3V and a built-in RTC ready to send wakeup interrupts.

    Coming up next: more detailed power consumption measurements, full-fledged sleep mode.

  • And then we ran out of power

    Tomislav Mamić08/29/2016 at 09:41 0 comments

    After finally getting to play with our device for longer periods of time, we noticed that, while the battery does charge itself more than enough to send reports and stay up during the sunny summer days, our device tends to go down with the sun.

    Obviously, this is a problem.

    We were quick to choose a prototyping platform such as Arduino, in fact a clone of it, for a project that requires low idle power consumption. Some tests later, we realized that the USB to serial chip, as well as its regulator (okay we saw that one coming) take away quite a bit of current in their idle state. The sim808 module is unsurprisingly a big spender too, but since that one can be turned off, we don't really mind.

    At 3V supply (low limit), our Arduino managed to pull 77mA through its step-up circuit and down its regulator. Now, obviously this isn't really the circuitry one would want in an efficient project, but we needed stability, and we needed it fast.

    The step-up itself wastes around 13mA when idle, and sim808 drains about 35mA when idle and unconnected.

    On top of our simple multimeter tests (warning, digression incoming), I assembled some oscilloscope kit on a whim, so we tried using that to check the variations in input voltages.

    Going full zen, I sat down, measured and sorted all the components and let the soldering iron heat up. A few hours and a dozen google pages later, I found out that I'm not actually bad at soldering, but that there's a couple of jumpers the user is supposed to short on the board. But you know, real men don't read manuals. So now that we had a working oscilloscope, and for the price and amount of effort, it's actually pretty impressive, I monitored supply voltage and found out some interesting things. But let's save those for when I have some pictures, or when I figure out how to draw data out of this baby into the PC.

    But here's where it gets interesting. See the logo in the top left that says SainSmart? Well, we had pretty bad experience with their stuff before so when I assembled this and it worked like a charm, I was honestly surprised and impressed! Well, no wonder it works like a charm when they're not the ones who made it! Sneaky schmucks.

    This is our professional solar plant setup by the way.

    Such sleek design. It actually does serve a purpose - it simulates poor real-world conditions.

    So now we need to come up with a way to keep the devices stable by keeping voltages tamed, while dodging the regulators and all this wasteful circuitry.

View all 16 project logs

Enjoy this project?



Giulio Pons wrote 05/08/2020 at 22:25 point

very nice. I'I've propesed the same project one year ago to the local garbage collector company... but they didn't answered. Good job, go on!!

  Are you sure? yes | no

Alex Bucknall wrote 08/19/2016 at 14:09 point

Looks fantastic! :) Have you considered the possibility of using LPWAN instead of GSM for your trashcans? You can get significantly better power efficiency, greater range and a significantly lower cost device with a LPWAN such as Sigfox. If you've got a device that need to be battery powered in areas that potentially have poor/expensive GSM coverage you might want to look at an alternative communication protocol. I know I'm a little biased as I work for Sigfox but we're providing network service for free to makers wishing to integrate with our network/use Sigfox enabled modules! Let me know if this sounds like something you might be interested in - I might be able to set you up with a dev kit to test it - you can set up HTTP callbacks to your server to notify you immediately! Keep up the awesome work!

  Are you sure? yes | no

mikrotron wrote 08/19/2016 at 21:03 point

Sure we did, for an entire second, maybe even two! ;)
You know, there's power consumption, range, coverage and so on, but at the end of the day - we have a $40 worth SIM808 breakout right here:)
Your offer is great, of course we would love to try out new tech!
Too bad we don't have any coverage here in Croatia... or, do we?

  Are you sure? yes | no

Alex Bucknall wrote 10/19/2016 at 12:32 point

Apologies only just seen your reply! I checked the network and unfortunately we don't yet have coverage in Croatia... :/ But we're rolling out network coverage in more countries every day! If you want -  drop me an email at and I'll set a reminder to message you when we launch coverage in Croatia and send you a dev kit!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

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