El Wire Color Changing

Years ago I experimented with shifting the color of El Wire by changing the AC frequency.

The color effect is subtle, but can be seen by most people with good color vision.

Not long after I published this video, I discovered “dcroy” built this same thing a few months before I did, and using only a 555 timer! Looks like it’s not as unique as I thought!

This is the schematic for the circuit I built.  Most of the parts are small surface mount and they’re hidden under the transformer.

Here’s the code from the Arduino IDE. Pretty simple stuff. But beware, if you try this, it’s essential to drive each transistor for the same length of time, and not more than about 1ms. If you drive one more than the other, or leave either on too long, the transform sees a DC or low frequency signal. That could result in far too much current, probably destroying the transistors if the battery is fresh.

const int pin1 = 12;
const int pin2 = 19;

void setup() {
  Serial.end();  // USB off, to save power
  for (byte i=0; i<25; i++) {
    pinMode(i, OUTPUT);    // all unused pins low
    digitalWrite(i, LOW);  // to avoid wasting power
  }
  pinMode(pin1, OUTPUT);
  pinMode(pin2, OUTPUT);
}

unsigned int us = 250 * 64;
const int usMax = 500 * 32;
const int usMin = 120 * 32;
byte dir = 0;

void loop() {
  digitalWrite(pin1, HIGH);
  delayMicroseconds(us / 32);
  digitalWrite(pin1, LOW);
  if (dir) {
    us = us + 1 + us / 2048;
    if (us >= usMax) dir = 0;
  } else {
    us = us - 1 - us / 2048;
    if (us <= usMin) dir = 1; 
  }
  digitalWrite(pin2, HIGH);
  delayMicroseconds(us / 32);
  digitalWrite(pin2, LOW);
}

This article was originally published on the DorkbotPDX website, on July 12, 2011.  In late 2018, DorkbotPDX removed its blog section.  An archive of the original article is still available on the Internet Archive.  I am republishing this article here, in case anyone might wish to try El Wire color changing.  Admittedly, El Wire became less popular around 2013 when inexpensive LED strips appeared on the market, but it still offers interesting effects which are hard to accomplish with LEDs.