Difference between revisions of "StellaLight"

From Ethersex_Wiki
Jump to: navigation, search
(table)
(timer)
 
(6 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
|STATUS={{stable}}
 
|STATUS={{stable}}
 
|PINNING=yes
 
|PINNING=yes
|ECMD=yes
+
|ECMD={{has_ecmd}}
|DEPENDS=[[DMX Storage]] (optional)
+
|DEPENDS=[[DMX Storage]] (optional), udpStella (optional)
 
|REQUIRES=
 
|REQUIRES=
 +
|TIMER={{occupies_timer|2}}
 
|CODE=[https://github.com/ethersex/ethersex/tree/master/services/stella https://github.com/ethersex/ethersex/tree/master/services/stella]
 
|CODE=[https://github.com/ethersex/ethersex/tree/master/services/stella https://github.com/ethersex/ethersex/tree/master/services/stella]
 
}}
 
}}
Line 23: Line 24:
 
== Configuration ==
 
== 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.'''
+
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, ergo increase the prescaler.'''  
  
 
{| border="1"
 
{| border="1"
Line 71: Line 72:
  
 
'''1. 3 LEDs (e.g. RGB) on PORTA, Pins: 0,1,2'''
 
'''1. 3 LEDs (e.g. RGB) on PORTA, Pins: 0,1,2'''
<source>
+
<source lang="c">
 
ifdef(`conf_STELLA', `dnl
 
ifdef(`conf_STELLA', `dnl
 
   STELLA_PORT1_RANGE(PA0,PA2)
 
   STELLA_PORT1_RANGE(PA0,PA2)
Line 79: Line 80:
  
 
'''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'''
 
'''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'''
<source>
+
<source lang="c" >
 
ifdef(`conf_STELLA', `dnl
 
ifdef(`conf_STELLA', `dnl
 
   STELLA_PORT1_RANGE(PA0,PA7)
 
   STELLA_PORT1_RANGE(PA0,PA7)
   STELLA_PORT1_RANGE(PD0,PD6)
+
   STELLA_PORT2_RANGE(PD0,PD6)
 
   STELLA_USE_TIMER(2)
 
   STELLA_USE_TIMER(2)
 
')dnl
 
')dnl
 
</source>
 
</source>
 +
 +
== udp control ==
 +
We recommend to use the [[DMX Storage]]. But for easy set ups it is possible to use a simple udp protocol to control stella channels.
 +
Activate protocols->udpStella and configure the port.
 +
A datagram for stella has three bytes:
 +
 +
{| border="1"
 +
! Byte #
 +
! Semantic
 +
! Valid values
 +
|-
 +
| 1
 +
| Command Byte
 +
|
 +
  STELLA_SET_IMMEDIATELY=0,
 +
  STELLA_SET_FADE=1,
 +
  STELLA_SET_FLASHY=2,
 +
  STELLA_SET_IMMEDIATELY_RELATIVE=3,
 +
  STELLA_SET_FADESTEP=4,
 +
  STELLA_GETALL = 255
 +
|-
 +
| 2
 +
| Channel
 +
| 0-15
 +
|-
 +
| 3
 +
| Value
 +
| 0-255
 +
|-
 +
|}
 +
 +
You will get back an UDP datagram if you send the STELLA_GETALL command. It consists of an identifier ["STELLA"]+[Amount of channels]+[channel#1]+..+[channel#n]
  
 
== Alternative ==
 
== Alternative ==
  
 
Have a look at [[Starburst]] for an improved and more resource-conserving solution.
 
Have a look at [[Starburst]] for an improved and more resource-conserving solution.
 +
 +
[[Category:e6la]]

Latest revision as of 21:21, 2 April 2013

StellaLight
Status
Stable
menuconfig Applications->StellaLight: Multichannel pwm
Pinning yes
Ecmd yes
Uses Timer Timer 2
Depends on DMX Storage (optional), udpStella (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, ergo increase the prescaler.

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_PORT2_RANGE(PD0,PD6)
  STELLA_USE_TIMER(2)
')dnl

udp control

We recommend to use the DMX Storage. But for easy set ups it is possible to use a simple udp protocol to control stella channels. Activate protocols->udpStella and configure the port. A datagram for stella has three bytes:

Byte # Semantic Valid values
1 Command Byte
 STELLA_SET_IMMEDIATELY=0,
 STELLA_SET_FADE=1,
 STELLA_SET_FLASHY=2,
 STELLA_SET_IMMEDIATELY_RELATIVE=3,
 STELLA_SET_FADESTEP=4,
 STELLA_GETALL = 255
2 Channel 0-15
3 Value 0-255

You will get back an UDP datagram if you send the STELLA_GETALL command. It consists of an identifier ["STELLA"]+[Amount of channels]+[channel#1]+..+[channel#n]

Alternative

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