SN087 Wireless Lighting Controller¶
The SN087 is a California Title 24 compliant lighting controller that provides for the remote, wireless control of lighting for both indoor and outdoor commercial applications. Powered by compatible LED drivers, its compact design and flexible deployment options make it ideal for placement in a wide array of fixtures.
The SN087 has a dimming output that can control lighting dimmers using PWM or 0-10V analog voltage. The pins used to control this output as well as the onboard LEDs are:
|Name||SM220 Series Pad||SNAPpy IO||Description|
|LVLA||D1||5||Controls the analog voltage of the output signal|
|PWMA||D3||7||Controls the PWM waveform of the output signal|
|BOOST_EN||C5||23||Enables the 3v3-to-12v output signal boost converter|
|LED_GREEN||F1||0||Controls the on-board green LED|
|LED_RED||F2||9||Controls the on-board red LED|
The SN087 is also able to verify certain voltages at different points on the board using the SM220UF1’s ADC pins. A self-test function is provided in the example script to verify correct voltages. The ADC channels and voltage divider ratios can be used to read these voltages manually as well:
|Voltage Source||ADC Channel||Voltage Divider Ratio||mV per ADC Tick|
|+12v (from boost)||0||211/1871||0.0138551540|
|DIM Output (0-10v)||1||211/1871||0.0138551540|
These voltage measurements can be used to verify hardware and software functionality. See the example script below for a sample “self-test” function.
In order to make getting started with the SN087 as easy as possible, we’ve provided an example script on GitHub that enables a number of useful lighting functions:
- Getting and setting the dim level
- Setting and checking a virtual “Group ID” to control multiple lights at once
- Controlling the on-board LEDs
- Designating a “no communication” timeout to reset the dim level to a default level
- Running a hardware “self-test” that verifies voltages at certain points in the device
Unmodified, the script will set the dim level to 80% on startup, and will return to this default
dim level if the keep-alive timer expires. Calling the
reset_keep_alive() functions will reset the timer. While the keep-alive timer is still active,
the on-board LED will remain green, but once it expires, the LED will turn red. The keep-alive timer
defaults to 15 minutes, but can be changed by modifying the
(measured in seconds). The default dim level can be changed by modifying the
The script also contains the concept of a “group” ID, that allows you to put multiple lights in
a group that can be controlled simultaneously using multicast RPCs. Each light can only belong
to one user-defined group as set by the
set_group() function, but all lights also belong to
the wildcard group (
When the dim level for a light is set, the light will smoothly fade to the set level. The speed
at which the light fades up or down is set by the
DIM_RAMP_SPEED value. Increasing this value
will cause the light to dim more slowly, while decreasing it will cause the light to dim more slowly.
The available callable functions are described below.
Sets the dim level from 0%-100% by providing a
level value between 0 and 100. Without modification,
the script will dim from 0-10V using the LVLA analog voltage control instead of the PWMA pulse-width
Calling this function will reset the keep-alive timer.
Get the dim level from 0%-100% as an integer.
Set the dim level for this light if the
group parameter matches the light’s group. This is handy
for controlling many lights at a time with multicast messages.
group parameter is set to
0xFFFF (the “wildcard” group), this function will change the
dim level of this light, regardless of the light’s group.
Calling this function will reset the keep-alive timer if the
group parameters matches this light’s
group or is the wildcard group (
Set the group that this light belongs to, where
group can be
Helper function to determine if this light belongs to the
group parameter provided. It is used by
True if this light’s group matches the
group parameter, or if the
is set to the wildcard group (
Helper function that turns the red on-board LED off and turns on the green on-board LED. This indicates that the keep-alive timer is still active.
Helper function that turns the green on-board LED off and turns on the red on-board LED. This indicates that the keep-alive timer has expired and the light has returned to the default dim level.
Resets the keep-alive timer. Setting the dim level via
automatically resets the keep-alive timer using this function, but can be manually reset if needed.
A callable function that takes no arguments and returns a string. This function is very similar to
except that it returns a string so that it can be used for data collection.
This function runs a hardware self-test that measures the voltages on the +3v3, +12v, and dim level output. It verifies that each voltage is within 10% of the expected value, and loops through a set number of dim level settings.
True if the self-test passes, and
False otherwise. It will also print the particular error to