Episode 2 - where we talk about Serial communication

A project log for Wendy

Wendy is a UV laser projector for alt photographic process printing

pierre-loup-mPierre-Loup M. 03/06/2019 at 16:060 Comments

The first idea was to use an Arduino to drive the laser. First problem was that serial from computer was faaaar too slow. Imagine sending for each pixel a string like "x17235y25994z210" (x-position, y-position, plus laser intensity), with each char being one byte. Now imagine you use an image that is 1500x2000px ! At 115200 baud, it takes more than an hour. Not only is it very long (imagine waiting an hour when you print a document at office !), but it gave burnt prints, as the images were too much insolated ! And there were the need for other data to be sent as well.

Other solution had to be found. A protocol was designed for the serial communication, with a byte containing flags for the data to be received in each packet, and one or two byte for each value to be sent, so the Arduino knows exactly what to do with bytes received. Only the changing bytes were sent on each packet, which made the communication much faster. A control sum was also added to verify that each packet was correctly received. This took some time to develop, because some bugs were hidden here and there... I've learnt that MSB and LSB can be tricky to domesticate when using two systems that doesn't handle it the same way ! And that bit shifting can be quite hazardous. :)

This serial protocol was of course way faster and reliable (at least 1440 coordinates per second), but then other problems arose...