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.

Healthy Chair

Ryan Chen, Alan Tokarsky, Tod Wang

Healthy Chair

Featured Project

Team Members:

- Wang Qiuyu (qiuyuw2)

- Ryan Chen (ryanc6)

- Alan Torkarsky(alanmt2)

## Problem

The majority of the population sits for most of the day, whether it’s students doing homework or

employees working at a desk. In particular, during the Covid era where many people are either

working at home or quarantining for long periods of time, they tend to work out less and sit

longer, making it more likely for people to result in obesity, hemorrhoids, and even heart

diseases. In addition, sitting too long is detrimental to one’s bottom and urinary tract, and can

result in urinary urgency, and poor sitting posture can lead to reduced blood circulation, joint

and muscle pain, and other health-related issues.

## Solution

Our team is proposing a project to develop a healthy chair that aims at addressing the problems

mentioned above by reminding people if they have been sitting for too long, using a fan to cool

off the chair, and making people aware of their unhealthy leaning posture.

1. It uses thin film pressure sensors under the chair’s seat to detect the presence of a user,

and pressure sensors on the chair’s back to detect the leaning posture of the user.

2. It uses a temperature sensor under the chair’s seat, and if the seat’s temperature goes

beyond a set temperature threshold, a fan below will be turned on by the microcontroller.

3. It utilizes an LCD display with programmable user interface. The user is able to input the

duration of time the chair will alert the user.

4. It uses a voice module to remind the user if he or she has been sitting for too long. The

sitting time is inputted by the user and tracked by the microcontroller.

5. Utilize only a voice chip instead of the existing speech module to construct our own

voice module.

6. The "smart" chair is able to analyze the situation that the chair surface temperature

exceeds a certain temperature within 24 hours and warns the user about it.

## Solution Components

## Signal Acquisition Subsystem

The signal acquisition subsystem is composed of multiple pressure sensors and a temperature

sensor. This subsystem provides all the input signals (pressure exerted on the bottom and the

back of the chair, as well as the chair’s temperature) that go into the microcontroller. We will be

using RP-C18.3-ST thin film pressure sensors and MLX90614-DCC non-contact IR temperature

sensor.

## Microcontroller Subsystem

In order to achieve seamless data transfer and have enough IO for all the sensors we will use

two ATMEGA88A-PU microcontrollers. One microcontroller is used to take the inputs and

serves as the master, and the second one controls the outputs and acts as the slave. We will

use I2C communication to let the two microcontrollers talk to each other. The microcontrollers

will also be programmed with the ch340g usb to ttl converter. They will be programmed outside

the board and placed into it to avoid over cluttering the PCB with extra circuits.

The microcontroller will be in charge of processing the data that it receives from all input

sensors: pressure and temperature. Once it determines that there is a person sitting on it we

can use the internal clock to begin tracking how long they have been sitting. The clock will also

be used to determine if the person has stood up for a break. The microcontroller will also use

the readings from the temperature sensor to determine if the chair has been overheating to turn

on the fans if necessary. A speaker will tell the user to get up and stretch for a while when they

have been sitting for too long. We will use the speech module to create speech through the

speaker to inform the user of their lengthy sitting duration.

The microcontroller will also be able to relay data about the posture to the led screen for the

user. When it’s detected that the user is leaning against the chair improperly for too long from

the thin film pressure sensors on the chair back, we will flash the corresponding LEDs to notify

the user of their unhealthy sitting posture.

## Implementation Subsystem

The implementation subsystem can be further broken down into three modules: the fan module,

the speech module, and the LCD module. This subsystem includes all the outputs controlled by

the microcontroller. We will be using a MF40100V2-1000U-A99 fan for the fan module,

ISD4002-240PY voice record chip for the speech module, and Adafruit 1.54" 240x240 Wide

Angle TFT LCD Display with MicroSD - ST7789 LCD display for the OLED.

## Power Subsystem

The power subsystem converts 120V AC voltage to a lower DC voltage. Since most of the input

and output sensors, as well as the ATMEGA88A-PU microcontroller operate under a DC voltage

of around or less than 5V, we will be implementing the power subsystem that can switch

between a battery and normal power from the wall.

## Criteria for Success

-The thin film pressure sensors on the bottom of the chair are able to detect the pressure of a

human sitting on the chair

-The temperature sensor is able to detect an increase in temperature and turns the fan as

temperature goes beyond our set threshold temperature. After the temperature decreases

below the threshold, the fan is able to be turned off by the microcontroller

-The thin film pressure sensors on the back of the chair are able to detect unhealthy sitting

posture

-The outputs of the implementation subsystem including the speech, fan, and LCD modules are

able to function as described above and inform the user correctly

## Envision of Final Demo

Our final demo of the healthy chair project is an office chair with grids. The office chair’s back

holds several other pressure sensors to detect the person’s leaning posture. The pressure and

temperature sensors are located under the office chair. After receiving input time from the user,

the healthy chair is able to warn the user if he has been sitting for too long by alerting him from

the speech module. The fan below the chair’s seat is able to turn on after the chair seat’s

temperature goes beyond a set threshold temperature. The LCD displays which sensors are

activated and it also receives the user’s time input.

Project Videos