Whiteboard Clock

by Maurice Bos

Video: https://www.youtube.com/watch?v=4QgeQAiSmM8

clock.jpg

It's a device operating a whiteboard marker to write the current time on a whiteboard. Every X minutes (currently 5), it erases what was previously written, and writes the current time. (See the video.)

It uses two servos to operate the arms holding the pen, and another servo to lift the structure with the two servos and the pen up and down.

IMG_20150130_230002.jpg

The plastic parts (red and yellow) are 3d-printed. The base attaches to the whiteboard using four magnets. (But I had to add some tape, as it wasn't strong enough to keep itself in place properly.)

The 3D models were made with OpenSCAD. The source can be found here: https://gist.github.com/m-ou-se/7bcdf9b35117730cf043

IMG_20150130_210824.jpg

It is controlled by a PIC16F1454 microcontroller, connected to a generic 433MHz receiver to get updates from my computer. The device has USB connector, but only for power.

IMG_20150201_204703.jpg

Attached to my computer with USB is another PIC16F1454, with a 433MHz transmitter. It can broadcast small packets with ASCII text using a simple custom protocol. The USB device behaves as an abstract modem, which simply broadcasts every line of text sent to it. The time is sent in plain text, so "echo 12:34 > /dev/whiteboard" makes the clock write "12:34".

My computer simply runs a cronjob:

*/5 * * * * date +\%H:\%M >/dev/whiteboard

IMG_20150202_145901.jpg

The protocol works as follows:

All bits are encoded as a pulse with a certain length:

To indicate the start of a message, 31 1-bits followed by 1 0-bit are sent. The receiver will trigger after 12 or more 1-bits followed by a 0 bit. After this preamble, several bytes follow in little endian:

All messages are sent multiple times, so if a message is received with some error (which is detected with the checksum), it is simply discarded and we hope we have better luck next time. The message index is incremented every time the transmitter transmits a new message. The receiver uses this byte to detect whether a message is just one of the retransmissions of a previously received message, or if it is a new one.

The font is specified by a simple file in X Y coordinates, like this: https://gist.github.com/m-ou-se/d4895b7a8ffc49398ff5

This font is processed by a C++ program, which will convert the coordinates to servo positions, after interpolating. (Here’s the function that does the coordinate transformation: https://gist.github.com/m-ou-se/b9d215db145cfe018021.) This program generates a C file with the servo positions for each point of all paths, which will be compiled into the C program for the PIC microcontroller. The font has to be rendered separately for each position it will be drawn at. To save space, only '0', '1', and '2' are rendered for the first position, all numbers for the second, only the ':' for the third, etc. The PIC microcontroller will linearly interpolate the servo positions from this rendered font to limit the servo speeds to a fixed maximum.

plot.pngplot.pngplot.png