06-01-2020 04:55 PM
Hello Everyone, I was able to get everything connected, and started building my homebrewing mash set up. For hardware, i'm using an Arduino Mega 2560 to control everything, a sainsmart 8 channel relay board connected to the Arduino to control heat and valves,a 12v N/C 1/2 solenoid valve, and a 1/2 ball valve for a water bath drain.
For the program, I am using 1 relay with A/C 120v 60hz to power a 1500 watt heater that heats a water bath to the heat my brewing mash. No issues running that. At the end of the process, I have a system to rapidly cool the mash. I have a 12v 1/2 solenoid hooked up to a water supply, a 1/2 ball valve that opens to drain the cooling water after it heated up, and a float sensor to tell the solenoid when to open and close to fill/add more cooling water to the water bath.
Both the ball valve, and solenoid valves are powered by their own relays on the relay board, as they use 12v power, and Arduino uses 5v. My Arduino is powered using the usb port on the computer. I have a separate 12v power supply with the ground going directly to the valves, and then the positive 12v to the center position on the relay. The valve positives to the n/o side, so when the relay triggers it sends the power to the serious valves. I'm 99.9% i have everything hooked up properly, as I'm and engineer and have been playing with electronics for years.
I have a program that runs through heating cycles and different setpoints for the mashing process that runs great. I'm running into an issue during the cooling process however i'm having issues. The ball valve can open and close with no issues to the program. When the solenoid valve shuts off the labview program stops and throws a 5003 error.
Here is the process summary. Ball valve opens by relay trigger to drain hot water, float connected to 5v power and then read via analog pin goes from 4.99v to 3.4v indicating it is no longer completely floating, the program activates the relay for the solenoid valve and the water turns on filling the bath with cool water. The float rises and gives the 4.99v signal to the analog pin telling the program to shut the cooling water off. The relay switches, and shuts the water off. The program errors out.
To diagnose this issue I made another program, using switches only to activate the relays, and then an led/numeric indicator to monitor the float signal. Using this program again no issues switching on the open and close relay for the ball valve, but switching on the relay for the solenoid valve OK, turn it off and program errors out 5003. If i disconnect the solenoid valve to just switch the relay on and off, no error out. If i move the to a different relay on the board and reconnect the solenoid it errors out again when i shut it off. I have tried multiple solenoids same issue. I don't understand what would cause this, since the 12v power should be completely isolated through the relay.
To make it more confusing i tried a new mega 2560, and 8 channel relay board. Same error. Here is where it gets interesting. I disconnected everything and then tried each valve one and a time. What i have discovered is that if i'm not using anything on analog pins then i don't get the error. aka remove the thermocouple wires, and remove the float sensor wires from the analog pins and then flip the switch for the solenoid valve on and off it functions with no problem, and the program doesn't error out. If i connect an analog sensor back in, even without code written for it (aka just the wires are connect) shutting the solenoid valve off causes the error.
I'm extremely confused by this behavior because the solenoid power should be isolated from the low voltage side of the relay board, and the Arduino all together so switching it on and off shouldn't make a different. This complicated by the fact that it only errors out when something is connected to the anlog system is even more confusing. I can switch on relay connected to the 120v ac no problem, and the 2 relays to open and close the ball valve no problem. In fact i can switch all 8 relays on no problem, but the moment that solenoid valve is connected to one of the relays I can turn it on, but turn it off with something connected to an analog pin, and the labview program fails.
Sorry for the long description. Does anyone have a clue what could be causing my issue?
08-11-2020 12:06 PM
Hi,
Have you tried connecting a flyback diode across the solenoid valve coil?
If the ground for the 12V supply is connected to the Arduino 0V then perhaps a spike is getting coupled onto the analogue input. This could crash the Mega 2560 causing the comms error.
Can you check the analogue input voltage with an oscilloscope?
12-05-2020 08:30 PM - edited 12-05-2020 08:32 PM
Yes you need a snubber for the back EMF pulse that the solenoid coil throws out when you de-energize it. Usually a diode across the coil is enough.
I have had this same problem using an Agilent 34970A DAQ/Switch with an actuator card (little relays) switching high current DC contactors (Big relays).
The back EMF was actually locking up the Agilent.