|
| 1 | +# Mella |
| 2 | +Mella is a mushroom growing chamber designed at FirstBuild. The chamber provides a humidity, light, and fresh air controlled environment that allows users to customize the conditions to promote growth of a multitude of mushroom species. |
| 3 | + |
| 4 | +## Software Structure |
| 5 | +The software is made up of a few main components/modules: |
| 6 | + |
| 7 | +```mermaid |
| 8 | +graph TD |
| 9 | + UnitState[Unit State] |
| 10 | + AirExchange[Air Exchange Controller] |
| 11 | + Humidity[Humidity Controller] |
| 12 | + Light[Light Controller] |
| 13 | + Encoders[Encoders] |
| 14 | +``` |
| 15 | + |
| 16 | +### Unit State |
| 17 | +The primary purpose of this state machine is to maintain the system status. |
| 18 | + |
| 19 | +Upon startup, the State Machine enters `State_Startup` for a parametrically-defined time. After startup, the unit enters `State_Normal`. While in this state, the humidity is periodically checked. If the humidity value falls outside the parametrically-defined range, the unit will enter `State_Abnormal` and remain in that state until the humidity returns to the normal range or a parametrically-defined timeout occurs. If the timeout occurs, the unit will enter `State_Fault`. While in this state, the lighting will be set to Error Mode. If the humidity re-enters the normal range, the unit will immediately return to `State_Normal`. |
| 20 | + |
| 21 | +```mermaid |
| 22 | +flowchart TD |
| 23 | + State_StartUp -- Timeout --> State_Normal |
| 24 | + State_Normal -- %RH Good --> State_Normal |
| 25 | + State_Normal -- %RH Bad --> State_Abnormal |
| 26 | + State_Abnormal -- %RH Good --> State_Normal |
| 27 | + State_Abnormal -- %RH Bad --> State_Abnormal |
| 28 | + State_Abnormal -- Timeout --> State_Fault |
| 29 | + State_Fault -- %RH Good --> State_Normal |
| 30 | + State_Fault -- %RH Bad --> State_Fault |
| 31 | +``` |
| 32 | + |
| 33 | +### Air Exchange Controller |
| 34 | +This controller simply controls the fresh air exchange fan in accordance with the knob setting. In a future update, the fan will be set to only run for a parametrically-defined period of time. |
| 35 | + |
| 36 | +### Humidity Controller |
| 37 | +Mella uses a SHT31 temperature/humidity sensor for closed loop control. Measurements from the sensor are fed back into a parametrically-defined PID loop whose output controls the humidity fan. |
| 38 | + |
| 39 | +During operation, the humidity controller will periodically measure relative humidity and control the humidity fan in an attempt to maintain the humidity setpoint defined by the encoder knob position. The Humidity Controller is responsible for determining if the humidity falls within the parametrically-defined normal range. |
| 40 | + |
| 41 | +### Light Controller |
| 42 | +The light controller handles the lighting modes and animations. The state machine will request either Error Mode or Normal Mode. Based on this request, the light controller will adjust how it controls both the chamber light as well as the PCB heartbeat LED. In Normal Mode, the chamber lights will remain on and the intensity will be set based on the encoder position. The heartbeat LED will blink in 1 second intervals. In Error Mode, the chamber lights will slowly pulsate/bounce to notify the user of an issue. Additionally, the heartbeat LED will begin blinking ten times per second. |
| 43 | + |
| 44 | +### Encoders |
| 45 | +All three controllers (Air Exchange, Humidity, and Light) get their setpoint from the user via a set of three 16-position absolute encoders. |
| 46 | +The knob being in the 6 o'clock position equates to off. The remaining 15 positions represent equally spaced values from the minimum to maximum values for the respective controllers. |
| 47 | + |
| 48 | +## Logging |
| 49 | +Mella provides periodic logging of data in CSV format. When logging occurs, the output of each module is printed to the output. This log can be accessed via the Mini USB port as a serial UART with a baud rate of 115200. |
| 50 | + |
| 51 | +## Building |
| 52 | +This project uses PlatformIO and can be built using the PlatformIO build function. For flashing, it is recommended that you use the shell scripts. For debugging/testing purposes, use the PlatformIO functions. |
0 commit comments