Jeff's Raspberry Pi Laser Projector
This Laser Projector uses a set of 20k point-per-second galvonometers with controller cards and power supply purchased on eBay.
It is controlled by a Raspberry Pi 3B+ programmed completely in Python.
It is a reboot of a High School project I built in 1982 that had used audio speakers, a sine wave function generator, and audio input. That simple version used crossed sticks with a single mirror glued at the center, one end of each end fixed to a frame, and the free end resting on a speaker cone. It made Lissajous patterns and interesting effects with music, but had very limited angular sweep and a lot of unwanted X-Y coupling due to the single mirror.
This newer version was inspired by a colleague's Arduino and C++ project, which in turn was based on several on-line projects, possibly including: Instructables - Arduino Show With Real Galvos.
- An interesting project to get me back into hardware control after years of business software programming.
- An opportunity to learn the Python language.
- See if the Raspberry Pi alone was sufficient to drive the projector at acceptable point-per-second and frame rate for still frames and simple animations.
- See if this could be done all in Python without needing faster low-level functions in C++
- Provide a platform for testing projective error correction algorithms.
The results have been better than expected and meet my initial goals.
The ICs on the breakout proto-board are: MCP4822 12-bit DAC, TL084IN Quad-Op-Amp, L293D quad-half-H-bridge driver. Then a 9v to 5v power supply module.
The Op Amps will be used to expand the DAC's 0v to 4.095v output to +10v/-10v for larger projection angles. It currently works fine without that, the image is just small.
The H-bridge chip switches the laser since I did not have an individual JFET or MOSFET handy and it is safe for TTL input.
The L293D is only rated for 5kHz but seems to be turning the laser on and off ok for images at 20k points-per-second, of course for many of those points the laser remains on more than off.
The standard ILDA Test Image above shows shows poor resolution due to the low amplification and large beam diameter of my cheap laser module, but shows proper function with a small laser "blanking" timing issue I can live with.
See this Animation of Canada Goose in flight. Special thanks to laserfx.com for providing the CanGoose.ild file.
Main coding tasks completed:
- ILDA format binary laser show file reader. Initially created a PC-based Python graphics program to display the files on screen.
- Comma Separated Value(.csv) file reader for simple test files. Also an ILDA to CSV converter to help with analysis and for sharing files with my colleague's Arduino project.
- SPI communications to the MCP4822 Digital-to-Analog converter. Requires splitting each X and Y coordinate value into individual bytes and joining 4 bits of control information to the upper byte of each coordinate.
- Repeat each frame multiple times to control the overall animation speed.
- Interpolate extra points within long lines to slow and brighten the line.
- CAD/CAM G-Code file reader to load fractal images created with Sandify. Note: I manually edit the file to change the return-path non-visible lines from code G01 to G00. My projector program then turns off the laser during re-positioning.
- 3D Graphics program to simulate the laser projector's orientation, visualize the laser point files, and make perspective adjustments prior to projection.
- Point timing. Eventually moved all calculations to outside of the main projection loop, which now has only three lines: send X, send Y, set laser. Points-per-second is then controlled by setting the SPI communications baud rate. Any other calculations or delay loops execute too slowly. Can now run at 2M baud, resulting in 20k points-per-second.
- Frame timing. Simple files project too fast and over-drive the galvos or finish before clearly visible. So added frame-repetition variable to adjust for each shape file. Professionally made ILDA files add extra points and repeated frames to control timing, but my manually created CSV point-files did not.
- My stubbornness to figure out the code myself and not just copy an existing project. Some techniques were definitely inspired by others' solutions though, particularly "The Raspberry Pi Coookbook" by Simon Monk and Donald Papp's Hackaday project
- Add anti-keystone and other perspective error correction algorithms.
- Develop a web-services interface to control it remotely, particularly to select which file to present and adjust frame-rate and projection angle parameters.
- Wire up the Op Amp circuit so can project at full size capability of the galvos. The circuit is well described by DeltaFlo's Instructables article and this buildlog.net blog.
- Add separate power-supply for the laser to replace the 9v battery and circuitry. Have separate power switches for: RPi, DAC card, Galvo controller cards, and Laser so don't have to have all powered up when just using RPi.
- Hard-wire a circuit board to replace the socket proto board that has too much signal noise. Also add more filtering capacitors.
- Experiment with brightness control via PWM or another DAC.
Back to Jeff's
My wife Luda's real estate site, www.ludasrealestate.com
Back to Jeff's Home page