Skip to content

Protocol Spec

This document outlines the control and data collection protocol used to send and receive data from the laser microcontroller.

Format of this document

Most packets are represented using [name:type] syntax.

Some types are as follows:

  • u{n}: an unsigned {n} bit integer in little endian format. (ex. u8)
  • i{n}: a signed {n} bit integer in little endian format. (ex. i8)
  • [{len}]{type}: an array of {type} with length {len} (ex. [10]u8)

General Message Format

[type:u8][subtype:u8][len:u32][content]

Data commands (type=0)

DATA_UPTIME (type=0,subtype=0)

A regular status heartbeat (sent every ~0.5s)

[uptime:u32][lasterror:u16]

DATA_LOG (type=0,subtype=1)

Some logging information from the firmware.

[level:u8][...message:bytes]

DATA_SENSOR (type=0,subtype=2)

Sensor data

[id:u8][value:f32]

COMMAND commands (type=½)

GET_INFO (type=1,subtype=0)

Gets the current status from the Arduino. (No arguments)

RET_INFO (type=2,subtype=0)

Sends the status back to the computer.

[uuid:[36]u8]         // As a fixed length string
[version:u16]
[build_date:[11]u8]   // In the format: Mmm dd yyyy
[build_time:[8]u8]    // In the format: hh:mm:ss

LASER_POWER (type=1,subtype=2)

Sets a pin high or low

[pin:u8]
[out:u8]    // 1 for high 0 for low

RET_LASER_POWER (type=1,subtype=2)

no data