Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security by Avery

ARDUINO & DAC for XY projector

Joined
Feb 10, 2012
Messages
330
Points
0
Super job, glad the PSU has arrived...collourrrrrss :drool:

As BB said, would be interestig to see the max points it can output, or the ILDA test frame, or Yuki girl etc.

Good work:beer:
 





OldNo7

0
Joined
Nov 13, 2012
Messages
79
Points
8
That looks pretty good. +1

I want to try using two parralel DACs and write directly to the ports on the micro.
 
Last edited:
Joined
Mar 31, 2013
Messages
6
Points
0
This looks pretty good!

However I am confused by the math.

You simply multiply the X/Y values by a scaling + add an offset to get the voltage as the formula for bouncing off mirrors is not linear in the X/Y axis.

Isn't the galvo only linear in the rotation? When I tried this it gives me a pin cushion effect when I draw a square (bigger angle is more severe).

Any thoughts for pincushion correction?
 

camvo

0
Joined
Sep 25, 2011
Messages
102
Points
0
@ Laserlightguy

I am not exactly sure what you mean by pincushion.


The original figures are drawn around the origin of 0,0.
If you draw it out on a sheet of grid paper, you will see it.
The image data also contains negative coordinates.
Call this your "painting canvas" where you draw up the figure.

Code:
// image data
int imgdata [250] =
    {
     0,   200,   200,	   
     1,   200,   200,
     1,   400,   200,
     1,   400,   400,	   
     1,   200,   400,	
     1,   200,   200,
     0,  -400,   200,
     2,  -400,   200,
     2,  -200,   200,	   
     2,  -200,   400,
     2,  -400,   400,
     2,	 -400,   200,
     etc ........


"zoom" is just to increase the size of the image. Yes, scaling as you said.

A DAC cannot handle negative figures so I transpose the center to midx and midy to be sure that all figures are in plus.

Code:
analogWrite(DAC1, valx * zoom + midx);
analogWrite(DAC0, valy * zoom + midy);


Basically you have a grid of 4096x4096 points (12 bits) to work with.
To keep things simple, I only use a 4000x4000 points.
Then my limited brain can also little bit grasp what is going on.
The real center would be 2048,2048.

Negative numbers are handled as 0 so you get a line at the bottom and left.
Numbers higher than 4095 are handled as 4095 and will display a line at top and/or right.

As far as I know (and have seen) a Galvo is directly linear to the DAC value/output.

Bouncing off mirrors? Did you build "my" PCB for the DUE?
 
Last edited:

camvo

0
Joined
Sep 25, 2011
Messages
102
Points
0
@ OldNo7

Which DAC will you use?

If you cannot update them simultaniously, it will not work.
Then you are back at post 1 of this thread.;)


I also tried the MCP4922 DAC and applied the LDAC function. (See post#45)

It worked but way, waaaaayyyy too slow.
 
Last edited:
Joined
Feb 10, 2012
Messages
330
Points
0
@ Laserlightguy

I am not exactly sure what you mean by pincushion.

Pincushion distortion, difficult to describe, but the outer corners of a projected square will distort due to the angel / distance..... errr this might be better:D
http://en.wikipedia.org/wiki/Distortion_(optics)

For small deflection angles the effect is not very visible.
For marking / size critical applications, the system will compensate for the error.
 

camvo

0
Joined
Sep 25, 2011
Messages
102
Points
0
Thanks Multimode,

I have a magnetic disc pin cushion so I had no imagination. :)
 
Joined
Dec 31, 2012
Messages
904
Points
0
So in the end, what kind of performance are you getting from your DACs? How many writes per second?

I've been following this thread for some time, and I was disappointed with the initial poor performance of the I2C bus. I want to be able to overdrive my scanners, which means (at least to me) I want to see 40K writes per second to each DAC. Perhaps, more than that, if I am writing to X, Y and one or more blanking DACs.

I just reread through the entire thread, and I guess I'm not seeing what the final performance figures were with the improved performance of the Duemilanove. Is an Arduino Due necessary for decent performance?
 
Joined
Oct 26, 2007
Messages
5,438
Points
83
It's kind of like how a fisheye lens distorts the image because the lens affects the mapping of the image.

The value provided to the DAC, that then goes to the galvos is supposed to map to a linear distance. For example, a value of 10 should be twice as long as a value of 5. However, the galvo is actually tilting a mirror, so that value actually corresponds to an angle. For small angles you can make the approximation tan(theta) ~ theta; however, for larger angles that does not hold. Usually that "pincushion" effect doesn't make much difference because galvos are used at very shallow scan angles to improve speed.

laserlightguy: I would try adjusting your galvos to use smaller scan angles. You can try doing this in code by dividing down the output values that go to the galvos.


I just reread through the entire thread, and I guess I'm not seeing what the final performance figures were with the improved performance of the Duemilanove. Is an Arduino Due necessary for decent performance?

An ATmega-based Arduino would be pretty bad, and the "DAC"s on those are just 10k PWM that need to be filtered. You should stick with the Due.
 
Last edited:

camvo

0
Joined
Sep 25, 2011
Messages
102
Points
0
I just thought about a fair test.

1. I will put 10 values in the image data array.
(Or more or less. See if the scope can pick up the return to the beginning of the data array.)

2. I will let the DAC-s put out a square wave from 0 to 4.88V
(DAC numerical value 4000.)

3. I will set the color to white so 3 lasers have to be switched on.
(Using a simple digitalWrite command, no direct port manipulation.)

4. I will put the white color as last CASE in the SWITCH loop.
(So all cases need to be examined.)

5. I will delete all delay commands.
(To get the maximum speed)

That would be the worst case scenario I think.

Then hook it up to the scope at the galvo connectors on the PCB.
See what frequency I can get.


Anyone more items?
 
Joined
Dec 31, 2012
Messages
904
Points
0
I am interested in the best possible scenario.

With no delays due to trig calculations (as in using hard-coded values) and with no write delays, how many writes per second is the setup capable of?

I would expect as the code gets more complex, the maximum writes per second may decrease.

My vote for your test scenario is looping through four pairs of values to make a square. Then, pump the values out to the galvos and see how fast you can make those babies move. If the speed exceeds the galvos, we may expect to see some distortion in the image, such as rounded corners.

I'm also curious if the DACs need some "settle time" after the value is written before the correct value is seen by the galvos.

An internal software counter may be all you need, if you have an accurate time-of-day clock in which to benchmark your writes.

This all sounds like great fun. :)
 
Joined
Oct 26, 2007
Messages
5,438
Points
83
From the datasheet it takes 25 clock periods to convert, which should be far less than the maximum point-rate the galvos would use, given the DAC conversion clock period is at a maximum of 1 microseconds.
 
Joined
Feb 10, 2012
Messages
330
Points
0
I just thought about a fair test.
1. I will put 10 values in the image data array.
(Or more or less. See if the scope can pick up the return to the beginning of the data array.)
2. I will let the DAC-s put out a square wave from 0 to 4.88V
(DAC numerical value 4000.)
3. I will set the color to white so 3 lasers have to be switched on.
(Using a simple digitalWrite command, no direct port manipulation.)
4. I will put the white color as last CASE in the SWITCH loop.
(So all cases need to be examined.)
5. I will delete all delay commands.
(To get the maximum speed)
That would be the worst case scenario I think.
Then hook it up to the scope at the galvo connectors on the PCB.
See what frequency I can get.
Anyone more items?

OR,

A logo /frame needs to be output at ~20 to 25hz minimum to be flicker free.
My test would be using a scope to see the maximum number of points can be output before the scan frequency drops below ~25hz.
From what I have seen :)thinking:) , ILDA frames / logos have between 700 and 1300 points.

This would shown the limit of the electronic hardware and as long as this comfortably exceeds the scanner capability (1300 points ish) ...happy days.

ATB
MM
 
Joined
Oct 26, 2007
Messages
5,438
Points
83
Ideally, if he could load up the points in the ILDA frame he could see how that displays for a "true" PPS count.
 




Top