Page 1 of 1

ESP8266 WiFi - NeoPixel - Multiple Boards connecting to host

Posted: Fri Jan 12, 2018 12:19 pm
by PacoTheCharm
Hello!

I've been playing with the excellent libraries to send/receive sACN to the little adafruit HUZZAH ESP8266 wifi boards.

I am currently working from the file: "ESP-DMXNeoPixels.ino"

So far, if I make the board a WiFi AP, I can connect to its access point and immediately get to controlling the NeoPixels with no problem by sending sACN to the right universe.

However, I am interested in having multiple boards connecting to one WiFi network and be able to individually send DMX to them independently.

More concretely, I have two different dancers on which I would like to control the LED's from each of their suits individually from their independent ESP8266 boards.

Is there a way to do this? I've gotten the board to connect to a network a few other scripts instead of creating the access point.

I've tried by changing these settings in the "LXDMXWiFiConfig.cpp":

strncpy((char*)_wifi_config, CONFIG_PACKET_IDENT, 8); //add ident
_wifi_config->version = DMXWIFI_CONFIG_VERSION;
_wifi_config->wifi_mode = AP_MODE; // AP_MODE or STATION_MODE
_wifi_config->protocol_flags = MULTICAST_MODE; // sACN multicast mode

strncpy(_wifi_config->ssid, "ESP-DMX-WiFi", 63);
strncpy(_wifi_config->pwd, "*****", 63);


(changing the mode to STATION_MODE and adding a wifi network SSID and Password).

Not quite sure if that is the correct way, but the few things I've tried won't get the board connecting to a wireless network yet, so I haven't been able to try stuff past that.

Any advice would be greatly appreciated!

Best,

Wlad

Posted: Fri Jan 12, 2018 2:23 pm
by admin
A number of the examples in the LXDMXWiFi_Library use a similar scheme to enable the configuration settings to be saved to persistent memory without editing and re-loading the sketch. The configuration utility allows you to locate the project on the network and to upload new settings. But, because you might have set the microcontroller to log into a WiFi network that is no longer available, there needed to be a way of using default settings (an access point with a know IPAddress). The way this is set to work is that if the startup pin is low when the sketch boots up, it will use the default settings, the ones defined in initConfig(). Otherwise, the sketch will use the settings saved to persistent memory.

This idea is great for a finished project because you don't need to re-compile and re-load a sketch to move it to a different WiFi network. But, it may have been too complicated and confusing to include in example code. Perhaps the header file should be more clear about how LXDMXWiFiConfig is supposed to work.

The problem is likely that without the full explanation, it is easy to assume that the settings defined in initConfig() are used every time the sketch starts up. This is only the case if the startup pin is held low. Otherwise, the settings are the ones stored in persistent memory.

Of course, the persistent memory does not have the default settings on a fresh blank board. It has to be written to once. The very first time the sketch is run, the settings from initConfig() are loaded into persistent memory. So, after that, unless new settings have been uploaded, the configuration does not change.

If you don't want to get into using the remote configuration utility and just want to hard code the settings in initConfig(), the easiest thing to do is to skip tthe startup pin altogether and just pass zero to DMXWiFiConfig.begin. This causes the sketch to use the settings from initConfig() which is the backup default startup in the original design.

In the sketch's setup() function, change

DMXWiFiConfig.begin(digitalRead(STARTUP_MODE_PIN));

to

DMXWiFiConfig.begin(0);

Posted: Sat Jan 13, 2018 6:17 pm
by PacoTheCharm
I think I see what you mean. I will try it later tonight and report back.

Thank you Claude! Big fan of your stuff since undergrad and still finding myself learning from your work as I finish my masters.

Cheers,

Wlad

Posted: Sat Jan 13, 2018 7:34 pm
by admin
I posted an update to the LXDMXWiFi_Library code on github that changes several of the examples that use the config class to manage options.

First, there's a comment explaining the config class and its intended use with the configuration utility near the top of the example sketches.

In the LXDMXWiFiConfig class the mode parameter to the begin() method now has a default value of zero. In consequence, calling LXDMXWiFiConfig.begin() without a parameter will always set the config structure with values as defined in initConfig().

Finally, there's a conditional compilation macro: #define USE_REMOTE_CONFIG 0
When defined this macro allows the sketch to be compiled as before for use with the configuration utility application.

But in the examples, this macro is commented out. The result being that the remote configuration code is left out and LXDMXWiFiConfig.begin() is called in startup(). This further means that the settings that are hard coded into initConfig() will always be used.

Posted: Sun Jan 14, 2018 8:53 pm
by PacoTheCharm
I'm finally understanding the use of the python or java utility to modify the wifi connection settings on the board.

I've been able to connect to the board on the 'ESP-DMX-WiFi', can ping the board just fine and have been able to control some neo-pixels over sACN.

What I haven't been able to do it is have the python or java utility find my board and return current settings with the 'get info' button. On the python console, I keep getting this as the program searches: 'exception reading packet'. On the Java one i also get no returns.

Is there some setting I am missing in terms of getting the applications to recognize the unit?

I will try hard coding again a little later, but the applications actually seem pretty awesome.

Posted: Sun Jan 14, 2018 10:18 pm
by PacoTheCharm
I've had more success now by changing the DMXWiFiConfig.begin to (0) like you mentioned earlier and changing the config file with my network information.

Now I am getting the board to respond to sACN over a wifi network. I hope this will work with having multiple boards connected to the network, so that each dancer can have their own lights. I get the other two boards in the mail this week, so I will be able to test this soon.

Still haven't gotten the python or java utilities to work yet how ever, I assume they will become quite handy in the near future.

Posted: Tue Jan 16, 2018 6:06 pm
by admin
It may be basic, but your computer needs to be connected to the same WiFi network as the ESP8266 in order for the configuration utility to find it. If the ESP8266 is configured as an access point, you need to connect the computer's WiFi to that network.

In the latest commit on github, remote configuration is optional and is disabled by default. To enable it, uncomment the line: #define USE_REMOTE_CONFIG 0.

Also, the configuration utility is set to search for likely addresses. If you've altered the default address from 10.110.115.10, you may need to enter that address or try 255.255.255.255 in the target IP field before searching.

The next commit will add 255.255.255.255 to the list of addresses to always search.