Controling the pump

Hi there,

For my first project i was thinking about building a automatic watering plants system. To begin with (only 1 pump, soil meter and plant but later on build a big container with more plants meters and watercontainers etc. I got the arduino and the soilhumitity meter in about an hour but i got stuck with my pump. I bought a jt-180A pump and want to control is. In my oppinion (correct me if i am wrong) there are two ways to do so. With a relais (which i ordered online) and but with the existing wires aswell. I dont want to focus on the relais to much because i think i can figger that out myself. My question is: how to control the pump?

The pump has 3 wires (red+ black- and white speedwire as i found out?). I hooked up my pump with an old usbcable to an external powersupply and it works great but i can not control it. Is it possible to control it with the white wire from the pump?

I have tried to control it with a analogWrite (11, x) but that dit not work. It did not gave me any errors but when i change the values from 0 to 255 the power of the stream did not change. In both cases i started with #define/int pump 11 or int pump 11.

I also tried an analogWrite on pin A0 since that is the real analog but it said it is a read only pin.

Am i doing something wrong or isn't possible to control the pump with the white wire and do i need to wait for my relais?

Hope i gave the right information and i hope you can help.

Greetz Pieter

Before i forget: Arduino uno Waterpunt jt-180A soilsensor hl-69

(I wrote something much more - Arduino decided to erase it. Sorry for the short answer.) analogWrite uses PWM - see here for more details. In terms of analog, A0 has no difference between the others. See this to see the pins you can use for PWM. I'd recommend a transistor instead of a relay - Adafruit has a tutorial here. Transistors allow you to control the speed without using the control pin - it will probably work better. They are also faster, cheaper, and quieter than relays. If you do use a relay, however (but you do need a transistor to power it - so there's no reason to use it here, unless you ordered a board that has it built in), I'd recommend the tutorial here. Your pump uses 0.5A - i.e. you can just power it from USB, but running any computationally challenging code on the Arduino will make your computer give you a power warning. Maybe try using the motor as a servo motor - see the tutorial here as a guide. Just remember not to run the pump dry for more than ~5-10 seconds - it will heat up and (hopefully, depending on how good the manufacturers are) shut down or maybe even shut down. It wouldn't be a bad idea to use water level sensors and attach a temperature sensor on the motor.

1 - The output pin of an arduino does not give enough power to run a pump.

2 - Using PWM is a bad idea with an inductive load (ie: anything with coils), because of the electrical behaviour of inductors. Attaching any motor directly to your arduino will likely fry the arduino because of "back EMF" - the same thing that creates the spark across a spark plug.

If you want to turn a motor on/off, use a relay, MOSFET, or darlington pair. Don't forget the flyback diode.

If you want to make it adjustable, use a shield built to control a motor, which has electronics to convert a PWM signal into a smooth voltage.

According to this the white wire seems to be a sensor that you can use to detect the motor's speed.