t. When the battery is first connected, the voltage charges the capacitor C2, then nothing happens until SW1 is closed. Once the SW1 is closed, current goes through R1 to turn on Q2, and the Joule Thief circuit starts working.
In afraction of a second, the voltage at C2 reaches high enough for the microcontroller to start up. Once the microcontroller starts running, it puts PWR signal high, so that the Joule Thief will keep running even after SW1 is open. (Power-on latch) Note that after initial power up, microcontroller watches its own supply voltage via A/D converter and adjusts it slightly below the zener voltage, so to not waste precious power from the battery.
"PWR" connection to the microprocessor does this by turning on/off bias current to Q2. This "PWR" pin has two purpose; one is to control the booster circuit, the other is to read the status of the button switch. (this arrangement saves a precious microcontroller pin. ) The button switch SW1 is more than a power switch, it provides pattern change, animation speed change (double tap to increase the speed, triple tap to decrease the speed).
Microcontroller reads the button state by periodically turning the "PWR" pin into an input pin. This happens roughly every 8 milliseconds (125 times/second). The reading of the button takes about 2 microseconds each. The booster circuit turns off during this 2 microseconds, but it won`t be felt because capacitor C2 supplies the power during that period.
Each of eight LEDs can have its own brightness level. Brightness is specified (in firmware) in 8 bit number 0 - 255. Timer interrupt routine reads the brightness levels and turn on/off each LED accordingly, in sync with the hardware PWM signal. (PWM frequency is 31. 25kHz. Interrupt occurs every 32 microseconds with firmware version 1. 0) Brightness change is very smooth - using the same PWM technique as my Aurora projects. Unlike other PWM implementations, the curve of brightness change is not linear, but exponent (anti-logarithmic).
This is important because our eye`s response to brightness change is more or less logarithmic, therefore LEDs need to change brightness in the opposite fashion. With Wave JT, the hardware PWM output is used as a precision clock to drive the LED bus (common line that connects to all LEDs) and "COLx" pins select which pulse to turn on the LED that`s connected to.