Computer controlled laser show system.
Software algorithm
Links to other laser related webpages


I started this project as my final year thesis at the University of Stellenbosch. Since that time I have rebuild the system totally.

This laser controller uses three galvanometers. The first galvanometer controlled the shutter, while the other two galvanometers controls the X-axis and Y-axis mirrors respectively. Below is a front view of the laser controller unit.

A standard laser pointer is used here as laser source. The shutter control can not be seen here as it is hidden behind the front panel. The mirrors can be seen clearly. The laser is first reflected from the bottom mirror, which controls the horizontal position, onto the top mirror, which controls the vertical position of the laser.

The first version of this laser controller consisted of a 8031 microprocessor interfaced with digital to analog convertors which controls the galvanometers controlling the mirrors. The microcontroller is connected to a PC via a RS232 serial interface. Software on the PC is used to generate and download frames to the laser controller. The software consisted of an editor for editing frames and a sequencer. The software also contained additional effects like drawing a banner or drawing random lines on the beat of the music.

In the new version I moved the digital to analog convertors to an expansion card in the PC. Instead of using a 8031 to write the values to the DACs, I wrote a TSR which runs on the PC to do this. This saved the long upload times needed using the RS232 interface.

Below is a photo of the laser setup I am currently using. The box at the bottom contains the PC. The keyboard is mounted on the back of the front cover, which folds down. The mousepad slides out on the top-left side of the box. If the box is closed, the mouse is stored in the space above the stiffy drive. The controller for the lights is placed on the laser computer, with the computer monitor on top of that. The laser controller with the laser source is placed on the top of the stand.

The Software

The software consists of the main program as well as a TSR driver. The main software was written in Turbo C while the TSR laser driver was written in assembly language.

Below are some screenshots of the software.

The above screenshot shows the basic layout of the software. The right side of the screen is the frame window, which either displays the actual laser output, or it is used to edit a frame. The left side of the screen is used dialog windows. In this case it is the frame browse window, which is used to browse the frames.

The above screenshot shows the laser display settings window. This window is used to control the output to the laser galvanometers. The sampling rate is the actual DAC sampling rate, while the Frames per seconds says how many frames should be drawn each second. The scale factor is used to adjust the size of the image. The Horizontal and Vertical centers adjust the position of the laser image on a wall.

The above  screenshot shows the effects buttons. This laser software is 3D software, although it is best to use only 2D frames, otherwise the drawing path might become to long and complex. Despite using only 2D frames, the 3D capabilities of the software may be utilized by the effects, which supports 3D rotation. The effects may be divided into 3 main categories, namely panning, zooming and rotation. As can be seen each effect has four parameters. The first parameter selects the mode. None means that that effect is disabled. The other three parameters adjusts the limits as well as the speed or value.

The hardware

The laser controller is an open-loop system, there is no speed or position feedback. I have tried various ways, using IR diodes and detectors, to implement position feedback, but none of my methods worked because of the construction methods I used. My advice is that if you want galvanometers with positional feedback, it is best to buy professional units.

The amplifiers I have build using current feedback, which greatly increases the frequency response of the galvanometers. It also reduces a three-pole control system to a two-pole control system. The problem with current feedback is that the galvanometer is a very lightly damped two-pole system, which causes a peaking in the frequency response. I therefore added variable voltage feedback to the existing current feedback of the servo amplifiers. By adjusting the voltage feedback, I can in affect adjust the damping of the galvanometer.

Below is the frequency response if voltage feedback is used:

It can be seen that the -3dB points lies at approximately 20Hz, which is very low for laser applications. The response peak lies at approximately 120Hz. Below is the frequency response if current feedback is used:

Here the -3dB point lies above 100Hz, but there is a very high peak at just above 90Hz. This peak may be reduces by damping the galvanometers. First I used foam rubber which pressed against the  axis of the galvanometer. This didn't give good results, the damping was non-linear. Circles looked more like rectangles. It is then that I decided to use electronic damping by adding voltage feedback. I have not yet measured the frequency response with the current servo amplifiers which uses a combination of voltage and current feedback.

A galvanometer may be seen as nothing more than a DC motor with a spring which forces it back to its original position. Below is the electrical equivalent of a galvanometer:

It is consists of a back emf generator, a voltage which is equal to the current armature velocity. There is also the inductance of the field coil and there is also copper losses. Below is a more complete block diagram of a galvanometer's transfer function:

The first summer sums voltages, while the second summer sums torque. The current into the galvanometer is the voltage difference between the terminal voltage and back emf divided by the coil impedance. The torque generated by the current is directly proportional by the input current. The constant, Kt, relates torque to input current. The moment of inertia, J, relates current to armature acceleration. By integrating the acceleration, velocity is obtained. The constant, b, is the amount of viscous friction, the force which is proportional to the velocity. The back emf is also proportional to the velocity, and Ke is the back emf constant. By integrating the velocity, position is obtained. The constant, k, is the spring constant. The further the armature is from the zero position, the higher is the force exerted by the spring.

The galvanometer servo amplifiers

Below is the schematic of the first amplifiers I have build for the galvanometers. These amplifiers could either have been configured as voltage feedback, or current feedback. By default I used the amplifiers in current feedback mode for a better frequency response. I used foam rubber pads against the mirrors for damping.

Below is the schematic of the new servo amplifiers I have build. These amplifiers uses discrete components. It uses a combination of current and voltage feedback.

Q1 and Q2 forms a current source which biases the differential input pair Q3 and Q4. Q3 if the non-inverting input, while Q4 is the inverting input. Q5 and Q6 forms a current mirror too ensure a high voltage gain for the differential amplifier. Q7 and Q8 forms a current source which biases the output drivers. Q9 forms a Vbe voltage multiplier which is used to set the correct biasing voltage between the output drivers so that the amplifier runs in class AB operation. Q10, which is driven by the output of the differential pair, drives the bottom end of the voltage ladder formed by Q7,8 and Q9. Q12 and Q15 is the output drivers, while Q13 and Q16 are the output transistors. Q11 and Q14 is part of the overcurrent protection.

R18 is the current sensing resistor for the galvanometer current.  The current feedback control resistor is R5. C6 limits the frequency response. The voltage feedback is applied via VR3.

During setup VR3 must be turned to its maximum value. The laser controller software is then setup to display a rectangle. VR3 may then be adjusted until the required damping is achieved, without the corners being rounded too much.

Below are some more images of the laser hardware:

In the above image, the galvanometers can be clearly seen. The left-most galvanometer controls the Y-axis. The center galvanometer, which is hidden behind the mounting bracket, controls the X-axis. The rightmost galvanometer controls the mechanical shutter. The cylinder mounted to the galvanometer axis has two slits at opposite ends through which the laser beam passes. If the cylinder is turned, these two slots no longer coincides and the laser beam is blocked. The mains transformer is visible  behind the Y-axis galvanometer, while the power supply board and filter capacitors are visible to the right of the mains transformer. The printed circuit board on top of the mains transformer is the servo amplifiers, which is based on the schematic of the discrete servo amplifier above. The small PCB mounted on the left top of the housing is a pre-amplifer. The pre-amplifier consists of a variable gain stage follows buy a 2-pole low-pass Butterworth filter. The photo below is a view from the top:


Below is a photo of the laser controller with the servo amplifier removed:

Software algorithm

The laser draws images by using vector graphics, that is, the image consists of a bunch of straight lines. The following figure illustrates a square which should be drawn:

The laser will start at the top-left corner, it will then move to the top-right corner, then the bottom-right corner, then the bottom-left corner, and then back to the top-left corner. Lets assume that the laser is in the top-left corner if the value (0;0) is sent to the digital-to-analogue converters. Lets further assume that the DAC values for the bottom-left corner is (100;100). To generate a laser image, three things should be known, namely the vector data of the image, the sampling rate of the data being send to the DACs and lastly the framerate of the laser. The rectangle may be described as follows:

    (0;0) -> (100;0) -> (100;100) -> (0;100) -> (0;0)

The samplingrate depends on the frequency response of the servos and also on the speed of the PC. You do not want a too low sampling rate to interfere with the frequency response of the servos. A too high samplingrate on the other hand will burden the CPU more. Since my servos has a usable frequency range of up to about 100Hz, I have selected a samplingrate of 1kHz for my laser system, but for simplicity, lets make the samplingrate for this example 80 Hz.

Next comes the framerate, this value indicates how many frames the laser should draw per second. This really depends on the speed and accuracy of the servos. I have experienced that this value should be adjusted for each individual frame to give the best results. For this examples lets use a framerate of 10 frames per second.

Now that we have the necessary information, we may do the calculations for the actual values being send to the analogue-to-digital converters. The first two calculations we do is the total length the laser beam has to travel to draw one frame, and also the time the laser has to draw that frame. The square we are drawing consists of four sides, each is 100 units long. The total line length is therefore 400 units. Since we are drawing 10 frames per second, we will have 1/10 or 100ms to draw a single frame. For the samplingrate of 80 Hz this means that we have 8 samples per frame. With this information we can now calculate the sample values. The values for the square is as follows:

      0;  0    // Top-left corner
     50;  0
    100;  0    // Top-right corner
    100; 50
    100;100    // Bottom-right corner
      0;100    // Bottom-left corner
      0; 50

As can be seen, the last point is (0;50), after which the next sample would be for the following frame, which is (0;0). It is probably easier and safer to generate 9 points instead of 8, with the last one being (0;0) to complete the whole rectangle in one frame. This will slightly reduce the framerate, but it can be compensated for.

Not all lines would necessarily be visible, but the same algorithm applies, the only difference is that for invisible lines, the shutter should be closed. For images with a different start and end point, an invisible line should be drawn from the end point back to the start point, which should be taken into account  then doing the calculations. If a frame is changed from one figure to another one, that invisible line should be from the current figure's end point to the next one's start point.

The Results

All of the results were drawn using a framerate of 12 frames per second. Below are some photos of the laser images drawn on the wall.

Of all these frames, the face is the most complex. The laser system is capable of drawing 3D objects as shown in the next image:

The laser system is also capable of drawing alphanumerical characters, below are three examples:


 Back to main page