Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

Arduino: timeout error from Visa Serial write

Go to solution

I am using Arduino Mega 2560 to control 16 solenoid valves by ON/OFF 16 relays.
The VI operate very well on my laptops (Samsung I5-7200U and Acer I3-2330M) but unstable on PCs (Core duo).  After a few iterations, time-out error (1073807339) has appeared. I tried using both LIFA and LINX, but this error still occurs.
That problem does not occur when I disconnected loads (solenoid valves) to the circuit.

I attached the VI.


Download All
0 Kudos
Message 1 of 7

Are the solenoids DC powered? If so do they have built in snubbers or diodes to quench the back EMF voltage spike when they are turned off? I mention this because you state it works fine when the solenoids are disconnected. Also wonder if you have a ground loop since the laptop (floating from AC mains) works but the PC's do not. May be a shot in the dark but worth mentioning.


Can you supply make/model of solenoids and a sketch of how things are wired up?



"It’s the questions that drive us.”
Message 2 of 7

Hi. Thank you for your fast reply.
My solenoids use 24 VDC power. Model: SMC 10-VQ1200Y-5.
I uploaded the circuit diagram.

0 Kudos
Message 3 of 7

The LV application works well without the solenoid attached, so there is no problem with the code.

You have to narrow down to the electrical circuit and HW connection problem. 


It seems that this post is similar to your problem.

Large load (solenoid, chiller, heater, etc) activation/deactivation kills LIFA USB communication. Wh...

Message 4 of 7

I'd try putting some reverse biased diodes (ie 1N4004) across each of the solenoid coils first.

Not sure of the spec's on your relays, they may need some also.



"It’s the questions that drive us.”
Message 5 of 7
Accepted by topic author atupha

The problem has been solved by adding a ceramic capacitor to each relay. 
Relay module has built-in capacitors, diodes, and optoisolators. But it seems that is not enough.
When the load is connected to the circuit, the arc generates at the contact each time the relay is turned on / off. 
Then Arduino is reset, leading to a disconnection from the computer.

The laptop's USB port seems to filter noise better than PC.
I'm not sure about these things but my system has been working well anyway.
Thank you very much for your help.

Message 6 of 7

Good detective work, I did not even consider contact arcing. Alternative is to use Solid state Relays for the solenoids.




"It’s the questions that drive us.”
0 Kudos
Message 7 of 7