LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to scan in raster manner using dual Galvano mirrors and NiDAQmx?

Solved!
Go to solution

Hi, 

 

I am working on project where I have to scan the rectangular area of the cells in raster manner by using dual galvano mirrors.

 

I made VI which is intended to scan in raster manner, but unfortunately it is not working in a right way and instead of scanning in raster manner it scan diagonally between the input range.

 

I have attached image which shows the raster pattern I wanted to scan.

 

I also have attached the VI which I use for scanning(I use two diff VIs).

I have attached the video as well to see how it scans right now.

 

and if anyone know another solution apart from this two VI than it also be good.

 

 

0 Kudos
Message 1 of 7
(3,891 Views)
Solution
Accepted by topic author @mi

You picture "Raster.png" shows, in fact, the common form of a Raster.  It consists of a unidirectional (we'll say Left-to-Right) horizontal scan at a controlled rate, followed by a "fly-back" quick Right-to-Left return to the left edge while simultaneously moving down one scan line to begin the next sample.  

 

If you are creating a raster using movement along Cartesian (X, Y) axes, this horizontal scan/diagonal "fly-back" is probably the most common model of scans, used in (analog) Video devices (the electron beam moves this way).  The "catch", of course, is that you generally move the beam at two speeds, "Scan" and "Fly-Back", two "time" intervals, one where data are taken/displayed, and another where it is "ignored", and a "busy" Axis (X, generally) and one that moves a scan line every sweep (Y).  [Note -- Videos often "interlace", doing even scan lines in one pass, followed by the odd scan lines, but the principle of a "fast" and "slow" axis is still valid].

 

It occurs to me that if you are doing the scan, yourself, you might try scanning back and forth.  The Odd Scans go horizontally L->R.  At the end, you stop the mirror, step down one Scan line on the Y axis (a short step), then on the Even Scan go R->L.  This minimizes the large "Fly-Back", though you'll still have the same situation when you get to the bottom of the Scan, and need to move Y back to the top.  But ... no reason you can't use the following scheme:

  • Start Y at 0, X at 0, Scan L-R to XEnd.  Step Y to Y+2.
  • Scan R-L back to 0.  Step Y to Y+2.  If Y<YEnd, go back and repeat to do all Even Scans.
  • Step Y to Y-1 to start Odd Scans.  I'll assume Y is divisible by 4 to keep the Math simple.
  • Scan L-R to XEnd.  Step Y to Y-2.
  • Scan R-L back to 0.  Step Y to Y-2.  If Y>0, go back one step to finish Odd Scan.
  • Go back to the top to do another Even/Odd Left-Right-Left, Top-Bottom-Top scan.

This "messes up" the timing some, but saves "wear and tear" on the mechanics, and if there are multiple scans per "event-of-interest", this might be a useful tradeoff.

 

To implement a conventional raster, the algorithm goes like this:

  1. Start at Y=0, X=0.
  2. Move the X mirror at constant velocity to move beam from X=0 to X=XEnd.
  3. Turn beam off, move mirror back to X=0, at the same time moving Y to Y+1.
  4. If Y<YEnd, go back to Step 2.  Otherwise turn beam off, move mirrors back to X=0, Y=0, and go back to Step 1.

Note that you'd need to test the timings -- galvo mirrors are pretty good, but they don't instanteously start and stop.

 

Bob Schor

 

P.S. -- I haven't (yet) looked at your code.  This is in response to your pictures, to clarify that your Raster picture is what you should expect to see.  You need to know "when to sample" and "when to wait", which will require a more complex sampling scheme. 

0 Kudos
Message 2 of 7
(3,866 Views)
Solution
Accepted by topic author @mi

hi,

I went through your raster scan vi. you have to just make a little change and it will work. Just send the a double array of xy cordinates with voltage factor to output and you can perform the raster. Refer to the image below. raster.PNG


CLD Using LabVIEW since 2013
Message 3 of 7
(3,855 Views)

Hi,

 

Thank you very much for providing me the solution and it is working in right manner in which it should be

0 Kudos
Message 4 of 7
(3,844 Views)

Glad you've got this part working *almost* right.  Technically, the AO and AI tasks still aren't locked into hardware-level sync.   As illustrated, the tasks will start at *nearly* the same time, but there's no guarantee which starts first or how much earlier.  

 

Please follow some of the links I pointed you to in other threads to see how get that last little bit of hardware-sync guarantee by sharing a sample clock.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
0 Kudos
Message 5 of 7
(3,834 Views)

Hi,

 

Yes the scanning is done, now I have to sync the AI and AO and I will have a look the threads you pointed before and I will try to make the things by myself.

 

Thank you very much again for the help.I really appreciate the way you helping me as well others.

 

 

0 Kudos
Message 6 of 7
(3,829 Views)

I wonder if you can tell me the electrical connections between the 2-axis galvo driver board and your NIDAQ USB with 2 analog ouputs. Since the tholabs munual gives me the instructions that we should use the three wire: one + the other - and a ground wire. I can see that the ground wire should connect to the ground in NIDAQ. But I was confused about how to connect the other two +/- wires. As you said before, one analog output can control one-axis galvo, which means the + wire should connect to one analog output. So, what about the - wire? Do I need to also connect the - wire to the ground of the NIDAQ? Thanks a lot.

 

 

0 Kudos
Message 7 of 7
(93 Views)