Spike Prime Laser
Here's a laser powered by the Spike Prime Hub (or Robot Inventor), which follows the building techniques in Chapter 2 of "High-Tech LEGO Projects". However, there's no need for a voltage converter to power the laser diode module, since this particular laser diode module can run on a 3.3V input. The laser diode module is a Quarton VLM-650-03-LPA that I ordered from Digi-Key (digikey.com). It's 650-nm wavelength, 2.5 mW power. Projects to use a laser for a MINDSTORMS break-beam alarm and a light show are also in "High-Tech LEGO Projects", though with EV3. But the same projects could be built with Spike Prime or Robot Inventor. Please be careful using a diode laser module, since they can be an eye hazard--safety protocols are described in "High-Tech LEGO Projects". The particular laser used here is about the same power level as a laser pointer, but don't get too comfortable, since there are ways to hurt yourself with a laser pointer.