Midterm Project

What are the two things you’re most likely to see in a typical dorm room in NYU Abu Dhabi? Plants (alive or dead, it’s anyone’s guess), and fairy lights. 

What’s the problem with plants? They die. What do we like to do? Party. (Keeping it halal of course). With this in mind, I decided to make a plant that helps use with all three of the aforementioned situations- having fairy lights, plants that don’t die, and parties. 

It uses three potentiometers, one for ‘water’, one for ‘light’, and one for party mode. If you turn the water potentiometer, the plant ‘grows’. Turning the light potentiometer makes the leaves and flowers (for which I used LEDs) glow. The party mode potentiometer makes the LEDs blink at varying speeds depending how much you turn the potentiometer.

Water:

I initially tried using weight sensors for the ‘water’ potentiometer since I wanted to use actual water- the increasing weight of the water in a glass would make the plant grow- but it didn’t work since the sensor wasn’t consistent enough with its readings. So I decided to use a potentiometer instead. I used if statements to create three ‘levels’ so that the plant can grow a little more each time. The potentiometer is connected to a motor (again, I had issues with the motor being too weak so I had to rewire my plant to make it lighter and also use a stronger motor), which turns for a set amount of time every time it’s turned. The motor is connected to a pulley system which pulls the plant up, making it ‘appear’ out of its container, giving the illusion of growth. This was SUPER tricky because I had to figure out the mechanics of it while making sure the plant didn’t just tip over to one side as it was lifted- I was partially successful. But hey, plants don’t necessarily grow in exactly vertically lines do they?

Light:

The light potentiometer makes the LEDs light up in turn, from bottom to top, adding to the illusion of growth- I used green for leaves and other colours for flowers- very original, I know. Again, I used if statements to make them light up in sequence. 

PARTY PARTY PARTY:

Yet again, if statements to the rescue- turning the party potentiometer makes the LEDs (the leaves and flowers) blink at different speeds, depending on how crazy you want to get. 

I’ve labelled the potentiometers so people know what they’re controlling, and the little dial type thing I’ve drawn above the knobs (hopefully) conveys that there are three levels to each potentiometer setting. 

So there you have it: disco plant.

int counter = 0;
// the setup routine runs once when you press reset:
void setup() {

// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);

pinMode(11, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sV1 = analogRead(A0);
sV1 = map(sV1, 0, 1023, 0, 255); //potentiometer for 'water' makes the plant 'grow'

int sV2 = analogRead(A1);
sV2 = map(sV2, 0, 1023, 0, 255); //potentiometer for 'sunlight'. affects LEDs

int sV3 = analogRead(A2);
sV3 = map(sV3, 0, 1023, 0, 255); //potentiometer for party mode- makes the lights blink

// print out the value you read:
Serial.println(sV2);
delay(1); // delay in between reads for stability

if (sV1 > 0 && sV1 < 85 && counter == 0) {
digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2500);
digitalWrite(11, LOW);
delay(500);

counter ++; //ensures that the motor turns only once

}

if (sV1 > 85 && sV1 < 170 && counter == 1) {
digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2500);
digitalWrite(11, LOW);
delay(500);
counter ++;

}

if (sV1 > 170 && sV1 < 255 && counter == 2) {
digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1500);
digitalWrite(11, LOW);
delay(500);
counter ++;

}

if (sV2 > 0 && sV2 < 15) {
digitalWrite(3, LOW); // turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW);
digitalWrite(6, LOW);

}

if (sV2 > 0 && sV2 < 115) {
digitalWrite(3, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW);
digitalWrite(6, LOW);

}

if (sV2 > 115 && sV2 < 190) {
// turn the LED on (HIGH is the voltage level)
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(3, HIGH);

}

if (sV2 > 190 && sV2 < 255) {
// turn the LED on (HIGH is the voltage level)
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(3, HIGH);

}

if (sV3 > 10 && sV3 < 85) {
digitalWrite(3, HIGH);// turn the LED on (HIGH is the voltage level)
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(1000);
digitalWrite(3, LOW);// turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(1000);

}

if (sV3 > 85 && sV3 < 175) {
digitalWrite(3, HIGH);// turn the LED on (HIGH is the voltage level)
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(500);
digitalWrite(3, LOW);// turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW);
digitalWrite(6, LOW);
delay(500);

}

if (sV3 > 175 && sV3 < 255) {
digitalWrite(3, HIGH);// turn the LED on (HIGH is the voltage level)
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay(250);
digitalWrite(3, LOW);// turn the LED on (HIGH is the voltage level)
digitalWrite(5, LOW);
digitalWrite(6, LOW); //LEDs blinking at varying speeds
delay(250);

}

}

 

video:

https://drive.google.com/open?id=12GA-RQHJ3nGKpNV4oIUWMX-hbXSYaBqU

 

 

 

Leave a Reply

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