Hacking a Laser
The Synrad Firestar i401 is a 400 watt CO2 laser commonly used for marking, cutting, and engraving. It's a seriously powerful laser which can vaporize a chicken wing in a matter of seconds.
Laser power can be controlled with a 0-10V DC signal through a 15-pin D-sub connector which provides a few other basic controls. There is also a static IP Ethernet interface, but unfortunately it is limited in its capabilities. By visiting http://192.168.50.50 and http://192.168.50.50/service.html an experienced operator can access status info, warning and error messages, and historical data in a web browser. Unfortunately these pages aren’t useful for a typical user, and Synrad doesn't offer an easy way to pull data off of these pages.
But the data is there, so there has to be a way to access it, right? Diving into the source code for the two status pages seemed like a dead end. These pages just set up the layout and define some <div> blocks, but then I noticed ambiguous javascript calls at the bottom of the two pages: /js/main_noimage.js and /js/service.js. After setting up a bunch of pointers to the established <div> tags, each script respectively calls /cmd/getalldata and /cmd/getservicedata which return comma-separated lists which are then parsed and used to update the web interface. Naively, I thought I'd just point my browser toward http:/192.168.50.50/cmd/getalldata, but that gave me a 404 error. I felt stuck and out of ideas.
Playing around in LabVIEW (my primary dev environment), I found that sending an HTTP Post request to http:/192.168.50.50/cmd/getalldata returned the string of comma-separated numbers in the body of the response! The final step was to read through the javascript files line by line to extract the meaning of each value. Fortunately, Synrad's developers well documented their code making this task much easier. Now I can parse all of this laser status data myself and display only relevant data to my users in a consistent UI.
For anyone else working with this laser, I've posted the list of variable descriptions on Github. It was a fun challenge to extract this data and it was a great learning experience.