Arduino Laser Show With Real Galvos

106,082

240

170

Introduction: Arduino Laser Show With Real Galvos

About: I'm a software guy, starting to learn electronics.

In this project we use an Arduino UNO/Nano to run a laser show with a laser pointer. We are using real galvos (galvanometers) like in commercial laser projectors, since these have become quite affordable recently (around 100 Euros/Dollars) and provide a much higher quality than speakers or stepper motors.

Hardware

On the hardware side, we build the Arduino driven projector by using a external 12Bit DAC (digital to analog converter) and an (optional) amplifier circuit to create the signal for the galvonometers.

You can build this project if you have some basic experience with an Arduino board and a breadboard.You can get away without any soldering, although it is probably a better solution to solder a PCB finally.

Software

On the software side, a complete Arduino sketch is provided which features:

  • Text rendering (including zoom/translate/rotate)
  • Logo rendering
  • Drawing effect (draw object or text incrementally)
  • Line clipping
  • Optimized for small program size (PROGMEM font/objects) and speed (fixed-point arithmetic)
  • And a 3D cube that is rendered live...

All source code is provided and can be easily adapted to create your own show!

Inspiration / further reading

I was originally inspired by the following project, which explains quite well how laser projectors work and which uses speakers to simulate the galvos:

https://www.instructables.com/id/Arduino-Laser-Show-with-Full-XY-Control/

Using speakers is very limited regarding quality and complexity of the objects you can draw, which is why we use real galvos in our project.

Step 1: Parts You Need

  • an Arduino UNO / Nano (or a compatible clone) + USB power
  • 20Kpps galvos with driver cards and power supply (these typically come in a set, see below)
  • a 220V or 110V power cord (if galvo power supply does not come with a cord)
  • MCP4822 DAC (a cheap dual channel 12 bit DAC)
  • a red laser pointer
  • some crocodile/alligator clips (to easier connect the laser pointer)
  • a breadboard or prototyping PCB
  • jumper wires
  • some Lego bricks (optional, for the laser mounting)
  • a box/casing to mount the project (optional but recommended)

If you want to build the (optional) ILDA amplifier, see the parts list in the amplifier step.

The most expensive parts of this project are the 20Kpps galvos. I bought my set on ebay:

http://www.ebay.de/itm/20Kpps-laser-scanning-galvo-scanners-ILDA-/201645259187

Just search the internet / ebay for "20Kpps galvo" and you should find an adequate set. These sets typically come with a bipolar power source (mine uses +15V/-15V, if yours is in the range of 12-15V it should not make a difference).

Step 2: Laser Pointer

Hacking the laser pointer

For our project, we need to switch a laser pointer on/off from the Arduino. For this, you need to buy a cheap red laser pointer. It will typically have an on/off push button, which you need to fixate to a permanent pushed state. On my pointer, I just used duct tape to permanently press the button. Next you need to remove the battery case (back part of the pointer) and add power supply wires instead of the batteries. The easiest will be to use two alligator clips, typically one on the spring (-) and one on the case (+).

Have a look at the images for an example laser pointer.

Testing

To test the pointer, you can connect it like this: Arduino 5V -> Laser+, Arduino GND -> Laser -

If your laser pointer draws too much current to be safely connected to the digital output of the Arduino, you have to use a transistor or MOSFET to switch it. My pointer worked without problems, so it probably draws less than 50mA.

Mounting

The pointer needs to be at the correct height to point into the galvos, for this you need to build some holder. I used some Lego bricks to build the holder, see above picture. Of course you can use any other material to build it.

Step 3: Setting Up the 20 Kpps Galvos

The galvo set should consist of:

  • The two X/Y galvos with mirrors (attached to a metal block)
  • Two identical driver boards, on for X and one for Y
  • A power supply
  • Connector cables to wire everything
  • Extra input connector cables

Power supply

In my set, the power supply did not have a power cord, so I added a standard 3 wire power cord (I used an old PC power cord and removed the PC connector). Be careful when you work with the power supply, since it works on AC 220V/110V and this is (as you should know) DANGEROUS! I recommend that you get some kind of box to mount everything in and reserve an extra isolated spot for the power supply. I glued a plastic box on top, covering the power supply so that nobody can touch the high voltage input.

Connecting everything

Now connect the cables from the power supply to each driver card and each driver card to one of the galvos. You should have two remaining connector cables, which you can plug into the ILDA input of each card. You can either use these connector cables or instead you may use individual female jumper cables instead. In the next step, we will connect these to the Arduino / DAC outputs.

Step 4: Wiring the DAC and Laser Pointer

For this project we choose the MCP4822 DAC (as PDIP-8, to be breadboard friendly). It is available for 3-4 euros. It offers dual channel 12bit and there is an Arduino library available for it. It is connected to the Arduino via SPI and supports an additional LATCH pin which offers synchronous update of both channels. It will generate two output signals ranging 0V to 4.096V.

The following links to the datasheet for the DAC:

http://ww1.microchip.com/downloads/en/DeviceDoc/21953a.pdf

The wiring is done like shown in the images above.

The laser pointer is connected to GND and to Arduino pin D5. As said before, if you want to be on the safe side regarding drawing current from the Arduino, you can also use a transistor/MOSFET instead of a direct connection from pin D5.

The connection to the DAC is as follows:

Arduino CLK (pin D13) -> DAC SCK (pin 3)

Arduino MOSI (pin D11) -> DAC SDI (pin 4)

Arduino CS (pin D10) -> DAC CS (pin2)

Arduino pin D7 -> DAC LATCH (pin 5)

Arduino 5V -> DAC VDD (pin 1)

Arduino GND -> DAC VSS (pin 7)

This leaves us with DAC pin 6 and pin 8 which provide us with the two analog output signals.

One output of the DAC is connected to the ILDA driver card for the X galvo and the other one to the Y galvo. Since the ILDA driver cards expect a bipolar signal, in pricipal we would have to generate a signal from -5V to +5V and an inverted signal for the negative driver input. But these driver cards do not care so much about the bipolar signal, so you can wire each DAC output (with is positive 0 to +4.096V) to the ILDA IN+ connector and connect both the ILDA GND and ILDA IN- to the Arduino's GND. This will not drive the galvos to their full angle range, but it should already generate an image in about 1/4 of the galvos range. In a later step, we will learn how to create a correct bipolar signal.

In principle, this DAC is replaceable by any other dual channel DAC
that operates on 5V and supports latching, but you will need to adjust the Arduino sketch to make it work with a different DAC. The DAC code is inside of the Laser.cpp file.

Step 5: Housing / Putting Everything Together

If you don't have a box/case yet, now is a good time to get one. Don't forget to add an opening so that the laser ray can be emitted. I just used a wooden box and sawed a (too big) round hole and added a flap to open/close it. As you can see in the picture, I have plenty of room left, so I should have choosen a smaller box.

After everything is mounted, place the laser pointer near the galvos and adjust it so that it points into the center of the first galvo. I recommend to not fixate it at this point, so that you can re-adjust it later on.

The Arduino should be powered via USB, so you need to connect it to your PC (or later on to a USB charger) to run the laser show. You could also get the power from the galvo power supply, but this would require a DC-DC step down module, which is easy to add but out of scope of this project.

Your setup should look similiar to the one given in the image above, except for the extra (optional) amplifier PCB on the image, which will be explained later on.

Step 6: Software: Uploading the Laser Show to the Arduino

If you haven't already installed the Arduino IDE, now is a good time to do so.

You can download the complete laser show sketch from:

https://github.com/DeltaFlo/LaserProjector

  • Download the project (Just click on the "Clone or Download" button and choose "Download ZIP").
  • Open the LaserShow/LaserShow.ino sketch in the Arduino IDE.
  • Connect the Arduino via USB.
  • Press the compile and upload button.

If you wired everything as explained, the Arduino should now run the laser show right away.

Since the laser pointer does not have a lot of power, you will need a dark place to fully enjoy the show. Of course you can upgrade the project to a more powerful laser diode, but this is not covered in this tutorial and requires additional safety measures.

Trouble shooting:

  • is the laser pointer not switching on/off? Check if it is wired correctly.
  • is the laser pointer hitting the galvos in the right position? Try readjusting the height/angle of the pointer.
  • are't the galvos moving? Check if the power supply is working. Check if the galvos move when you connect +5V and afterwards GND to the positive input of the driver card instead of the output from the DAC.
  • is the image flipped horizontally or vertically? (adapt the Laser.h header file to flip the projection)
  • is the image rotated 90 degrees (adapt the Laser.h file to swap X/Y)

Fine Tuning:
Have a look at the Laser.h file to fine tune various timings to your hardware. Your laser pointer might have a smaller/bigger on/off delay than mine and the galvos might react differently.

The galvo driver cards typically also have potentiometers to fine tune over/under shooting, so you might play with those as well. In my setup I still had problems reaching the closing point of a contour exactly, probably because of the overshooting.

Step 7: Bipolar Signal With Opamps

NOTE: you only need to do this step if you want to get a bigger projection angle or if you are eager to learn how to generate bipolar signals and their inverse.

In the previous steps, we have already built a working laser projector, but we did not generate the correct bipolar ILDA signal that the driver cards expect. So how does a bipolar signal work? Bipolar means that the signal swings from -5V to +5V (so it has a range of 10V and GND is the center). In additional, the ILDA standard wants the same signal again as an inverted signal. For example a negative ILDA input of e.g. -5V requires a positive ILDA input of +5V.

Want we want to build now is an amplifier circuit which amplifies the unipolar DAC signal (from 0V to +4.095V) to the bipolar range -5V to +5V. For this we need a bipolar power supply. Luckily we can just use the power supply of the galvos, which is bipolar.

We are going to build the amplifier for X and Y separately, since it is the exact same circuit. To amplify an analog signal and to invert it, an opamp (operational amplifier) is used. Since we want to make the amplifier adjustable, we will add potentiometers for the gain and the offset, instead of fixed resistors. This makes the whole setup adjustable to different input ranges from the DAC and different power supply voltages.

Parts needed:

  • 2x TL082 opamp (PDIP-8)
  • 2x 1 KOhm resistor
  • 2x 47 KOhm resistor
  • 4x 10 KOhm resistor
  • 4x 10 KOhm potentiometers

The above images show the circuit for one signal line, you need to build it two times. I generated a circuit view and a breadboard view. I decided to put it on prototyping PCB together with the DAC, but that is totally up to you, breadboards will work fine as well. My PCB is shown on the last image.

Finally you need to connect the two DAC outputs to the two amplifiers and their +/- output to the ILDA driver inputs. Make sure that you also connect the GND of the Arduino with the GND of the galvo power supply, to get a common ground. Connect the power supply to the two amplifiers as well. Now everthing should be setup and you can run the laser show and adjust the image using the potentiometers.

How the amplifier works

One potentiometer is used for the GAIN (it scales the image) and the other for the OFFSET (it moves the image). The TL082 IC contains two separate opamps. One opamp is used to move and scale the signal (and also invert it), the output is the negative ILDA INPUT-. The second opamp is used to invert the signal again to get the positive ILDA INPUT+.

Step 8: Further Project Extensions

You can extend this project in various way. If anyone is interested, I plan to write additional instructables that extend this project:

  • Upgrade to a Teensy 3.2 microcontroller and create a live spectrum analyzer

    (https://www.youtube.com/watch?v=QLwdwvleztA)

    (Source code here: https://github.com/DeltaFlo/LaserProjector/tree/master/LaserSpectrumAnalyzer)

  • Add an ESP8266 to show content from the Web

  • Create an Etch-A-Sketch Webpage which sends the drawn sketch to the laser projector
Lamps and Lighting Contest 2016

Participated in the
Lamps and Lighting Contest 2016

20 People Made This Project!

Recommendations

  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • Anything Goes Contest

    Anything Goes Contest
  • Cold Challenge

    Cold Challenge

170 Comments

0
aerichmond
aerichmond

17 days ago

My son an I needed to upgrade the Arduino from the Uno to the Mega for our project so I figured I'd document the changes we had to make.
1) In the DAC_MCP4X.cpp file:
on line 179 we changed "PORTB &= 0xfb;" to "PORTB &= 0xfe;"
on line 189 "PORTB |= (1 << 2);" to "PORTB |= (1 << 0);"
on line 217 "PORTD &= ~(1 << 7);" to "PORTD &= ~(1 << 38);"
and on line 219 "PORTD |= (1 << 7);" to "PORTD |= (1 << 38);"

2) Then on the Arduino:
Arduino Uno CLK (pin D13) -> DAC SCK (pin 3) changed to Arduino Mega CLK (pin D52)
Arduino Uno MOSI (pin D11) -> DAC SDI (pin 4) changed to Arduino Mega CLK (pin D51)
Arduino Uno CS (pin D10) -> DAC CS (pin2) changed to Arduino Mega CLK (pin D53)
Arduino Uno pin D7 -> DAC LATCH (pin 5) changed to Arduino Mega CLK (pin D38)
0
Svennte
Svennte

1 year ago

Hey anyone,
I wrote a simple website where you can draw pictures with points and lines.
With a button you get the code this arduino sketch needs for drawing an object.
Its not perfect but works for simple drawings. If anyone ist interested I can upload it, but please consider that I didnt continued working on it because my Galvo driver got broke after just a few days. :(

0
arnaldoalvarado
arnaldoalvarado

Reply 4 months ago

I'm interested is the website still active?

0
maitresinh
maitresinh

7 months ago

Just wondering if part of the wire/code could be used for a fretless laser harp.

2
trevor.boultwood14
trevor.boultwood14

2 years ago

I have generated a few PCBs which can hold an arduino nano and correction amplifier and DAC. If anyone is interested drop me a message. It also has the ability to play ilda files from a modified sound card. I hope to create an instructable at some point in the near future! Thank you for your instructable.

0
trevor.boultwood14
trevor.boultwood14

Reply 2 years ago

Here is a picture, i am still awaitng delivery but will have a few spare.

DAC.png
0
maitresinh
maitresinh

Reply 7 months ago

Looks great. An instructable would be help using it

0
jojoxy
jojoxy

11 months ago

gcode_to_hex_converter_v2

convetrer.JPG
1
hanklloydright
hanklloydright

12 months ago

Hello DeltaFlo,
Just wanted to let you know that I used your project, as well as a few other Laser DAC projects on github (like Atomic14) as inspiration to create an entirely self-contained laser DAC that outputs to any ILDA compatible laser projector (this way people don't have to build the laser diode and galvo parts themselves). I'm using an ESP-32, plus three MCP4922 dual 12-bit DACs, an OLED display, and an SD card to hold thousands of ILDA files for playback. You can see all the details here: https://ildac32.com/
I just wanted to thank you as your project was the initial inspiration for my ESP32 version. I learned a lot by studying every detail of your hardware design. Thanks!
-HankLloydRight

1
chrissoz
chrissoz

1 year ago

Made a circuit board for this - minimum order was 10 so have some spares if anyone wants one for postage.

20210812_085521.jpg
0
jphastings
jphastings

Reply 1 year ago

Do you have any more available? (And would shipping to the UK/London be economically smart?)

If you're based elsewhere I'd be happy to have some made and shipped here to act as UK distribution 😂

0
b.p.sitek
b.p.sitek

Reply 1 year ago




20210810_083535.jpg
0
chrissoz
chrissoz

Reply 1 year ago

Here is the Schematic an layout of the board

0
chrissoz
chrissoz

Reply 1 year ago

Ignore PDF... see below

Board.pngSchematic.png
0
dimanyci
dimanyci

3 years ago

Hi, DeltaFlo.
Very beautiful project!!!!!!!!!!!!!!!!!!!!!!!!!!
I built on your instructables this laser show, it works well. It was a lot of fun to build it. Now I want to change the Arduino Uno card with the Arduino Due card (to have more memory for many designs, and for speed), but I found a problem with the Arduino Due,
says ->
--------------------------------------------------------------------------------------------------------------------------
DAC_MCP4X.cpp:179:3: error: 'PORTB' was not declared in this scope
PORTB &= 0xfb; // Clear PORTB pin 2 = arduino pin 10
^
DAC_MCP4X.cpp:189:3: error: 'PORTB' was not declared in this scope
PORTB |= (1 << 2); // set PORTB pin 2 = arduino pin 10
^
C:\Users\RDM\AppData\Local\Temp\arduino_build_91070\sketch\DAC_MCP4X.cpp: In member function 'void MCP4X::latch()':
DAC_MCP4X.cpp:217:3: error: 'PORTD' was not declared in this scope
PORTD &= ~(1 << 7); // Uno: digital pin 7; Mega: digital pin 38
-------------------------------------------------------------------------------------------------------------------------

What am I doing wrong?

Help me please.........





0
lishuai000
lishuai000

Reply 2 years ago

Hello! I have encountered the same situation. Have you solved it?

0
hondaman9001
hondaman9001

Reply 1 year ago

I'm having the same issues with PORTB and PORTD not declared in scope errors. I'm running this on an ESP32 and getting this error when compiling, so I'm guessing it's not finding specific pins?. Did you find a solution and what was it?

0
chrissoz
chrissoz

Reply 1 year ago

It is direct port access that is not present on ESP chips. There are some comments around this in the code - you just need to comment the lines and uncomment the ones with a digital.write.

0
chrissoz
chrissoz

Reply 1 year ago

in DAC_MCP4X.h
change
#define MCP4X_PORT_WRITE 1
to
#define MCP4X_PORT_WRITE 0
then comment out all references to PORTD and PORTB in all tabs

This works fine on my ESP32 ad 2866 setup. Probably don't need the direct port write as they are much faster controllers.