I happen to be the group leader of ten people working on this project, so getting the materials and finishing it before the deadline would be simple. Having to build this project reinforced my learning and taught me a lot of new things.
The truth is that not many people contributed to the project; they were only concerned with the money required to obtain the components. Many of my group members did not show up from the start of this assignment to the end.
The project is simple, but because it is something I don't do often, I had a lot of problems with the sensor and the battery. Initially, I attempted to use an IR Sensor for this project, but discovered that when exposed to light, the IR Sensor always turns HIGH, which was not what I desired. The sensor was supposed to turn HIGH only if there was an obstacle or an object in close proximity to it.
Using an IR Sensor meant writing fewer lines of code in my Arduino, which was why it was my first choice, and it was also less expensive than the Ultrasonic Sensor. I was using a 5v Submersive Pump, which cost about $8, to pump the liquid out. It seemed quite pricey, but because I was getting it locally, they raised the price.
Except for the light issue, the IR Sensor performed admirably, even better than the Ultrasonic Sensor. I went ahead and used the Ultrasonic sensor because a friend of mine who is more knowledgeable in this area advised me to.
The components and Items eventually used for this Project are:
- Arduino Uno
- Jumper Wires (Male and Female)
- Pipe
- 5v Submersive Pump
- Relay Module
- Container to hold the liquid
Below is the Block and Circuit Diagram for this project:
This diagram was made using the Fritzing Software...
Below is the Arduino Code used:
int trig = 3;
int echo = 4;
int relay = 8;
int a,distance;
void setup()
{
Serial.begin(9600);
pinMode(trig, OUTPUT);
pinMode(relay, OUTPUT);
pinMode(echo, INPUT);
}
void loop()
{
digitalWrite(trig, LOW);
delayMicroseconds(5);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
a = pulseIn(echo, HIGH);
distance= a*0.034/2;
Serial.println(distance);
if (distance <10)
{
digitalWrite(relay, HIGH);
delay(3000);
digitalWrite(relay, LOW);
delay(3000);
}
else
{
digitalWrite(relay,LOW);
}
}
Yesterday was the submission of this project, and I face serious issues with powering the project. The 9-volt battery I got for the project was not really functioning well or was not enough to power the pump. I noticed that if I disconnected the pump from the battery, the whole circuit worked very well and the relay would trigger.
At some point, the pump worked, but when I called my lecturer to check out my project, the whole thing stopped working all of a sudden. I didn't bring extra batteries and didn't have the cash to get new ones. The lecturer told me to come finish up the project on Monday.
So I would have to build a battery pack that would be powerful enough to power the pump and Arduino. Hopefully, I will get to do that before next week so I can get full grades for this project.
WHO IS STARSTRINGS01
Designed by @ grisvisa
Starstrings01, also known as Giftedhands, attends the Federal University of Agriculture in Abeokuta to study Mechatronics Engineering. He is a lover of the hive, a guitarist from Nigeria, and a student.
His ambition on Hive is to be more than just an ordinary blogger; he wants to be someone with a purpose. That's why he started the newbies initiative @newbies-hive to help guide and support newbies. Please follow the @newbies-hive curation trail by clicking here.
He tries to juggle education with being active on the chain, but his love and passion for Hive keep him on track..
All gifs included are powered by Tenor