My intention is to replace the Noisebridge light switches with a computer controlled, triac, dimmable, and easily hackable system.
General system requirements
- Damage the existing light switch panel as little as possible
- 6 12 to 16 amp outputs
- Touch screen UI at the front door
- Easy-to-access override switches for each circuit (force on and force off)
- A programmatic CGI/XML interface
- A HTML interface
- Fully insulated, fused, and generally not-going-to-fall-apart-and-hurt-someone construction.
I want to split parts of the system that handles the AC switching from the computer and network interface stuff. We'll call the two parts the Computer Control System (CCS) and the Alternating Current Dimming System ACDS.
AC Dimming System
The ACDS will have four dimmable AC outlets and an analog input (using an RCA connector) for each one. The input voltage can vary from zero to five volts. Less than 0.8 volts turns a light completely off and more than 3.4 volts turns a light switch completely on. A voltage in between 0.8 and 3.4 volts runs the light at partial power. The inputs are filtered such that a digital device can use PWM from a TTL chip instead of a true analog output.
The ADCS unit will be inside a 10"x8"x4" NEMA enclosure. It will have a master switch and circuit breaker as well as a circuit breaker for each output. Each output will also have an externally accessible override switch that can force it on or off. The power input and outputs will be standard NEMA-15 sockets and plugs to enable easy bench testing and burn in.
I'll connect the ACDS to the light switch panel by replacing that panel with a single power outlet and four IEC power inlets. (Think the plug on the back of a computer.) For computer power cables will connect the ACDS to the lights. In the event of a catastrophic failure of the system, the power cable for a light can be manually connected to the power outlet.
Analog Theory of Operation
The high current switching element in an AC dimmer is an optically coupled triac. These are commonly known as SSRs (Solid State Relays) SSRs will turn on when a voltage is applied across the control pins. Once an SSR is turned on, it will not turn off until no current flows through it.
AC dimmer circuits exploit this fact by turning the SSR on in phase with the AC waveform. For example, to run a light at 25% intensity, you'd use a control voltage of 1.6 volts. The comparator would not turn the triac on until 75% of each sine wave. The comparator would automatically turn the SSR off at the end of the wave because the integrator would reset back to 4 volts. A voltage above 4.0 volts or below 0.8 volts hold the output always on or always off.
See Lightintg Analog Details for the full description of the analog circuitry.
The low pass filter on the input means that the lights can be controlled with a PWM circuit instead of an analog voltage. A PWM circuit controlling the lights should have a base freequency of between 2,000hz and 20,000hz for the best results. In the example above, you'd use a PWM circuit set at 36% duty cycle. The input impedence is about 5K ohms.
Computer Control System
The CCS is basically a computer with a DAC (digital to analog converter) circuit attached. The computer has a digital I/O board based around an 82c55 that will connect to a TLC7226IN four channel DAC. The outputs of the DAC are buffered and connect to the inputs of the ADCS unit. My intention is to use a Transmetta-based PC-104 board with a solid state disk and a 82c55 daughter card.
The CCS has three interfaces: A web page, a touch screen LCD panel, and a CGI/xml interface.
Status: The DAC interface is built and working. The four input channels arn't set up yet. I don't have an LCD panel yet.
I imagine a three tired software system. A the lowest level, there's a simple program written in C that communicates with the DAC and keeps track of the state of each light. Built on top of that is a simple CGI/XML interface that can query and set the state of the lights. Something like:
Fetches an XML document describing logical names and permissible values for the lights
Returns an XML document with the current value for light XXXX
Sets light XXXX to value YYYY Returns an XML document with the current value for light XXXX
Returns an XML document with the status of the input line XXXX
Returns an XML document with the status of every input and output.
On top of that, we want a pretty web UI.
STATUS: Nothing written. Most of the UI code can be copied from the system I have at home.
The main user interface should be an LCD panel installed near the enterance. Then panel will be illuminated by a few LEDs so that its easy to find even with all the lights off and the screensaver on. I think it should just run X with some web browser 'stuck' on the web page for the lights. It should only one tap to turn the lights on.
--- TODO --- Include screenshot of my system.
Ideas for expansion
- Add other sensors such as a temperature sensor, motion sensor, door sensor.
- Perform automated actions, for example turning a light on when the door opens.
- Add outputs than run to other lights
- Add a remote control, for example the firefly.
- Send a retro-looking physical lightswitch to NYC Resistor or to other hackspaces and with instructions to give it network control over one of our lights. Hope they do the same.