I love plants and green areas. they make me more comfortable and relaxed. but I have a problem that I forgive to water on time. so, I think to solve this problem and apply what I've learnt at the maker diploma. I decided to build a system that could water them on time.
I needed to make just an enclosure for the electronic components to be contained.
so, I used fusion 360 to design it.
it was 6 parts. I drew them with T-slots to use screws and nuts.
I drew them in 2D sketch, then I extruded them to 2.5D then I exported them by using fusion extension that called " DXF 4 laser".
First, I used laser works to transform DXF files to G code so the laser cutting machine could read it. I used 3mm PLY wood in manufacturing .
I adjusted the parameters for cutting and engraving then I downloaded them.
I chose the file, chose track and adjusted the origin of cutting then pressed "enter". the machine started its mission and I took some photos as I love this step so much :"D
the electronic components were:
1- breadboard (make electrical connection between the components)
2-arduino UNO(micro controller)
3-soil moisture sensor (measuring the watering content. the probes act as variable resistance that changes according to water content. the more water the more conductivity the lower resistance and vice versa. The sensor produces an output voltage according to the resistance). (input component)
4- ultrasonic sensor (measuring the distance of the target object by emitting ultrasonic sound waves and convert it after reflection to an electrical signal ). (input component)
5- mini water pump ( it contains piston or turbine to create negative pressure at it inlet so, the atmospheric pressure will push the water). ( output component)
6- mini speaker (output component)
7- DF mini MP3 player module
8-SD card ( flash memory that store files)
9- Jumpers ( males & females) used to connect components with each others.
10-PVC tube used to transfer water from pump to the target object.
11-relay module ( electrical switch that is operated by an electromagnet. I used it specially to power the water pump).
12- 6V adaptor for powering
13- 2K resistor I used for the MP3 module
I used 6V adaptor to power it instead of batteries as there is no movement.
I also used Relay module which is an electrical switch to give current to the pump.
an I connected it as in the following diagram.
I programmed each single object alone. at first, I programmed the soil moisture sensor to read the serial monitor to choose the appropriate read to put it as a limit in the code.
the second was to programme the ultrasonic to measure the water level and also know the range of reading.
then I integrate between the codes as following:
1- upon the reading of soil moisture if it is above 400 so, turn on the pump else, turn it off
2- according to the read of the ultra sonic sensor if the distance is larger than 10 cm then turn off the pump and turn on the mp3 module ( which I've added its code it to the library) . if not? follow the previous step.
#include "DFRobotDFPlayerMini.h"
#include "SoftwareSerial.h"
int sensorPin = A0;
int sensorValue;
int limit = 400;
#define echoPin 2
#define trigPin 3
long duration;
int distance;
SoftwareSerial mySoftwareSerial(0, 1); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void setup() {
pinMode(sensorPin, INPUT);
Serial.begin(9600);
pinMode(8, OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.println("Ultrasonic Sensor HC-SR04 Test");
Serial.println("with Arduino UNO R3");
Serial.begin(115200);
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini Demo"));
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
if (!myDFPlayer.begin(mySoftwareSerial)) { //Use softwareSerial to communicate with mp3.
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while (true);
}
Serial.println(F("DFPlayer Mini online."));
myDFPlayer.volume(25);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
sensorValue = analogRead(sensorPin);
Serial.print("Analog Value : ");
Serial.println(sensorValue);
if (distance <= 5) {
if (sensorValue < limit) {
digitalWrite(8, LOW);
}
else {
digitalWrite(8, HIGH);
}
}
else {
digitalWrite(8, LOW);
myDFPlayer.play(1); //Play the first mp3
delay(2000);
myDFPlayer.pause(); //pause the mp3
}
}
Ultrasonic connection
1- VCC to 5V
2- GND to GND
3-Trig to pin 2
4- Echo to pin 3
Moisture sensor
1- VCC to 5V
2- GND to GND
3-A0 to A0
Relay module
1- DC + to 5V
2- DC- to GND
3- IN to pin 8
4- COM to (+) of the adaptor
5- NO to (+) of the pump
MP3 module
1- VCC to 5V
2- RX to pin 0
3- RX to pin 1
4- SPK1 to 5V
5-GND to GND
6- SPK2 to GND
pump
1- (+) to NO of the relay
2- (-) to GND
Adaptor
1- (+) to VIN on Arduino & COM on relay
2- (-) to GND
Actually, I owe to my peers and instructors in helping me in every step in this project.
I'd thank Menna for the idea discussion and her encourage. Ahmed Adam for his helping in the design, programming and giving feedbacks, Ahmed Saeed for his help in files exporting and to adjust the MP3 module. Haneen for her help in MP3 code and her tips. also Ali provided me with watering system code libraries. Noha helped me a lot in cutting process patiently.
I helped Mariam and Esraa in exporting their files, chose LEDs colors with Esraa and help her to use avometer. I also helped Haneen to write the text on her design.
N.P: I wanted to add some photos at the Hackathon day as I love this day so much....
I was reading the serial monitor of the ultrasonic sensor.
I expected it will be a wrong reading but, it was not so, they were laughing at me :"D
Together we're winners ( it's me, Mariam and Haneen)
The group photo
thanks Saeed for this photo you made my day
_ it seems like they were laughing at me too but it's okay I laugh too :"DD
I got stuck after cutting the enclosure parts as I did not cancel the overlapping of the parts so, the things that I wanted to have it engraved, got cut. don't repeat my mistakes you should check the overlapping before cutting :"D
I also made some modifications on the design.
I also got stuck when it comes to code the MP3 module. I've searched and asked for help.
that is what i talked about the wrong cutting instead of engraving
I'll make it move and detect the plants by camera.
The integration step
while working
the final shape
Sokara ( my lovely cactus), aquatic plants and sunflower with my beehive project