Go Down

Topic: Remote monitoring over WiFi (Read 520 times) previous topic - next topic

Steve-SFX

Thats exactly what I just ordered....

jimLee

Actually... I'd look realy closely at this.

Adafruit feather with Huzza built in. The feather programs exactly like an Arduino, has WAY more horsepower RAM and things, includes battery charging for LiPo battey and has your WiFi chip onboard.

-jim lee
PNW Ardiuno & Maker club
1012 9Th Street, Anacortes, WA 98221 (Around the back of building)

Steve-SFX

Well... I found an ESP8266 in the workshop.... an so far, have not even got my UNO to talk to it!

My other issue is the actual network I am going to get my modules to talk to. I am going to have to make some kind of 'Hub' that covers a decent area for the modules to connect to.

Hmm..  is that possible using a ESP8266 and boosting it somehow?

This wifi option is the best way forward with regards options for reading the data.   If I use wireless RS485 or something, I am going to have to make a custom receiver screen/module to convert the received data to something viewable

Steve-SFX

OK.  Walking away for now!

Been using the code on this page (it has typos... which I think I have corrected)..

https://circuitdigest.com/microcontroller-projects/sending-arduino-data-to-webpage

Nothing...  The led on the ESP is not doing a thing (blinks briefly upon power up and that is it).

It just tries to connect for ages.
(Can you bounce the commands back to the serial screen without it messing up the commands?)

Uno TX is voltage divided into the RX on the ESP
Uno Rx is connected to TX on the ESP
Its own dedicated 3.3v supply with shared 0v with the Uno
EN pin on the ESP held high (enable). There is no Ch_pd on this board.

Code: [Select]
#include <SoftwareSerial.h>

const byte rxPin = 2; // Wire this to Tx Pin of ESP8266
const byte txPin = 3; // Wire this to Rx Pin of ESP8266

// We'll use a software serial interface to connect to ESP8266
SoftwareSerial ESP8266 (rxPin, txPin);

void setup() {
  Serial.begin(115200);
  ESP8266.begin(115200); // Change this to the baudrate used by ESP8266
  delay(1000); // Let the module self-initialize
}

void loop() {
  Serial.println("Sending an AT command...");
  ESP8266.println("AT");
  delay(30);
  while (ESP8266.available()){
     String inData = ESP8266.readStringUntil('\n');
     Serial.println("Got reponse from ESP8266: " + inData);
  } 
}


This code I found says its got a response from the ESP.  But it lies.  Unplug the ESP and it still says its getting a response.

Its a shame I don't seem to be able to get my head around this.
I understand you can program the ESP8266 directly from the Arduino IDE (I have installed the boards into the manager). 
Is it standard Arduino coding they accept?

Anyone have any useful web pages for me to browse, then that would be great.  Trying to get my head around it.

Final question (I see the eyes rolling)...  flashing the module. What does that mean/acheive?


srnet

$50SAT is now Silent (but probably still running)
http://www.50dollarsat.info/
http://www.loratracker.uk/

Steve-SFX

Actually... I'd look realy closely at this.

Adafruit feather with Huzza built in. The feather programs exactly like an Arduino, has WAY more horsepower RAM and things, includes battery charging for LiPo battey and has your WiFi chip onboard.

-jim lee
Yes. Like the look of this module. Just ordered one, and the plug-in shield that gives it an Oled screen.
I think I am off to a bad start with some dodgy old module that arrived from China a year ago.

Thank you all for your assistance to date

Steve-SFX

#21
Nov 11, 2018, 07:00 pm Last Edit: Nov 11, 2018, 07:00 pm by Steve-SFX
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)



Steve-SFX

#22
Nov 12, 2018, 02:07 pm Last Edit: Nov 12, 2018, 02:36 pm by Steve-SFX
OK.  We have a network...

Code: [Select]

#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

Steve-SFX

#23
Nov 12, 2018, 03:33 pm Last Edit: Nov 12, 2018, 03:37 pm by Steve-SFX
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  :smiley-roll:

darrob

#24
Nov 13, 2018, 02:56 am Last Edit: Nov 13, 2018, 02:58 am by darrob
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  :smiley-roll:
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.

Steve-SFX

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

Go Up