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

Sound card DAC tutorial

Joined
Oct 31, 2008
Messages
30
Points
0
"Why is the output of the op-amps inverted?"

The op-amp is used as a summing amplifier. It adds together a constant negative voltage and the DAC signal which has a constant positive voltage offset, thereby nulling out the offset. It is an inverter, so that this can be done with only one stage of op-amp.

This is easily corrected by inverting the wave data before you play it back.

James. :)
 





Joined
Mar 1, 2012
Messages
18
Points
0
Thanks James. :)

I have another question now too.. I've built up a laserboy amp and have attached the x and y outputs to my scope where I can see simple images.. so it must be working (yay!)

Now I would like to attach it to my spacelas 30K galvo amps. The spacelas galvo amps connectors have a (X+, X-, and GND) connector. On the "showcard" that came with the galvo amps, I see X- and GND are directly connected so I have put the amplifier X on the X+ line, and grounded the X- and GND lines.

When I try running the software now, the galvos do move, but it seems like the y galvo offset is incorrect.. it seems way off to the side to the point that I don't see any image at all.

I've checked the tuning, and the stopped voltage is 0... and the gain with max.wav is 5v. What could be going on now?

Oh, and to add to this, I used the scope to check the x and y voltages that are being fed into the galvo amplifiers from the laserboy amp board. They are showing up as 4v to -4v for both the x and y.
 
Last edited:
Joined
Mar 1, 2012
Messages
18
Points
0
Just wanted to follow up and say I solved the issue. It turns out the showcard had a significant bias to it that I found out by probing. Doh! The showcard setup is fine.
 
Last edited:
Joined
Oct 31, 2008
Messages
30
Points
0
Congratulations!

I know one thing... Op-amps can do some really weird things when the connections to just about any of the pins are flaky.

So what's up with the screen name uCLinux? Are you a Linux user?

Have you ever tried to compile and run LaserBoy in Linux? :)

James. :)
 
Joined
Mar 1, 2012
Messages
18
Points
0
I do use linux but haven't played with the laserboy app. Currently I'm using openlase. Right now I can play mpegs/etc and see them, but I don't have blanking (that channel always reports 0). This is because I'm fighting alsa to act as more than a 2 channel output device... or possibly a volume issue on the other channels, not sure.

Once I get this worked out, I'm thinking of building my own usb open source dac kit (I have a background in software, firmware, and electronics/pcb fabrication).

How interesting would this be if I made it?
-USB setup, no sound card needed, but it would require drivers
-16 or 24 bit
-auto calibration
-have a db25 connector
-have connectors to go directly to galvos/lasers

I've also thought of adding a button to display ilda test pattern

I'm not sure if this will be a surface mount kit or through-hole kit.. SMD would be smaller/cheaper. I'm also not sure how support would work out.

Thoughts? Feature ideas?
 
Last edited:
Joined
Mar 1, 2012
Messages
18
Points
0
I did just build LaserBoy and launch it. That was quite easy :) Only had to install the lboost-system and lboost-filesystem packages. I'll have to poke around this more
 
Joined
Oct 31, 2008
Messages
30
Points
0
Considering the fact that you just built the LaserBoy DAC, I would think it would only be natural! :)

LaserBoy started in Linux back at the end of 2003. There used to be two apps. One that is sort-of like the current LaserBoy development environment and another one that connected to ALSA to play the waves to the sound card, with on-the-fly sample shifting to correct the timing between the color mods and the scanners.

If you have a kernel built with frame buffer support, you can run LaserBoy at the command prompt with no X server running!

Just make sure to use fbset to set the best X and Y resolution and to set the bits per pixel to 24 or 32. Then run ./LaserBoy with the width and height in pixels of your screen as arguments. Now that's FAST! Almost no system overhead at all, direct rendering to the video RAM!

James. :)
 
Joined
Oct 31, 2008
Messages
30
Points
0
Since you already have LaserBoy set up and ready to recompile at any moment, you should look at the files LaserBoy_frame_effects.cpp and LaserBoy_frame_set_effects.cpp.

You can see many examples there. You can copy a function, rename it and modify it to do what you want. Notice that you need to register your new function with the system at the bottom of these files. Recompile!

Then, when you go to output a new file of type ild, you can choose option 4 or 5, to generate a frame set from a function applied to either just the current frame, selected frames or the entire frame set. Your new function will appear, by name, in the list.

This is what makes LaserBoy so powerful! Look at how much direct control you have over the individual elements that make a frame set!

James. :)
 
Last edited:
Joined
Mar 1, 2012
Messages
18
Points
0
I've been thinking about my build and something is bothering me.

For x and y, I believe I understand why I set the offset to 0v and then play the max wav file and amplify it until I see 5v. This way I can get +5v to -5v and take advantage of the scanner's entire range.

What I don't understand is why I do this for the r, g, b, and shutter channels.

As-is aren't we only taking advantage of 1/2 the dac output? Why not just put a unity gain amplifier there?
 
Last edited:
Joined
Oct 26, 2007
Messages
5,438
Points
83
No, that's by design: X and Y have 10Vpp. The R, G and B signals only have 5Vpp, and are differential unipolar (only using positive differential voltages).

Here are the electrical signal standards.

Also remember that the DAC output will not always be perfect, and your correction amp is to make sure that it really does go from 0 to 5V, not something like 0 to 4.8V or whatever the DAC outputs. Many DACs will not put out the full 5V.
 
Last edited:
Joined
Oct 31, 2008
Messages
30
Points
0
If you either built a kit or bought a pre-assembled board that has one of those wonderful DC/DC converters on it, then you can magically turn the single ended USB voltage into a differential voltage supply. If you measure your USB voltage it is supposed to be +5VDC, but often it's not quite that. It's usually a bit less. You need a true differential voltage supply to power the op-amps. That is, you need ground and a positive and negative voltage that are both about the same difference from ground. And the supply voltages need to be greater than the maximum voltage swing you expect to get as signals out of the op-amps.

That being said, you also need to take into account that a sound card was not originally designed to produce laser signals. It just happens to work well for the job.

The origin of laser vector art uses 8 bit unsigned values to designate the levels of the red, green and blue. DACs that are made specifically for laser display only need to convert these 8 bit numbers (all positive numerical values) to corresponding voltages from 0 to +5VDC. But if you use an audio DAC, these 8 bit unsigned values need to be converted to 16 bit signed (positive) values. This is done by shifting the 8 bits up 7 bits and making sure the highest bit in the 16 bit number is zero. This is the sign bit and zero designates a positive value. To make matters a bit more confusing, the correction amp is an inverter. So every channel of digital numerical information needs to be inverted or negated before it goes through the DAC so that, when inverted in the correction amp, it comes out with the proper voltage polarity.

There is a standard that all laser (color) modulation signals go from 0 to +5VDC, so you can play a wave that is all white and set the gains with a meter to exactly +5VDC.

There really is no standard as to the peak-to-peak voltage for scanner control signals. Scanner amps have an input sensitivity trim pot and they are typically set to give you a predictable swing in radians per input voltage. But it really comes down to what you want. If you are interested in graphics display on a screen then it makes sense to set your X and Y gains such that your projections fit well on the screen. It also makes sense to adjust them carefully to match each other so that when you project a circle, you get a circle and not an ellipse. It makes more sense to set these gains visually, since a meter won't tell you anything about the scanner amp's input sensitivity or if there is any difference between your X and Y amps.

Making a wave of the big white circle (frame 10 from the default frame set) in LaserBoy is a good test wave. Not only is it all white and therefore drives all the color channels to maximum, but it also gives you a nice signal for the scanners to set their maximum scan angle and match the gains to make a perfect circle. Since it is a circle, you will be able to see if your are clipping. If so, the circle will have flattened sides. Some audio DAC drivers have "digital gain". If your driver is set to have a digital gain of more than 1, it will clip when you play a wave that uses the full swing of a 16 bit signed digital stream. If you see this, you need to bring down the master volume in the audio device driver (software).

If you find that your DAC does have digital gain and you need to decrease the master volume in software to get a circle without flattened sides, then you will need to go back and adjust your color signal gains again, because decreasing the master volume in software will decrease the color signals too.

James. :)
 
Last edited:
Joined
Mar 1, 2012
Messages
18
Points
0
The origin of laser vector art uses 8 bit unsigned values to designate the levels of the red, green and blue. DACs that are made specifically for laser display only need to convert these 8 bit numbers (all positive numerical values) to corresponding voltages from 0 to +5VDC. But if you use an audio DAC, these 8 bit unsigned values need to be converted to 16 bit signed (positive) values. This is done by shifting the 8 bits up 7 bits and making sure the highest bit in the 16 bit number is zero. This is the sign bit and zero designates a positive value. To make matters a bit more confusing, the correction amp is an inverter. So every channel of digital numerical information needs to be inverted or negated before it goes through the DAC so that, when inverted in the correction amp, it comes out with the proper voltage polarity.

There is a standard that all laser (color) modulation signals go from 0 to +5VDC, so you can play a wave that is all white and set the gains with a meter to exactly +5VDC.
)


From those responses, I don't think I phrased my question well. I am aware the modulation is only 5vpp for the r, g, b channels, yet if you purchase and tune a soundcard amplifier dac based on the instructions here, you are tuning it so the dac setup is capable of a 10vpp sweep on the x and y channels.. but also on the r, g, b, etc channels too! This means with poorly made software, you could accidentally send 0 to -5v into the laser modulation signals.

Instead of just using only the 8 "positive" bits of the dac, why not offset the dac to be centered at 2.5v and take advantage of the full 16bits?
 
Last edited:
Joined
Oct 26, 2007
Messages
5,438
Points
83
From those responses, I don't think I phrased my question well. I am aware the modulation is only 5vpp for the r, g, b channels, yet if you purchase and tune a soundcard amplifier dac based on the instructions here, you are tuning it so the dac setup is capable of a 10vpp sweep on the x and y channels.. but also on the r, g, b, etc channels too! This means with poorly made software, you could accidentally send 0 to -5v into the laser modulation signals.

Yeah, but so what? Most laser modulation inputs don't care about anything below 0V. They'll just remain off. If it's an issue you can put a reverse diode in to drop whatever current.

Instead of just using only the 8 "positive" bits of the dac, why not offset the dac to be centered at 2.5v and take advantage of the full 16bits?

It's actually 15-bits of data on each sign of the waveform, as the 16th bit is the sign bit. Values go from -32768 to 32767; 2^15 - 1 = 32767. For color, you're not gaining anything as colors are sent (at least for ILDA) using 8-bits-per-channel color. Even your computer monitor doesn't use more than 8bits per channel anyway (and it's often as low as 6-bits on LCDs), and exact color reproduction isn't such an issue with laser shows. The DAC software is probably even scaling the 8-bits to the 15-bits in order to use more of the entire output voltage range

For X, and Y position data, you have access to the whole 16-bits of resolution with a sound card DAC because of the 16-bit audio output. Other DACs like FB3 only support 12-bit precision for X and Y, but that is usually sufficient as that grants you a 4096x4096 sized canvas.
 
Last edited:
Joined
Oct 31, 2008
Messages
30
Points
0
Just in case you are interested in seeing the exact effects of lower bit resolutions, like if you are designing vector art for other kinds of DACs, you can set bit resolution masks in LaserBoy to be less than 16, 16, 9, 9, 9 for X, Y, R, G, B. In this case 9 bits is designated for each color channel as 8 bits of numerical resolution and the highest bit being the sign bit. You can set these bit resolutions from the main menu in sub menu 't'. As soon as you change them, the art in the display will be shown that way and any art you save in the form of ild, DXF or wave will be saved that way as well.

Every time you drop a bit off the least significant end of a binary number you cut the resolution in half.

James. :)
 
Last edited:
Joined
Oct 31, 2008
Messages
30
Points
0
Oh yeah.... One more thing about setting color signal levels....

I recently got a new analog modulated DPSS green that puts out a peak of about 600+ mW. That is noticeably too much green to get a decnet white ballance with the reds and blues I have. So I fixed that by trimming down the gain on the green channel of the LaserBoy correction amp. PERFECT! :)

James. :)
 




Top