I have a plan. Whether it ends up anything like the plan... I have no idea!
I have Googled the bottom off this subject, and tried to learn about these ESP8266 modules.
So, I have bought 2x Adafruit Feather HUZZAH with ESP8266 modules. They look like a good place to start.
Also got the I2C display module that plugs directly into the top - handy for diagnostics,
This is my thinking... please feel free to shoot it all down in pieces due to my lack of knowledge on this subject...
Set one of the ESP8266 modules up as a base unit giving me a network. This can live happily in an enclosure, along with a local 'off the shelf' Wifi repeater unit to help boost its range to - well, as far as I can throw it.
This unit uploads its received data to a webpage where I can access it later.
Failed to date on this point however... the ESP8266 i have here just totally refuses to respond at all.
Hoping for better with the new Adafruit modules.
Then, I set up further identically programmed ESP8266's as slave modules that send the information to the main ESP8266 over wifi.
I will have to set the master ESP8266 to 'scan' the network for devices and prioritise their data.
I have then been playing with MIT app inventor 2 to retrieve the data from a webpage and display it on an Android App.
Its a bit adventurous for my first endeavour with wifi, but feet first and all that.
Anyone see a glaring issue or problem I may face? (apart from my own programming shortfall)
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
const char *ssid = "TEST";
const char *password = "password";
ESP8266WebServer server(80);
void handleRoot() {
server.send(200, "text/html", "<h1>Test is now broadcasting</h1>");
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point... ");
Serial.print("");
WiFi.softAP(ssid, password);
IPAddress myIP = WiFi.softAPIP();
Serial.print("Q-NET now available on IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
}
void loop() {
server.handleClient();
}
This works fine.
However, if I now change the SSID or the password and re-upload it, it ignores it.
Tried the flash button, but that changes nothing.
How do you now upload changes to the code? It seems to be ignoring the new uploads (although they upload OK)
Update... I found in the Tools section the 'Erase flash' drop down menu. Thought selecting Wifi settings as well as the sketch would clear it. It did... but now it ignores the SSID I specify in me code
Password. I had our personal password in the code (which I changed when I posted the code)... it was only 7 letters, so it ignored it.
Anyway, I believe the entire system has just fallen flat, as I just read that an ESP8266 set up as an AP can only receive data from 5x ESP8266's set as Stations.
That is not anywhere near enough
Wish I had found that golden snippet before ordering further ESP8266's
Steve-SFX:
Anyway, I believe the entire system has just fallen flat, as I just read that an ESP8266 set up as an AP can only receive data from 5x ESP8266's set as Stations.
That is not anywhere near enough
Wish I had found that golden snippet before ordering further ESP8266's
Creating a system as you have described it is not going to be good for real time data acquisition in any case. There are too many chances of a wifi drop out. The best that you can hope for is a system which gets updates from clients on an irregular basis. (Realtime really needs physical wiring.)
However, that fact can be a saving grace in your situation.
Rather than having a fixed number of clients with set IP addresses, the ESP8266 can use a form of DHCP. Look for startMDNS(); in the ESP8266 core.
It can be arranged that your system never has 8 clients accessing the 'server' at the same time.
In cases where a 'client/slave' can't make a connection, it should just re-try until one can be establish or until a timeout occurs. (The ESP8266 Core Soft Access Point Class reference indicates that you can have up to 8 clients)
The client would, most of the time, be doing nothing. Occasionally it should wake up, read sensor data and attempt a connection to the master/server. Once connection has been established, squirt the data over then go back to sleep.
On the server side, if a client/slave has not established a connection for a set period of time, an indication/warning/error can be raised on the page it's hosting.
Even if you have several people looking at the data on their handheld devices, you'll still be able to get data from the slaves. You may have to refuse a handheld connection if there are too many people trying to access the pages/app at the same time (ie reserve at least 1 or 2 connection for client/slave updates)
The other way to go is to pass the job of the 'Network Master' off to a router. The ESP devices (including the server) can be set to Station mode. The 'server/master' can just sit there and accept incoming connections, and deal with them as and when they arrive. If the connection request data, send it out in the form of a web page. If the connection attempts to send data then accept that data and, likewise, do stuff with it.
The clients would behave in the way I described earlier.
Yes. I wish I understood the whole wireless/wifi area more. Getting my head around it, but there is a lot to learn.
I was thinking of exactly that idea.... my 'hub' ESP8266 never actually sees more that its maximum amount of stations.
I could set my slave stations to have say 3 modes... low, medium and high importance.
Then, the AP could check the high importance stations say 3 times more often than the low.
None of the data is critical. A slow connection is not particularly terrible. As long as I can obtain data say every 10 seconds to 20 seconds (and maybe every 3 or 4 seconds for the high priority stuff), then this might work.
It all depends I think on how quickly the chip can disconnect and reconnect to a station.
My only other option is wireless RS485. Transmit that back to the AP and then read the data off the wifi.
Still trying to find a comprehensive guide on pulling data off wifi to my android tablet