Arduino Laser Show With Real Galvos

88,292

208

162

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

18 People Made This Project!

Recommendations

  • Pumpkins & Gourds Speed Challenge

    Pumpkins & Gourds Speed Challenge
  • Retro Tech Challenge

    Retro Tech Challenge
  • Robots Contest

    Robots Contest

162 Comments

0
chrissoz
chrissoz

2 months 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
b.p.sitek
b.p.sitek

Reply 2 months ago




20210810_083535.jpg
0
chrissoz
chrissoz

Reply 26 days ago

Here is the Schematic an layout of the board

0
chrissoz
chrissoz

Reply 26 days ago

Ignore PDF... see below

Board.pngSchematic.png
0
dimanyci
dimanyci

2 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 11 months ago

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

0
hondaman9001
hondaman9001

Reply 3 months 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 2 months 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 2 months 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.

0
hondaman9001
hondaman9001

Reply 3 months ago

I'm having the same issues with PORTB and PORTD not declared in scope errors. Did you find a solution and what was it?

0
SuperNit
SuperNit

2 years ago

Thank you very much for this excellent tutorial and especially for the elaborated and well documented source code! It is a great fun experimenting with it and I have great plans :-).

For everyone who is interested: I've created a breadboard view of the complete setup, maybe you could use it. I have a 3V Laser, so I used a transistor and the 3.3V output of the Arduino. I'm not completely sure of the 330Ω resistor but it seems to work fine.

Best Regards
Martin

LaserShowComplete_Steckplatine.png
0
robertzegwaard
robertzegwaard

Reply 2 months ago

Hi Martin,
Which software did you use to create this view? If ThinkerCad, how did you add the Arduino Nano?
Kind Regards
Robert

0
SuperNit
SuperNit

Reply 2 months ago

Hi Robert,
I used Fritzing - there is an Arduino Nano available in the library. I replaced my screenshot with a proper export from Fritzing, so now the logo is also included.
Best Regards
Martin

0
robertzegwaard
robertzegwaard

2 months ago

Hi,
What software was used to draw the circuit ? If Thinkercad then how did you add the Arduino Nano? It's not in the ThinkerCad library...
Robert

0
Svennte
Svennte

3 months 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
adrian.kollmann
adrian.kollmann

Question 7 months ago on Step 8

Thanks for this great idea and project. Now I try to get my own pictures and bigger pictures into the laser show. I have still the challenge to convert G00/G01 Code via phyton, without an clear process from the image file (e.g. *.svg) or a own creation in another program to the proper g-code file, which is readable by the phyton program. Which program is to use, to create the proper *cn file? (best would be open source) 2nd I would like to control the arduino to the galvos directly via USB cable from my computer, to have the possibility to send bigger pictures in a longer time-line. Are there any ideas how to come forward with this?

0
lechaudepierre
lechaudepierre

Question 8 months ago

hello,
for my university, I have to make the same project as you except de construction of the laser and the galvanometer.
could you give me de parametric equation that you used to describe the mouvement of your 2 galvanometer (X/Y) and to finally show the figure. (I'm interested in the lissajouh figures I don't know if you heard about it)

thank you for your work,

Pierre
0
johnny.spicer
johnny.spicer

3 years ago

After trying this project I decided I wanted to make it look a bit more professional. To that end I had a PCB made up. I have 30 left over if you want one you can find one Ebay at

http://rover.ebay.com/rover/1/710-53481-19255-0/1?icep_ff3=2&pub=5575378759&campid=5338273189&customid=&icep_item=123437933142&ipn=psmain&icep_vectorid=229508&kwid=902099&mtid=824&kw=lg&toolid=11111

If you want to order the PCB yourself I've created a GitHib page with the Eagle schematic/board and gerber files.

https://github.com/SpicerSolutions/GalvoController

0
jscurry
jscurry

Reply 3 years ago

Johnny, do you have any more of those PCBs? If you do I'd like to grab one... or a few. :-)

0
johnny.spicer
johnny.spicer

Reply 3 years ago

Hello, I have more in stock if you still want one.