Go Down

Topic: What Microprocessor with Wifi or Radio Frequency To Use (Read 1 time) previous topic - next topic

KevinRoach

My coding skills are not the best but I am learning and I am willing to learn.

What I want to do is monitor water temp and weather on the water. I would like a wifi distance of 150ft.

cattledog

Quote
What I want to do is monitor water temp and weather on the water
How are you planning to "monitor the weather" on the water?

Quote
I would like a wifi distance of 150ft.
Is this line of sight over open water with no obstacles? If so, you may be OK. In my experience, my D1 does not have anything like the range of my home router with wall and other obstacles. The D1 mini pro can use an external antenna.

Riva

Do you intend on using the Wemos D1 as a web server that you connect the phone to and browse a web page generated on the D1 or will the D1 push results to a cloud dashboard like Cayenne so you can view the results from an App/browser anywhere in the world.
Don't PM me for help as I will ignore it.

PaulRB

So this is a continuation of this thread?

You should not start new topics on the same subject, it is called cross-posting, and is against the forum rules.

PaulRB

#19
Jul 13, 2018, 11:00 am Last Edit: Jul 13, 2018, 11:05 am by PaulRB
will the D1 push results to a cloud
From the OP:
Is this possible without send it up to see cloud or a server etc.?

PaulRB

#20
Jul 13, 2018, 11:06 am Last Edit: Jul 13, 2018, 11:12 am by PaulRB
Here is an example sketch which you could use as a starting point. The Sparkfun Thing and Wemos Mini Pro are the same, from a sketch point of view. They both use an esp8266.
Code: [Select]

#include <ESP8266WiFi.h>

//////////////////////
// WiFi Definitions //
//////////////////////
const char WiFiAPPSK[] = "sparkfun";

/////////////////////
// Pin Definitions //
/////////////////////
const int LED_PIN = 5; // Thing's onboard, green LED
const int ANALOG_PIN = A0; // The only analog pin on the Thing
const int DIGITAL_PIN = 12; // Digital pin to be read

WiFiServer server(80);

void setup()
{
  initHardware();
  setupWiFi();
  server.begin();
}

void loop()
{
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }

  // Read the first line of the request
  String req = client.readStringUntil('\r');
  Serial.println(req);
  client.flush();

  // Match the request
  int val = -1; // We'll use 'val' to keep track of both the
                // request type (read/set) and value if set.
  if (req.indexOf("/led/0") != -1)
    val = 0; // Will write LED low
  else if (req.indexOf("/led/1") != -1)
    val = 1; // Will write LED high
  else if (req.indexOf("/read") != -1)
    val = -2; // Will print pin reads
  // Otherwise request will be invalid. We'll say as much in HTML

  // Set GPIO5 according to the request
  if (val >= 0)
    digitalWrite(LED_PIN, val);

  client.flush();

  // Prepare the response. Start with the common header:
  String s = "HTTP/1.1 200 OK\r\n";
  s += "Content-Type: text/html\r\n\r\n";
  s += "<!DOCTYPE HTML>\r\n<html>\r\n";
  // If we're setting the LED, print out a message saying we did
  if (val >= 0)
  {
    s += "LED is now ";
    s += (val)?"on":"off";
  }
  else if (val == -2)
  { // If we're reading pins, print out those values:
    s += "Analog Pin = ";
    s += String(analogRead(ANALOG_PIN));
    s += "<br>"; // Go to the next line.
    s += "Digital Pin 12 = ";
    s += String(digitalRead(DIGITAL_PIN));
  }
  else
  {
    s += "Invalid Request.<br> Try /led/1, /led/0, or /read.";
  }
  s += "</html>\n";

  // Send the response to the client
  client.print(s);
  delay(1);
  Serial.println("Client disonnected");

  // The client will actually be disconnected
  // when the function returns and 'client' object is detroyed
}

void setupWiFi()
{
  WiFi.mode(WIFI_AP);

  // Do a little work to get a unique-ish name. Append the
  // last two bytes of the MAC (HEX'd) to "Thing-":
  uint8_t mac[WL_MAC_ADDR_LENGTH];
  WiFi.softAPmacAddress(mac);
  String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
                 String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
  macID.toUpperCase();
  String AP_NameString = "ESP8266 Thing " + macID;

  char AP_NameChar[AP_NameString.length() + 1];
  memset(AP_NameChar, 0, AP_NameString.length() + 1);

  for (int i=0; i<AP_NameString.length(); i++)
    AP_NameChar[i] = AP_NameString.charAt(i);

  WiFi.softAP(AP_NameChar, WiFiAPPSK);
}

void initHardware()
{
  Serial.begin(115200);
  pinMode(DIGITAL_PIN, INPUT_PULLUP);
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);
  // Don't need to set ANALOG_PIN as input,
  // that's all it can be.
}


KevinRoach

How are you planning to "monitor the weather" on the water?

Is this line of sight over open water with no obstacles? If so, you may be OK. In my experience, my D1 does not have anything like the range of my home router with wall and other obstacles. The D1 mini pro can use an external antenna.
Yes line of site out er the water and use a water sensor ds1820 and a bme280 for sir readings.

KevinRoach

So this is a continuation of this thread?

You should not start new topics on the same subject, it is called cross-posting, and is against the forum rules.
I reposted this because it is not related to the other post. I was told that the Wemos does not have enough processing power to do what I want for it to be a server. It was suggested to use a raspberry pi.

KevinRoach

Do you intend on using the Wemos D1 as a web server that you connect the phone to and browse a web page generated on the D1 or will the D1 push results to a cloud dashboard like Cayenne so you can view the results from an App/browser anywhere in the world.
Read the orinal post! People don't read!

PaulRB

#24
Jul 13, 2018, 08:27 pm Last Edit: Jul 13, 2018, 08:35 pm by PaulRB
I reposted this because it is not related to the other post.
You "re-posted" an unrelated post?

Now there is smoke coming from your underwear...

Coding Badly

I reposted this because it is not related to the other post.
They are directly related.

There are details in the other thread excluded from this one.


Please do not cross-post.  Threads merged.


KevinRoach

@PaulRB

You mentioned that the Wemos board wouldn't be pwerfull enough for the project and I looked going with the raspberry pi. Now I am confused. Which board is best to go with?

Southpark

@PaulRB

You mentioned that the Wemos board wouldn't be pwerfull enough for the project and I looked going with the raspberry pi. Now I am confused. Which board is best to go with?
Raspberry pi and batteries won't go down well, or won't go at all.

cattledog

#28
Jul 14, 2018, 04:13 am Last Edit: Jul 14, 2018, 04:14 am by cattledog
Quote
You mentioned that the Wemos board wouldn't be pwerfull enough for the project and I looked going with the raspberry pi. Now I am confused. Which board is best to go with?
The suitability of the Wemos as the AP server all depends on the web page(s) you are designing. If you are going to supply a few values like temperature, humidity it should be fine. If you want graphics, multiple pages, links, images, many simultaneous connections, etc., like a "real" web site,  the Wemos may not be an appropriate server.

PaulRB

You mentioned that the Wemos board wouldn't be pwerfull enough for the project
No, I said it might not be powerful enough. You will have not told us what information you want to see on your phone. Plain text or graphics? Current values or historical? You asked if it can be done without using a cloud server. If you expect to be able to do all the stuff you can do with a cloud server, then esp will not be powerful enough. If you keep it simple, it will be powerful enough.

Go Up