Go Down

Topic: Multiple NEOPIXEL and ESP8266 wifi control (Read 259 times) previous topic - next topic

rrebegeanu

Hello guys,

I am looking to build "my dream" project and I am stucked. I have to admit, I am not good at all as I believed :)

The project
---
A 1m long with 144pixels strip driven by a NodeMCU ESP8266 - let's call it "TUBE"
To it, I've attached a rotary encoder and a 0.9" OLED
I've designed a small menu controlled by the encoder, which actually works in which you can chose the MODE: COLOR, SFX, MANUAL, etc and for each MODE, it's PROGRAMS and finally the DIMMING.
Now, I want to link multiple TUBES via Wi-Fi and to be able to control them accordingly.
This what I want to do:
I have a "SERVER" - a standalone ESP8266 which acts like a directory and main director - it has a WiFi name set ex.: wizzMACADDRESS so no duplicates can be created.
Each TUBE will scan and look for a wizz* network, and if they find it they will connect to it.
Here I would like them to change a tiny bit of info so we can know for sure it is a valid server as: CLIENT ASKS FOR MAC. SERVER REPLIES MAC. CLIENT COMPARES MAC AND WIFINAME.
After that, each client can chose to be a MASTER or to be a SLAVE to a already existing MASTER. It will register with its MAC and a value defining if it will be SLAVE or MASTER and will receive an INDEX NUMBER which will display each on its screen.
If a MASTER changes whatever from the MENU, its SLAVE should get it also.

The SERVER, on the other hand, will display a HTML page where all the CLIENTS TREE are displayed and be controlled from that page, ALL, BY GROUP or INDIVIDUALLY.
Alsom I would like that the server keeps in the EEPROM the CLIENT TREE and each CLIENT it's INDEX NUMBER received upon registration.

I couldn't think of any other solutions for accomplishing this and I widely open to suggestions.

On the CLIENT side should sound like:
scan for SERVER
   if SERVER is found ask SECURITY INFO and compare SECURITY VALUE received
      <chose MASTER or SLAVE>
         if MASTER register "M"+MAC and receive "M"+INDEX
         if SLAVE ask SERVER for MASTERS
            SELECT from MASTER "M.INDEX" register "S"+["M"+INDEX]+MAC  and receive "S"+["M"+INDEX]
   if CLIENT is REGISTERED as MASTER and changes MENU send SERVER all the info (MODE, PROGRAM, DIM, RGB VALUES)   
   
   if CLIENT is REGISTERED and COMMANDS arrive act accordingly (set MODE, PROGRAM, DIM, RGB VALUES)


On the SERVER side:
start WiFi spot (wizz+MAC with no ":")
load from EEPROM CLIENTS TREE if exists
serving the HTML page - onchange pass values accordingly
listening for incoming new connections
   if NEW CLIENT asks for SECURITY INFO - return SECURITY VALUE
   if NEW CLIENT register it and write it to EEPROM
      if SLAVE pass it the values from its MASTER
   if a MASTER sends values (menu changed) pass it to its SLAVES

Thank you,
Razvan

I am new to this and new to this forum and I don't know if I should post the code I have by now, even though I think it's irrelevant as no part of code covers any of the items I've described.

PaulRB

How does a CLIENT know if it is a MASTER or SLAVE? How does it choose?

rrebegeanu

How does a CLIENT know if it is a MASTER or SLAVE? How does it choose?
It will be selected on the screen, in the wireless connection mode menu.

PaulRB

Ah, OK.

How does a slave know which "tube" is its master?

What if a master is changed to be a slave, but it already had a slave?

Anyway, I have written code before to find out, on an esp8266 in AP mode, the IP addresses of all the attached stations.

rrebegeanu

As I imagined it, as you select it to be a SLAVE it will request the SERVER for the list of MASTERS and you will get to choose one of them (an integer representing the index of the MAC addresses registered as MASTER in the SERVER'S TREE).
If a MASTER is not available or changed state, all the tree beneath it, will drop, and be either not registered, or each slave will be switched to MASTER....
That is a very solid question of keep alive signal, good point!
Is there any way to address a message to a certain MAC ADDRESS or to get the IP of those specific MAC, even they are not static?
Oh my, this project becomes a bit overwhelming...

PaulRB


Go Up