Difference between revisions of "StellaLight"

From Ethersex_Wiki
Jump to: navigation, search
(first version)
 
(table)
Line 55: Line 55:
 
== Pinning ==
 
== Pinning ==
  
STELLA_PORT1_RANGE(PXI,PXJ) sets the range of StellaLight controlled pins on PORTX
+
{| border="1"
STELLA_PORT2_RANGE(PX2I,PX2J) sets the range of StellaLight controlled pins on PORTX2
+
|-
STELLA_USE_TIMER(2) programs Timer2 for StellaLight
+
| STELLA_PORT1_RANGE(PX'''I''',PX'''J''')  
 +
sets the range ('''I''' to '''J''') of StellaLight controlled pins on PORTX
 +
|-
 +
| STELLA_PORT2_RANGE(PX2'''I''',PX2'''J''')  
 +
| sets the range ('''I''' to '''J''') of StellaLight controlled pins on PORTX2
 +
|-
 +
| STELLA_USE_TIMER('''I''')  
 +
| programs Timer'''I''' for StellaLight
 +
|-
 +
|}
  
 
Two examples:
 
Two examples:

Revision as of 01:29, 28 December 2011

StellaLight
Status
Stable
menuconfig Applications->StellaLight: Multichannel pwm
Pinning yes
Ecmd yes
Depends on DMX Storage (optional)
Code https://github.com/ethersex/ethersex/tree/master/services/stella

StellaLight produces PWM signals on up to 16 independent pins for driving LEDs or servo motors.

Internals

Stella uses an 8-bit Timer of your choice for producing the PWM signals. Since the overflow interrupts need to be very consistent, StellaLight will not work flawlessy when other modules are active that disable the interrupts for a short amount of time.

This is a list of module where you can expect some problems with: Onewire, RFM12 (please add more if you find some).

Moreover StellaLight does not support Gamma Correction since that would require at least 10-12 bit PWM.

Configuration

In Menuconfig you can select the prescaler. The higher the frequency, the more often the StellaLight PWM functions will be executed, leading to an higher overall load of the device. So if you run into problems, try decreasing the frequency.

Option Prescaler
Very slow 1024
Slow 256
Normal 128
Fast 64

You can calculate the resulting frequency by using this formula:

F_CPU: The clockspeed of your AVR (like 8Mhz, 16Mhz etc.)

F_STELLA=F_CPU/Prescaler/512

So given a setting of "Normal" on a 16Mhz device will result in 244Hz which is pretty good for most setups. So more than enough for the human eye (10 times more)

If you have enabled DMX Storage in Menuconfig, you also can set the universe and start channel of StellaLight, so you can control StellaLight via Artnet or DMX FXSlot.

Pinning

STELLA_PORT1_RANGE(PXI,PXJ) sets the range (I to J) of StellaLight controlled pins on PORTX
STELLA_PORT2_RANGE(PX2I,PX2J) sets the range (I to J) of StellaLight controlled pins on PORTX2
STELLA_USE_TIMER(I) programs TimerI for StellaLight

Two examples:

1. 3 LEDs (e.g. RGB) on PORTA, Pins: 0,1,2

ifdef(`conf_STELLA', `dnl
  STELLA_PORT1_RANGE(PA0,PA2)
  STELLA_USE_TIMER(2)
')dnl

2. 15 LEDs (e.g. 5x RGB) on PORTA, Pins: 0,1,2,3,4,5,6,7 on PORTD, Pins: 0,1,2,3,4,5,6

ifdef(`conf_STELLA', `dnl
  STELLA_PORT1_RANGE(PA0,PA7)
  STELLA_PORT1_RANGE(PD0,PD6)
  STELLA_USE_TIMER(2)
')dnl

Alternative

Have a look at Starburst for an improved and more resource-conserving solution.