Triggering data acquisition

Hi,

I am new with Arduino. I have a task to automate the slowcontrol process of a camera for capturing certain experimental data. The Arduino needs to be controlled through a GUI and simultaneously check for a machine trigger. It needs to provide a 'high' (i.e. '1') signal to trigger the data acquisition.
I'm trying to formulate some python code via importing Arduino-Python3 Command API (i.e instead of using Arduino IDE), but really a bit clueless at the moment. Can anyone please help with any possible solution-idea(s) on building the code?

many thanks.
Best,

Welcome to the forum

Which Arduino board do you have ?

Hi, thanks.
arduino leonardo.

can you explain further? Do you have a data sheet or link to one for the camera?

On what hardware/software ? (eg PC, Windows10)

Hello,
On Desktop and we have mac and windows both kinds.
and no, not datasheet, rather to link to the camera. So, the GUI needs to control a digital micromirror device (MEMS) and also the Arduino board while checking for the machine trigger simultaneously.

your Python GUI could transmit commands over serial to the Arduino board
the Arduino receives the commands and executes them
have a look at why-do-serial-commands-from-python-dont-run-arduino-when-sent-in-a-for-loop

Hello,
Thanks!
would that work for our Arduino here, which needs to provide a “high” signal to trigger the acquisition? to control the Arduino through the GUI is one part and simultaneously the Arduino needs to check for the machine trigger.

Best,

should work
the Arduino would loop()

  1. monitor Serial for commands from the Python GUI
  2. check the digital input for the machine trigger
1 Like

okay, thanks again!
I see in that link of yours (Why do serial commands from Python don't run Arduino when sent in a for loop?) :
you suggested a method of using pyserial module. I'm not familiar with it, but will try to understand how it works.
for the second part (i.e for Arduino to provide a high signal to trigger the acquisition)- can you please explain a bit more? because that part is not suggested in that link if I understood correctly(?)

in the post the user was using serial communications hence the use of pyserial
if you are using a microcontroller with WiFi (e.g. ESP32) you could use TCP/IP - see esp32-s3-softap-connect-and-receive-data-with-python
try a web search for arduino digital input will give you some ideas about checking your machine trigger
could you upload a schematic of your circuit?

I found this one for example-

I am using Arduino leonardo with a LAN connector (ethernet).
The rough sketch of the set up is attached herewith...
(DMD is the digital micromirror device (MEMS))

So the Arduino receives via a serial interface a command that shall trigger the camera to take a picture?

The arduino-Code must observe a digital input from a machine.
This machine sends a new trigger-impuls once every 100 milliseconds that shall trigger the camera to take a picture?

How can the camera be interfaced?
simple IO-pin switching HIGH/LOW 5V/0,0V?

best regards Stefan

1 Like

if you wish to use Ethernet to communicate with the arduino have a look at python-sockets
also try a web search for python ethernet arduino

1 Like

thanks @horace, it helps for the first part.
I will start working with this base.

But, still a bit clueless about the 2nd part i.e. Arduino checking the digital input for the machine trigger and sends high signal to the trigger the acquisition by the camera.

Hi Stefan,
yes that's correct, everything you said.. (except that- am trying to connect arduino via ethernet)

So, while I take some ideas as horace suggested about that python code for ethernet arduino connection, any help on the triggering part please (i.e. checking the digital inputs for the machine trigger and sends signal for data acquisition to the camera)?

You have to provide the specifications.
What voltage does the machine triggering signal have?
How much amperage can the machine-signal deliver?
Is it open-collector?

What are the specs of the camera-trigger input?

5V ?
3.3V ?
anything other?

best regards Stefan

if the trigger signal (say on pin 2) is the correct width etc for the camera (on pin 3)you could

void setup() {
pinMode(2, INPUT);           // set pin to input
pinMode(3 ,OUTPUT);           // set pin to output

......
}

void loop() {
digitalWrite(3, digitalRead(2));      // output
....
}
  
1 Like

Hi Stefan,
sorry for my late response. So, to answer your specifications:
-regarding the voltage of the machine triggering signal: we don't have the exact numbers yet, as it is on a different experimental facility, wild guess is 5V.
-The machine-signal's amperage is quite low, I don't know it by heart. not sure what do you mean by 'open collector'.

  • The camera-trigger input is 3.3V
    does this help?

The Arduino can be connected either by ethernet or by usb, so for the latter, I guess I can see the forum chat, suggested by @horace on serial connection (?)

As per the earlier attachment of my schematic, I need to find a way (not sure how) to define a function inside the python code to initiate automation control of the GUI to talk to the DMD device. Then the DMD should communicate to the Arduino through some volt. Any ideas or suggestion are very welcome and appreciated.

I don't understand this sentence. Please describe new in shorter sentences.

The Python-GUI shall automatically control the DMD-device?

Without

EXACT specifications and DATASHEETS

Ideas are just wild guessings that are likely to turnout to be not realisable or need so much modification almost as starting from scratch.

Who is developping this project you or me?

You will have to provide much more details

  • how does the python GUI look like?

  • what data/signal-exchange does happen between python-GUI and your DMD-device?

  • is the data/signal-exchange between python-GUI bi-rectional or only one direction?

  • if one direction which direction?
    python-GUI---->>>------DMD?
    or
    python-GUI----<<<<<------DMD?

  • what does it mean if there should run (whatever) automatically? You will have to describe this process very very detailed.

If the camera-trigger is 3.3V you need a voltage-level-shifter in case you are using a 5V-Arduino

If you can't do all this. There is a lot of homework for you ahead.
best regards Stefan

initially don't worry about a GUI
just send commands from the keyboard over serial to the arduino - possibly single characters
when it is working add a GUI

1 Like