I've been messing around with lasers and controlling them from my ESP32.
This project creates a version of the classic arcade game Asteroids. There's a detailed walkthrough of how it works in the video below:
I've had a custom PCB built for the project, but you can easily build the circuitry on a breadboard.
The schematic is fairly straightforward - we have a dual-channel SPI DAC which is then run through a set of op-amps to give us the differential signal that is required by the laser galvos.
You can see a typical control signal for one of the directional galvos below.
I've 3D printed a case for the project to hold the power supply, galvo control boards, my custom PCB, and a sound card - I'm using the MAX98357A breakout board from Adafruit for sound and have written a multichannel sound player on the ESP32 to play the original sound effects from the game.
The actual game engine uses Box2D to do the heavy lifting. This handles all the complicated parts of the game such as collision detection.
Rendering is performed by sending out samples to the SPI device synchronised with turning the laser on and off using a MOSFET on the PCB.
The game plays really well and I can project it onto the wall at about 2m x 2m with good brightness in a dark room.