Skip to main content

Laser interface

Laser interface Rev. A

Four PWM channels for lasers or LED drivers, controlled over CAN. Between the XIAO and the output terminal sits an interlock built from logic gates: the signals only reach the laser while the keyswitch is on, the hood is closed and the 12 V supply is healthy. The firmware cannot override it.

Current revisionRev. A, 2025-02-24
ControllerSeeed XIAO ESP32-S3
Outputs4 × PWM, 0 / 3.3 V (low = off), plus switched 12 V for the laser
Supply12 V from the bus
FirmwareUC2_canopen_slave_laser, in the web flasher as "Laser satellite"
CAN node20. Channels 0 to 3 are laser ids 0 to 3 on the HAT+ master.
SourcesKiCad project · schematic PDF

Connectors​

Top view with silkscreen

RefTypePin 1 → nUse
J101JST XH 4GND, +12 V, CAN_H, CAN_Lbus
J1076-pin terminalGND, 12 V switched, laser 1, 2, 3, 4to the laser driver, behind the interlock
J1023-pin terminalLED cathode, LED anode / switch, switchkeyswitch and its red LED
J1033-pin terminalGND, signal, 3.3 Vhood endstop. Signal must be high for "safe".
J1042-pin terminalGND, switchmagnet (reed) switch. Closed = safe.
J11019-pin terminalGND, 12 V, signal 1 to 4, D6, D7, D8raw XIAO pins, before the interlock

XIAO pinout​

XIAO pinESP32-S3 GPIOFunction
D01in: low when the interlock has tripped (enable the pull-up). Out: pull low to light the keyswitch LED.
D12signal 1 (laser 0)
D23signal 2 (laser 1)
D34CAN TX
D45signal 3 (laser 2)
D56signal 4 (laser 3)
D643free, on J1101
D744free, on J1101
D87free, on J1101
D98in: low while the interlock is powered (keyswitch on)
D109CAN RX

Interlock​

The interlock is armed by turning the keyswitch on. From then on it watches its sources. If one of them goes unsafe it latches: the signals to the laser are cut and the red LED lights, both the one on the board next to the output terminal and the one at the keyswitch. It stays latched until the keyswitch is turned off and on again.

LEDMeaning
green, at the output terminalinterlock powered, signals pass
red, at the output terminal and at the keyswitchtripped, reset with the keyswitch
green, below the XIAO12 V to the laser is on

Sources​

  • Keyswitch (J102). Single-pole switch whose key can only be removed in the off position. It switches less than 1 mA at 3.3 V and connects pins 2 and 3 when on. The LED goes between pin 2 (anode) and pin 1 (cathode). 200 Ω are on the board, so a red LED runs at about 7 mA.
  • 12 V monitor (internal). If the bus drops below 11.3 V, the 12 V to the laser is switched off and the interlock trips. This is how the board notices an emergency stop: the HAT+ cuts bus power, and the laser is dark before the supply has collapsed.
  • Hood endstop (J103). The signal has to be high. Low or floating trips the interlock. 3.3 V and GND are on the jack, so an optical endstop can be used.
  • Magnet switch (J104). A reed switch in the base and a magnet in the hood. Open contacts trip the interlock.

Overrides​

Not every microscope has all four safety devices. DIP switch SW701 bypasses individual sources. With all four switches off, everything is active.

SW701When ON
1magnet switch J104 ignored
212 V monitor ignored, 12 V to the laser always on
3hood endstop J103 ignored
4whole interlock bypassed, including the keyswitch. Signals always pass. The 12 V monitor still switches the laser supply.

Switch 4 turns the board into a plain PWM output. Do not ship a laser system like that.

Solder jumpers​

JumperWhen closed
JP301120 Ω CAN termination. Close only at a physical end of the bus.
JP302CAN activity LED
JP1101, JP1102, JP11034.7 kΩ pull-up on D6, D7, D8

As a general CAN-to-GPIO board​

J1101 carries the XIAO pins before the interlock, together with unswitched 12 V. Signals 1 to 4 have fixed 4.7 kΩ pull-downs, D6 to D8 get a pull-up when their jumper is closed. For new designs that only need a few GPIOs on the bus, the CAN GPIO board is the smaller choice.

Firmware​

EnvUC2_canopen_slave_laser
Pin mapmain/config/UC2_canopen_slave_laser/PinConfig.h
BusCANopen, 500 kbit/s, node 20, channels on object sub-indices 1 to 4
USBserial JSON over USB-CDC

Flash it as described in Flashing the firmware. A test over USB or through the master:

{"task":"/laser_act","LASERid":1,"LASERval":512}

If nothing comes out, look at the LEDs first. A tripped interlock is the usual reason.


Boards: shop.openuc2.com. Questions: openuc2.discourse.group.