Smart Composting System

A set of senors and actuators that make composting simple.

Similar projects worth following
Per the EPA, food scraps & yard waste currently make up 20-30% of what we throw away, and should be composted instead. Making compost keeps these materials out of landfills, where they release methane, a potent greenhouse gas.

Atmospheric levels of methane are spiking. This is cause for alarm among global warming scientists because methane emissions warm the planet by more than 20X similar volumes of CO2.

Unfortunately, most do not compost - typically due to ignorance on the benefits of composting, misunderstanding of what can be added to compost, and lack of desire to manage compost.

I am building a smart system that makes it easier to compost. The system will:
- Monitor temperature, moisture, and methane output to automatically regulate the compost (add water or air)
- Make recommendation on types of products to add to compost (more "green" or "brown" items)
- Provide alerts when the compost is ready or when additional user action is needed


The Smart Compost system is made up of three components

  1. Satellite Sensor Station - an Arduino powered device that is connected to the compost pile and measures ambient temperature, compost temperature, soil moisture, and methane gas output. Based on the sensors, the sensor station can add water to the compost or open/close air vents. Communication to the sensor station is via LoRa radio.
  2. Base Station - a Intel Edison or Raspberry Pi device that persists the sensor data and provides a dashboard. The Base station also uses the sensor logic to make recommendations to the user on actions needed. The base station would be connected to an small kitchen "scraps" holder (like this) with an LED indicator that gives status of the compost.
  3. "Can I Compost" home device - an Alexa or Google Home program that (a) tells the user what can be composted and (b) what should be composted (based on the user's compost composition)

The goal is that the system helps the user quickly create a batch of compost with minimal work. We are also looking to ensure that the compost is created using aerobic processes (with oxygen) versus anaerobic (without oxygen). Anaerobic processing (like landfills) can create higher concentrations of methane gas.


Project Phases

The project will be developed in 4 phases:

Phase 1: Sensor Tests (complete)

  • Proof of concept to validate sensors, output to serial print
  • Arduino 101 for Satellite System
  • Raspberry Pi for Base Station

Phase 2: Proof of Concept against small batch of compost (ETC - end of June 2017)

  • use LoRa radio to communicate readings between Satellite and Base System
  • Data stored in SQLite database
  • Initial dashboard with simple analytics

Phase 3: Minimum Viable Product (ETC - end of Aug 2017)

  • Base System - move from Raspberry Pi to Intel Edison and add warning indicators
  • Move from breadboard to soldering
  • Improved dashboard and analytics
  • Improved sensors
  • Add solar power

Phase 4: Enhancements/Final Product (ETC - end of Sept 2017)

  • Weather proofing
  • Dashboard in cloud and integrated with Alexa skill
  • Tune devices for less power consumption/deep sleep
  • Full Outdoor Test (1 month in "real" compost bin)

Running List of Enhancements and Improvements

Lessons Learned:

  1. Soil moisture sensor not robust enough - switch to combined temperature and moisture sensor probe (ETC - Phase 3) [use the following sensor - Soil Temperature/Moisture Sensor - SHT10]
  2. BLE not suitable for communication between devices, switch to LoRa radio (ETC - Phase 2)
  3. Ambinent temperature should factor into analytics (ETC - Phase 3)


  • Is it possible to use the accelerometer and gyroscope to determine when compost is added to the pile (added 6/6/2017)
  • Is O2 or CO2 a better indicator of health than Methane concentration? (added 6/6/2017)
  • Does it make sense to measure pH of the compost? (added 6/6/2017)
  • Consider replacing 1 central micro-controller (Arduino 101) with separate battery-powered smaller processors for each sensor or actuator. This would make the product easier to use. (added 6/8/2017)


Draft version of the PHP file that reads the SQLite database and creates a JSON object for the dashboard measurements.

php - 1.23 kB - 06/03/2017 at 19:09



Draft version of the dashboard

HyperText Markup Language (HTML) - 7.27 kB - 06/03/2017 at 19:08



Arduino sketch for the prototype

plain - 7.15 kB - 06/03/2017 at 02:37



The Logic for the Satellite Sensor

JPEG Image - 75.01 kB - 06/03/2017 at 02:29


  • 1 × Aruino 101 Micro controller for the satellite system
  • 1 × Weatherrpoof Temperature Sensor currently used to measure soil temperature. Will be replaced with a combo humidity/temperature sensor. This will then be used to measure ambient temperature
  • 1 × Moisture Sensor Note - will replace with a more robust sensor for the final build -
  • 1 × Water Pump (6-9V) Needs to be powered through the VIN (not the 5V pin).
  • 1 × Ultrasonic Sensor To determine water level

View all 15 components

  • Major Changes to the MVP

    Darian Johnson08/30/2017 at 03:50 0 comments

      August 29, 2017

      I've started work on the new prototype. Key changes:

      1. Moving from Arduino 101 board to Adafruit Feathers (RFM and ESP8266). The feathers (and their associated wings) have a smaller form factor and lower power requirements (3.3v v 5.0 volts).
      2. Adding a physical compost bin
      3. Adding a physical display (a TFT screen). I may still use a web app/bluetooth phone app, but I thought seeing the feedback as easy as possible made the most sense.

  • MVP - Solar Powered Smart Compost System

    Darian Johnson08/14/2017 at 21:59 0 comments

    Aug 14 2017 -

    It's been a busy few months since my last log. I've updated the solution as follows:

    • communication between devices using radio packets
    • solution waterproof and solar powered
    • solution integrated into Alexa skill
    • solution notifies users of status via a kitchen compost bin

    The good news is that I've tested the logic and feel comfortable with the analysis algorithm. 

    The bad (or good, depending on the point of view) is that the solution still requires work:

    • I originally designed the solution as an "add-on" to an existing compost bin. Based on user feedback, I need to create an "all-encompassing solution", which includes an outdoor compost bin
    • I am unable to power the entire solution (servo, Arduino, and pump) with one rechargeable battery. 

    I'm in the process of making design changes, now. The goal is to have a more robust prototype available for testing by early September.

  • Analyze Sensors and Take Action Code

    Darian Johnson06/11/2017 at 05:10 0 comments

      6/11/2017 -

      I am still waiting for my LoRa sensors to arrive; in the meantime, I've started writing the logic that will interpret the sensor data. This code will run on the base station. The flow is:

      1. Base station requests sensor data
      2. Satellite station returns sensor values
      3. Base station interprets data and sends commands to satellite station
      4. Satellite station takes requested action (water compost, open vent, etc)
      5. Base station saves sensor data to database
      6. Base station saves UI data (warning colors, messages) to database for easy retrieval

      The first pass of the code is below:

      from datetime import timedelta, datetime
      import json
      def main:
          # TODO implement
          #return 'Hello from Lambda'
          tempMessageArray = [
              "Your compost is at optimal levels.", #0
              "Your compost is ready for use. At your convenience, move your sensors to a new compost pile/layer.", #1
              "Your compost heating cycle is complete and is in a 'curing stage'.", #2
              "Your compost has reached an unsafe temperature. Immediately turn the compost and add water.", #3
              "Your compost has reached unhealthily temperature. At your convenience, turn compost and add 'brown' (Carbon-rich) materials.", #4
              "Your compost temperature is slightly higher than optimal. You may want to turn the compost and add 'brown' materials.", #5
              "Your compost temperature is slightly higher than optimal, but is staring to cool off. I will let you know if any action is required.", #6
              "Your compost is at optimal temperature.", #7
              "Your compost temperature is slightly lower than optimal, but is staring to warm up. I will let you know if any action is required.", #8
              "Your compost temperature is slightly lower than optimal, and is continuing to cool. At your convenience, turn compost and add 'green' (Nitrogen-rich) materials.", #9
              "Your compost temperature is slightly lower than optimal, and is continuing to cool. The ambient temperature is low, so you should cover your compost to continue aerobic composting." #10
          moistureMessageArray = [
              "Your compost moisture content is too high. Turn your compost and add 'green' (Nitrogen-rich) materials.", #0
              "Your compost moisture content is too high but is starting to dry out. I will let you know if any action is required.", #1
              "Your compost is at optimal moisture levels.", #2
              "Your compost moisture content is too dry, but is starting to reach optimal moisture. I will let you know if any action is required.", #3
              "Your compost  is too dry and requires your attention. You need to turn and water your compost." #4
          success = "alert alert-success"
          info = "alert alert-info"
          warning = "alert alert-warning"
          danger = "alert alert-danger"
          tempDanger = 175
          tempHigh = 160
          tempOK = 140
          tempLow = 90
          moistHigh = 60
          moistLow = 40
          #get inputs for analysis
          sensorDataJSON = getSensorData()
          trendDataJSON = getTrendData()
          days = handleDateLogic()
          #set variables
          tempF = sensorDataJSON["tempF"]
          tempC = sensorDataJSON["tempC"]
          moisture = sensorDataJSON["moisture"]
          methane = sensorDataJSON["methane"]
          waterLevel = sensorDataJSON["waterLevel"]
          ambientTemp = sensorDataJSON["ambientTemp"]
          tempTrend = trendDataJSON['tempTrend']
          moistTrend = trendDataJSON['moistTrend']
          tempAlert = info
          moistAlert = info
          methaneAlert = info
          waterLevelAlert = info
          OverallMsg = tempMessageArray[0]
          msgPriority = 3 #1 = trumps all other actions, #2 additive
          if days > 35:
              OverallMsg = tempMessageArray[1]
          elif days > 25:
              OverallMsg = tempMessageArray[2]
          else: # the compost is not ready
              #Handle Temperatures
              if tempF > tempDanger:
    Read more »

  • Logic/Alerts/Actions based on Temperature and Moisture readings

    Darian Johnson06/09/2017 at 03:16 0 comments

    6/8/2017 -

    I am in the process of writing the logic that drives alerts and actuators (water pump and vent open/close). I've create a few tables that will help me to write the AI.

    Temperature Logic

    Moisture Logic

  • Art of the Possible with Alexa

    Darian Johnson06/05/2017 at 13:33 0 comments

    6/5/2017 -

    I created a simple Alexa skill that tells a user if an item can be composted.... I wanted to extend this functionality into a "bolt on" Alexa skill for the Smart Compost System. The Alexa skill would integrate with the Smart Compost data to tell the user recommendations specific to his/her needed. For example, if the oxygen flow was too high (not enough carbon), then the user would be directed to add items like grass clippings, leaves, newspapers instead of fruit or vegetable scraps.

    Video below is a demo of the skill...

    You can read more about it (and get the source code) here:

  • Smart Compost Dashboard

    Darian Johnson06/03/2017 at 19:08 0 comments

    6/3/2017 -

    I am in the process of creating a dashboard for the Compost System. The version is still very much in the early stages, but will share what I have created to date:

    • The gauge shows the number of days until the compost is ready (25 days at greater that 110 degrees F).
    • The sensor indicators are red, yellow, and green based on the state of the sensor
    • The actions panel shows the interpretation of the data, and the actions the user must take. This also has a red, yellow, and green indicator.

    The dashboard is written in HTML/Javascript, leveraging:

    • Bootstrap
    • JustGage.js
    • icons from Freepik

    The data is stored in a SQLite database. The data is retrieved by making a http call to an php.file (see code in attachments section for details).

    Right now, the actions are hard coded into the HTML; I am still in the process of writing the logic for determining when a particular action needs to take place. For example, if the temperature is low, but the ambient temperature is low as well, then we would want to wait 5-10 hours to determine if the temperature rises before asking the user to take more corrective actions (e.g. stirring the compost or adding more nitrogen-rich materials).

  • My First Prototype (outside of soil)

    Darian Johnson06/02/2017 at 22:43 0 comments

      June 2 2017 -

      I've assembled the sensors and actuators into a bird's nest of wires... but, it works fine for a prototype. The attached video shows how the assembled prototype will work (I wanted to show the components before I added them into the composting soil).

      A few notes:

      1. I originally planned to use a solenoid and use gravity to water the compost, but ultimately decided on a pump.
      2. I have a difficult time calculating % humidity using the moisture sensor (there isn't a great correlation between the voltage out of the sensor to the % wetness of the soil). I'm looking into using a better sensor that (a) outputs % moisture and (b) is more robust (this sensor would only last a few months) [I'll probably use this sensor -]
      3. I am using an ultrasonic sensor for the prototype, but plant to switch to a "dumb" float sensor (I don't need to know levels - just dry or not dry]
      4. I was originally using Bluetooth LE to send data from Arduino to a Raspberry Pi - but decided to remove that logic and go with LoRa instead. Devices are in the mail now... hope to show that interaction later this month.

      Last note - here's a simple process flow that outlines the logic.

  • Prototype Sensors Received

    Darian Johnson05/28/2017 at 12:59 0 comments

    5/27/2017 -

    I got my first set of sensors in the mail. At a high level, my though process is:

    • Temperature sensor to measure compost - healthy compost must reach a temperature of 140 F for 20-25 days
    • Moisture sensor - compost should be 40-60% moist
    • Methane Sensor - a high PPM reading would indicate that the compost is in an anaerobic cycle (similar to a landfill)

    I also have a few actuators

    • solenoid valve to support gravity drip of water (if moisture is below 40%)
    • servo - to open/close a vent to a perforated pipe embedded in the compost (to support additional oxygen and air flow

    Finally, I am using a Arduino 101 as the micro-controller for the sensors and actuators. I will use a Raspberry Pi to persist the data and make it available in a web page. I'll use BLE for communication between to the for the prototype (will need to move to LoRa for the final product.

  • Challenges With Maintaining My Compost Pile

    Darian Johnson05/26/2017 at 20:09 0 comments

    May 26 -

    So, my family composts.... but we do a poor job of it. We rarely turn the compost or water it. We just add compost-able materials and hope everything works out. What we end up with is what you see below (questionable-quality compost at the bottom and rubbish/leaves at the top)

    There is a science to composting, and I'm hoping to use sensors to measure gas output, temperature, moisture of the compost. This information would then be used to make recommendations (more brown, less green, more water, turn, etc). I ordered a bunch sensors from Amazon; so I hope to have a very high-level prototype in the next 1-2 weeks.

View all 9 project logs

  • 1
    Step 1

    I'm not at a point where I can add detailed instructions yet - still prototyping.

    That being said, I've uploaded my Arduino code so that you can get a sense of where I'm going. I've also included a Fritzing schematic of the sensor module.

View all instructions

Enjoy this project?



Valeryprogrammation wrote 08/25/2017 at 13:28 point

I've made a copy all the material I could take here on a facebook page.
I hope I can make a similar project, borrowing this one.
And I will try to pair the project with a local fablab I'm working with.
I will obviously keep you in touch with my progress.
Thank you

  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