CodeCast Code Explanation Video Attempt 2
Transcript
English (Auto-generated)
OK. So here's our read me file for our project Grow Pro So Grow Pro is an IOT self watering plant device designed to simplify plant care and optimize plant health by integrating sensors for monitoring environmental conditions and a server motor for automated watering. The Grow Pro offers convenience efficiency and peace of mind to plant owners. So here are the features for our project and below are the instructions for installation and here is how users can use a GoPro and now we go through the files. All right. Um Here is the code for our Arduino file. So this code is gonna be run on Arduino. Uh These are important libraries that we have to import to run the Bluetooth temperature and humidity and motor. These are pins and types that we need to, to get everything running for the Bluetooth DH D or temperature and humidity and servo motor. So this next section here is initializing objects to get everything running. So we have the Bluetooth serial object which uses these pins to initialize. We have the DH T which uses the pin and type to initialize. And, and this is like the the pins kind of like, yeah, the, the the pins that the Bluetooth needs to initialize and then this is the Sergo object and the Servo uses its pin down here to initialize. Um And so here are three variables that we use to keep track of data within the file as it runs. So watering status is, is has the motor run on a particular loop and then temperature and humidity just store the float values of temperature and humidity. Um For setup, we begin the serial Bluetooth monitor and then we connect it here. And so this DH t begin kind of like initializes the temperature and humidity and then this initializes the motor by attaching it to its pin and then writing it to the null state or like zero. So when water isn't being dripped out, so this is our loop that's gonna be run over and over, we have a 15 2nd delay on each run of the loop. Uh We made this choice because we realized that temperature and humidity wouldn't be changing so drastically that we'd need to um send the data over every second or even every five seconds or something like that. Um And we, and we knew that when you don't send the data as much, you, you uh reduce bandwidth and reduce power consumption. So we realized that that was a, that was an important part of our project. Um And then this next line gets the temperature and humidity. So this uses the DH T here, the DH T object to read temperature and Celsius and to read humidity and then use the, the pointer variables to send them back uh into this, these temperature and humidity. And then this conditional reads, temperature and humidity values. And if the temperature is above 25 °C and below 40% humidity, it will move the servo. And so we go to this, this method here. So this is gonna water the plant for five seconds. So it writes the Servo to 90 which is kind of like the drip state or the watering state when the motor is down and the water can pour sort of drip out onto the plant. Um We change the watering status to one to indicate that the motor has been turned on. We delay for five seconds to let the water drip out. And then we write the Servo back to its mill state where the water will not drip out. And then this is composing the string uh that will be sent back via Bluetooth. And then this line is, this line here is just like a debug output to make sure everything's working. And then this sets the watering status back to zero or not watering um just to reset the loop correctly. And that is our or do we not code onto the Raspberry P? So for this code, um it's supposed to be uploaded onto the Raspberry Pi, what this code does that, it retrieves the data that is sent from the via Bluetooth and then it uploads it on to our The Spot platform. This code is supposed to be run after the original is connected to the Rasbury Pi and that we've already locked down into our things Spot platform. So first, um these are the libraries that we be using. We'll be using serial so that we can initialize the serial connection between um our um res wifi and the things poured. No, she, we can restart. Yeah, it happens. It happens. Oh, wow.