6 channel DMX control trial. esp standalone. local server

Thought I’d test out this … https://github.com/Rickgg/ESP-Dmx … made my life easy … as does Blynk!

As it happens it appears to work very well. Just cobbled a cheap ST485 chip to gpio2 (all at 3v3) and it worked very nicely. Waveform timing is spot on.
6 sliders and a Terminal widget.
Any key shows slot numbers (1-511) assigned to channels. ChanN nnn assigns slot number to channel which is re affirmed by a terminal write back.
Crap programming and no error catches, but it shows it works.

Just waiting for that direct connect now! Could be handy for a few products.

I wish this stuff had been around years ago, it’s like pic mix n go now instead of two weeks doing assembler!

`#include <ESPDMX.h>`

WidgetTerminal terminal(V2);
DMXESPSerial dmx;
SimpleTimer dmxout;
int slidV20val;
int slidV21val;
int slidV22val;
int slidV23val;
int slidV24val;
int slidV25val;
int chan1 = 1;
int chan2 = 2;
int chan3 = 3;
int chan4 = 4;
int chan5 = 5;
int chan6 = 6;

in setup



String pinData = param.asStr();  // data comingin
slidV20val = param.asInt();
const char* slid_dat =  pinData.c_str();   
//client.publish("outTopic" , slid_dat);
String pinData = param.asStr();  // data comingin
slidV21val = param.asInt();
const char* slid_dat =  pinData.c_str();   
//client.publish("outTopic" , slid_dat);
String pinData = param.asStr();  // data comingin
slidV22val = param.asInt();
const char* slid_dat =  pinData.c_str();   
//client.publish("outTopic" , slid_dat);
String pinData = param.asStr();  // data comingin
slidV23val = param.asInt();
const char* slid_dat =  pinData.c_str();   
//client.publish("outTopic" , slid_dat);
String pinData = param.asStr();  // data comingin
slidV24val = param.asInt();
const char* slid_dat =  pinData.c_str();   
//client.publish("outTopic" , slid_dat);
String pinData = param.asStr();  // data comingin
slidV25val = param.asInt();
const char* slid_dat =  pinData.c_str();   
//client.publish("outTopic" , slid_dat);

  String chanrequest = param.asStr(); 
    String chanX =chanrequest.substring(4,5);
    String chanY= chanrequest.substring(6);
    int chanXnum = chanX.toInt();
    int chanslot =chanY.toInt();

    switch (chanXnum) {
      case 1:
      chan1 = chanslot;
      case 2:
      chan2 = chanslot;
      case 3:
      chan3 = chanslot;
      case 4:
      chan4 = chanslot;
      case 5:
      chan5 = chanslot;
      case 6:
      chan6 = chanslot;
     terminal.print(" Chan1 = ");
      terminal.print (chan1);     
      terminal.print("  ");
      terminal.print(" Chan2 = ");
      terminal.print (chan2);     
      terminal.print("  ");
      terminal.print(" Chan3 = ");
      terminal.println (chan3);     
      terminal.print(" Chan4 = ");
      terminal.print (chan4);     
      terminal.print("  ");
      terminal.print(" Chan5 = ");
      terminal.print (chan5);     
      terminal.print("  ");
      terminal.print(" Chan6 = ");
      terminal.println (chan6);    


void dmxSend()
    dmx.write(chan2, slidV21val)

In loop() add


And it’s sorted.

1 Like

Thank you for sharing. Your code will save me a few hours getting my garden dmx lighting rig together.

Will post again once everything arrives from China.

Dear friend,
because it seems a nice project, can you explain us what it does and how it is constarcted the hardware?

Thanks and Best Regards,
Mike Kranidis

Hmmmmm… seems years ago …
I hope your project works out Jamin … I was appreciative that the DMX timing code etc was already for me just to load it up!
Very basic but worked well as I recall.

mikekgr … Basically it allows Blynk to act as a DMX controller. DMX is a lighting control protocol used in the entertainment industry, and controls most stage effects.
All sorts of DMX controlled devices exist.
There are separate dimmer/switch modules as well as devices that have DMX in situ.

DMX is a serial transmission protocol operating at 250K baud. Reasonably fast, but not a two way communication. Send and control, that’s about it (although there are some extensions that allow queries to be made).
The protocol is serial 485 type, and there are low cost devices that are simple to use.
Normally they are Rec/trans types and require certain pins to be set for either Rec or Trans.
The output / input is differential in that there is an in phase line and an inverted phase line.
These must be correctly connected! 485 communication deals reasonably well with line noise etc.
DMX can control up to 512 channels. The receiving device will have working channels set, such that any data sent to that channel will cause a responding action. All 512 channel data is sent in one frame.
Google DMX protocol for more info…
This project uses an ESP8266 with a simple 8pin dip 485 chip, whose input is connected to
On receiving data from a Blynk project, the ESP will output DMX data every 100mS and control. Sliders set on Virtual pins20 to 25 (level range 0-255, since dmx is 8 bit) control the desired channels.
variables chan1 to chan6 are set to the desired channel operation.
The 485 chip worked at 3V3 for me, so no 5V line was required.
Pin1 not used
Pin2 take to 3V3
Pin3 take to 3V3
Pin4 connect to gpio2
Pin5 Ground
Pin6 Output (in phase - hot)
Pin7 Output (inverted)
Pin8 3V3

I hope this goes a little way towards understanding the purpose of this project.


Dear Roffey,

thanks a lot for your in details indroduction for the DMX ecosystem that I did not know.
Now and because of you, I learned something.

Best Regards,
Mike Kranidis