Hello I am doing a home project which includes watering plants as I'm interested in growing my own food (grocery prices, am I right? )
I want to make use of PWM to drive a couple of peristaltic pumps, but am unsure if PWM is possible with the Edge Control using one of the pins meant for a MKR board. My hope was that with PWM I can accurately water my plants by continually adjusting the rate at which the pump runs at, as a moisture sensor continually updates its reading of the moisture level. I am worried that a simple on/off may put my plants at risk of overwatering as some are really sensitive to that.
WHY! What is wrong with using real on and off, high and low, to turn the pump on and off? How does PWM get the power to the actual pump motor? The Arduino CANNOT power the pump, but it can control the power.
@Paul_KD7HB The idea in my mind was that once the soil moisture sensor detects dry enough soil, it'll cause the pump to run and the Edge Control through PWM will slow the motor down as the soil gets more moist. The idea is to have precise control based on the readings from the soil moisture sensor.
Well, good luck getting that with a DC motor and a peristaltic pump. Remember that motors and water take a lot of energy just to get them started moving.
Maybe I should have been more clear. I will have a separate power circuit, the pumps are only 5V, and diameter of the tubing is on the scale of millimeters. This isn't meant to move much water at any one instant; power won't be an issue. All that matters to me is that I can use PWM to get a variable duty cycle based on soil moisture reading.
Do you understand there is NO power to the motor with PWM, EXCEPT for the times there is +5 volts in the PWM signal? When the PWM signal is at zero volts, there is no power to the motor and it will try to stop. So power is the fundamental issue. With PWM, the actual power is fluctuating between zero and what ever time there is +5 volts from the Arduino. So if you are going to use PWM, start with 100% positive and 0 at ground level, and then reduce the 100% to a lower value of whatever you want.
It takes several minutes for water to soak into the soil and for the moisture level to settle.
Have the Arduino run the pump for maybe 30 seconds and then wait at least 5 minutes before taking another moisture reading. If still too dry, repeat the process.
(You could say that the process I just described is actually PWM. But with a period of 5 minutes rather than 2 milliseconds!)
@paulpaulson I have started a practical exercise previously, but the pump worked as a simple on/off dependent on moisture reading. But that was with a different Arduino model and was some years ago. After brushing up on my understanding of both principles, I believe that PPM may still be ok for my intended use case.
@PaulRB This is brilliant. I suppose I was overthinking this setup. I think I'll be better served with having the system check every so often based on some testing I need to do as part of calibrating the soil moisture sensor anyway. So I can do as suggested and update motor speed once the Arduino "reads" the sensor value.