Comms trouble when driving relays

Hello everyone,

I'm trying to operate a piece of vacuum equipment (a gate valve) using an Arduino. The valve is of the electropneumatic type, there's a 24V relay which when energised causes a pneumatic valve to open. I'm using an Arduino connected to a Darlington pair to step up to 24V, this is then driving a relay in a control box which in turn drives the relay on the gate valve. I'm using a diode to remove any back EMF on the input to the first relay connected to the Darlington pair. The problem is that when I set the Arduino output high, the valve closes but I lose serial comms to the Arduino (I'm using a streaming library to send info over the serial bus about the state of the valves I'm controlling). This also stops the bluetooth mouse connected to my laptop working. Any ideas how I can fix this?

Is this while you are running some type of motor?

If I understand correctly. You are doing some wireless serial transmission. And you believe noise is cancelling out your communication? Also to a blue tooth mouse that's completely separate from the system?

The relays shouldnt be noisy unless something is pwm ing it.

Asumming you are using serial port 0 are your tx rx lights still flashing?

Have you attempted this while USB teathered instead?

More information on hardware necessary, have you put a resistor i series with base of transistor? What value? Can you draw schematics?

Hello, thanks for your replies... I've attached a PDF of the circuit. There is no resistor on the base of the transistor, but this seems to work fine driving a different set of small valves; it's just this larger gate valve that gives the trouble. The serial transmission isn't wireless, it's over a USB cable. I've tried running my comms program (written in LabVIEW) on two computers now, both show the serial link crash when closing (not opening, though) the gate valve. The gate valve is in a normally closed position, the relays are energised to open it. I've only got a bluetooth mouse attached to one of the computers and the bluetooth serial to the mouse falls over whenever the gate valve is closed. Also shown on the attached circuit diagram is the microswitch used to detect the gate valve position.



Gate valve drive circuit.pdf (14.3 KB)

Your circuit is wrong, most likely arduino "crash" when trying to set output "high", current via clamping diodes exceeding limits.
You can modify adding resistors and NPN transistors as it shown here :
Or , change Darlington to NPN, and add base resistor.

Hello Magician,

Thanks for the reply - the circuit works when driving other relays, I'll check to see if I've drawn it correctly. But in the meantime I'll implement the ruggedised circuit in the link you sent.

Thanks again,


The circuit as drawn would fry the Arduino instantly as it puts about 22V directly into pin0.

Can you draw the correct circuit. Hint: your darlington is likely to be NPN in common-emitter configuration I think. You absolutely must use a base resistor when driving transistors this way - you may think its working, but its actually burning out the pin's output transistor - you must limit current from a pin to below 40mA at all times, and not let the pin voltage exceed the supply rails.

As for the Arduino crashing that's likely to the switching transients of the relay circuit - how are the 24V and 5V grounds connected?

Hello Mark,

Thanks for the reply - you're right, that's an NPN Darlington pair, part of an array of seven. In an attempt to solve the problem I isolated the arduino with an optocoupler - I thought this was overkill but then it still didn't solve the trouble. It turned out that even with the arduino completely disconnected from the relays the gate valve close still killed the serial link. I took apart the solenoid on the electropneumatic actuator and added a flyback (or snubber, or whatever - using Wikipedia here) diode, completely solved the comms trouble. All works nicely now.

Thanks to everyone for their help.



That's not what you drew - Darlington arrays have resistors built-in and often free-wheel diodes too. Glad its solved - yes every relay coil needs transient surpression (snubbers are used for AC, diodes are simpler and usually used for DC unless there's a reason not to).

Its best not to use solenoid valves as spark transmitters.