f0led

here is another project built around the esp8266. it's a wireless osc controlled 100w led. as the led should act as a stroboscope and not be kept on for long durations of time, i could save space and cost using a smaller sized heatsink. via wifi (opensound control) the led can be turned on/off, the level, attack and release times adjusted etc. there is also a push button trigger input as well as a microphone input (both not connected in the picture). so the strobe can be triggered manually by the musician, by the sound of the nearby instrument or remotely by a computer.

the strobe also send out osc data from the button and mic so it can in turn be used to trigger additional sounds in the computer.

supercollider example code...

OSCFunc.trace(true)
OSCFunc.trace(false)

n= NetAddr("192.168.1.104", 15555);
n.sendMsg(\led, 0.5, 0.1)   //val, fade
n.sendMsg(\led, 0.0, 0.01)  //val, fade
n.sendMsg(\micMode, 1);  //mic on/off
n.sendMsg(\micFade, 1.0, 0.1);  //mic atk rel
n.sendMsg(\butFade, 1.0, 0.1);  //but atk rel

OSCdef(\oscin, {|msg| msg.postln}, \f0led, NetAddr("192.168.1.104", 15555));

f0led 1

the battery is a 12v sealed lead-acid and i measured up toward 8 amps current draw. it weights about 0.5kg.

f0led schematics

bill of material...

1       ESP8266-01
1       4x2 socket
1       heatsink
2       100uF cap
1       100 resistor
1       10k resistor
1       10k log pot     (reichelt ACP 6-L 10K)
1       regulator       (reichelt LF 33 CV)
1       mosfet          (reichelt IRLZ 34N)
1       mic             (reichelt MCE 101)
4       screwterminals  (reichelt AKL 101-02)
1       12v lead-acid   (pollin 94‑271194)
1       heatsink        (ebay 2.4x2.4inch Aluminum Alloy Heat Sink for 1W/3W/5W/10W LED Silver White)
1       dcdc            (ebay DC DC boost converter Constant Current Mobile Power supply 250W)
1       100w led        (ebay 100W Cool White High Power LED LIGHT SMD chip Panel 9000-10000LM)

thick wires
heat paste
screws and nuts

arduino code...

// * install OSC from https://github.com/CNMAT/OSC
// * edit where it says EDIT below
// * choose board: "Generic ESP8266 Module" 160 MHz

//TODO: gamma correction

#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <OSCMessage.h>
#include <OSCData.h>

//pin3 (urxd) can do pwm out
//pin2 and pin0 can not do pwm
//pin2 and pin0 have to be 3v3 at powerup

#define PINMIC 0
#define PINBUT 2
#define PINPWM 3
#define PORT 15555
#define UPDATERATE 16
#define PINGRATE 600

const char *ssid = "f0led"; //EDIT your accessPoint network name
const char *password = "mypass";  //EDIT your password
const IPAddress outIp(192, 168, 1, 99);  //EDIT receiver ip (supercollider)
const char *espname = "f0led";
const unsigned int outPort = 57120;
float micFadeAtk = 1.0, micFadeRel = 0.1; //default fade times
float butFadeAtk = 1.0, butFadeRel = 0.1; //default fade times
float val = 0.0, valTarget = 0.0, fade = 1.0;
unsigned long nextTime;
byte micMode = 0;  //allow mic trigger led on/off
byte micState = 1;
byte butState = 1;
int cnt;
WiFiUDP Udp;
OSCMessage msgPing("/f0led");
OSCMessage msgMic("/f0led");

void setup() {
  delay(10);
  WiFi.hostname(espname);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
  }
  Udp.begin(PORT);
  Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
  pinMode(PINMIC, INPUT);
  pinMode(PINBUT, INPUT_PULLUP);
  pinMode(PINPWM, OUTPUT);
  msgMic.add("mic");
  msgPing.add("ping");
}

void oscLed(OSCMessage &msg) {
  valTarget = msg.getFloat(0);
  fade = msg.getFloat(1);
}
void oscMicMode(OSCMessage &msg) {
  micMode = msg.getInt(0);
}
void oscMicFade(OSCMessage &msg) {
  micFadeAtk = msg.getFloat(0);
  micFadeRel = msg.getFloat(1);
}
void oscButFade(OSCMessage &msg) {
  butFadeAtk = msg.getFloat(0);
  butFadeRel = msg.getFloat(1);
}
void sendOscBut(byte val) {
  OSCMessage msg("/f0led");
  msg.add("but");
  msg.add(val);
  Udp.beginPacket(outIp, outPort);
  msg.send(Udp);
  Udp.endPacket();
  msg.empty();
}
void sendOscMic() {
  Udp.beginPacket(outIp, outPort);
  msgMic.send(Udp);
  Udp.endPacket();
}
void sendOscPing() {
  Udp.beginPacket(outIp, outPort);
  msgPing.send(Udp);
  Udp.endPacket();
}

void loop() {

  //--osc input
  OSCMessage oscMsg;
  int packetSize = Udp.parsePacket();
  if (packetSize) {
    while (packetSize--) {
      oscMsg.fill(Udp.read());
    }
    if (!oscMsg.hasError()) {
      oscMsg.dispatch("/led", oscLed);
      oscMsg.dispatch("/micMode", oscMicMode);
      oscMsg.dispatch("/micFade", oscMicFade);
      oscMsg.dispatch("/butFade", oscButFade);
    }
  }

  //--mic input
  if (digitalRead(PINMIC) == 0) {
    if (micState == 0) {
      micState = 1;
    }
  }

  if (millis() >= nextTime) {
    nextTime = millis() + UPDATERATE;
    if (cnt % PINGRATE == 0) {
      sendOscPing();
    }
    cnt++;

    //--mic input2
    if (micState == 1) {
      micState = 2;
      sendOscMic();
      if (micMode == 1) {
        valTarget = 1.0;
        fade = micFadeAtk;
      }
    } else if (micState == 2) {
      if (digitalRead(PINMIC) == 1) {
        valTarget = 0.0;
        fade = micFadeRel;
        micState = 0;
      }
    }

    //--button input
    if (digitalRead(PINBUT) == 0) {
      if (butState == 0) {
        butState = 1;
        sendOscBut(1);
        valTarget = 1.0;
        fade = butFadeAtk;
      }
    } else {
      if (butState == 1) {
        butState = 0;
        sendOscBut(0);
        valTarget = 0.0;
        fade = butFadeRel;
      }
    }

    //--fade in/out
    if (val < valTarget) {
      val = val + fade;
      if (val > valTarget) {
        val = valTarget;
      }
    } else if (val > valTarget) {
      val = val - fade;
      if (val < valTarget) {
        val = valTarget;
      }
    }

    analogWrite(PINPWM, int(val * 1023));
  }
}