151
edits
(→Wiring Diagram: and add codes) |
|||
Line 2: | Line 2: | ||
This project is called "'''Respiring Reflections'''", a bubble machine which is connected to Pothos plants (''Epipremnum aureum'') in an enclosed environment. Read below to follow the process and the story behind the making of this project. | This project is called "'''Respiring Reflections'''", a bubble machine which is connected to Pothos plants (''Epipremnum aureum'') in an enclosed environment. Read below to follow the process and the story behind the making of this project. | ||
//TODO: add gif/video<gallery mode="packed" heights=" | //TODO: add gif/video<gallery mode="packed" heights="200"> | ||
File:Respiring Reflections image 1.png | File:Respiring Reflections image 1.png | ||
File:Respiring Reflections image 2.jpg | File:Respiring Reflections image 2.jpg | ||
Line 46: | Line 46: | ||
=== Wiring Diagram === | === Wiring Diagram === | ||
[[File:The_Plant_Plant_-_Bubble_Machine_Wiring_Diagram.png|none|thumb| | [[File:The_Plant_Plant_-_Bubble_Machine_Wiring_Diagram.png|none|thumb|450x450px]] | ||
During the process of making the bubble machine, unfortunately I fried my ESP32... I'm still not sure why, but perhaps it was due to false wiring. Thus I made this wiring diagram so that the wiring could be clear. I tried some free tools to make wiring diagram, such as but in the end I stick with EasyEDA to make this. The wiring diagram helps me a lot in reproducing the wiring I wanted to do, as well as to ask opinion from Christian or someone else for consultation. | During the process of making the bubble machine, unfortunately I fried my ESP32... I'm still not sure why, but perhaps it was due to false wiring. Thus I made this wiring diagram so that the wiring could be clear. I tried some free tools to make wiring diagram, such as but in the end I stick with EasyEDA to make this. The wiring diagram helps me a lot in reproducing the wiring I wanted to do, as well as to ask opinion from Christian or someone else for consultation. | ||
Since I wanted this installation to be a standalone one, I powered the ESP32 with the power suppy of 12 volts, through a buck converter of 5 volts, 1 Ampere. For this, I went to an electronics store in Erfurt (Bastlerland) and showed my wiring diagram for this project. The guy in that store recommended me this solution and I followed it. | Since I wanted this installation to be a standalone one, I powered the ESP32 with the power suppy of 12 volts, through a buck converter of 5 volts, 1 Ampere. For this, I went to an electronics store in Erfurt (Bastlerland) and showed my wiring diagram for this project. The guy in that store recommended me this solution and I followed it. | ||
=== | === Codes === | ||
To program the ESP32, I used Visual Studio Code with PlatformIO extension. Here are the codes I uploaded to the ESP32 to run the bubble machine: | To program the ESP32, I used Visual Studio Code with PlatformIO extension. Here are the codes I uploaded to the ESP32 to run the bubble machine: | ||
===== Bubble machine ===== | |||
'''main.cpp:'''<syntaxhighlight lang="cpp"> | '''main.cpp:'''<syntaxhighlight lang="cpp"> | ||
#include <Arduino.h> | #include <Arduino.h> | ||
Line 160: | Line 161: | ||
waspinator/AccelStepper@^1.64 | waspinator/AccelStepper@^1.64 | ||
wifwaf/MH-Z19@^1.5.4 | wifwaf/MH-Z19@^1.5.4 | ||
</syntaxhighlight> | |||
===== Calibration ===== | |||
To determine the thresholds for my bubble machine, I uploaded a calibration script to the ESP32 and let the CO<sub>2</sub> sensor run in the enclosed plants' casing for minutes until the values are somewhat "stable" and not deviating too much from the previous ones: | |||
'''main.cpp:'''<syntaxhighlight lang="cpp"> | |||
#include <Arduino.h> | |||
#include "MHZ19.h" | |||
#include <HardwareSerial.h> | |||
#define BAUDRATE 9600 | |||
/*CO2 sensor*/ | |||
#define RX_PIN 16 //wire green here (8) | |||
#define TX_PIN 17 //wire blue here (9) | |||
/*CO2 sensor variables*/ | |||
MHZ19 myMHZ19; | |||
HardwareSerial mySerial(2); | |||
unsigned long getDataTimer = 0; | |||
unsigned long timeElapse = 0; | |||
void verifyRange(int range); | |||
int CO2; | |||
int8_t Temp; | |||
int minCO2 = 1500; // save min CO2 value | |||
int maxCO2 = 400; // save max CO2 value | |||
int range; | |||
void setup() { | |||
// put your setup code here, to run once: | |||
Serial.begin(9600); | |||
mySerial.begin(BAUDRATE); // sensor serial | |||
/*CO2 sensor*/ | |||
myMHZ19.begin(mySerial); // pass to library | |||
myMHZ19.autoCalibration(); | |||
timeElapse = 6e5; // wait 10mins to calibrate | |||
Serial.println("Calibrating... (10mins)"); | |||
delay(timeElapse); | |||
} | |||
void loop() { | |||
// put your main code here, to run repeatedly: | |||
if (millis() - getDataTimer >= 1000) // Check if interval has elapsed (non-blocking delay() equivalent) | |||
{ | |||
CO2 = myMHZ19.getCO2(); // get CO2 value | |||
Serial.print("CO2 (ppm): "); | |||
Serial.println(CO2); | |||
if(CO2 < minCO2){ // if current CO2 value is lower than the min value: save the new value as the min | |||
minCO2 = CO2; | |||
} | |||
if(CO2 > maxCO2){ // if current CO2 value is higher than the max value: save the new value as the max | |||
maxCO2 = CO2; | |||
} | |||
Serial.print("Min CO2: "); | |||
Serial.println(minCO2); | |||
Serial.print("Max CO2: "); | |||
Serial.println(maxCO2); | |||
int8_t Temp; // Buffer for temperature | |||
Temp = myMHZ19.getTemperature(); // Request Temperature (as Celsius) | |||
Serial.print("Temperature (C): "); | |||
Serial.println(Temp); | |||
range = maxCO2 - minCO2; // calculate the range | |||
Serial.print("Range: "); | |||
Serial.println(range); | |||
Serial.print("Lower threshold: "); | |||
Serial.println(minCO2 + (range * 1 / 3)); // lower threshold | |||
Serial.print("Higher threshold: "); | |||
Serial.println(minCO2 + (range * 2 / 3)); // higher threshold | |||
getDataTimer = millis(); // Update interval | |||
} | |||
} | |||
</syntaxhighlight>'''platformio.ini:'''<syntaxhighlight lang="ini"> | |||
[env:esp32dev] | |||
platform = espressif32 | |||
board = esp32dev | |||
framework = arduino | |||
lib_deps = wifwaf/MH-Z19@^1.5.4 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 170: | Line 268: | ||
To build the final prototype for the Winterwerkschau, I decided to change the casing material to transparent acrylic sheets. I think it matches the concept that everything is transparent/translucent. Before building the real physical final prototype, I tried out several online tools to help me, such as 3D sketch plan, 2D blueprint and optimization software to cut the acrylic sheets, to know how much materials I needed. Because the dimension of my final prototype will depend on the bubble sticks (attached to the rotating stepper motor), and also the length of the breadboard, I decided to use half-size breadboard instead of a full-size one, since the full-size will be redundant for my project. The wiring diagram helped me to consider this, since I wouldn't need that much space of the breadboard. The half-size breadboard minimized the length (or depth) dimension of my prototype a lot. In building the final prototype, I learned a lot how to be creative in finding solutions with common materials or tools that I could find in the lab (either diyElectronics Lab in B15 or Electronics Lab in M5), at home or in the city. I'm glad that I made it work in the end:) | To build the final prototype for the Winterwerkschau, I decided to change the casing material to transparent acrylic sheets. I think it matches the concept that everything is transparent/translucent. Before building the real physical final prototype, I tried out several online tools to help me, such as 3D sketch plan, 2D blueprint and optimization software to cut the acrylic sheets, to know how much materials I needed. Because the dimension of my final prototype will depend on the bubble sticks (attached to the rotating stepper motor), and also the length of the breadboard, I decided to use half-size breadboard instead of a full-size one, since the full-size will be redundant for my project. The wiring diagram helped me to consider this, since I wouldn't need that much space of the breadboard. The half-size breadboard minimized the length (or depth) dimension of my prototype a lot. In building the final prototype, I learned a lot how to be creative in finding solutions with common materials or tools that I could find in the lab (either diyElectronics Lab in B15 or Electronics Lab in M5), at home or in the city. I'm glad that I made it work in the end:) | ||
//TODO: add gif/video<gallery mode="packed" heights=" | //TODO: add pics + gif/video<gallery mode="packed" heights="200"> | ||
File:3D sketch bubble machine.png|3D plan - Tinkercad | File:3D sketch bubble machine.png|3D plan - Tinkercad | ||
File:2D blueprint bubble machine.png|2D blueprint - cuttle.xyz | File:2D blueprint bubble machine.png|2D blueprint - cuttle.xyz | ||
Line 180: | Line 278: | ||
===== Prototyping hurdles ===== | ===== Prototyping hurdles ===== | ||
Technically it was challenging, since it was the first time I learned ESP32, plus I broke my first one in this class... But lessons learned, always make a wiring diagram and triple check everything! I usually only deal with digital problems, so prototyping with electronics and physical mechanical things adds dimension in the project, which means when I encounter a problem, that problem could be in any dimension and I couldn't really pinpoint where. Throughout the class, I experienced that problems can arise everywhere: cables, ESP32, understanding of mechanical/physical things, materials, tools, device specification that needs specific usage in the code, etc. But that's just the art of prototyping, as my friend said. We're not doing a finished line of production, so enjoy the ups and downs, the successes and failures. Fail fast is better. | Technically it was challenging, since it was the first time I learned ESP32, plus I broke my first one in this class... But lessons learned, always make a wiring diagram and triple check everything! I usually only deal with digital problems, so prototyping with electronics and physical mechanical things adds dimension in the project, which means when I encounter a problem, that problem could be in any dimension and I couldn't really pinpoint where. Throughout the class, I experienced that problems can arise everywhere: cables, ESP32, understanding of mechanical/physical things, materials, tools, device specification that needs specific usage in the code, etc. But that's just the art of prototyping, as my friend said. We're not doing a finished line of production, so enjoy the ups and downs, the successes and failures. Fail fast is also better. | ||
I feel like I spent most of my time designing and planning for my prototypes rather than building the prototypes, both for the cardboard prototype (first prototype) and also the final one. I wasn't sure how it was supposed to be made, but I kept thinking about the measurements and the mechanisms so that I could make them work, at least logically in my mind. Sometimes even night and day, that I got a little bit overwhelmed. In the end though, I compromised the accuracy aspect and focused more on the functionality/mechanical things to make it work. "Just try it out" was definitely a motto for this project. | |||
===== Learning from my Pothos plants (and observations) ===== | ===== Learning from my Pothos plants (and observations) ===== |
edits