Mushroom Sense

Last Update: 4/1/2022

A picture of the mushroom sense device

Table of Contents

Intro

Mushroom sense connecting to my wifi network

Find this project on my GitHb Mushroom Sense

I thought it would be cool to set up a fully automated mushroom farm. Much like animals, mushrooms expel CO2 as a byproduct of respiration. As such CO2 levels can be an interesting variable to track and manipulate when growing mushrooms. However CO2 sensors are pricey and I wanted one that I could integrate into Home Assistant which I planned to use as the brains of my automated mushroom farm. MushroomSense is my solution to this problem and as icing on the cake it'll measure temperature and humiditiy and having good control over these two varibles is vital to growing mushrooms (although if that's all your looking for there are dirt cheep solutions available I've got one of these for example and its pretty easy to get integrated with home assistant with a bit of google-ing).

Hardware

The hardware is all available from Adafruit:

One of the following true CO2 Sensors

Do some research see what suits your needs. The SCD-40 is probably sufficient for most people's needs.

These prices could change but the total comes out to about $95. Not too shabby for a wifi enabled CO2 sensor. I know the sensor is a bit pricey but that's because its the real deal. The cheaper CO2 sensors measure effective CO2. essentially they measure some other gasses and use some math to make an educated guess on how much CO2 there is. A future goal is to support one of these cheaper sensors so people can save some money and upgrade later if they wish. If your looking to write some code this project can be modified to support any sensor you want.

Wizard

The Wizard can be downloaded for Linux and Windows from the Releases Page of this project. Download the package for your OS and Follow the instructions for your OS Bellow.

Linux

  • Unzip the folder and open it in a terminal window. run ./wizard
  • If you don't see the port for the board listed you may need to run it as su sudo ./wizard

Windows

  • First you'll also need to install the CP2104 USB Driver to connect to the Feather HUZZAH over USB.

  • Next Unzip the folder and double click wizard.exe

MacOS

Currently the only option is to run the wizard from source. The Windows and Linux executables are built using pyinstaller which seems to have some problems with Big Sur. Unfortunately I don't have the time to figure out a solution so if someone could build a MacOS executable and submit a pull request your contribution would be much appreciated.

python3 ./src/wizard/wizard.py

There are several dependencies you may need to install.

pip install pysimplegui

pip install esptool

You'll also need to install the CP2104 USB Driver to connect to the Feather HUZZAH over USB.

Using the Wizard

A screenshot of the home page of the wizard

Once you have the wizard open via the direction above, you can use it to install mushroom sense on your hardware.

Install Mushroom

  1. Plug the Feather HUZZAH board into you computer via a micro-b USB cable.
  2. Click the 'Upload' button in the wizard

A screenshot of the home page of the wizard

  1. Select the correct port for your Feather HUZZAH board. If you're not sure:

    • Unplug your board
    • Click 'Refresh Ports'
    • Take note of the available ports
    • Plug your board back in
    • Click 'Refresh Ports' again
    • The port for your board will be the one that was not there before.
  2. Click 'Start'

A screenshot of the home page of the wizard

  1. You will see a progress bar and console output while the binary is being uploaded.

A screenshot of the home page of the wizard

A screenshot of the home page of the wizard

  1. Once the upload is complete you will see the MycoBoy splash appear and after the board is done booting you will see sensor data appear in the log.

Connecting WiFi

  1. Next you can optionally connect the board to wifi. you can also do this via the web interface
  2. Enter your network name and password in the provided inputs and click 'Connect WiFi''.

A screenshot of the home page of the wizard

  1. once the WiFi is connected you will see a message that says "WiFi Connected" followed by the boards IP address. This can also be found in the device menu by selecting the 'Status' option.
  2. Press the reset button on your device, this is not required for all versions of Mushroom Sense but won't hurt.

Web Interface

The web interface allows you to interact with Mushroom sense via you web browser. It also provides a REST API that can be used for integration with Home Assistant or other automation software.

Connecting WiFi

  1. On your Mushroom Sense device press the center button to open the menu.
  2. Then use the down button to select 'Configure WIFI', the second option in the list.

A screenshot of the home page of the wizard

  1. This will put the device into configuration mode. The device will turn into a WIFI hot spot that you can connect to.

  2. On your computer, This will not work on most phones, connect to the WIFI network called Mushroom Sense

    • The password will be: mushlove

A screenshot of the home page of the wizard

  1. Type the IP address shown on the screen into your web browser. In the example above http://192.168.4.1

A screenshot of the home page of the wizard

  1. Enter your WIFI ID and password into the inputs provided and click 'Connect'.
  2. You device should display its IP address. This can also be found in the device menu by selecting the 'Status' option.
  3. Reconnect your computer to you WIFI network.
  4. Press the reset button on your device, this is not required for all versions of Mushroom Sense but won't hurt.

Exploring the Web Interface

Once Mushroom Sense is connected to your network you can open the web interface in a browser on any device that is also connected to your network.

Home

Mushroom sense connecting to my wifi network

This page will display the current sensor value of the device. It is live and will update as the sensor values change

REST API

Mushroom sense connecting to my wifi network

This page shows all the available REST API endpoints offered by the device. It also serves as a REST API playground Allowing you to send REST calls to the device and view the device's response.

HASS

Mushroom sense connecting to my wifi network

This page generates a bit Home Assistant configuration YAML. This YAML can be copy and pasted into home assistant to quickly add Mushroom Sense to Home Assistant where it can be used for automation.

Using Mushroom Sense

Mushroom sense connecting to my wifi network

The device has 4 buttons:

  • Reset - reboots teh device
  • A - generally used to scroll up
  • B - generally used as select
  • A - generally used to scroll down, occasionally used to return to the previous screen.

When the device boots you will be on the home screen. This screen will continuously update/display the current temperature, humidity, and CO2 consecration measured by the sensor.

Device Menu

Mushroom sense connecting to my wifi network

From the home screen the pressing button B opens the device menu. The menu has the following options:

Exit

Returns to the home screen

Configure WIFI

Puts the device in WIFI configuration mode. Read more here.

Connect Wifi

Connects or reconnects to the configured WIFI network. this can be useful if the connection fails on boot or the WIFI is disconnected for some reason.

Refresh Interval

Mushroom sense connecting to my wifi network

The interval at which the sensor will take a new reading. The avalible range will depend on what sensor you are using:

  • SCD-30: 2s-120s (Default is 2s)
  • scd-4X: 5s-120s (Default is 5s)

Screen Timeout

Mushroom sense connecting to my wifi network

Sets the length of inactivity that will cause the screen to turn off. options:

  • Never (Default)
  • 10 seconds
  • 30 seconds
  • 1 minute
  • 5 minutes
  • 10 minutes

Temperature Unit

Mushroom sense connecting to my wifi network

Allows you to set the temperature unit on the device to celsius(C) or fahrenheit(F). Metric or Freedom units whatever you prefer. (Default is F)

CO2 Calibration

Sets the current calibration to 400ppm. this is intended to be used outside as an easy way of recalibrating the SCD-30.

Status

Gives the current WIFI connection status and the current IP address if connected.