Microcontroller
Hardware
The microcontroller is the heart of this machine. However, its tasks are simple, so I could use a very cheap and rather slow one. This is what it has to do:
- listen for new data bytes (channel change requests) arriving on the FT245 USB receiver chip and update an internal table (one byte for each channel)
- catch interrupts from the phase zero crossing circuit and reset an internal timer when it happens
- send out signals to the triac output stages when the time for a channel has come to do so
This board is based on a SX48/52 chip from Scenix which needs some external voodoo to get programmed. But we did most work for you already with our programming toolkit.
The microcode I wrote is of course also available.
Protocol
The USB protocol is very simple. It consists of two bytes, one for the channel
and one for the value to be set.
For more robustness, the most significant bit of the channel byte must be set
and the most significant bit of the the value byte must not be set.
This limitates the maximum number of dimm steps and lamps to 128 each but makes
it very easy to avoid off-by-one-errors that would normally cause the whole system
to behave rather unpredictable.