YimFY: Compost Monitor
Made by Kami Chin and Josh Somers
Made by Kami Chin and Josh Somers
Created: April 30th, 2018
The Compost Monitor keeps track of activity in the community's compost pile. It monitors activity by measuring the amount of compost in the bin and the number of times the bin is opened/closed. By sending live tweets of activity and action required for the compost pile's maintenance, it encourages community responsibility and awareness of contribution to the compost pile. After a certain amount of activity is recorded by the compost monitor, points are added to the neighborhood's point tracker as a system of positive reinforcement for doing good deeds and being environmentally conscious.
The Compost Monitor is one of three devices that will be implemented in a futuristic neighborhood that we are imagining. In this neighborhood, people rely on homegrown produce as a main food source. In order to make an individual task into a more community-wide effort, these three products promote collaboration among neighbors and encourage helping each other by publicizing progress made. Compost is an important ingredient in helping gardens flourish, and is an eco-friendly way to repurpose waste into something beneficial to the whole community. We hope that neighborhoods that use this compost monitor will be encouraged to help each other and their shared gardens.
Initially, as a group, we had two different products that performed very similar tasks. This was the usage of lights to relay a message. After receiving feedback we decided to go in a different direction, away from lights. We decided to add a new feature to our neighborhood that would promote environmental consciousness through composting and be connected to the scoreboard tree. After envisioning this idea, we came up a compost bin with two main components: a pushbutton that would determine if the bin was open or closed, and a ultrasonic sensor to see how full the bin was. We wanted to incorporate a thermistor at the bottom to take the temperature of the bin, as over time the decomposition of compost will release heat energy and heat up the bin. However, we decided not to include it because the time that decomposition requires is much longer than is available for our live demo.
The Compost Monitor encourages environmental awareness by publishing tweets that document the progress and activity of the community's compost bin. The bin itself is represented by a cardboard box with a flip-top lid. A pushbutton on the edge of the bin can detect when the bin is opened and closed. An ultrasonic sensor on the inside of the lid detects the height of compost within the bin. The Particle is concealed within the bin.
When the lid is closed, the ultrasonic sensor will measure how much compost is in the bin by measuring the distance between the lid and the top of the compost content. If compost has been added, it will publish a tweet saying how much is currently in the bin. These tweets, which represent positive action in the community, contribute to the community's points system.
The product's circuitry and code is included below.
As mentioned earlier in this Gallery post, this product was originally supposed to be something similar to the scoreboard tree- another device which displays related information through light. We decided to expand further on our goal of helping a community share resources and time while being environmentally friendly. So we created a compost bin that tracks the community's participation.
We had some trouble with the Particle's distance readings initially because of the measuring sequence we had implemented in our code. An intentional delay in our code interfered with the loop timing and skewed the timing between event publishing and tweet publishing. We learned how to solve this problem by eliminating the delay time and being more efficient with event publishing.
/*
******************************************************************************
* Copyright (c) 2015 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
******************************************************************************
*/
/* HC-SR04 Ping / Range finder wiring:
* -----------------------------------
* Particle - HC-SR04
* GND - GND
* VIN - VCC
* D2 - TRIG
* D6 - ECHO
*/
//if A0 and not A1 then open. if not then closed...
#include "application.h"
int ledPin = D1;
// Our button wired to D0
int buttonPin = D4;
int buttoncount=0;
void setup() {
Serial.begin(115200);
pinMode( buttonPin , INPUT_PULLUP); // sets pin as input
// We also want to use the LED
pinMode( ledPin , OUTPUT ); // sets pin as output
}
void loop() {
// Trigger pin, Echo pin, delay (ms), visual=true|info=false
int buttonState = digitalRead( buttonPin );
if( buttonState == LOW )
{
// turn the LED On
// Monitor height of Compost
digitalWrite( ledPin, LOW);
int prevDist = ping(D2, D6, 250, false);
delay(5000);
int currDist = ping(D2, D6, 250, false);
if (currDist < prevDist) {
Particle.publish("Compost height increased");
buttoncount = buttoncount +1;
if( buttoncount == 5){
Particle.publish("Please stir the Compost");
buttoncount = 0;
}else{ //bin open
// Counting times bin is opened/closed
digitalWrite( ledPin, HIGH);
//Particle.publish("Compost has been added!");
}
delay(5000);
}
}
}
int ping(pin_t trig_pin, pin_t echo_pin, uint32_t wait, bool info)
{
uint32_t duration, inches, cm;
static bool init = false;
if (!init) {
pinMode(trig_pin, OUTPUT);
digitalWriteFast(trig_pin, LOW);
pinMode(echo_pin, INPUT);
delay(50);
init = true;
}
/* Trigger the sensor by sending a HIGH pulse of 10 or more microseconds */
digitalWriteFast(trig_pin, HIGH);
delayMicroseconds(10);
digitalWriteFast(trig_pin, LOW);
duration = pulseIn(echo_pin, HIGH);
/* Convert the time into a distance */
// Sound travels at 1130 ft/s (73.746 us/inch)
// or 340 m/s (29 us/cm), out and back so divide by 2
// Ref: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
inches = duration / 74 / 2;
cm = duration / 29 / 2;
if (info) { /* Visual Output */
Serial.printf("%2d:", inches);
for(int x=0;x<inches;x++) Serial.print("#");
Serial.println();
} else { /* Informational Output */
Serial.printlnf("%6d in / %6d cm / %6d us", inches, cm, duration);
}
return inches;
//delay(wait); // slow down the output
}
A hands-on introductory course exploring the Internet of Things and connected product experiences.
~