DIY IoT Compost Monitor

Discover

Things you will need :

  • Solve Ninja Techno Kit which will contain
  • Additional materials
    • DS18B20 Digital waterproof temperature sensor
    • 4.7K Ohm resistor
    • Breadboard and jumper cables or soldering iron, solder.
    • Electrical wire and sockets for extension

Investigate

Questions you need to ask

Get data. Examples:

  • How does composting take place?
  • How do you know if composting is taking place? In other words, what is the data point to measure progress of composting?
  • Where is the compost bin placed - shaded/ sunny area, indoor/ outdoor, etc.?
  • Is there a power socket close to where the compost bin is located?
  • Should the compost bin be closed tight?
  • How frequently should wet waste and/or Degrade be added?

What are the things you need to learn about the user? Examples:

  • Who is the user?
  • How/ how often do they interact with the compost bin?
  • Is the compost bin very far away from the user’s reach/ access, for eg. is it at the other end of the house, etc.?
  • Does the user know the process of composting thoroughly?
  • Does the user forget to add waste and/or Degrade?
  • Does the user recognise this as a problem?
  • What is stopping the user from recognising the problem and taking action?

What are the things you need to think about to convince the user that wasting food is a problem? Examples:

  • Why is it a problem?
  • Does the user need to be notified when the composting is in progress?
  • How would the user like to be reminded about the progress of composting?

This will help the Solve Ninja decide what output device to use, for example-

  • buzzer with a loud beep or a gentle music (like a water filter) if the user has to be alerted when composting is done or in progress, or,
  • multicolour LED that blinks red when composting is in progress, or green when composting is done, or,
  • LCD screen that displays some encouraging message, or temperature-humidity values of the compost bin, or,
  • moisture sensor that detects presence of leachate. The list is endless.

Solve

Code Overview:

  1. Waterproof temperature sensor senses temperature inside the compost bin.
  2. DHT22 temperature and humidity sensor senses temperature outside the compost bin.
  3. Arduino compares the temperatures inside and outside the compost bin.
  4. If compost temperature > outside temperature, composting is in progress.
  5. If compost temperature < outside temperature, composting is done.

Steps:

  1. Take the Solution Box from the Solve Ninja Techno Kit.
  2. Connect the 3 pin wire connector to the PCB in the port named “Flow Sensor”.
  3. Connect the DHT22 sensor to the 3 pin wire connector.
  4. Connect the 4.7k Ohm resistor between the data and VCC wires of the waterproof temperature sensor.
  5. Connect the waterproof temperature sensor to the PCB in digital pin 2 marked “Flow sensor”.
  6. Connect one end of the USB cable to Arduino and other to Computer/laptop.
  7. Plug in one end of the power adapter to the DC jack, and the other end to a power socket.

You will need 9V-1A power supply for using this kit. It will not work with the USB cable alone.

  1. Switch on the Solution Box.
  2. Open Arduino IDE on computer/laptop.
  3. Download, Copy, Paste code from here to the Arduino IDE.
Click here for code
/* Prototype Name : Compost Monitor
   Input Sensor   : DHT22, DS18b20 Sensor
   Output Device  : LCD, Multicolor LED
   Libraries Used : LiquidCrystalPCF584, One wire, Dallas Temperature, FastLED
*/

#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal_PCF8574.h>
LiquidCrystal_PCF8574 lcd(0x3F);
#include<DHT.h>
#include<FastLED.h>

DHT dht (7, DHT22); // 7 denotes Digital pin for DHT22 sensor, DHT22 denotes DHT type
#define DATA_PIN 9 // Digital pin number for LED (Multicolor)
#define NUM_LEDS 3
CRGB leds[NUM_LEDS];
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

int tempC = 0;
int humidity = 0;
int temperature = 0;
void setup() {
  sensors.begin();
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  lcd.begin(16, 2);
  lcd.setBacklight(255);
  lcd.home();
  lcd.clear();
  dht.begin();
  lcd.setCursor(0, 0);
  lcd.print("Compost Monitor");
  lcd.setCursor(0, 1);
  lcd.print("With SNT kit");
  delay(4500);
  Serial.begin(9600);
}
void loop() {
  dsb();
  dht22();
  compost_test();
  leds[0] = CRGB::Black;
  FastLED.show();
}
void dsb() {
  sensors.requestTemperatures();
  tempC = sensors.getTempCByIndex(0);
  delay(1000);
  Serial.println(tempC);

  //  lcd.setCursor(0, 0);
  //  lcd.print("BinTemp:");
  //  lcd.print(tempC);
  //  lcd.print("*C");
}
void dht22() {
  delay(2000);
  humidity = dht.readHumidity();
  temperature = dht.readTemperature();

  //  lcd.setCursor(0, 1);
  //  lcd.print("AmbientTem:");
  //  lcd.print(temperature);
  //  lcd.print(" *C");
}
void compost_test() {
  if ( temperature < tempC) {
    lcd.clear();
    lcd.setCursor(0, 0);
    //Serial.print(temp_0);
    lcd.print("BinTemp(*C):");
    lcd.print(tempC);
    lcd.setCursor(0, 1);
    lcd.print("T(*C):");
    lcd.print(temperature);
    lcd.setCursor(9, 1);
    lcd.print("CIP");
    leds[0] = CRGB::Red;
    FastLED.show();
    delay(2000); // Red light glows for 1 second
  }
  else if (temperature >= tempC) {
    lcd.clear();
    lcd.setCursor(0, 0);
    //Serial.print(temp_0);
    lcd.print("BinTemp(*C):");
    lcd.print(tempC);
    lcd.setCursor(0, 1);
    lcd.print("T(*C):");
    lcd.print(temperature);
    lcd.setCursor(9, 1);
    lcd.print("Done");
    leds[0] = CRGB::Green;
    FastLED.show();
    delay(2000); // Green light glows for 1 second
  }
}
  1. Then Check for Tools → Board → Port in the IDE.
  2. Compile and Upload the code.
  3. Disconnect USB cable.
  4. Switch off the Solution Box.
  5. Switch on the Solution Box.
  6. Test by dipping the waterproof temperature sensor in a cup of warm water and keeping DHT sensor exposed to air. If the output is “CIP”, the prototype is working
  7. Hang the Solution Box on the wall at a suitable place. To check if the place is suitable,
  • make sure that the waterproof temperature sensor probe is fully inserted into the compost, and the DHT sensor is well outside the compost bin.
  • the wires/power adapter wire should not be too taut.

Share

  • Locally: Once you install the solution in a place, observe if and how the user interacts with the compost bin and monitor. Talk to them about the solution and learn what they think of it.
    • Do they keep track of the compost progress through the monitor?
    • Is there any way to collect data to prove that?