Project
| # | Title | Team Members | TA | Documents | Sponsor |
|---|---|---|---|---|---|
| 30 | Self-Calibrating Long-Exposure Laser Light Painter |
Alex Chen Billy Huang Michael Shi |
Denghan Xiong | ||
| # Self-Calibrating Long-Exposure Laser Light Painter Team Members: * Alex Chen (alex18) * Billy Huang (billyh2) * Michael Shi (mwshi2) # Problem Long-exposure light painting is normally done by hand, so it is difficult to repeat a drawing or reproduce a specific image. A laser steered by galvanometer mirrors can draw a vector image while a camera shutter remains open, but existing hobby systems use off-the-shelf galvo kits without measuring the finished output. Two errors are especially visible in the photograph: geometric distortion caused by mirror geometry and sensor scale error, and uneven exposure caused by the beam slowing at corners and moving quickly along straight segments. Because the camera integrates every error over time, these effects appear as bent lines, bright blobs, and dim strokes. # Solution We will build a laser light-painting instrument on a custom controller PCB. A pair of closed-loop galvos will steer a 650 nm laser onto a rear-projection screen inside an enclosure while a DSLR takes a long exposure. The controller will measure where the beam lands with a removable photodiode calibration target, fit a two-dimensional geometric correction, and modulate laser current based on beam velocity so that each millimeter of a stroke receives similar exposure. The final two-axis demonstration will use the galvo kit amplifiers. We will also design and characterize one custom galvo servo daughtercard containing loop compensation, current sensing, and a bipolar power stage. It closes the loop on one axis using the position signal already produced by the kit driver. The kit driver's output link acts as a hardware selector: with the link removed, the kit cannot drive that coil and the daughtercard does, so the two can never drive the same coil at once. Reach goals, in priority order: a small learned residual model trained on recorded trajectories to correct errors the static correction misses, with training on a laptop and bounded inference on the microcontroller; a second custom servo channel; and a music-driven drawing mode. # Solution Components ## Subsystems 1. Controller and embedded processing. Plays vector stroke files, applies the geometric correction, generates X/Y commands, controls retrace blanking and the camera shutter, and produces the heartbeat. STM32G474RET6, DAC8562SDGSR, OPA2197ID, TPS3823-33DBVR. 2. Photodiode calibration target. Measures beam landing positions for the correction fit; the perimeter cells also retrigger the beam-stall watchdog. Nine BPW34 photodiodes, nine OPA380AID transimpedance amplifiers, nine TLV3501AIDBVR comparators, 650 nm bandpass filters, apertures. 3. Laser driver, exposure control, and safety interlock. Constant-current drive with monitor-photodiode feedback, velocity-dependent current, and the hardware interlock chain. RLD65MZT7, OPA197IDR, 2N7002K, TLV1702AIDR, D2HW-A201D lid switch, key switch, interlock MOSFET. 4. Custom galvo servo daughtercard. Closed-loop position servo and power stage for one galvo axis. This is the main custom analog design in the project. OPA2197ID, INA240A2DR, TIP41C/TIP42C, powered from the kit's ±15 V supply. 5. Camera trigger and power. Isolated focus and shutter contacts, the 3.3 V rail, rail supervision, fuses, soft start. Two AQY212EH PhotoMOS relays, TPS62162DSGR, TVS diodes. 6. Optomechanics and enclosure. Galvo mount, screen, baffles, lid switch, laser mount, and the ND filter holder. 3D-printed or extrusion frame with rear-projection film. Interfaces: the controller sends ILDA-standard ±5 V differential X/Y to the galvo amplifiers, and to the daughtercard through the selector. The daughtercard takes its position feedback from the kit driver's buffered position output. The nine comparator outputs go to controller GPIO with timer capture. The laser driver takes a DAC current command and an enable line. The interlock chain is independent of the controller and can only be reset by the key switch. ## Motion Control and Embedded Processing An STM32G474RET6 microcontroller will play vector stroke files converted from SVG on a laptop. Timer-driven DMA will update synchronized X/Y commands, apply the geometric correction (and the learned correction if that reach goal is met), control retrace blanking, and coordinate the camera shutter. A DAC8562SDGSR dual 16-bit DAC and OPA2197ID level-shifting amplifiers will generate the ILDA-standard differential X/Y commands. A TPS3823-33DBVR watchdog will place the laser in its disabled state if the real-time firmware stops responding. ## Galvo Kit and Daughtercard The galvos are a standard ILDA 20 kpps galvo scanner set, sold as a "20K galvo set" on Amazon and by laser-parts.com for about $70 to $130 depending on seller. The set includes two moving-magnet galvo motors with 7 by 11 mm mirrors, two analog servo driver boards, motor-to-driver cables, ILDA differential input cables, a mount, and a ±15 V linear supply rated +15 V at 1.0 A and −15 V at 0.6 A. Published specifications: ±5 V differential command input, 200 kΩ input impedance, over 20 kpps on the ILDA test pattern at ±20° optical, and driver trim pots for input scale, servo gain, low- and high-frequency damping, offset, and position scale. Several sellers also list a buffered position output at 0.5 V/° on the driver. We will record the exact seller and listing in the design document once the kit is in hand. The galvo motor cable carries two coil leads and a sensor bundle: a sensor illuminator or oscillator supply, two differential sensor outputs, and ground. On these kits the sensor output is a small differential current, optical on some units and capacitive with a megahertz oscillator on others, and the sensor is undocumented, so the daughtercard does not include a sensor front end. The kit driver handles sensor demodulation and gain control, and the daughtercard closes its own loop on the driver's demodulated position signal: the buffered position output where the driver provides one, otherwise a follower on the driver's internal position node, which is a low-impedance op-amp output on these boards. The daughtercard contains an OPA2197ID error amplifier (command minus position), an OPA2197ID lead-lag compensator with a notch near the first mirror resonance, an INA240A2DR shunt current sense with a current-limit clamp, and a complementary TIP41C/TIP42C class-AB output stage running from the kit's ±15 V rails. The coil connects to the daughtercard through a breakout cable. The kit driver's output link is lifted so it cannot drive that coil; nothing else on the kit driver is modified. Before any daughtercard layout, in week 2, we will put the kit on the bench and: find the position node on the driver with a scope and confirm its V/° scale against a known command; measure coil resistance and inductance and the driver's coil current at full swing; and swept-sine the kit-driven galvo to find the mirror resonance. If no usable position signal can be found on the driver, we will drop the daughtercard and present the laser driver and the nine-channel calibration target as the custom analog design, with the two-axis image demonstration unchanged. ## Photodiode Calibration Target A removable target will contain a 3 by 3 array of BPW34 photodiodes behind 1 mm apertures and 650 nm filters, at known positions on the screen plane, machined or printed to ±0.1 mm. Each channel will use an OPA380AID transimpedance amplifier and TLV3501AIDBVR comparator. The controller will sweep the beam across the target. Each time the beam crosses an aperture the comparator fires; a microcontroller timer captures the command-space coordinate at both the rising and falling edge, and the midpoint is taken as the beam center for that fiducial. Each crossing is repeated in both scan directions and averaged to cancel comparator delay. Perimeter detectors will also retrigger the independent beam-stall watchdog. Error definition. For each fiducial i with known screen position p_i and commanded position c_i, the residual is e_i = ‖p_i − M(c_i)‖, where M is the current command-to-screen map. We report the RMS and the maximum of e_i in millimeters over a set of test points that were not used in the fit. Correction model. The main error sources are the tangent geometry of two mirrors projecting onto a flat screen, DAC and galvo position-scale gain error, and axis skew and offset. A degree-2 polynomial in x and y with cross terms, fit by least squares to the fiducials, captures all of these. The firmware needs the inverse map, screen to command, so we fit that direction directly: for each fiducial we know the screen position and the command that hit it. The microcontroller stores the coefficients and evaluates them per vertex when a stroke file is loaded. Between vertices the path is linearly interpolated in command space; the fit script checks the worst-case chord error at our stroke lengths. Nine detectors is a thin set for a twelve-coefficient fit (six per axis), so the target has registration pins and can be placed at four known offsets on the screen frame, giving 36 fiducials from nine channels. The held-out test points come from photographing a printed checkerboard. Velocity compensation. Exposure per unit length of a stroke is proportional to P/v, laser power over beam speed on the screen. We compensate in two places. On the laptop, each SVG path is resampled to points spaced for a constant screen speed, subject to the galvo's acceleration limit; at a corner the path decelerates, blanks for a short dwell, and re-accelerates, so the mirror never has to turn a sharp corner at speed, and the blanked segment is shorter than the spot so the line still reads as continuous. In firmware, the beam speed is computed from consecutive command points and the laser current is set to I = I_th + k·v, clamped to the hardware maximum, so P/v stays roughly constant through accelerations. Below a minimum speed the laser is blanked. The constants k and I_th are calibrated by drawing a test stroke at several fixed speeds and measuring stroke brightness in a RAW photograph. The 5 mm exclusion around corners in the success criteria is where the dwell blanking sits. ## Laser Driver, Exposure Control, and Safety A custom constant-current driver will power an RLD65MZT7 laser diode using an OPA197IDR error amplifier, 2N7002K MOSFET, current-sense resistor, and the diode's monitor-photodiode feedback. The commanded current will vary with beam velocity above the lasing threshold and will be blanked during retrace or when velocity falls below a safe minimum. Operating point. The RLD65MZT7 datasheet gives an absolute maximum output of 7 mW, threshold current 20 mA typical and 60 mA maximum, operating current 28 mA typical at 5 mW, and a wavelength of 645 to 665 nm, so the slope efficiency is about 0.6 mW/mA above threshold. Running the diode within a milliamp or two of threshold gives an unstable, LED-like output with poor modulation linearity, which would defeat the velocity compensation. The diode will therefore run at 2 to 3 mW, about 23 to 25 mA, and a fixed neutral-density filter (OD 0.6 or 0.7) after the collimator will bring the beam reaching the mirrors and screen down to at most 0.75 mW, so the 1 mW Class 2 limit holds with margin even at the hardware current clamp. The filter is mounted in the optomechanics and is not user-removable. Class. Accessible emission of 1 mW or less at 650 nm is Class 2 under IEC 60825-1 and ANSI Z136.1. With the lid closed the accessible emission is zero, so the finished instrument is an embedded Class 2 product. Class 2 does not require registration with the Division of Research Safety; only Class 3B and Class 4 lasers are registered. Safety glasses are not required for Class 2. We will keep OD 2 or better glasses at the bench for alignment and driver bring-up, when the ND filter may be out of the path and the diode can emit up to 5 mW, which is Class 3R. Measurement. We will measure optical power rather than infer it from current: with the lab's optical power meter at the screen plane, with and without the ND filter, at the maximum commanded current, and as a cross-check with a BPW34 behind a known aperture using its datasheet responsivity at 650 nm. The maximum commanded current is set in firmware and also hard-clamped by a resistor divider on the OPA197 reference, so software cannot exceed it. Measured values will go in the design document. Training. All three of us will complete the DRS online Laser Safety module in addition to the ECE 445 Laboratory Safety modules and submit the certificates to the TA before laser bring-up. Interlock. A series interlock MOSFET and an independently powered, latched hardware watchdog will disable the laser after a stalled beam (perimeter photodiodes not retriggered within a window), an out-of-zone command (a TLV1702AIDR window comparator monitoring the X/Y command range independently of firmware), an open D2HW-A201D lid switch, a disarmed key switch, or a missing microcontroller heartbeat. Blanking below the minimum beam velocity is enforced in firmware and backed by the stall watchdog in hardware. ## Camera Trigger and Power Two AQY212EH PhotoMOS relays will provide isolated dry-contact focus and shutter outputs for a standard wired camera remote. The camera is a team-owned DSLR with bulb mode and a wired remote jack; the relays present the same focus and shutter contacts a wired remote does, so any body with a remote port works. The camera is external to the design and not a purchased part. The controller will open the shutter, draw the image, blank the laser, and close the shutter in a repeatable sequence. The galvo kit's ±15 V supply provides the galvo rails and the daughtercard rails; a TPS62162DSGR regulator and local analog filtering will provide the 3.3 V control rail. Rail supervision, fuses, soft start, reverse-polarity protection, and test points will be included on the PCB. ## Controls Background Alex is enrolled in ECE 486 Control Systems this semester and spent two summers doing closed-loop tuning on optical transceivers (bias and equalizer optimization against measured error rates). Billy and Michael have not taken a controls course, so Alex owns the servo loop and the other two own the calibration target, laser driver, and firmware, which are signal-chain and embedded work. To keep the loop design manageable, the daughtercard starts from the kit driver's own topology (proportional gain with low- and high-frequency damping, which is a lead-lag), the plant is characterized by swept-sine on the kit-driven galvo before any compensator values are chosen, and the compensator is a single analog stage with values set from the measured resonance. If the loop does not close cleanly by the week-8 review, the fallback in the success criteria applies. ## Budget ECE 445 provides $50 per student, $150 for the team, through the TA's CFOP. | Item | Estimate | Source | |---|---|---| | RLD65MZT7 laser diode, two (one spare) | $20 | Digikey via TA | | Laser collimator/housing, ND filter, nine 650 nm bandpass filters | $40 | Amazon/Thorlabs via TA | | ICs: nine OPA380, nine TLV3501, four OPA2197, OPA197, INA240, TLV1702, DAC8562, TPS62162, TPS3823, two AQY212EH, 2N7002K, TIP41C/TIP42C | $70 | Digikey via TA | | STM32G474RET6, passives, connectors, twelve BPW34 | $30 | Digikey via TA, ECE Stores | | PCB fabrication, controller plus daughtercard plus target | $0 to $40 | ECE 445 PCB service, PCBway if needed | | ILDA 20K galvo set (two galvos, two drivers, ±15 V supply, cables) | $70 to $130 | personal purchase, not reimbursed | | Enclosure, screen film, mounts | $30 | personal, makerspace | Course-funded parts come to about $160 to $200. Anything over $150 and the galvo kit are personal purchases, which we accept. The laser diode itself is under $10; the galvo kit is the main cost. # Criterion For Success * After calibration, beam-position error measured against a printed checkerboard is at most 3 mm RMS and 6 mm maximum over at least 25 test points across a field at least 500 mm wide at a 1 m projection distance. The test points will not be used to fit the calibration, and calibration must reduce RMS error by at least 60% relative to the uncorrected system. * With velocity compensation enabled, brightness in an unclipped RAW photograph remains within 20% of the median along each stroke, excluding 5 mm around corners and blanking points. * Ten repetitions of the same stroke file reproduce checkerboard positions within 2 mm RMS. * The system draws at least three supplied SVG files, including one containing straight lines, curves, and sharp corners, and in each photograph every stroke in the source file is present as a continuous line with no unintended breaks or extra strokes. * The hardware interlock drops the laser diode below its forward voltage within 10 ms after a stalled beam, zone violation, open lid, or lost heartbeat, verified by fault injection and oscilloscope measurement. * The custom servo holds a static point within 1 mrad optical for 10 minutes after warm-up and settles a 10-degree step to within 2% in 5 ms. If it does not pass by the week-eight go/no-go review, the final image demo will use the kit amplifier and the custom channel will be presented as a characterized subsystem. Reach goals, not success criteria: a learned residual correction model that reduces RMS path error on held-out trajectories relative to the geometric correction alone, running on the microcontroller; a second custom servo channel; a music-driven drawing mode. |
|||||