Difference between revisions of "RGB clock"
(66 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
[[File:RGB_clock_complete.jpg|thumb|300px|alt=The fully working clock|The fully working clock]] |
|||
= RGB clock = |
|||
This is the documentation page for the RGB clock kit. |
This is the documentation page for the [http://www.bitwizard.nl/shop/rgb-clock-full-kit RGB clock kit]. |
||
[http://www.bitwizard.nl/shop/kits/rgb-clock Here] you can buy the components of the clock. |
|||
== Overview == |
== Overview == |
||
Line 7: | Line 9: | ||
Driver PCB for up to 64 common-anode RGB LEDs, or 192 normal LEDs.<br> |
Driver PCB for up to 64 common-anode RGB LEDs, or 192 normal LEDs.<br> |
||
The PCB is designed for 1:3 multiplexing of the LEDs, and is equipped with 8 74HC595 shift registers (configured as 4 16-bit deep registers), 64 current-limiting resistors (220 Ohm by default) and 3 FETs to switch the cathode groups on-and-off.<br> |
The PCB is designed for 1:3 multiplexing of the LEDs, and is equipped with 8 74HC595 shift registers (configured as 4 16-bit deep registers), 64 current-limiting resistors (220 Ohm by default) and 3 FETs to switch the cathode groups on-and-off.<br> |
||
The PCB is equipped with a |
The PCB is equipped with a BitWizard-standard 20-pin IO connector, designed to work together with our USB-multio PCB, but it is also possible to connect our FTDI-ATmega, USB-bigmultio or Cyclone dev board, or one of your own boards, like for example an Arduino.<br> |
||
<br> |
<br> |
||
SV1-SV8 are the connectors for the RGB LEDs. SV1-SV8 are connected to IC1-IC8.<br> |
SV1-SV8 are the connectors for the RGB LEDs. SV1-SV8 are connected to IC1-IC8.<br> |
||
Line 21: | Line 23: | ||
It is therefore required to update all shift registers at the same time. |
It is therefore required to update all shift registers at the same time. |
||
== |
== Assembly instructions == |
||
==== LED Driver PCB ==== |
==== LED Driver PCB ==== |
||
Line 47: | Line 49: | ||
D2-D7 LED |
D2-D7 LED |
||
SW1-SW4 Pushbutton |
SW1-SW4 Pushbutton |
||
[[File:RGB_clock_top.jpg|none|thumb|300px|alt=A closeup of the assembled board|A closeup of the assembled board]] |
|||
==== LED chains ==== |
==== LED chains ==== |
||
===== Building your own clock-face ===== |
|||
If you are not buying the laser-cut clock-face that we offer, you'll be building one yourself. A consideration is that at about 20cm radius, the legs of the LEDs are long enough to form the R, G and B common lines. If you make the clock larger, you'll have to run three wires along the leds.... |
|||
The "puzzle" line between the four segments stems from the fact that the laser-cutter that we have access to only goes so big. And it comes in handy for transport. The laser-cutter could handle up to 30cm outer diameter. And it could handle half a clock at once. But the 4-fold symmetry looks nice. |
|||
The laser cutter leaves a bit of brown residue near the laser-cut edges. You can sand this off with a fine sandpaper. |
|||
===== Connecting the LEDs ===== |
|||
Counting clockwise, starting at the LED to the right of the topmost LED: |
Counting clockwise, starting at the LED to the right of the topmost LED: |
||
Output Pin# Connector |
Output Pin# Connector |
||
Line 67: | Line 80: | ||
Qb 2 SV2 |
Qb 2 SV2 |
||
Qa 1 SV2 |
Qa 1 SV2 |
||
All R, G and B pins should be connected in parrallel.<br> |
|||
[[File:RGB_clock_back_complete_edit.jpg|none|thumb|300px|alt=The full clock with a few locations marked]] |
|||
<br> |
|||
[[File:RGB_clock_quadrant.jpg|none|thumb|300px|alt=A fully assembled quadrant|A fully assembled quadrant]] |
|||
All R, G and B pins should be connected in parallel.<br> |
|||
[[File:RGB_LED_closeup.jpg|none|thumb|300px|alt=A closeup of one of the LEDs|A closeup of one of the LEDs]] |
|||
This is the same for each quadrant, only the connector numbers differ. |
This is the same for each quadrant, only the connector numbers differ. |
||
==== Putting it all together ==== |
==== Putting it all together ==== |
||
Version 1.0 uses 12pin headers to connect to the LEDs, but unfortunately, 12-pin ICD connectors don't exist, so we used 14-pin ICD connectors.<br> |
|||
Pay close attention then connecting the 14-pin connectors to the PCB! Pin 1 through 12 should line up, and pin 13 and 14 should be "floating". |
|||
[[File:RGB_clock_connectors.jpg|none|thumb|300px|alt=Everything wired-up|Everything wired-up]] |
|||
As can be seen in this image, the left ICD connectors are a bit further towards the USB connector, and the right ICD connectors are a bit further to the switches. Also, the reset switch isn't mounted. We decided we would never use it, so left it out. Your version will come equipped with a reset switch<br> |
|||
<br> |
|||
After hooking everything up, you should end up with something like this: |
|||
[[File:RGB_clock_back_complete.jpg|none|thumb|300px|alt=The completed clock|The completed clock]] |
|||
== External resources == |
== External resources == |
||
=== Datasheets === |
|||
http://www.fairchildsemi.com/ds/MM/MM74HC595.pdf |
|||
* [http://www.fairchildsemi.com/ds/MM/MM74HC595.pdf 74HC595 datasheet] |
|||
=== Related projects === |
|||
== Pinout == |
== Pinout == |
||
Line 82: | Line 111: | ||
<table border=1> |
<table border=1> |
||
<tr>< |
<tr><th> connector pin number</th><th>pin name</th><th>multiio AVR pin name</th></tr> |
||
<tr><td> |
<tr><td> 1</td><td>GND </td> <td> </td> </tr> |
||
<tr><td> |
<tr><td> 2</td><td>GND </td> <td> </td> </tr> |
||
<tr><td> |
<tr><td> 3</td><td>SER0 </td> <td> PD1 </td> </tr> |
||
<tr><td> |
<tr><td> 4</td><td>SER1 </td> <td> PD2 </td> </tr> |
||
<tr><td> |
<tr><td> 5</td><td>SER2 </td> <td> PD3 </td> </tr> |
||
<tr><td> |
<tr><td> 6</td><td>SER3 </td> <td> PD4 </td> </tr> |
||
<tr><td> |
<tr><td> 7</td><td>!OE </td> <td> PD5 </td> </tr> |
||
<tr><td> |
<tr><td> 8</td><td>LATCH </td> <td> PD6 </td> </tr> |
||
<tr><td> |
<tr><td> 9</td><td>!RESET</td> <td> PB1 </td> </tr> |
||
<tr><td> |
<tr><td>10</td><td>CLOCK </td> <td> PB0 </td> </tr> |
||
<tr><td> |
<tr><td>11</td><td>R </td> <td> PB3 </td> </tr> |
||
<tr><td> |
<tr><td>12</td><td>G </td> <td> PB2 </td> </tr> |
||
<tr><td> |
<tr><td>13</td><td>B </td> <td> PB5 </td> </tr> |
||
<tr><td> |
<tr><td>14</td><td>external clock source</td><td>PB4</td></tr> |
||
<tr><td> |
<tr><td>15</td><td>IO1 </td> <td> PB7 </td> </tr> |
||
<tr><td> |
<tr><td>16</td><td>IO0 </td> <td> PB6 </td> </tr> |
||
<tr><td> |
<tr><td>17</td><td>IO3 </td> <td> PC6 </td> </tr> |
||
<tr><td> |
<tr><td>18</td><td>IO2 </td> <td> PC7 </td> </tr> |
||
<tr><td> |
<tr><td>19</td><td>VCC </td> <td> </td> </tr> |
||
<tr><td>20</td><td>VCC </td> <td> </td> </tr> |
|||
</table> |
</table> |
||
<br> |
<br> |
||
Line 126: | Line 156: | ||
<tr><td> 1</td><td>GND</td></tr> |
<tr><td> 1</td><td>GND</td></tr> |
||
<tr><td> 2</td><td>VCC</td></tr> |
<tr><td> 2</td><td>VCC</td></tr> |
||
<tr><td> 3</td><td>connected to pin14 |
<tr><td> 3</td><td>connected to pin14 of SV10</td></tr> |
||
</table> |
</table> |
||
Pin 3 has two clamping diodes attached, to limit the voltage range to GND-0.6V and VCC+0.6V. |
Pin 3 has two clamping diodes attached, to limit the voltage range to GND-0.6V and VCC+0.6V.<br> |
||
We are considering connecting this pin through a very large valued resistor directly to the mains. In that case the clamping diodes are neccessary. The better option would be to use an optocoupler or something like that.... |
|||
<br> |
<br> |
||
=== LEDs: === |
|||
* D2 is connected to VCC from SV10 |
* D2 is connected to VCC from SV10 |
||
Line 137: | Line 170: | ||
* D6 is connected to pin15 from SV10 |
* D6 is connected to pin15 from SV10 |
||
* D7 is connected to pin16 from SV10 |
* D7 is connected to pin16 from SV10 |
||
<br> |
|||
=== Switches: === |
|||
* Switch1 (next to R71) is connected to pin16 from SV10 |
* Switch1 (next to R71) is connected to pin16 from SV10 |
||
* Switch2 (next to R72) is connected to pin15 from SV10 |
* Switch2 (next to R72) is connected to pin15 from SV10 |
||
Line 148: | Line 183: | ||
Open: LED driver board and microcontroller board have individual power supplies<br> |
Open: LED driver board and microcontroller board have individual power supplies<br> |
||
Closed: VCC from LED driver board and microcontroller board are connected.<br> |
Closed: VCC from LED driver board and microcontroller board are connected.<br> |
||
==== alternative use ==== |
|||
== Programming == |
|||
If the complete device is powered from the microcontroller board, the jumper can be replaced with a toggle switch. This allows you to turn the LEDs on and off, without affecting timekeeping. |
|||
Please refer to http://www.bitwizard.nl/wiki/index.php/Usbio#programming for information on programming the controller PCB. |
|||
== The software == |
== The software == |
||
The software supplied by BitWizard, is designed to run on the BitWizard Multio board, but it should be possible to port it to other boards. |
The software supplied by BitWizard, is designed to run on the BitWizard USB-Multio board, but it should be possible to port it to other boards.<br> |
||
A zipfile containing the latest source code can be downloaded here: http://www.bitwizard.nl/software/rgb_clock/ |
|||
=== Default operation === |
|||
==== Test modes ==== |
|||
As of software version 20120208, there are several (test) modes included. |
|||
These can be accessed in two ways: |
|||
===== Over USB ===== |
|||
All modes are available. |
|||
Usage: |
|||
m [m] |
|||
For example: |
|||
m 3 |
|||
jumps to the LED test mode. |
|||
====== Mode 0 (default)====== |
|||
Default operation.<br> |
|||
PWM routine: Enabled.<br> |
|||
Bitmap generation: Enabled.<br> |
|||
====== Mode 1 ====== |
|||
Allows you to, for example, send your own RGB bitmaps to the clock with the "D", "E", and "F" commands.<br> |
|||
PWM routine: Enabled.<br> |
|||
Bitmap generation: Disabled.<br> |
|||
====== Mode 2 ====== |
|||
Enables you to manually turn colors on and off, and also send your own bitmaps.<br> |
|||
PWM routine: Disabled.<br> |
|||
Bitmap generation: Disabled.<br> |
|||
====== Mode 3 ====== |
|||
Perfect for testing your LEDs and soldering work. This mode automatically generates a test sequence.<br> |
|||
PWM routine: Enabled.<br> |
|||
Bitmap generation: Enabled, but using a test bitmap.<br> |
|||
====== Mode 4 ====== |
|||
Normal clock operation, but with a twist: Instead of only lighting LED x from color y, LED 0 though x are all lighted.<br> |
|||
PWM routine: Enabled.<br> |
|||
Bitmap generation: Enabled.<br> |
|||
===== Using the pushbuttons ===== |
|||
Only [[RGB_clock#Mode_0_.28default.29|mode 0]] and [[RGB_clock#Mode_4|mode 4]] are available. |
|||
Press Swtich 1 to toggle between both modes. |
|||
==== Loading custom bitmaps ==== |
|||
This is only possible is some test modes. |
|||
===== Identical for each quadrant ===== |
|||
Use the "d" command (only works in mode 2): |
|||
d [value] |
|||
The value should be in hex. However, it might be easyer to think binary. Each bit represents an LED.<br> |
|||
For example, to light each even LED: |
|||
d aaaa |
|||
Or for each odd LED: |
|||
d 5555 |
|||
Only one color is active in this mode. To change the active color, use the "r", "g", and "b" commands. |
|||
To turn on the red LEDs, and turn off the green and blue LEDs: |
|||
r |
|||
The same goes for the "g" and "b" commands, only the colors differ.<br> |
|||
<br> |
|||
If you send the data quick enough (for example, with a script), it should be possible to generate some nice effects. |
|||
===== Complete RGB bitmap ===== |
|||
Use the "D", "E", and "F" commands (only works in mode 1):<br> |
|||
This is a little bit more complicated than the previous option, but gives you a lot more possibilities.<br> |
|||
The "D" command controls the red LEDs.<br> |
|||
The "E" command controls the green LEDs.<br> |
|||
The "F" command controls the blue LEDs.<br> |
|||
To turn all red LEDs on, and all green and blue LEDs off: |
|||
D ff ff ff ff ff ff ff ff |
|||
E 00 00 00 00 00 00 00 00 |
|||
F 00 00 00 00 00 00 00 00 |
|||
Each nibble represents one LED in each quadrant. Let's call the quadrants 1, 2, 4, and 8. Quadrant 1 is the bottom right, quadrant 2 top right, quadrant 4 top left, and quadrant 8 bottom left.<br> |
|||
We only have 15 LEDs, so one of the 16 nibbles is not used: |
|||
D ff ff ff ff xf ff ff ff |
|||
^ |
|||
Nibble x (also marked with a ^) is not in use.<br> |
|||
<br> |
|||
Table of which nibble represents which LED: |
|||
D ff|ff ff ff ff ff ff ff |
|||
x | | | | | | | LED 0 |
|||
x| | | | | | | LED 1 |
|||
|x | | | | | | LED 2 |
|||
| x| | | | | | LED 3 |
|||
| |x | | | | | LED 4 |
|||
| | x| | | | | LED 5 |
|||
| | |x | | | | LED 6 |
|||
| | | x| | | | LED 7 |
|||
| | | | x| | | LED 8 |
|||
| | | | |x | | LED 9 |
|||
| | | | | x| | LED 10 |
|||
| | | | | |x | LED 11 |
|||
| | | | | | x| LED 12 |
|||
| | | | | | |x LED 13 |
|||
| | | | | | | x LED 14 |
|||
So, for example:<br> |
|||
To light the first 5 red LEDs in quadrant 2: |
|||
D 22 22 02 00 00 00 00 00 |
|||
To light the first 5 red LEDs in quadrant 2 and 4: |
|||
D 66 66 06 00 00 00 00 00 |
|||
To light the first 5 red LEDs in quadrant 2, and the last 5 red LEDs in quadrant 4: |
|||
D 22 22 02 00 00 04 44 44 |
|||
The syntax is identical for green and blue, but you should use the "E" and "F" command instead of the "D" command. |
|||
==== Setting the time ==== |
|||
===== Over USB ===== |
|||
It is possible to set the time over a USB-serial port, using the "T" command.<br> |
|||
Usage: |
|||
T [hh] [mm] [ss] |
|||
With hh, mm, and ss in hexadecimal. For example: |
|||
T 10 2F D |
|||
sets the time to 16:47:13 .<br> |
|||
<br> |
|||
At BitWizard, we use the following script (we called it tsync) to set the time: |
|||
#!/bin/sh |
|||
h=`(echo obase=16 ;date +"%H" )| bc` |
|||
m=`(echo obase=16 ;date +"%M" )| bc` |
|||
s=`(echo obase=16 ;date +"%S" )| bc` |
|||
echo T $h $m $s |
|||
Forward the output of this script to the clock, to set the time: |
|||
./tsync > /dev/ttyACM0 |
|||
===== Using the pushbuttons ===== |
|||
Switch 2: Push to jump one hour forward<br> |
|||
Switch 3: Push to jump 1 minute forward<br> |
|||
Switch 4: Push to reset the seconds to 0<br> |
|||
==== Reading back the time ==== |
|||
The "t" command outputs the current time on the clock over the serial interface: |
|||
CDC usbio/usbmultiio Wed Jan 11 18:28:22 CET 2012 |
|||
> t 11:2F:03.02E0 |
|||
> |
|||
The time is printed in hex, in hh:mm:ss.milliseconds |
|||
==== Adjusting the white-balance ==== |
|||
===== Over USB ===== |
|||
Setting the white-balance can be done with the "B" command.<br> |
|||
Usage: |
|||
B [rValue] [gValue] [bValue] |
|||
Values are in hex. Example (this is the default setting): |
|||
B 7800 7E00 0000 |
|||
This means the red LED is on from 0x0000 until 0x7800, green is on from 0x7800 until 0x7E00, and blue is on from 0x7E00 until 0x0000.<br> |
|||
This counter counts from 0x0000 to 0xBB80. |
|||
Because the interrupt routine takes some time too, there is a minimum interval between two interrupts. This minimum was measured to be between 0x600 and 0x700. I recommend you do not set the interval between two interrupts shorter than about 0x800.<br> |
|||
===== Using the pushbuttons ===== |
|||
Not yet implemented. |
|||
==== Jump to bootloader ==== |
|||
If you want to flash the controller, you need to switch to the bootloader. You can do this by pressing the pushbutton of the multio, of if you're lazy (or if the clock is hanging on a wall on the other side of the room) you can do it by issuing the "z" command. |
|||
== Technical Specifications: == |
|||
Power usage: Approximately 30mA with default firmware. |
|||
== Future hardware enhancements == |
== Future hardware enhancements == |
||
Line 159: | Line 376: | ||
* Replace 2 12-pin connectors by 1 20-pin connector |
* Replace 2 12-pin connectors by 1 20-pin connector |
||
* Add numbers to the pushbutton switches |
* Add numbers to the pushbutton switches |
||
== Future software enhancements == |
|||
== Changelog == |
== Changelog == |
||
1.0 |
=== 1.0 === |
||
* Initial public release |
* Initial public release |
Latest revision as of 11:03, 2 December 2015
This is the documentation page for the RGB clock kit.
Here you can buy the components of the clock.
Overview
Driver PCB for up to 64 common-anode RGB LEDs, or 192 normal LEDs.
The PCB is designed for 1:3 multiplexing of the LEDs, and is equipped with 8 74HC595 shift registers (configured as 4 16-bit deep registers), 64 current-limiting resistors (220 Ohm by default) and 3 FETs to switch the cathode groups on-and-off.
The PCB is equipped with a BitWizard-standard 20-pin IO connector, designed to work together with our USB-multio PCB, but it is also possible to connect our FTDI-ATmega, USB-bigmultio or Cyclone dev board, or one of your own boards, like for example an Arduino.
SV1-SV8 are the connectors for the RGB LEDs. SV1-SV8 are connected to IC1-IC8.
IC1 and IC5 are configured as one 16-bit deep shift register. Qa-Qh are connected to IC1, and Qi-Qp are connected to IC5.
IC2 and IC6 are configured as one 16-bit deep shift register. Qa-Qh are connected to IC2, and Qi-Qp are connected to IC6.
IC3 and IC7 are configured as one 16-bit deep shift register. Qa-Qh are connected to IC3, and Qi-Qp are connected to IC7.
IC4 and IC8 are configured as one 16-bit deep shift register. Qa-Qh are connected to IC4, and Qi-Qp are connected to IC8.
The control pins (!OE, LATCH, !RESET, CLK) of all shift registers are connected in parallel.
SER0 is connected to IC1.
SER1 is connected to IC2.
SER2 is connected to IC3.
SER3 is connected to IC4.
It is therefore required to update all shift registers at the same time.
Assembly instructions
LED Driver PCB
- First, decide if you want to use 4 pushbutton switches (for the default firmware), 4 LEDs, or a mix (for custom firmware).
- SW1 and R65 or D7 and R71
- SW2 and R66 or D6 and R72
- SW3 and R67 or D5 and R73
- SW4 and R68 or D4 and R74
- Mount all necessary SMD components. Which component should go where, can be found in the table below.
- cut the header strips to the right length. Our suggestion:
- cut the first strip in one 10-pin long strip, and 5 6-pin long strips.
- cut the second header in 3 6-pin strips, and one 4-pin strip.
- solder all headers in place
- solder the desired switches in place
Component Value IC1-IC8 74HC595 R1-R64 220R R65-R68 10K R69-R74 1K C1-C8 100nF C9 10uF T1-T3 N-channel FET D1 Double Diode (BAT54S for example) D2-D7 LED SW1-SW4 Pushbutton
LED chains
Building your own clock-face
If you are not buying the laser-cut clock-face that we offer, you'll be building one yourself. A consideration is that at about 20cm radius, the legs of the LEDs are long enough to form the R, G and B common lines. If you make the clock larger, you'll have to run three wires along the leds....
The "puzzle" line between the four segments stems from the fact that the laser-cutter that we have access to only goes so big. And it comes in handy for transport. The laser-cutter could handle up to 30cm outer diameter. And it could handle half a clock at once. But the 4-fold symmetry looks nice.
The laser cutter leaves a bit of brown residue near the laser-cut edges. You can sand this off with a fine sandpaper.
Connecting the LEDs
Counting clockwise, starting at the LED to the right of the topmost LED:
Output Pin# Connector Qp 8 SV6 Qo 7 SV6 Qn 6 SV6 Qm 5 SV6 Ql 4 SV6 Qk 3 SV6 Qj 2 SV6 Qi 1 SV6 Qg 7 SV2 Qf 6 SV2 Qe 5 SV2 Qd 4 SV2 Qc 3 SV2 Qb 2 SV2 Qa 1 SV2
All R, G and B pins should be connected in parallel.
This is the same for each quadrant, only the connector numbers differ.
Putting it all together
Version 1.0 uses 12pin headers to connect to the LEDs, but unfortunately, 12-pin ICD connectors don't exist, so we used 14-pin ICD connectors.
Pay close attention then connecting the 14-pin connectors to the PCB! Pin 1 through 12 should line up, and pin 13 and 14 should be "floating".
As can be seen in this image, the left ICD connectors are a bit further towards the USB connector, and the right ICD connectors are a bit further to the switches. Also, the reset switch isn't mounted. We decided we would never use it, so left it out. Your version will come equipped with a reset switch
After hooking everything up, you should end up with something like this:
External resources
Datasheets
Related projects
Pinout
SV10 is connected as follows
connector pin number | pin name | multiio AVR pin name |
---|---|---|
1 | GND | |
2 | GND | |
3 | SER0 | PD1 |
4 | SER1 | PD2 |
5 | SER2 | PD3 |
6 | SER3 | PD4 |
7 | !OE | PD5 |
8 | LATCH | PD6 |
9 | !RESET | PB1 |
10 | CLOCK | PB0 |
11 | R | PB3 |
12 | G | PB2 |
13 | B | PB5 |
14 | external clock source | PB4 |
15 | IO1 | PB7 |
16 | IO0 | PB6 |
17 | IO3 | PC6 |
18 | IO2 | PC7 |
19 | VCC | |
20 | VCC |
SV1 through SV8 are connected as follows:
1 | A0 |
2 | A1 |
3 | A2 |
4 | A3 |
5 | A4 |
6 | A5 |
7 | A6 |
8 | A7 |
9 | R |
10 | G |
11 | B |
12 | GND |
SV9 can be used to connect an external clock source, or a servo motor, or...
1 | GND |
2 | VCC |
3 | connected to pin14 of SV10 |
Pin 3 has two clamping diodes attached, to limit the voltage range to GND-0.6V and VCC+0.6V.
We are considering connecting this pin through a very large valued resistor directly to the mains. In that case the clamping diodes are neccessary. The better option would be to use an optocoupler or something like that....
LEDs:
- D2 is connected to VCC from SV10
- D3 is connected to USB power
- D4 is connected to pin17 from SV10
- D5 is connected to pin18 from SV10
- D6 is connected to pin15 from SV10
- D7 is connected to pin16 from SV10
Switches:
- Switch1 (next to R71) is connected to pin16 from SV10
- Switch2 (next to R72) is connected to pin15 from SV10
- Switch3 (next to R73) is connected to pin18 from SV10
- Switch4 (next to R74) is connected to pin17 from SV10
Jumper settings
JP1: Power supply selection.
Open: LED driver board and microcontroller board have individual power supplies
Closed: VCC from LED driver board and microcontroller board are connected.
Programming
Please refer to http://www.bitwizard.nl/wiki/index.php/Usbio#programming for information on programming the controller PCB.
The software
The software supplied by BitWizard, is designed to run on the BitWizard USB-Multio board, but it should be possible to port it to other boards.
A zipfile containing the latest source code can be downloaded here: http://www.bitwizard.nl/software/rgb_clock/
Default operation
Test modes
As of software version 20120208, there are several (test) modes included.
These can be accessed in two ways:
Over USB
All modes are available.
Usage:
m [m]
For example:
m 3
jumps to the LED test mode.
Mode 0 (default)
Default operation.
PWM routine: Enabled.
Bitmap generation: Enabled.
Mode 1
Allows you to, for example, send your own RGB bitmaps to the clock with the "D", "E", and "F" commands.
PWM routine: Enabled.
Bitmap generation: Disabled.
Mode 2
Enables you to manually turn colors on and off, and also send your own bitmaps.
PWM routine: Disabled.
Bitmap generation: Disabled.
Mode 3
Perfect for testing your LEDs and soldering work. This mode automatically generates a test sequence.
PWM routine: Enabled.
Bitmap generation: Enabled, but using a test bitmap.
Mode 4
Normal clock operation, but with a twist: Instead of only lighting LED x from color y, LED 0 though x are all lighted.
PWM routine: Enabled.
Bitmap generation: Enabled.
Using the pushbuttons
Only mode 0 and mode 4 are available.
Press Swtich 1 to toggle between both modes.
Loading custom bitmaps
This is only possible is some test modes.
Identical for each quadrant
Use the "d" command (only works in mode 2):
d [value]
The value should be in hex. However, it might be easyer to think binary. Each bit represents an LED.
For example, to light each even LED:
d aaaa
Or for each odd LED:
d 5555
Only one color is active in this mode. To change the active color, use the "r", "g", and "b" commands. To turn on the red LEDs, and turn off the green and blue LEDs:
r
The same goes for the "g" and "b" commands, only the colors differ.
If you send the data quick enough (for example, with a script), it should be possible to generate some nice effects.
Complete RGB bitmap
Use the "D", "E", and "F" commands (only works in mode 1):
This is a little bit more complicated than the previous option, but gives you a lot more possibilities.
The "D" command controls the red LEDs.
The "E" command controls the green LEDs.
The "F" command controls the blue LEDs.
To turn all red LEDs on, and all green and blue LEDs off:
D ff ff ff ff ff ff ff ff E 00 00 00 00 00 00 00 00 F 00 00 00 00 00 00 00 00
Each nibble represents one LED in each quadrant. Let's call the quadrants 1, 2, 4, and 8. Quadrant 1 is the bottom right, quadrant 2 top right, quadrant 4 top left, and quadrant 8 bottom left.
We only have 15 LEDs, so one of the 16 nibbles is not used:
D ff ff ff ff xf ff ff ff ^
Nibble x (also marked with a ^) is not in use.
Table of which nibble represents which LED:
D ff|ff ff ff ff ff ff ff x | | | | | | | LED 0 x| | | | | | | LED 1 |x | | | | | | LED 2 | x| | | | | | LED 3 | |x | | | | | LED 4 | | x| | | | | LED 5 | | |x | | | | LED 6 | | | x| | | | LED 7 | | | | x| | | LED 8 | | | | |x | | LED 9 | | | | | x| | LED 10 | | | | | |x | LED 11 | | | | | | x| LED 12 | | | | | | |x LED 13 | | | | | | | x LED 14
So, for example:
To light the first 5 red LEDs in quadrant 2:
D 22 22 02 00 00 00 00 00
To light the first 5 red LEDs in quadrant 2 and 4:
D 66 66 06 00 00 00 00 00
To light the first 5 red LEDs in quadrant 2, and the last 5 red LEDs in quadrant 4:
D 22 22 02 00 00 04 44 44
The syntax is identical for green and blue, but you should use the "E" and "F" command instead of the "D" command.
Setting the time
Over USB
It is possible to set the time over a USB-serial port, using the "T" command.
Usage:
T [hh] [mm] [ss]
With hh, mm, and ss in hexadecimal. For example:
T 10 2F D
sets the time to 16:47:13 .
At BitWizard, we use the following script (we called it tsync) to set the time:
#!/bin/sh h=`(echo obase=16 ;date +"%H" )| bc` m=`(echo obase=16 ;date +"%M" )| bc` s=`(echo obase=16 ;date +"%S" )| bc` echo T $h $m $s
Forward the output of this script to the clock, to set the time:
./tsync > /dev/ttyACM0
Using the pushbuttons
Switch 2: Push to jump one hour forward
Switch 3: Push to jump 1 minute forward
Switch 4: Push to reset the seconds to 0
Reading back the time
The "t" command outputs the current time on the clock over the serial interface:
CDC usbio/usbmultiio Wed Jan 11 18:28:22 CET 2012 > t 11:2F:03.02E0 >
The time is printed in hex, in hh:mm:ss.milliseconds
Adjusting the white-balance
Over USB
Setting the white-balance can be done with the "B" command.
Usage:
B [rValue] [gValue] [bValue]
Values are in hex. Example (this is the default setting):
B 7800 7E00 0000
This means the red LED is on from 0x0000 until 0x7800, green is on from 0x7800 until 0x7E00, and blue is on from 0x7E00 until 0x0000.
This counter counts from 0x0000 to 0xBB80.
Because the interrupt routine takes some time too, there is a minimum interval between two interrupts. This minimum was measured to be between 0x600 and 0x700. I recommend you do not set the interval between two interrupts shorter than about 0x800.
Using the pushbuttons
Not yet implemented.
Jump to bootloader
If you want to flash the controller, you need to switch to the bootloader. You can do this by pressing the pushbutton of the multio, of if you're lazy (or if the clock is hanging on a wall on the other side of the room) you can do it by issuing the "z" command.
Technical Specifications:
Power usage: Approximately 30mA with default firmware.
Future hardware enhancements
- Replace 2 12-pin connectors by 1 20-pin connector
- Add numbers to the pushbutton switches
Future software enhancements
Changelog
1.0
- Initial public release