Go Down

Topic: ArtNet to WS2812 Pixel LED driver : Using Wemos D1 (arduino-esp8266) (Read 20584 times) previous topic - next topic

plabon07

hello Bob

wemos buy link : 

https://www.aliexpress.com/item/ESP12-ESP-12-WeMos-D1-mini-V2-Mini-NodeMcu-4M-bytes-Lua-WIFI-Internet-of-Things/32813996238.html?spm=a2g0s.9042311.0.0.IHZJFz






code uplode




/*
  SmartShow AirPixel ONE - Single Universe ArtNet to WS2812 Driver - For Wemos D1
  You can set the Device IP, and universe number below
  Works perfectly with Jinx LED software
*/

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

#define WSout 5  // Pin D1
#define WSbit (1<<WSout)

// ARTNET CODES
#define ARTNET_DATA 0x50
#define ARTNET_POLL 0x20
#define ARTNET_POLL_REPLY 0x21
#define ARTNET_PORT 6454
#define ARTNET_HEADER 17

WiFiUDP udp;

uint8_t uniData[514];
uint16_t uniSize;
uint8_t hData[ARTNET_HEADER + 1];
uint8_t net = 0;
uint8_t universe = 0;
uint8_t subnet = 0;

const char* ssid     = "pixelbrit";
const char* password = "Pixelbrit2";

IPAddress local_ip(192, 168, 1, 200);
IPAddress gateway_ip(192, 168, 1, 1);
IPAddress subnet_ip(255, 255, 255, 0);

void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  WiFi.config(local_ip, gateway_ip, subnet_ip);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  udp.begin(ARTNET_PORT); // Open ArtNet port

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  pinMode(WSout, OUTPUT);
}



void ICACHE_FLASH_ATTR sendWS() {
  uint32_t writeBits;
  uint8_t  bitMask, time;
  os_intr_lock();
  for (uint16_t t = 0; t < uniSize; t++) { // outer loop counting bytes
    bitMask = 0x80;
    while (bitMask) {
      // time=0ns : start by setting bit on
      time = 4;
      while (time--) {
        WRITE_PERI_REG( 0x60000304, WSbit );  // do ON bits // T=0
      }
      if ( uniData[t] & bitMask ) {
        writeBits = 0;  // if this is a '1' keep the on time on for longer, so dont write an off bit
      }
      else {
        writeBits = WSbit;  // else it must be a zero, so write the off bit !
      }
      time = 4;
      while (time--) {
        WRITE_PERI_REG( 0x60000308, writeBits );  // do OFF bits // T='0' time 350ns
      }
      time = 6;
      while (time--) {
        WRITE_PERI_REG( 0x60000308, WSbit );  // switch all bits off  T='1' time 700ns
      }
      // end of bite write time=1250ns
      bitMask >>= 1;
    }
  }
  os_intr_unlock();
}

void loop() {
  if (udp.parsePacket()) {
    udp.read(hData, ARTNET_HEADER + 1);
    if ( hData[0] == 'A' && hData[1] == 'r' && hData[2] == 't' && hData[3] == '-' && hData[4] == 'N' && hData[5] == 'e' && hData[6] == 't') {
      if ( hData[8] == 0x00 && hData[9] == ARTNET_DATA && hData[15] == net ) {
        if ( hData[14] == (subnet << 4) + universe ) { // UNIVERSE
          uniSize = (hData[16] << 8) + (hData[17]);
          udp.read(uniData, uniSize);
          //Serial.print("ArtNet packet RX Uni 0 - size:");
          //Serial.println(uniSize);
          sendWS();
        }
      } // if Artnet Data
    }
  }
}




plabon07

hello bob

my router 192.168.0.1




code upload  then

Connecting to pixelbrit
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - -

no info or not Connection


your info

This works fine with the current install of the ESP8266 for Arduino libraries
Just set your own router SSID and Password, and run using Jinx software available from http://www.live-leds.de/




libraries\Arduino-master..... i made it


please help me bob, SIR its my dream project - - - - - - - -  - - - - - - - - -

plabon07

Dear sir bob please please help

where is my problem 


 
dear sir i am working motion graphics artist at independent.tv 


ilove led its just a hobby  please help artnet its my dream




plabon07

sir bob
i am a beginner for arduino,  u make a full instructions for me thanks 

plabon07

hi bob one more think
 can i esp8266 board download

2.0.0
2.1.0.
2.2.0
2.3.0

plabon07

sir bob

void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");- - - - -- - - - - - - - - - - - - - -Connecting to
  Serial.println(ssid);
iFi.begin(ssid, password);     - - - - - - - - - - - - - - - - - - never ask

haikezegwaard

Hello Bob,

We are trying to create a 3d-led projector which will consist of around 22000 leds.
The goal is to create true 3-d objects (you can walk around them and see all sides) and animations which could be controlled over the web.

Your solution sounds very promising.

Would your led driver be a/the way to go for this amount of leds? Are there limitations/concerns we need to think of here?

Thanx in advance for your reply,

Haike Zegwaard

ColF

Hi mcnobby.
I´m trying to use this code to run my quite small matrix (10x20) with my esp8266 nodeMCU12E but it does not work well :( . I´m able to use one universe but I do not know how to set 2 universes. And if it seems to work (I used the programm from comilozk) the rows 17-18 (in universe 2) always are wrong coloured :smiley-confuse: , even I change the colour order in the setup. Can you tell me, what I have to do now?
Thanks. :)

mcnobby

Hello ColF

You need to read the universe size from the packet, and use that to determine how many bytes you output, In general a universe is 512 bytes, but WS2812 uses 3 bytes, 512 is NOT divisible by 3, so you need to stop at 510 bytes and then do the next universe
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

ColF

Yeah, I thought that but I still don´t know, where to change the number of universes.
Hello ColF

You need to read the universe size from the packet, and use that to determine how many bytes you output, In general a universe is 512 bytes, but WS2812 uses 3 bytes, 512 is NOT divisible by 3, so you need to stop at 510 bytes and then do the next universe

mcnobby

hello bob

my router 192.168.0.1




code upload  then

Connecting to pixelbrit
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - -

no info or not Connection


your info

This works fine with the current install of the ESP8266 for Arduino libraries
Just set your own router SSID and Password, and run using Jinx software available from http://www.live-leds.de/




libraries\Arduino-master..... i made it


please help me bob, SIR its my dream project - - - - - - - -  - - - - - - - - -

IPAddress local_ip(192, 168, 0, 200);
IPAddress gateway_ip(192, 168, 0, 1);
IPAddress subnet_ip(255, 255, 255, 0);
http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

Elson-Lucas

Hi, my name is lucas and im a very very beginer in arduino.. i had use your code to try something in my room with dmx and arduino wemos, but i have this error



Archiving built core (caching) in: C:\Users\Lucas\AppData\Local\Temp\arduino_cache_994680\core\core_esp8266_esp8266_d1_mini_CpuFrequency_160,FlashSize_4M1M,LwIPVariant_v2mss536,Debug_Disabled,DebugLevel_None____,FlashErase_none,UploadSpeed_115200_a51ad1c68a068c81cbb591c3b03f8a75.a

mcnobby

http://www.youtube.com/user/Recovered
http://www.smartshow.lighting

Elson-Lucas

i have try this code in my arduino memos d1 r2 wifi



/*
  SmartShow AirPixel ONE - Single Universe ArtNet to WS2812 Driver - For Wemos D1
  You can set the Device IP, and universe number below
  Works perfectly with Jinx LED software
*/

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

#define WSout 5  // Pin D1
#define WSbit (1<<WSout)

// ARTNET CODES
#define ARTNET_DATA 0x50
#define ARTNET_POLL 0x20
#define ARTNET_POLL_REPLY 0x21
#define ARTNET_PORT 6454
#define ARTNET_HEADER 17

WiFiUDP udp;

uint8_t uniData[510];
uint16_t uniSize;
uint8_t hData[ARTNET_HEADER + 1];
uint8_t net = 0;
uint8_t universe = 0;
uint8_t subnet = 0;

const char* ssid     = "Roanita";
const char* password = "1002roga";

IPAddress local_ip(192, 168, 0, 20);
IPAddress gateway_ip(192, 168, 1, 1);
IPAddress subnet_ip(255, 255, 255, 0);

void setup() {
  Serial.begin(115200);
  delay(10);
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, password);
  WiFi.config(local_ip, gateway_ip, subnet_ip);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  udp.begin(ARTNET_PORT); // Open ArtNet port

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  pinMode(WSout, OUTPUT);
}



void sendWS() {
  uint32_t writeBits;
  uint8_t  bitMask, time;
  os_intr_lock();
  for (uint16_t t = 0; t < uniSize; t++) { // outer loop counting bytes
    bitMask = 0x80;
    while (bitMask) {
      // time=0ns : start by setting bit on
      time = 4;
      while (time--) {
        WRITE_PERI_REG( 0x60000304, WSbit );  // do ON bits // T=0
      }
      if ( uniData[t] & bitMask ) {
        writeBits = 0;  // if this is a '1' keep the on time on for longer, so dont write an off bit
      }
      else {
        writeBits = WSbit;  // else it must be a zero, so write the off bit !
      }
      time = 4;
      while (time--) {
        WRITE_PERI_REG( 0x60000308, writeBits );  // do OFF bits // T='0' time 350ns
      }
      time = 6;
      while (time--) {
        WRITE_PERI_REG( 0x60000308, WSbit );  // switch all bits off  T='1' time 700ns
      }
      // end of bite write time=1250ns
      bitMask >>= 1;
    }
  }
  os_intr_unlock();
}

void loop() {
  if (udp.parsePacket()) {
    udp.read(hData, ARTNET_HEADER + 1);
    if ( hData[0] == 'A' && hData[1] == 'r' && hData[2] == 't' && hData[3] == '-' && hData[4] == 'N' && hData[5] == 'e' && hData[6] == 't') {
      if ( hData[8] == 0x00 && hData[9] == ARTNET_DATA && hData[15] == net ) {
        if ( hData[14] == (subnet << 4) + universe ) { // UNIVERSE
          uniSize = (hData[16] << 8) + (hData[17]);
          udp.read(uniData, uniSize);
          //Serial.print("ArtNet packet RX Uni 0 - size:");
          //Serial.println(uniSize);
          sendWS();
        }
      } // if Artnet Data
    }
  }
}

AidanV

Hey mate. Love your work. i started watching some of your videos on youtube when i got interested in neopixels.

I have recently bought a role of ws2813 and a uno r3. i am looking at setting up some pixel mapping strips for a church project using the uno as an artnet node and using QLC+ as the dmx software for now and posiby moving to jinx or glediator donw the road depending on needs.

I am very green with this, litterally juist plugged in the uno and am waiting for the software to finish DL

how much luck have you had doing multiple universes off one arduino

and do you think your code would be good for my use case

Go Up