Introduction: Automatic Plant Watering System
Learn how to build an automatic watering system for indoor plants. Often, we may be busy and forget to water our plants. We sometimes go away from the house for days, on a vacation or a business trip. In these cases, the plant may die due to lack of water.
The automatic watering system described in this instructable will keep the plant alive by watering it automatically. We built this system using the Silego GreenPAKSLG46620VCMIC, a small liquid pump, transistors, LEDs, push buttons, and a buzzer.
Step 1: System Tasks
The system must water the plant (turn on the pump) automatically every 24 hours or 48 hours for a selectable time period (5 seconds, 10 seconds, or 15 seconds). The user can choose how long they want the plant to be watered based on the plant’s water requirements. The system also alerts the user when the water level in the tank is low. It can optionally display LED emotions as well.
A user interface must be built to control and monitor the system. The SLG46620V CMIC will be configured to run as an IC controller for all the project functions, as it is a cost-effective NVM-programmable device that minimizes component count and power consumption. Since GreenPAK IC cost less than microcontrollers, the overall project costs will be low. GreenPAK is also more power efficient for timing projects, so if we want the project to run on battery power, GreenPAK saves more power than a microcontroller. Some commercial products make do without a controller by using oscillators and ICs for timers, logic gates ICs, and many other discrete components. GreenPAK provides all these parts and more in one tiny chip which can be configured in minutes. To make the system interactive, a custom LED matrix is connected to the SLG46620V to show emotional images (happy and sad) according to the system state, so the system can be a competitive product. The system interface has 4 push buttons that are described in Table 1.
You can go through all steps to understand how the GreenPAK chip has been programmed. However, if you just want to easily create the cube without understanding all the inner circuitry, download GreenPAK software to view the already completed Watering system GreenPAK design file. Plug your computer to the GreenPAK Development Kit and hit program to create the custom IC to control your Plant Watering system.
The next steps will discuss the logic that is inside the Automatic Watering system GreenPAK design file for those that are interested in understand the internal circuitry.
The project contains 4 stages:
- Choose watering time (24h/48h timer)
- Choose water amount (5s, 10s, 15s)
- Water tank observing
- Make LED emotions
Step 2: Choose Watering Time (24h/48h Timer)
For this first stage, we will build the timers that will enable the pump after either 24 or 48 hours. First the RC OSC is configured to work at 25 kHz and "RC clock predivider" is set to 8, as shown in Figure 2.
The pump must be activated once every 24 or 48 hours. One counter isn't enough for this period, so to make the 24-hour timer, we’ll use two counters. CNT3/DLY3 from matrix1 is set to give a pulse every 10 seconds, and its "counter data" is 7812, which is given by the formula:
Time period=(counter data+1)/CLK
CNT3’s output is used as CLK for CNT0/DLY0 and CNT0’s counter data is set to 8640. This value comes from the equations:
24 hours=60*60*24=86400 seconds
To make the 48 hour timer, the CNT0 output is connected to Pipe Delay0, configured to make two rising-edge delays. Pipe Delay resets when the pump turns on. A control button to switch between the two options is built on PIN 2, which is connected with LUT1 (configured as an AND gate). DFF0 and DFF1 are used to save the option. The initial polarity of DFF0 is high, which represents the 24 hour state, and the output is piped to DFF1's D pin. When the DFF0 output is high and DFF1 is low (24 hour option), LUT0 activates the IN2 pin connected with CNT0, the counter output passes to P DLY0 (used as a rising edge detector), and a pulse passes to the pump counters (described in the next section) to turn the pump on. In the second state, when DFF0’s output is low and DFF1’s is high (48 hour option), Pipe Delay0’s output appears on LUT0’s output and the pump turns on every two periods of CNT0. PIN 4 is configured as a digital input and it is used as manual watering button. It is also connected with CNT0’s RESET IN pin to reset the counter and to restart timing from the beginning with every push (Figure 3). In this case, users can choose a preferred time and do a manual watering. After that, the system repeats watering at the same time every day (or every 48 hours). CNT2/DLY2 is used as a filter to prevent short pulses generated by button switching. One counter is used as filter for all the buttons, because of the limitation of counters, and the counter output is selected using LUTs connected with the buttons. CNT2 is set as an 8 ms rising edge delay and its output is wired to AND gates. The other gate input is the signal from the button itself.
Step 3: Choose Water Amount (5s, 10s, or 15s)
In this part, three timers must be created with three periods (5 seconds, 10 seconds, and 15 seconds) so that the user can choose the watering period according to their plant’s size. Switching between the periods is controlled by PIN 3’s input (Watering Mode button). This pin is connected to the LUT4 AND gate, which filters button input. LUT4’s output is piped to three DFFs’ CK pins (3, 4, 5). The DFFs are configured in series such that the output (Q) of each DFF goes to the input of the next DFF, and the last output goes back to the first input. These DFFs are used as buffers to save the watering mode chosen by the user.
Every DFF output is also connected with a counter configured as a falling edge delay. CNT9/DLY9 counter data is set to 244 to give a 5 second delay, CNT6 is set to give a 10 second delay, and CNT5 is set to give a 15 second delay. CNT5 and CNT6 use CNT4’s output from matrix1 as CLK to delay the required time while CNT3 is set to generate a pulse every 100 ms. AND gates are used to activate just one delay that is connected to the active DFF. LUT3 is used to prevent restarting delays while the pump is on (Figure 4).
Step 4: Water Tank Monitoring
A water tank must be located beside the system. The system monitors the water level in the tank and turns on the buzzer when it is low. This task is implemented using the water’s electrical conductivity. We use two anti-corrosion wires as sensors, set at different depths as pictured in Figure 5.
When there is some conduction between the two wires, the water level in the case is enough. When the conduction is lost, the water level is low and the alarm sounds. The SLG46620V IC sends a 100 ms wide pulse every 2 s to the bottom wire, connected to PIN 13. This signal is received at the top wire, connected to PIN 12.
The sampling pulses are generated using two counters. CNT4 sets the high pulse width, while CNT7 sets the output low time. A 100 ms high pulse width is set by CNT4 with counter data set to 78. CNT7/DLY7 controls the output low time with its counter data set to 20. Note that its clock input is the CNT4 output. This sets the low time in multiples of the high pulse width (100 ms high and 2 s low). This high pulse will turn the ACMP on for 100 ms to control sampling of PIN 12. ACMP1 is configured to improve the noise tolerance of the wires. The sample result is saved in DFF6. DFF6 is used as low water indicator, and its output is high when the water level is low (and vice versa). Then, the CNT7 pulse turns the ACMP off for two seconds. The CNT8/DLY8 and the 2-bit LUT5 combination form a glitch filter where the CNT8/DLY8 delay period equals 8 ms to reject the short pulses that may happen in ACMP input or which are generated by ACMP switching. PIN 12 is configured as an analog input with an internal 1 MΩ pull-down resistor. When PIN 13 presents a signal pulse high, conduction through the fluid can cause the PIN 12 wire (low/high) to pull up and be detected as “high” by ACMP1 (Figure 6).
Step 5: Generating LED Emotions
In this section, a custom LED matrix is built to make interactive emotions that make the system similar to a robot. The LED matrix can show two characters; a happy smile and a sad frown. Each character has two parts, eyes and lips. Our LED matrix comes with three pins, so the eye LEDs are wired together in parallel and enabled by one pin, the second pin is for happy lip LEDs, and the last pin is for sad lips which are also connected in parallel.
The sad frown is shown when the water level in the tank is low. When DFF6’s output is high, this means that water level is low, so a high signal passes to PIN 14, configured as a digital output and connected with the sad lip LEDs. This signal also passes to PIN 15, which turns on the eye LEDs.
The happy smile isshown in three cases. The first case is during the watering period (in other words, when the pump works), the second case is when the water level is low and we refill the tank, and the third case is when the LED enable button turns on. PIN 16 is set as a digital output and connected with the happy lip LEDs, which are wired together in parallel. When the pump works, the high signal coming from matrix0 across P1 appears on LUT8’s output to show the happy smile while the pump is working. This happens if the LED emotions are enabled. PIN 20 is used as a digital input to enable or disable the LED emotions, and the state is saved in DFF7 (the initial output of DFF7 is high). The second case that the happy smile is shown when we fill the water tank after the low level alarm. DFF6’s output is high when the level is low. It switches to low when the tank is filled and water connects the two sensor wires in the tank. P DLY1 is used as a falling edge detector to detect DFF6 switching from high to low. P DLY1’s output is connected with LUT9 to give a high pulse if LED emotions are enabled. The happy smile is also shown when LED emotions are re-enabled after being in a disabled state. To apply this, a wire is connected from PIN 20 to LUT9 so that a high pulse appears on LUT9’s output when the user enables LED emotions (Figure 8).
These three cases are briefly described in Table 2. CNT1/DLY1 is used as a 10 second delay to turn the LEDs on for 10 seconds and then turn them off every time LED emotions are enabled or the water level in the tank changes from low to high.
A buzzer is used in the system to sound an alarm when the water level is low. The buzzer is connected to PIN 19, and is activated using the LUT6 AND gate when DFF6’s output is high (low water level) with CNT7 pulses. As CNT7 is set to 100 ms high and 2 s low, a beep is heard every two seconds until the water case is filled.
Automatic plant watering system was built with a control interface to give users the ability to choose watering time and watering period. A custom LED matrix was also connected with the system to show interactive emotions. The SLG46620V CMIC was successfully configured to implement this smart and automated device. It allowed us to easily integrate several discrete components into a single small GreenPAK CMIC.
We have a be nice policy.
Please be positive and constructive.