run program according command list on TTL trigger


some of this is probably trivial, but I am absolutely new to Arduino :slight_smile:

This is what I want to do:
For my scientific experiments I need to control 8 solenoids which are opened and closed in a certain sequence and with certain delays. This sequence changes with different experimental protocols. Currently I am running a LabView/NI system that executes a list of commands that it reads from a file. I have different files for different experiments. I want to move this part on an Arduino to free ressources for data acquisition on the computer - it is also probably better in terms of timing, my LabView system has problems in that regard.

I was hoping to end up with the following:
A program on the Arduino waits for a trigger (TTL) signal from my data acquisition system. On trigger, it opens and closes solenoids according to a command file that I uploaded before the experiment. It should further write a log file telling me the date and time and which commands were executed and send it back to the main computer to be stored with the acquired data.

The solenoids work with 5V up/down states, so a I simply need to connect them to a parallel port, which is probably easy with an Arduino.

Is this feasible and which Arduino would you suggest?

thank you very much!

It sounds feasible enough. You can drive the solenoids directly if they don't pull much current or get an eight channel relay board to drive them if they pull too much for the arduino.

You could get something such as an arduino ethernet or shield that has an SD card on it and load your command file there, pushing the log data to the same place. Alternatively you can use an Uno and send the commands from the PC over serial and get the log data the same way.

If you want real timestamps in the log you'll need an RTC or the ability to get a time from the PC you've connected the arduino to or a time server over ethernet.

As you can see, you have options. One thing of some importance though is how long these command files are; if you're going to want to have the Arduino store them in RAM, their size will determine which one best suits your needs.

You are unclear on describing the interface. What is it presently?

You cannot drive solenoids directly from the Arduino, but neither can you from a PC, so presumably you already have some sort of driver board powering the solenoids.

The notion of "move this part on an Arduino to free resources for data acquisition on the computer" simply does not make sense - a PC has vastly more resources than the Arduino and what you are requiring is relatively trivial.

It may however be convenient to devolve the task to the Arduino and it certainly can generate well-timed sequences for you. Presumably the idea is that you issue a "start" command for the sequence and the Arduino then reports on each of the actions.

In fact, you have a perfectly convenient serial (USB) interface to the Arduino, so in practice, the sequence upload and the start command can be issued on this from the PC, and the event reports can then be returned to the PC which can interpret time-stamping as it needs to and compile the full log file accordingly There really is no reason for the Arduino to do this.

You need no complications such as Ethernet, and a UNO (or Nano) will be perfectly adequate.


thanks for your replies. I need the digital I/O to switch the solenoids. The solenoids themselves use 24VDC, so I won't do that directly.

Yes, a computer has vastly more resources than an arduino. But this computer is busy running windows, the control software for my experiments (displaying 20 channels of waveform data, 16 of them in 3 different ways, one channel runs at 200kHz, 16 Channels at 24kHz), storing the acquired data, and displaying and capturing video (which is the next thing to debug).

I further want the Arduino as independent as possible to make it easier to transfer this part of the experimental set up from one place to another with changing projects.

Finally, the reason why I can not have the arduino triggered via USB is because the computer is not the central piece of the system. The central piece is the multi-channel data acquisition hardware. The trigger must come from one of it's digital I/Os. Also, this sort of triggering is still standard in my field, so I will stick to it.

I'll ask a colleague if she has a spare Uno that I can play with.

thanks again!