‹ f0led f0dmx ›

f0neo

2017-05-13 15:01 electronics

Here is how I build super cheap wireless OSC controlled RGB led strips. The main components for these are an ESP8266, a 5V power bank, a voltage regulator and some LEDs. The LEDs I've used so far are the SK6812 RGBW, but it is easy to adapt the Arduino code to work with other models like the WS2812B.

f0neo schematics
f0neo schematics
f0neo schematics

A basic version of the Arduino code shown here below. When it starts it creates a soft access point. Connect to it with a computer or phone, figure out the IP address of the ESP8266 and start sending OSC commands to it.

// * install OSC from https://github.com/CNMAT/OSC
// * install Adafruit_NeoPixel from library manager
// * edit where it says EDIT below
// * choose board: "Generic ESP8266 Module"
// * upload and connect to softap with laptop
// * try to send OSC messages to ip 192.168.4.1 port 19999
//protocol: [\rgbw, index, red, green, blue, white] example red: [\rgbw, 0, 255, 0, 0, 0]

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

#define PORT 19999
#define NUMNEO 12  //EDIT number of neo pixels in use
#define PINNEO 2

const char *ssid = "f0neo"; //EDIT softAccessPoint network name
const char *password = "mypass123";  //EDIT password

WiFiUDP Udp;

//EDIT to match type of LEDs (see example/Adafruit_NeoPixel/strandtest)
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMNEO, PINNEO, NEO_RGBW + NEO_KHZ800);

void setup() {
  pixels.begin();
  pixels.show();
  WiFi.mode(WIFI_AP);
  WiFi.softAP(ssid, password);
  Udp.begin(PORT);
}

void rgbw(OSCMessage &msg) {
  pixels.setPixelColor(msg.getInt(0), msg.getInt(2), msg.getInt(1), msg.getInt(3), msg.getInt(4));
  pixels.show();
}

void loop() {
  OSCMessage oscMsg;
  int packetSize = Udp.parsePacket();
  if (packetSize) {
    while (packetSize--) {
      oscMsg.fill(Udp.read());
    }
    if (!oscMsg.hasError()) {
      oscMsg.dispatch("/rgbw", rgbw);
    }
  }
}

Attached (zip file) are more elaborate versions of this code - also including MaxMSPJitter and SuperCollider examples and KiCad schematics.

Attachments:


‹ f0led f0dmx ›