Optical data-transmission

In the post about the neon watch I mentioned the neon watch gets set to the correct time by a computer program that flashes the screen to send the time. Since that post I have modified my ‘lichtwekker’ (Light-up alarm clock / lineair clock) so that too can be used to set the neon watch. In this post I show how the time is sent to the neon watch. (Ook in het Nederlands beschikbaar).

To start with: how the watch is set to the computer’s clock.

A short video showing how the watch is set can be found in the first blogpost about the neonwatch or on youtube.

The computer program is written in Python. The source can be found in this git gist. It can be run using a python environment of your choosing, I used Thony. Feel free to leave a comment if anything can be coded better/pythonicer or otherwise more elegantly. Patches welcome, so to say.

The program sends the current hour, minute and second, followed by a CRC-8 checksum. A byte is used for each of these numbers.

I assume the computer screen refreshes at most at 60 Hz, then round to 20 ms as ‘Screen refresh period time’ (that would be 50 Hz). Each bit that is sent consists of a period where the screen is bright and a period where the screen is dark. Each of these periods I keep at least 2 ‘screen refresh period time’ units long.

Also, I’d like each bit to take the same amount of time to transmit, regardless of it being a 1 or a 0. That way the transmission time is known beforehand and can be compensated for.

A 1 is 40 ms “dark” followed by 80 ms “light”.

A 0 is 80 ms “dark” followed by 40 ms “light”.

A bit therefore takes 120 ms in total. So the total transmission time of the 4 bytes for hour, minute, second and CRC is 3,84 s (32 bits total at 120 ms per bit).

So to compensate for transmission time, the time that is being sent to the watch is increased by 4 seconds.

A long period of ‘light’ is used to reset the watch to the first (zeroth) bit.

The lichtwekker uses the same method to transmit the current time to the watch.

When the top button of this linear clock is held for over 3 seconds, one of the top LED’s starts glowing blue. This LED stays on (blue) for 5 seconds, so there is time to position the watch in front of it and also to cause the watch to start at bit 0 / to set it to the start of the transmission.

Then, the LED blinks in white to transmit the current time. During that transmission the WS2811 (or -12?) strip is not dimmed, to prevent PWM dimming from interfering with data transmission. After the transmission dim level is restored. The linear clock also compensates for the 4 second transmission time takes.

The modified software for the lichtwekker lineair clock can be found in the ‘watchsync’ branch of the lichtwekker project on github.

The Dutch version of this blogpost has a pun here about data-transfer and time-and-date-transfer that does not really translate (and wasn’t that phuny in the original language either): Because the watch only shows time and not date, this data-transfer is only a time-transfer and not a datum-transfer.



, , , ,




Leave a Reply

Your email address will not be published. Required fields are marked *