Distributed Sensors and Control Systems for Mushroom Farming Optimization

By Nikki Arakawa

Portobello mushrooms. Photo by Leif K-Brooks/Wikimedia Commons/CC-BY-SA-2.5


Growing mushrooms is a difficult process because the temperature and humidity needs to fall within a specific range within the container growing environment. Maintaining these conditions requires continuous monitoring. This means the farmer must manually take readings several times a day. However, opening the container affects the mushroom container environment and measurements. This system was developed to allow the farmer to take accurate measurements automatically while also allowing him to monitor his farm and respond to incidents if needed.


The purpose of this project is to push the limits of widely available microcontrollers and sensors in order to automate the measurements of temperature and humidity for mushroom production and display the data online in real-time.


The distributed sensor system is comprised of two parts: the hardware system and the server system. The hardware system handles the gathering of the data and their transfer to the server. The server in turn, performs the data processing and real time visualization. The overall method is shown in Figure 1.

Figure 1. Flow of information from MQTT inbound node to JSON to two separate sensor graph nodes. (Blue: Hardware System, Yellow: Server System).

Hardware System: One humidity and two temperature sensors are connected to an ESP8266 MCU with built in WIFI to perform data acquisition as shown in Figure 2. The ESP8266 receives data from the sensors, combines the information into a JSON object and sends the object via MQTT.

Figure 2: The MCU is represented on the left with digital pin 1 (D1) connected to Temp sensor one and two and digital pin 2 (D2) connected to the humidity sensor. All sensors are powered by the MCU.

Server System: The MQTT broker receives the JSON object and acts as a relay between hardware and software. The MQTT node in Node-Red receives the message from the broker and upon reception sends the object to the JSON node. The information is then turned into a string, parsed and delivered to graph nodes to be displayed in Node-red’s graphical user interface as described in Figure 3.

Figure 3: Node-Red flow. MQTT Topic nikki/mushy receives JSON, json node translates JSON object to string, and two function blocks parse relevant information for respective visualizations. Function nodes parse the string and the graph displays the parsed information.


The distributed sensor system was tested in an indoor laboratory setting. The sensor system is set to measure temperature and humidity continuously at a rate of 1Hz. The data is aggregated in node-red at adjustable intervals (e.g. 5 min averages). Graphs shown in Figure 4 and 5 demonstrate how measurements are plotted every second to allow for better resolution.

Figure 4: Real time representation of percent humidity vs. hour of day.
Figure 5: Real time representation of temperature in Fahrenheit vs. hour of day.

In the laboratory setting the MCU and sensors were connected to a breadboard for testing and adjusting circuit design as needed. The first version of a proto board, shown in Figure 6, was built replicating the working breadboard circuit layout in Figure 2, for a more permanent circuit design. The goal was to create a reliable circuit for outdoor installation using screw down terminal blocks which would make it easy to install or uninstall sensors while in the field. When connected to the MCU, the prototype was able to collect data sporadically and at the moment is not reliable enough to use for data collection.

Figure 6: Left. is the first hardware prototype. Screw down terminal blocks are used as a way to connect sensors to board without soldering down permanently.  

Connections in the first prototype were not sensitive enough for the MCU to receive reliable data from the sensors. Shown in Figure 7, a printed circuit design was created to test this theory and will be part of further research.

Figure 7: Printed circuit board design using EAGLE.

Conclusion and Further Research

The distributed sensor system is able to measure temperature and humidity while successfully posting it to the online graph, therefore making this a practical solution for improving mushroom farming techniques. The first hardware prototype is not a reliable source of measurements therefore a printed circuit board may help fix connection issues and reliability for field measurement collection.

The next steps of this research are: 1) deploy the system in a real mushroom growing setting to test its durability and ability to stay connected using PCB design, 2) create a regression algorithm to predict when measurements will fall outside of acceptable parameters, 3) create an alert system to email farmer when the monitoring system disconnects or measurements fall outside of normal operating conditions, and 4) create a database to store historical data. 


“NODE-RED.” Node, 2013, nodered.org/.

“Home.” Arduino, www.arduino.cc/.

Vargas, Angel G., et al. “ESP32 MQTT – Publish DHT11/DHT22 Temperature and Humidity Readings (Arduino IDE).” Random Nerd Tutorials, 6 Apr. 2020, randomnerdtutorials.com/esp32-mqtt-publish-dht11-dht22-arduino/.


I would like to thank Dr. Hervé Collin, the Kapi’olani STEM program for providing me with the opportunity to work on this project, and the Tribal Colleges and Universities Program from the National Science Foundation for funding this research.

About the Author

Aloha, my name is Nikki Arakawa. I am Native Hawaiian and I received my AS in natural sciences, with a concentration in engineering in the spring of 2020 at Kapiʻolani Community College. In the fall, I will be transferring to the University at Hawaiʻi at Mānoa to pursue a bachelor’s degree in electrical engineering.

Along with being a student, I also juggle being a single parent to a 6-year old with work. I’ve participated in research projects that involved programming and circuit building for IoT and designing sustainable energy solutions. As a student at Kapiʻolani Community College, I was given the opportunity to be supported by the Tribal Colleges and Universities Program from the National Science Foundation, and present my work at the Emerging Researchers National Conference in Washington D.C. and network with students and faculty from all over the country.

I am a big supporter of Hawaii’s sustainability goals, which includes increasing farming production to be more self-sustainable. My research is centered around a local mushroom farm that grows portobello mushrooms in shipping containers. All of the work is manual, including taking temperature and humidity measurements inside the shipping containers to make sure the container conditions are optimal for mushroom growing. This mushroom farming project is a monitoring system that allows the farmer to automate humidity and temperature measuring tasks in order to free up that time for other tasks.

A few years ago, I was a student returning to school after a ten-year hiatus. In the past, I did not have a good experience with math or science. I wasn’t expecting to come this far, but I have had so much overwhelming support from my mentors, STEM faculty, and fellow classmates. I hope they have a chance to read this one day to know that their support made all the difference.  

• • •

Enjoyed this story? Enter your email to receive notifications of new posts by email

Success! You're on the list.

Leave a Reply

Your email address will not be published. Required fields are marked *