User:BDolge/Compost Bin Monitoring System

Problem
Composting is a great way to reduce unnecessary organic waste addition to landfills. This waste degrades inside of oxygen-deprived plastic bags, resulting in anaerobic digestion, which, in turn, results in the release of methane, nitrous oxides, carbon dioxide, and hydrogen sulfides--all greenhouse gases. However, without careful monitoring, compost done at home can also create these anaerobic byproducts. Not only are these gases inhibiting the recovery of our atmosphere, they also make the composting an unpleasant experience. This project will address these issues by taking the guess work out of composting; by developing a sensor array that will detect GHG, internal and surface temperatures, relative humidity, and soil moisture, the user will be able to more accurately determine when to aerate their compost, adjust to nitrogen saturation (which can lead to anaerobic digestion), and more, the compost can be made in a more efficient and reliable manner.

Conceive
This project will also specifically address compost tumblers used in an urban, apartment-setting for a few reasons: 1) Aerating via tumbler action is the simplest way to aerate without exposing the user to odors, 2) Tumbling doesn't rely on ground contact to allow drainage of leachates, 3) Tumblers tend to be smaller and allow for waste to be collected in a bin before turning into compost without risking the waste biodegrading into an unpleasant state, 4) Sensors built into the top of the tumbler could gather gases released during aeration, assuming the aeration mechanism involves keeping the bin stationary, without exposing the sensors to soil contact and excess moisture. However, the design that was ultimately chosen was one where the gas is siphoned out through the PVC crank shaft and is analyzed in a separate gas chamber that will house the sensors. Airflow into and out of the chamber are regulated by vacuum pumps chained to one tube, and are controlled by relay and Arduino, which is triggered by a magnet and reed switch on the spinning handle.

The tumbler will have the above-mentioned sensors, and will cost <$50 to produce assuming 100+ unit production. The intended means to read the sensors is an Arduino Uno for prototyping, and possibly an Ardiuno Nano for a final product; the sensor readings will be displayed in one of three ways: 1) LCD display, 2) Bluetooth integration, 3) WiFi/Python website. The power supplied to the system should be either achievable through solar, long-lasting rechargeable battery, or a low wattage power supply.

Design
Bin and Frame

The bin used is a standard Rubbermaid Brute 32 gallon trash bin, with the handles cut off for a uniform circular shape. Link It is places on its side into the frame (see below) with a 1in hole drilled into the lid and the bottom of the bin. This hole will be used for the crank shaft to go through. The lid will also have clamps placed on the outside and surgical tubing (or some other form of sealing) on the inside; together, the clamps will force an airtight seal that will ensure minimum gas dilution from external air. An 8in square will also be cut out of the side of the bin that is facing up, which will be fastened back onto the spot it was cut out from with hinges, sealing, and clamps. This door will work as a means to put in and take out waste that will be converted into compost.

Frame

The frame is built using 2x4 wood planks (any wood type will work.) The pieces are fastened together using 3in hex screws, though standard wood screws will work. Pilot holes were drilled with a 1/2in spade bit to about halfway into the wood, and the hex screws were driven into these pilot holes.

The following are the sizes and quantities of wood needed:

5x 23"

2x 17"

2x 13"

Please see here for pictures of the building process: Link

Sensors: Internal Moisture Reader

The internal moisture reader will give a broad idea of how wet/dry the compost is. It is comprised of two stainless steel bolts/screws that are soldered to wire, with a 10kohm resistor added to the wire that leads to the Analog P1 and 5V output, and the second screw is wired to ground. The Arduino sends an electric current through the first screw, and the second screw is placed about 1in away from it for receiving. The resistance of the field decreases as the compost moistens. To get a percentage reading, an initial reading is taken with the screws submerged in water, and the RawADC value is noted. The serial.print function is then set so that it displays a percentage based on: RawADC(actual)/RawADC(highest value). These screws are placed into the bottom of the bin, with the crank shaft not interfering with them given a 2in clearance from the sidewalls of the bin.

Code:

Internal Temperature

A 10kohm thermistor is wired in a voltage divider means, with a 10k resistor placed in series with the thermistor and the 5v output pin, the Analog Pin linked to the space between the resistor and the thermistor, and the second leg of the thermistor linked to the GND. Using the Steinhart-Hart equation and the data sheet of the 10Kohm thermistor, an Arduino code was created using the 4th degree polynomial regression and math.h library. (Steinhart-Hart Equation)

Code (replace the coefficients in the formula with what fits your thermistor's datasheet; Link (see third code): Thermistor):

External Temperature/Humidity

A DHT11 will be used to measure the temperature and humidity of the bin's environment (not the compost). This information, in tandem with the moisute and internal temperature readings, can be used to gauge the compost's decomposition and progress. The instructions for wiring and coding a DHT11 are very well known, and the following was used: DHT11 Library

Gas Sensors: MQ-4 and TGS842

These sensors are placed soldered to NPN transistors, which are switched on and off by the Arduino when needed. This is because the sensors require preheating up to 48 hours, and this would drain any batteries. Alternatively, you can run a 5V, 1A wall wart to Arduino and gas sensors. The sensors are soldered and wired according to the following instuctions:

Baseline code for both sensors:

The gas sensors will also not be able to measure ppm of gas concentrations, so to provide the user with usable information, a code is developed that will alert the user via LED if the gas levels are relatively high (relative to a threshold that is calibrated using pure gas as a test.)

Code:

Vacuum Pump and Relay

A 6v vacuum pump with both inflate and deflate tubes will be used to bring gas into the chamber from the bin, and also timed so that, after a reading as taken place, it will flush our the chamber to prevent loss of sensor sensitivity.

The toggle switch on the pump is desoldered and replaced with wires that go to a relay switch. This relay switch is then controlled by the Arduino. The relay is activated when its pump's portion of the siphoning cycle is occuring. There are two of these pump/relay apparatuses, one for intake and one for exhaust, both connected using PVC piping and vacuum tubing so that both functions operate through the same hole in the chamber.

Crank Shaft and Reed Switch

The shaft goes inside the Bin itself and is supposed to move the compost in side the bin, taking any gasses released from the compost.

Gas Chamber and Valves

Demo
still in development

Next Steps
Assemble the entire system of sensors, switches, and pumps to run real-world tests using compost. The test would measure the ability of the user to access and apply the information gathered by the system to prepare better compost. For example, a low moisture reading with high internal temperature means that there's too much carbon, so the user could add more food scraps that they had been saving. This would also involve testing and calibrating precise times and delays for the vacuum pump and alternating between intake and flushing the chamber while also ensuring the gas sensors have enough time and concentrations of gas to measure the compost. Mechanically, also ensuring the integrity of the overall bin design, specifically the crank shaft, is very important, and prolonged usage would provide better feedback on possible changes in materials, as well as design changes that need to be made to accommodate prolonged usage.

The actual means of accessing this information is ideally Bluetooth and Android app. This is because it is not feasible to provide all of the different information that the sensors are taking on a typical 16x2 LCD screen, and a computer connected via Ethernet shield and Wifi is possibly too much "resource" space compared to a smart phone. This would also allow the user to che3ck their phone while in their kitchen without having to log onto a computer application or go out to the bin and check the statuses.