I am making a doser for my fish tank using an Arduino Nano and this dosing pump.
I'm using a 12V, 1A power supply connected to both the Nano and dosing pump. When the dosing pump comes on, the Nano jumps back to the start of the sketch. Without the dosing pump connected, the sketch runs fine operating the optocoupler relays as expected.
I read somewhere that a diode can help, so I connected a 1N4148 diode to dosing pump ground, then turned the diode around-did the same to dosing pump +, but that did not help.
I wondered if you guys could maybe help figure this one out...Here's the sketch I cobbled together.
unsigned long minutesInMs(int m){
return m*60000; //values will be expressed in minutes
}
unsigned long secondsInMs(int s){
return s*1000; //values will be expressed in seconds
}
void setup() {
pinMode(9, OUTPUT); //pins 9 and 10 on arduino are connected to relays to control mixing pump and dosing pump
pinMode(10, OUTPUT);
}
void loop() {
digitalWrite(10, LOW); // turn dosing pump off
digitalWrite(9, HIGH); // turn mixing pump on using a NO relay
delay(secondsInMs(20)); // let mixing pump run for 20 seconds, or long enough to create kalk slurry
digitalWrite(9, LOW); // turn mixing pump off
digitalWrite(10, HIGH); // turn dosing pump on using another NO relay
delay(secondsInMs(3)); // let dosing pump run only briefly to prevent a precipitation event
digitalWrite(10, LOW); // turn dosing pump off
delay(secondsInMs(5)); // leave dosing pump off briefly to allow slurry to dissipate
digitalWrite(10, HIGH); // same as above, this just spreads out the kalk slurry.
delay(secondsInMs(3));
digitalWrite(10, LOW);
delay(secondsInMs(5));
digitalWrite(10, HIGH); // same as above.
delay(secondsInMs(3));
digitalWrite(10, LOW);
delay(secondsInMs(5));
digitalWrite(10, HIGH); // almost same as above.
delay(secondsInMs(3));
digitalWrite(10, LOW); // turn dosing pump off
delay(minutesInMs(30)); // in 30 minutes, the mixing pump turns back on and the loop function repeats itself again and again and again...
}


