📜 ⬆️ ⬇️

We do automatic watering of a room flower on Arduino in 15 minutes

After I had died another flower, I realized that it would be nice to somehow automate the process of watering.
Without further ado, I decided to put together a design that would water the flower instead of me. As a result, I had such a device, which copes with its duties:

image

With the help of two regulators you can adjust the volume of water poured at a time, as well as the period between irrigations. Who cares - further detailed instructions on how to make such a device.

To build a polivalki you need a number of components and no more than 30 minutes of free time.
')
Components Used:


image

We collect everything according to this scheme:
image

Or clearer:
image

That's what happened with me:
image

First we test the pump. Give him 5V. If he buzzed, everything is in order, move on.

Now connect the pump to the Arduino. We will make a small strapping on the breadboard for controlling the pump with arduino.
image

Let's try to control the pump with Arduino. We flood such code

int pumpPin = 5; void setup() { pinMode(pumpPin, OUTPUT); digitalWrite(pumpPin, LOW); } void loop() { digitalWrite(pumpPin, HIGH); delay(1000); digitalWrite(pumpPin, LOW); delay(1000); } 


If he buzzes occasionally, then everything is fine again.

Now we have to add two regulators. We hook up to our device variable resistors, and check their performance.
image

We flood such code on Arduino

 int volumePin = A0; void setup() { pinMode(volumePin, INPUT); Serial.begin(9600); } void loop() { Serial.println(analogRead(volumePin)); delay(100); } 


Go to the Serial Monitor and make sure that there is a reaction to the rotation of the regulator. It should vary from approximately 0 to 1024.

image

It now remains to make earn it all together.

Here is the direct code of the water filter:

 //    ,     ( 4  15 ) #define MAX_FLOWTIME 15 // seconds #define MIN_FLOWTIME 4 // seconds //              #define MAX_PERIOD 7 // days #define MIN_PERIOD 1 // days #define MAX 1015 #define MIN 0 int volumePin = A0; // ,    ,      int periodPin = A1; // ,    ,      int pumpPin = 5; // ,      int volume; int period; // ,    ,   volume void water() { digitalWrite(pumpPin, HIGH); //   delay(volume); digitalWrite(pumpPin, LOW); //   delay(period); } void setup() { pinMode(pumpPin, OUTPUT); digitalWrite(pumpPin, LOW); } void loop() { //    ( )       volume = map(analogRead(volumePin), MIN, MAX, MIN_FLOWTIME, MAX_FLOWTIME) * 1000; period = map(analogRead(periodPin), MIN, MAX, MIN_PERIOD, MAX_PERIOD) * 1000 * 60 * 60 * 24; water(); } 


Here is the final result in the work:


In the near future, I think here to add a sensor of the water level in the tank and a soil moisture sensor.

Source: https://habr.com/ru/post/210814/


All Articles