Here is my problem. I have built a batch reactor for a a project at work. The program works, does what it needs to do, stores data, controls feeding, wasting and dilution cycles, controls pH and dissolved oxygen, etc... This was my first big program I wrote, had little experience with programming and circuits.
Now I read about the problems relays can have on the Arduino with restarting. I followed the advice of having the relay board opto isolated from the Arduino. From this website:
https://arduino-info.wikispaces.com/RelayIsolation
My problem occurs when I try and control the pH values. The Arduino will sometimes restart, it seems random. It can switch the relay on, and off 10 times with no problem. Then restart twice in a row.
I don't know if it's needed but here is the code for turning the relays on/off
void checkStates() {
#if NOCHK
return ;
#endif
check_pH();
checkDO();
automatedCycle();
return ;
}
void check_pH() {
if (pH < pH_lowerLimit) {
pinMode(baseRelay, HIGH);
delay(700);
pinMode(baseRelay, LOW);
}
else if (pH > pH_upperLimit) {
pinMode(acidRelay, HIGH);
delay(700);
pinMode(acidRelay, LOW);
}
return ;
}
void checkDO() {
if (DO < DO_lowerLimit) {
delay(1000);
pinMode(airRelay, HIGH);
}
else if (DO > (DO_lowerLimit + 0.50)) {
delay(1000);
pinMode(airRelay, LOW);
}
return ;
}
I've attached a wiring diagram. I apologize for it, I did my best but it's the first one I have ever made. Hope it makes some sense and is helpful.
The only time that I have a problem is when the acid or base pump is turning on. I can switch all the other pumps on/off to my hearts content with no restarts observed.
I haven't noticed a problem with the mixer (yes it should be connected to the NO on the relay) or the air pump.
Here is a list of the equipment that I am using:
Relay
Arduino
110V AC to 12VDC
5V Converter:
3V Converter:
Please let me know what other information I can provide! I'm sure I left important stuff out.
Thanks for all the help.
