Introduction: Arduino Laser Show With Full XY Control

About: Hi, I'm Rich Olson ( I sell cloud chambers for viewing radiation, make robots and dev software. If you need something prototyped - I might be able to help.
Update! See Step 32 to find out how to use this project with a green laser!

Also - checkout the LaserTweet Instructable to make this project display data from Twitter:

This project uses an Arduino and some cheap audio speakers to create a real laser show with full X and Y axis control.

The included source code lets you easily draw text and even simple pictures!

View the demo video to get an idea of what this project can do.

You should be able to get most components locally (besides the Arduino).

Assuming you already have an Arduino - expect to spend roughly $35 on this project.

If you can upload a program to an Arduino and solder - you can probably build this project in an afternoon.

Users who have built this project:
mattbeowulf -
minhenes (using "real" galvos) -
hydronics -
benhgd -
(Post a comment with your link - and I'll add yours to this list)

Step 1: A Bit About Laser Shows

Most laser shows use galvonometers (the little boxes in the picture) or "galvos"  to aim their mirrors.

Galvonometers are electromechanical devices that rotate to different angles based on how much voltage they are provided.

A minimum of two galvos are used - one for "X" (horizontal) control and one for "Y" (vertical control).

The laser show's controlling electronics quickly adjusts galvo voltages, and turns the laser on and off - moving it around so quickly that it appears to create a persistent image.

Commercially available galvos can move to up to 50,000 different points each second.

Galvos tend to be expensive - so we'll be making our own out of audio speakers!

Step 2: Stuff You'll Need - Electronics

Arduino Board
This project has been tested on an Arduino Duemilanove (Atmega 328).  Other 16MHZ Arduino boards with an Atmega 328 (such as the Uno) should work fine.

An Arduino with an Atmega 168 should work - but be aware the project barely fits into its memory - so you may hit issues adding your own functionality.

It's assumed you have a programming cable, a computer with the Arduino environment installed, etc.

Red Pocket Laser Pointer
Look for one powered by three 1.5v coin cell batteries.
If you're having trouble finding one at your favorite super store - check the pet toys section.

12v 3 Amp Power Supply
Voltage can be a bit higher or lower but needs to provide at least 3 amps of current.
You might find an old laptop power adapter at a thrift store with these specs.
Alternately - you can modify a PC ATX power supply.
Radio Shack Catalog # 22-507 would work fine - but is too expensive for what it is.
If you can't find a usable power supply locally - you can get one on eBay for about $15.

2 x 8-Ohm, 20-watt Non-Inductive Resistors
Available at Radio Shack - Catalog # 271-120
(alternatively - 2 x 6A, 50V Rectifier Diodes Radio Shack #276-1661 - see step 17 for details)

2 x 100-Ohm Resistors
Doesn't need to be exact value / wattage doesn't matter.
Available at Radio Shack - Catalog # 271-1311

2 x TIP120 Darlington Transistors
Available at Radio Shack - Catalog #: 276-2068

2 x TO-220 Heat Sinks (for Transistors)
These are required!  Without them the transistors will quickly overheat!
Available at Radio Shack - Catalog #: 276-1363

2 x 470uF 35V Radial-lead Electrolytic Capacitor
Available at Radio Shack - Catalog #: 272-1030

2 x Alligator Clips
These make connecting to the laser pointer's battery leads easier.
Variety of options available at Radio Shack.

22 Gauge Solid Core Hookup Wire
This wire easily fits into Arduino headers. Not needed if you have a better solution.
Available at Radio Shack - Catalog # 278-1221

20 Gauge or Thicker Hookup Wire
For power connections - "speaker wire" should work fine.

Green Laser Parts (Optional)
If you plan on using a green laser - check out step 32 - there are few extra parts you'll need.

Step 3: Stuff You'll Need - Speakers

Two 4 to 6 inch "woofer" speakers

Speaker quality does make a difference in performance.

I've found speakers with large magnets and power ratings of 80 watts or more tend to work best.

Look for something that might be capable of producing some bass.  You should be able to easily push the speaker cone in by about a 1/4" if you press on it.

Using a speaker larger than 6" will not necessarily help (and might hurt) performance.

The speakers do not have to match.

I extracted the pictured speakers from a set of 120 watt bookshelf-sized speakers I bought for $8 at a local thrift store.

They measure approximately 5 1/2" across and are rated at 6ohm.

Advanced Technical Stuff Below (Optional Reading)

There are at least two technical variables that effect how well a speaker driver will work for the laser show.

Resonant Frequency: The frequency the speaker will vibrate at most easily on its own.

Qts or Q: This number describes how the speaker's frequency response varies around the resonant frequency.

The pictured speakers had a resonant frequency of 63hz and a Qts of .55.  They worked quite well.

I also had good luck with speakers having a resonant frequency of 81hz and a Qts of .96.

I have also tested a set of speakers with a resonant frequency of 120hz and Qts of 1.4 - which resulted in poor results.

My suggestion would be to look for a driver with a Qts between .5 and 1 with a resonant frequency between 50hz and 85hz.

Other speaker parameters (like Vas) may or may not effect project performance.

If purchasing speakers from a website like - you'll be able to select from a wide variety of speakers that provide these specifications.  

Look for close-outs / deals.  As of last check, these drivers: looked quite promising for only $5 each.

If you want to try testing your own speakers - take a look at this site:

Step 4: Stuff You'll Need - Mounting Hardware

This project requires positioning the laser and both "galvos" (speakers) so the laser bounces off the first galvo, onto the second galvo, then onto the wall.

While this isn't a high-precision operation - it can be a little tricky.

The right tools for the job will depend on the exact size and shape of your speakers.

If you don't already have the items below - look in your toolbox and junk drawer and improvise!  

A Variety of C-clamps
4 clamps sized 2 1/2 to 4 inches should work for most speakers.

Spring Clamp
Used to point the laser.  

Optional: 18" x 24" Plywood Project Board
This project has a fair number of pieces to it.  Keeping everything on a project board can help keep it from getting out of control.
After you get everything working - you may want to replace the C-clamps with some kind of mounting solution that can be more permanently attached to the board (like brackets).

Step 5: Stuff You'll Need - Tools and Misc.

Coleman Acrylic Camping Mirror
About $2.50 at your local sporting goods store.

2 x #6 Bolts and Nuts
For mounting heat sinks to transistors / length doesn't matter.

2 x Wood Skewers
Like for cooking Shish Kabobs.

Scotch Tape
Or any kind of tape.

4 x 2x4 Lego Blocks
These are just used as spacers. You can substitute anything of similar shape / size.

Soldering Iron
And solder - gauge doesn't matter.

Hot Glue Gun
And hot glue - attempt other adhesive techniques at your own risk.

Bandsaw or Hacksaw
Used to cut the acrylic mirror. A rotary tool with a cutoff wheel should also work.

Step 6: Cutting the Mirrors

Mark two 1.5 inch squares on the back of the acrylic camping mirror.

Cut out the mirror squares using a band saw, hacksaw or rotary tool.

If using a band saw - cut face-down with a paper towel between the saw table and mirror to prevent scratching.

Be careful not to peel off the mirror's shiny backing.

Step 7: Install the Pivot Mounts

Use the hot glue gun to mount Lego blocks on opposite sides of one of the speakers as pictured.

The top of the Legos should be about 1/4" above the foam surround of the speakers.  If they are not - hot glue another object of appropriate thickness on top to achieve the needed height.

Step 8: Install the Mirror Pivot

Hot glue a wood skewer on top of the Legos - across the middle of the speaker.

The skewer will act as a pivot for the mirror.

After the glue cools, trim off the protruding end of the skewer with your cutting instrument of choice.

Step 9: Hot Glue the Mirror

Set one of the mirror squares on the speaker so it's supported by the pivot on the left edge, and the speaker surface on its right edge.

Attach the mirror to the pivot and speaker using a small drop of hot glue at each of its corners.

Step 10: Make the Y Galvo and Label

Congratulations - you've finished the X galvo!

Now it's time to make the Y galvo.

The Y galvo is exactly identical to the X galvo.

Repeat steps 7 through 9 to make it.

Label one galvo X and the other galvo Y using the method of your choice.

Step 11: Schematic

This schematic shows the electrical connections we'll be making over the next several steps.

No need to memorize this - we'll be going over every connection in detail!

(step 17 describes a minor variation on these plans - replacing the resistors with diodes for slightly improved efficiency)

Step 12: Tape Laser Pointer Into on Position

Wrap Scotch tape around the laser pointer's button to force it into the on position.

Wrap it around tightly several times to assure it stays in place.

Step 13: Remove Laser Pointer End Cap

Remove the laser pointer's end cap and batteries.

Examine inside - most laser pointers will have a spring that is the negative battery terminal.

Step 14: Connect Power Leads to Laser

Connect one alligator clip to the spring terminal (negative).

Connect the other alligator clip to the threading at the end of the case (positive).

Assure the clips don't short each other.

Note: Some laser pointers may be constructed slightly differently - so adjust / improvise as needed.

Step 15: Connect Laser Power Leads to Arduino

The laser only draws about 25 milliamps at 5v - so it can be attached directly to the Arduino (good for 50ma)!

Connect the positive laser power lead to Pin 12 on your Arduino.

Cut a short piece of 22 gauge solid core wire and strip both ends.

Insert one end into Pin 12 on your Arduino board.  Clip the alligator clip from the positive lead to the other.

Connect the negative laser power lead to a Ground Pin on your Arduino using the same method.

Step 16: Mount Heatsinks to Transistors and Label

Use the #6 bolts and nuts to attach the heat sinks to the transistors.

Attach them tightly - it should be difficult to move the transistors.

The heat sinks must be installed .  The transistors will quickly overheat otherwise.

Label one transistor X and the other transistor Y.

The transistors will act as switches - turning the small electrical signal the Arduino produces into a large electrical signal that can move the galvos.

Note: This part will get hot in normal use.  Do not touch it when powered.

Step 17: Connect Resistors to Galvos

Connect the 8 ohm resistors across the positive and negative speaker leads of the X galvo using 20 gauge hookup wire and your soldering iron.

Use several inches of wire for these connections - so they won't limit your ability to position the galvos later.

Repeat this step for the Y galvo.

Note: This part will get hot in normal use. Do not touch it when powered.

Note on Purpose of Resistors (optional reading)

As several users have noted - the purpose of the resistors seems to be to (inefficiently) eliminate back EMF generated by the speakers.

The resistors can alternately be replaced by diodes (such as  This will result in somewhat decreased power consumption

The diodes should be connected so that the cathode (the side with the bar) is on the side of the speaker connecting to +12v.

This alteration may require tweaking the Arduino code to get good results (try increasing the x_min_value and y_min_value variables to about 20).

Step 18: Connect Galvos to Positive Power

Note: At this point your 12v power supply should be off / unplugged.

Connect the negative speaker terminal (indicated with a "-") of the X galvo to the positive lead on your 12v power supply using 20 gauge hookup wire and your soldering iron.

Yes - to confirm -- we're connecting +12v to the negative speaker terminal .

Use ample wire for this connection (12 inches or more) - to assure you can position the galvos as needed later.

Repeat this step for the Y galvo.

Run a separate lead from each galvo back to the 12v power supply. Do not "chain" the connection between the two galvos.

Step 19: Connect Galvos to Transistor Collectors

Connect the positive speaker terminal (indicated with a "+") of the X galvo to the "collector" lead of the X transistor using 20 gauge hookup wire and your soldering iron.

The collector is the middle lead on the transistor.

Again - use a fairly long length of wire.

Tip: Applying a thin coat of solder to the tips of the connecting wires can help prevent them from unraveling and causing shorts.

Repeat this step for the Y transistor and Y galvo.

Step 20: Connect Transistor Emitters to Ground

Connect the "emitter" lead of the X transistor to the ground terminal of your 12v power supply using 20 gauge hookup wire and your soldering iron.

The emitter is the right most lead on the transistor as pictured.

Again - use a fairly long length of wire to accommodate moving things around later.

Repeat this step for the Y transistor.

Run a separate lead from each transistor back to ground. Do not "chain" the connection between the two transistors.

Step 21: Connect Power Filtering Caps

The capacitors help filter out power fluctuations - improving the laser show's image quality.

Connect the negative lead of a 470uF 35V electrolytic capacitor to the  "emitter" lead of the X transistor as pictured.

The negative lead of the capacitor is on the side with the black stripe and  "-" symbols.

Don't get this connection backwards - or you'll see smoke!

Connect the other end of the capacitor to the positive terminal of your 12v power supply using 20 gauge wire.

Repeat this step using the second capacitor and the Y transistor.

Step 22: Create Arduino to Transistor Leads

Cut two pieces of 22 gauge wire about 14 inches long and strip them on both ends.

Solder a 100 ohm resistor to the end of each wire.

These resistors help keep the amount of current that flows between the transistors and Arduino to a safe level.

Step 23: Solder Leads to Transistor Bases

Solder the resistor end of one of the Arduino to transistor leads to the base lead of transistor X.

The base lead is the one furthest to the left.

Repeat this step for the Y transistor.

Step 24: Connect Leads to Arduino

Insert the bare end of the X transistor lead into Arduino Pin 5.

Insert the bare end of the Y transistor lead into Arduino Pin 6.

Step 25: Connect Arduino to Ground

Connect one of the ground pins on the Arduino back to ground (negative) on your 12v power supply using a piece of 22 gauge solid core wire.

Step 26: Download Code and Upload It to Arduino

Note: The 12v power supply should still be off / unplugged.

Plug the programming cable into the Arduino.

Download (attached to this step) - and upload it to your Arduino.

Once the program is loaded - you should see the laser pulsing!

If you don't see the laser pulsing - skip ahead to the step titled "Troubleshooting".

Note: This code was updated on 4/10/11 to address a problem where it might not fit on an Arduino using an Atmega 168.

Step 27: Aim Laser and Galvos

Use your various clamps to aim the laser and galvos as shown in the picture.

This is one of those cases where a picture really is worth a thousand words - especially when taken using a fog machine.

The rundown:

The Y galvo should be positioned with its mirror pivot running horizontally, and the mirror oriented down.

The X galvo should be positioned with its mirror pivot running vertically, and the mirror oriented towards your left.

The laser should be pointed at the mirror of the Y galvo.

The Y galvo should be angled so the laser bounces of its mirror onto the X galvo's mirror.

The X galvo's mirror should be pointed toward where you want the laser show to project.

Step 28: Fire It Up!

Finally - it's time to turn on your 12v power supply and see if this thing works!

Leave your USB programming cable connected - as it's needed to power the Arduino (more on this later).

You should be presented with a cacophonous symphony of sound from the speakers - along with an actual working laser show.

You may find you need to slightly re-aim the laser once the speakers move a little.

If things aren't working right - unplug your power supply and proceed to the next step.

Step 29: Troubleshooting / Tweaks

Image isn't stable / text is hard to read

The transistors getting too warm are a common cause of image quality issues.  Even if things are generally working - you may be able to further improve quality with better cooling.

Make sure the transistor heat sinks are well installed.  Using larger heat sinks, thermal paste, or even adding fan(s) may help.

Check all your wiring.  An intermittent connection may be the culprit.

Towards the top of the code  - look for the line:

float exp_move = (some number)

The larger this value is - the slower the laser will draw (improving accuracy).  Try increasing it to 4.5 or higher.

There are also other variables you can adjust to help quality - see the code comments for details.  Experiment!

Speaker quality seems to be the biggest factor in determining how well the laser show works. If you're getting results that look a lot worse than the demo video - you may want to try using another pair of speakers.

Laser isn't on
Check the alligator clip connections going to the laser power lead and case.
Make sure the tape is really holding the laser's power button down.

Laser is dim
I have encountered a few laser pointers that are just dim or don't focus.  Try buying another one.

One or both galvos aren't moving / making noise
Disconnect power and check your wiring.

Image is rotated 90 degrees
Try swapping the connections to Pin 5 and Pin 6 on your Arduino.

Image is mirrored horizontally or vertically
This can be fixed either of  two ways:
   Swap the wires going to the positive and negative connections of the galvo with the inverted axis.
   Physically rotate the galvo of the inverted axis by 180 degrees (this may not be practical for the Y galvo).

Image is skewed at an angle
Try rotating either galvo slightly to correct this.
This can also be caused by aiming the laser at a surface that it's not perpendicular to.

Image size
The farther away you aim the laser - the larger the image will be. Typical projection area is about 2 feet by 2 feet at a distance of 25 feet.

The higher voltage power supply you use - the larger the image will be (until of course, something burns up - then you get no image at all...). This project has been tested extensively at 12v - but can probably go a bit higher.

Problems using an Arduino with an Atmega 168
This project -barely- fits in an Atmega 168's ROM and RAM.  If you see odd results - it may be that code you've added has "pushed things over the edge."  There might be cases where this does not generate a compiler error - making it hard to troubleshoot.  Removing the "demo()" function may help free up resources.

Step 30: Change the Code!

You didn't do all that work to just display the demo - it's time to make your own laser show!

Note: If you made it to this step without downloading the source code - it's in a zip file attached to Step 26.

Here's a few of the included routines:

Turns laser on.

Turns laser off.

sendto (X,Y)
Sends laser to X and Y coordinates.  The coordinate system is 256 x 256 - but the real resolution is lower (maybe half) that.

draw_string("STRING", X, Y, COUNT)
Draws a text string at X,Y for COUNT times.  Uppercase characters, numbers and some punctuation is supported (see code).

move_scale = X
Sets scaling (font size) used by draw_string.  Setting it to 2.8 provides enough room for 5 characters.

Draws a scrolling marquee CHARACTERS long - text is autoscaled to fit (4 to 7 characters long works best).

Now for a little tutorial - look for this code at around line 90:

//put your laser control code here!

void loop()

    //run the default laser show demo


The Arduino runs any code in this section over and over again.  Try changing it to:

void loop() 

     move_scale = 2.8;        //sets text size

    draw_string("LASER", 1, 1, 10);
    draw_string("TEST", 1, 1, 10);

    marquee("LET'S DRAW A STAR!!!", 5) ;

   //draw a star 15 times
    for (int loop = 0; loop < 15; loop ++)
       sendto (85,10);
       sendto (150,130);
       sendto (0,40);
       sendto (170,40);
       sendto (20,130);
       sendto (85,10);


There are a bunch of variables you can tweak and a few more routines documented in the code.

Dig in and have fun!  If you mess things up - you can always re-download the code and start over.

Step 31: Some Technical Notes

Running 12v to the Arduino
You might wonder why I didn't include a step to connect the 12v power supply directly to the Arduino board - so the laser show can be used without USB power from the computer.

Most Arduino boards have a maximum recommended input voltage of 12v.

Some "12v" power supplies actually put out 13.8v - and perhaps even higher when not under load.  You may want to test your power supply with a multimeter to make sure it's not significantly over 12v before connecting it to the Arduino.

To power your Arduino using your 12v power supply - connect its positive voltage terminal to the Arduino's Vin Pin.

An alternative is to use an external voltage regulator or separate power supply for the Arduino of appropriate voltage.

About the TIP120 Transistors
This project uses TIP120 "Darlington" transistors.  These transistors are actually two transistors chained together into one.  This gives them much higher "gain" - meaning they can use a very small current  to switch a much larger current.  They are a cheap and easy way to interface microcontrollers to things like speakers and motors.

PWM not Analog
This project generates a digital PWM (pulse width modulation) signal to control the speakers.  You might expect the quickly switching 1's and 0's to get converted to analog before going to the speakers - but they don't!

The signal is switched so fast - that the speakers respond as if they are getting an analog signal.

The picture shows an oscilloscope reading taken right off the speaker leads - still digital!

By default the Arduino does PWM at about 500hz - way to slow for this project.  If you look through the code you'll find some tweaks that boost that up to 64,000hz.

Step 32: Green Laser Upgrade!

Green lasers appear much brighter than red ones of the same power - and are still "safe" at 5mw.

Green lasers with power ratings over 5mw can blind you instantly!  Don't mess with them.

A 5mw green laser takes a lot more current to drive (a few hundred milliamps) than a red laser (maybe 20ma) - so we'll need to add some electronics to support it.

This setup worked for the 5mw green laser I had kicking around (unfortunately I don't have an exact model number).
Some green lasers may have more complicated driving electronics that may make them difficult to turn on / off quickly enough.  If one model doesn't work - you may need to try another.

Additional Stuff You'll Need

A 5mw green laser pointer
Look for one that runs off 2 x AAA batteries.
(This model will likely work - but has not specifically been tested)

220 ohm resistor
Any wattage

100 ohm resistor
Any wattage

LM317T Adjustable Voltage Regulator
Available at Radio Shack - Catalog #: 276-1778

1 x TIP120 Darlington Transistor
Available at Radio Shack - Catalog #: 276-2068

1 x TO-220 Heat Sink (for voltage regulator)
Available at Radio Shack - Catalog #: 276-1363

#6 Bolt and Nut


1. Build the the laser show as described in the previous steps.
2. Attach heat sink to the voltage regulator using the bolt and nut.
3. Wire in additional parts as shown in the schematic above.
4. That's it!

How it Works

The resistors "configure" the voltage regulator to provide about 3.75v (a bit more than 2xAAA batteries).
The heatsink is required since the regulator is dissipating a large amount of voltage with moderate current consumption.

While the red laser could be driven directly from the Arduino - the green laser consumes way too much power for that.

The TIP120 Darlington transistor uses the small signal from the Arduino to switch on and off the current going to the laser.  It's not perfectly efficient - so the 3.75v from the voltage regulator ends up closer to 3v (the same as 2 x AAA batteries).  Unlike the TIP120's powering the speakers - the load on this one is low enough so that it doesn't need a heatsink.

All other details of the project are the same.  If anything isn't obvious - consult the previous steps.

Step 33: Hack This Project!

Since this project is built on an Arduino - adding your own code / sensors / etc. is easy - here's some ideas:

Make a 2-player laser pong game using potentiometers as controllers.

Make some kind of interactive art installation.

Make a laser clock / countdown timer.

Connect it to the internet - and have it display your favorite RSS feed.

Drive your cat crazy.

Do something no one has even thought of yet!

Wicked Lasers Contest

First Prize in the
Wicked Lasers Contest

3rd Epilog Challenge

Second Prize in the
3rd Epilog Challenge

MakerBot Challenge

Participated in the
MakerBot Challenge