💭Brief Intro to our idea:
Plants don't want to interact with you.
In a fascinating twist of nature, plants have evolved innovative mechanical devices to protect themselves from human interference.
Our project creates a system that allows plants to detect human presence and behavior and respond by activating mechanical defense systems, including harmless deterrents such as movement, sound, and light. At the same time, we will simulate the plant's response to the environment , such as closing or withering, aiming to make people aware of the need for plants to protect themselves.
We got the fake flowers, moss and acrylic sheets we bought.
We selected the flowers that opened and closed obviously.
Glued the acrylic sheets and cardboard together according to the draft.
* The acrylic sheets were very difficult to fix with hot melt glue* 🥲
I completed the circuit and code:
✅ When the value of the distance sensor on the left is less than 20, control the 3 servos to turn 30 degrees to the left, and the right side to turn 30 degrees to the right.
✅ The 3 light sensors, when the light is greater than 300 and lasts for more than 3 seconds, make the fourth servo rotate several times.
* But the whole circuit did not work at all. During this period, the Arduino board suddenly turned off. I checked the circuit twice and found no problems. *
At the same time, Kitrina was studying the light strip, but she couldn't understand the tutorials on the Internet. When she asked LA, they said that we couldn't use the light strip yet, so we gave up this part.
💭 But if we were given more time, even if we used small LED lights, we would like to add lighting design to the work, such as lighting up with the opening and closing of the petals/lighting up when alerting/breathing rhythm. . .
code ⬇️
// Monitor and check light sensor A
int lightLevelA = analogRead(lightSensorAPin);
Serial.print("Light Sensor A: ");
Serial.println(lightLevelA); // Serial output for light sensor A
if (lightLevelA > lightThreshold) {
if (!lightDetectedA) {
lightDetectedA = true;
lightStartTimeA = millis();
}
if (millis() - lightStartTimeA >= 3000 && flowerbutton == 0) {
rotateRight(3); // Rotate 3 full turns to the right
flowerbutton = 1;
}
} else {
lightDetectedA = false;
}
code ⬇️
// Right distance sensor
long distanceRight = getDistance(trigPinRight, echoPinRight);
Serial.print("Distance Right: ");
Serial.print(distanceRight);
Serial.println(" cm");
if (distanceRight <= 20) {
// Move servos
servo1.write(30);
servo2.write(30);
servo3.write(30);
delay(6000);
servo1.write(90);
servo2.write(90);
servo3.write(90);
}
We asked LA Kitty to debug for us, she didn't find the problem, and finally I found that the breadboard (unbelievable) and the servo were short-circuited, and the short-circuited parts would turn off the Arduino light and get hot.
The distance sensor worked normally.
Meanwhile, Kitrina made the force sensor and bend sensor.
Because our idea is that "when petals are closed and any of the light sensors (A, B, or C) detect light above the threshold for more than 3 seconds, the servo rotates 3 full turns to the right and sets petals open, and vice versa."
we designed a flowerbutton in the code
(0 is off, 1 is on)
We use millis() to control the opening or closing.
This ensures that the servo completes the action and resets to the correct position.
Using delay() to control the rotation will interfere with the timing (the distance sensor can use delay because our design is that when the flower is dodging, other sensors will not work).
🫠 But millis() is really tricky...it did not work .
LA told me that it is really impossible for a 180-degree servo to rotate continuously in one direction, so I struggled to try a 360-degree servo and got three results:
the servo swayed left and right, never stopped, and did not move at all.
Ask for help to Prof. Inmi, we learned that the 360-degree servo has a rotation time written in brackets, and there is a special code to stop it.
🔑 The input range of a 360-degree servo is usually 0 to 180, where 90 means stop, below 90 means counterclockwise rotation, and above 90 means clockwise rotation. The closer the value is to 0 or 180, the faster the rotation speed.
Ask for help to Prof. Viola, she changed several of our if structures to avoid the malfunction caused by using two millis() in one code.
(Turning the two storage time values into one, sensing light for three seconds and then rotating for three seconds becomes six seconds.)
Ask for help for Fellow Kevin, the funny thing is that he first praised our code for being well organized, and then we watched him overturn most of our code step by step.🤲
1️⃣ Kevin changed the flowerbutton, because our interaction is mostly sequential, to use a state variable with defined states (0, 1, 2, 3),
each representing a specific part of the program logic ↗️
• State 0: Monitor light sensor.
• State 1: Perform bloom animation.
• State 2: Check force sensor (FSR).
• State 3: Close the flower if force is detected.
2️⃣ Introduces boolean flags (lightDetectedA, lightDetectedB, lightDetectedC) and records the timestamp when light is first detected. Avoids trigger inconsistencies and unexpected behavior caused by rapid changes in light.
3️⃣ Uses timestamps (lightStartTimeA, lightStartTimeB, lightStartTimeC) to debounce light sensors, which avoids repeated or overlapping servo actions if a sensor value briefly changes.
4️⃣ Put all the get data codes in the front.
5️⃣ Because we don't fully understand the function, Kevin recommend that
we do not ❌use the rotateRight() and rotateLeft() codes, and choose to repeat them in each sensor.
6️⃣ During this period, the values of the light sensors were erratic, and we found that it was because they were not purchased in the same batch... so the out out difference was too large.
code ⬇️
if (state == 0) { // checking LDRs
// Monitor and check light sensor A
if (lightLevelA > lightThreshold) {
if (!lightDetectedA) {
lightDetectedA = true;
lightStartTimeA = millis();
} else {
if (millis() >= lightStartTimeA + 3000) {
state1StartTime = millis();
state = 1;
}
}
} else {
lightDetectedA = false;
}
...same with B and C
⭐} else if (state == 1) { //state 1 plays blooming animation
if (millis() <= state1StartTime + 1000) {
topServo.write(180);
} else {
topServo.write(90);
state = 2;
}
} else if (state == 2) { //State 2 checks FSRS
Serial.print(fsrValue2);
Serial.println();
//fsr 1
⭐if (fsrValue1 > 10 || fsrValue2 > 10 || fsrValue3 > 10) {
state3StartTime = millis();
state = 3;
}
}
else if (state == 3) { //state 3 close flowers animation
if (millis() <= state3StartTime + 1000) {
topServo.write(0);
} else {
topServo.write(90);
state = 0;
}
}
Connect all wires
⬇️
Punch holes in the cardboard
⬇️
Connect the bend sensor to the grass 🌱
Test the 180 servo upright direction ➡️
Fix the servo at the bottom ➡️
Stick the wooden stick to the servo ➡️
Stick the flower to the wooden stick ➡️
Install everything on the stamens and petals🌷
*Use tape to stick the wires that are always loose*
Before user testing, we still couldn't figure out how to open and close the petals.
Our initial idea was to wrap the fishing line around the paper and stick the servo with the paper tube on top.
The problems we encountered were:
The contact area was too small, so the paper was not firmly attached.
The paper tube was too short, so the line would not wrap around the paper, but would wrap around itself.
The "ceiling" was not high enough, so the upward pull was not strong enough.
At the same time, the 360 servo line burned out, so we temporarily replaced it with another one
!! Next time don't glue the line together in the middle of making
The acrylic board was not stable when placed on the cardboard (it collapsed in the end)
Increase the volume of the buzzer triggered by the bend sensor
No prompts, don't know what to do
The acrylic board should be dropped to the ground. The original 30*30 acrylic board was changed to 60*30, so that it can be landed;
Increase the volume
Add music ❌---interaction changes too fast.
About the opening and closing of the flower:
The servo hanging high❌---Stress point remains unchanged, but the force is still not strong enough
Imitate the structure of umbrellas (Like a project last semester. )❌---Too difficult, too much change
Solve the problem of flower shaking:
Kevin said it might be insufficient power, but I changed to a 12v external power supply, which did not improve it, but I found that it worked normally when I held the base of the flower with my hand. I found that it was not a power problem, but the rotating piece (?) and the servo must be tightly fixed together, and the screws of the blue flower could not be tightened.
Try the second way to open and close the flower:
the servo is fixed at the bottom, and the iron wire and cardboard are used to build the pillars for the fishing line to wrap around: there is no way to fix it on the servo, and it is not lighter than the plastic tube
So we just use the plastic tube.
The plastic tube shakes too much, so we found a slightly thicker tube and added a bracket on it.
It was our first time using a studio saw!!
Then we started to experiment with the length of the fishing line. This step was very challenging. 🔥
If we experimented too many times, the tube would be filled with glue that couldn't be removed.
If we left too little length for the rope, the flower would be torn.
After the rope was tightened, the shaking controlled by the distance sensor was limited (this was the best effect during the user test), so we reduced the shaking value without affecting the effect as much as possible;
The fishing lines of the three flowers would get tangled on the pillar and affect each other, so we arranged the places where the three flowers were entangled from top to bottom in order of distance;
Maybe it’s because the 360-degree servo is time-controlled, and the angle of each rotation is different, with a large error, so we shortened the fishing line and reduced the rotation time to control the error.
Appearance design:
Separate the moss from the 4 servos at the bottom to prevent the line from being rolled in.
Because the paint cannot create a sense of technology and metal, I bought kitchen tin foil and pasted it on the outside of cardboard.
We decided to use clever tips, so the warnings were reversed, which can also fit our theme of
"Plants avoiding humans"
Final version
Link: Mid project video 🎦