No edit summary |
(revise/add text) |
||
Line 2: | Line 2: | ||
== Motivation == | == Motivation == | ||
Are my plants breathing? They seem fine, their leaves are green... but are they really okay? To observe my houseplants' respiration, a prototype of soap bubble maker machine is being developed. The quantity of soap bubbles will be in accordance to the CO<sub>2</sub> level of the plants' (closed) environment, divided into three categories: Low, Medium and High CO<small>2</small> level. | |||
== Materials == | == Materials == | ||
Line 18: | Line 18: | ||
== To-Do List == | == To-Do List == | ||
* Implement stepper motor speed | * Implement stepper motor speed (based on category (CO<sub>2</sub> value)) (s. Pseudocode below) | ||
* Stabilize bubble rings holder to the stepper motor | * Solve technical problems (failed to connect with ESP32? Stepper motor not working after extending wires? Unstable wires?) | ||
* For better and more directed air flow: add nozzle/funnel? | * Stabilize bubble rings holder to the stepper motor (done) | ||
* For better and more directed air flow: add nozzle/funnel? (done, but is air flow strong enough?) | |||
* Make wiring diagram | * Make wiring diagram | ||
* Documentation | * Documentation |
Revision as of 11:21, 9 January 2025
Project idea: https://miro.com/app/board/uXjVLBm7F8w=/?share_link_id=117991010729
Motivation
Are my plants breathing? They seem fine, their leaves are green... but are they really okay? To observe my houseplants' respiration, a prototype of soap bubble maker machine is being developed. The quantity of soap bubbles will be in accordance to the CO2 level of the plants' (closed) environment, divided into three categories: Low, Medium and High CO2 level.
Materials
- ESP32
- CO2 sensor MH-Z19C
- Stepper motor 28BYJ-48
- Stepper motor driver module ULN2003
- PWM fan AMD Ryzen 7 1700
- 10kΩ resistor
- Power supply 12 volts
- Switch
- Lots of cables...
To-Do List
- Implement stepper motor speed (based on category (CO2 value)) (s. Pseudocode below)
- Solve technical problems (failed to connect with ESP32? Stepper motor not working after extending wires? Unstable wires?)
- Stabilize bubble rings holder to the stepper motor (done)
- For better and more directed air flow: add nozzle/funnel? (done, but is air flow strong enough?)
- Make wiring diagram
- Documentation
Pseudocode
Idea: assign CO2 value into 3 categories; Low, Medium, High and adjust the stepper motor speed based on the category.
DEFINE constants for CO2 thresholds:
LOW_MEDIUM_THRESHOLD = 500 //to be determined via trials
MEDIUM_HIGH_THRESHOLD = 700 //to be determined via trials
DEFINE speed settings for each category:
LOW_SPEED = 400 // Steps per second
MEDIUM_SPEED = 800 // Steps per second
HIGH_SPEED = 1200 // Steps per second
INITIALIZE variable currentCategory to -1
INITIALIZE variable lastCategory to -1
FUNCTION setup():
BEGIN
SET maximum speed for stepper motor (e.g., 1200 steps/sec)
SET acceleration for smoother operation (e.g., 500 steps/sec^2)
START serial communication for debugging
END
FUNCTION loop():
BEGIN
READ CO2 value from the sensor (variable CO2)
DETERMINE currentCategory:
IF CO2 < LOW_MEDIUM_THRESHOLD:
SET currentCategory to LOW
ELSE IF CO2 < MEDIUM_HIGH_THRESHOLD:
SET currentCategory to MEDIUM
ELSE:
SET currentCategory to HIGH
IF currentCategory is different from lastCategory:
BEGIN
SWITCH currentCategory:
CASE LOW:
SET stepper motor speed to LOW_SPEED
CASE MEDIUM:
SET stepper motor speed to MEDIUM_SPEED
CASE HIGH:
SET stepper motor speed to HIGH_SPEED
UPDATE lastCategory to currentCategory
END
RUN stepper motor at the current speed (use AccelStepper's runSpeed() function)
END
Idea to determine thresholds: run trials on plants enclosed environment.
DEFINE variables:
minCO2 = Infinity // Initialize to a very high value
maxCO2 = -Infinity // Initialize to a very low value
startTime = CURRENT_TIME
trialDuration = 30 minutes (in milliseconds, e.g., 30 * 60 * 1000)
FUNCTION setup():
BEGIN
INITIALIZE serial communication for debugging
INITIALIZE CO2 sensor
PRINT "Starting 30-minute CO2 trial..."
END
FUNCTION loop():
BEGIN
WHILE (CURRENT_TIME - startTime) < trialDuration:
BEGIN
READ current CO2 value from sensor (variable currentCO2)
IF currentCO2 < minCO2:
UPDATE minCO2 to currentCO2
IF currentCO2 > maxCO2:
UPDATE maxCO2 to currentCO2
PRINT currentCO2, minCO2, and maxCO2 to serial monitor
WAIT for 1 second //reduce sampling frequency
END
PRINT "Trial Complete."
PRINT minCO2 and maxCO2 to serial monitor
CALCULATE range = maxCO2 - minCO2
CALCULATE lowMediumThreshold = minCO2 + (range / 3)
CALCULATE mediumHighThreshold = minCO2 + (2 * range / 3)
PRINT "Thresholds:"
PRINT "Low-Medium Threshold: " + lowMediumThreshold
PRINT "Medium-High Threshold: " + mediumHighThreshold
END
Gallery
The Plant Plant Gallery (Nextcloud Bauhaus Uni), Password: theplantplant (CO2 sensor first trial pictures are inside)
References
CO2 sensor MH-Z19C
- https://www.neumueller.com/datenblatt/neumueller/MH-Z19C.pdf (Datasheet)
- https://randomnerdtutorials.com/esp32-uart-communication-serial-arduino/ (Concept, wiring, code)
PWM fan AMD Ryzen 7 1700
- Arduino Fan Control using High Frequency 25kHz PWM // 4-Wire CPU Fans - YouTube (Concept, wiring, code); adapted to ESP32
Stepper motor 28BYJ-48 and stepper motor driver module ULN2003
- https://randomnerdtutorials.com/esp8266-nodemcu-stepper-motor-28byj-48-uln2003/ (Concept, wiring, code); adapted to own implementation