Chat freely about anything...

User avatar
By lethe
#22965 Just for the record: you should not power a 3.3V LDO with a 12V supply. In this case the LDO will have to dissipate more than 70% of the input power in heat, which can easily exceed the thermal limits of the regulator.
Better use a 5V supply (a USB charger with >= 1A output for example will do).
User avatar
By burkmurray
#22969 Looks like you have plenty of juice, but I can't get over the idea that you've got a power problem. Weird that you still get resets in HelloServer (although at a different interval, right?)

I'm not having any trouble with the same code on an ESP12, but I have had assorted weirdness with Wifi. One thing that has helped: adding
Code: Select allSerial.setDebugOutput(true);
after Serial.begin turns on a verbose status from ESP8266WiFi. You may be able to see what's happening just before the reset.

I've also gotten in the habit of setting my WiFi.mode manually, after the ESP seemed to want to hold on to the last active mode. I'd add:
Code: Select allWiFi.mode(WIFI_STA);
just before WiFi.begin.

Hope that helps - and good luck!
User avatar
By WStan
#22993 HelloServer code contains now:
Serial.setDebugOutput(true);
and
WiFi.mode(WIFI_STA);
also I added a timer:
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
 
const char* ssid = "@HomeCA72";
const char* password = "";
MDNSResponder mdns;
const int led = 0;
ESP8266WebServer server(80);

void handleRoot() {
  digitalWrite(led, 1);
  server.send(200, "text/plain", "hello from esp8266!");
  digitalWrite(led, 0);
}

void handleNotFound(){
  digitalWrite(led, 1);
  String message = "File Not Found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
  digitalWrite(led, 0);
}
void setup(void){
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  Serial.begin(115200);
  Serial.setDebugOutput(true); //burkmurray
  WiFi.mode(WIFI_STA);//burkmurray
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
 
  if (mdns.begin("esp8266", WiFi.localIP())) {
    Serial.println("MDNS responder started");
  }
 
  server.on("/", handleRoot);
  server.on("/inline", [](){
  server.send(200, "text/plain", "this works as well");
  });

  server.onNotFound(handleNotFound);
 
  server.begin();
  Serial.println("HTTP server started");
}
 
void loop(void){
  int sec = millis() / 1000;
  server.handleClient();
  Serial.print("work time [s]= ");
  Serial.println(sec);
  digitalWrite(led, 1);   
  delay(200);               
  digitalWrite(led, 0);   
  delay(200);   
}


Results:
Code: Select allr??#?n?$??l`??`rn|??n?????l`?~?? ??#?n?$? ??nn???l`nn???? ?r??? ? p p??<??l?? p ??nn?????;?? ??8rp?n???r?scandone

.scandone
add 0
aid 2
pm open phy_2,type:2 0 0

connected with @HomeCA72, channel 6
dhcp client start...
cnt
..ip:192.168.1.102,mask:255.255.255.0,gw:192.168.1.2
.
Connected to @HomeCA72
IP address: 192.168.1.102
MDNS responder started
HTTP server started
work time [s]=2
work time [s]=2
work time [s]=3
work time [s]=3
work time [s]=3
work time [s]=4
work time [s]=4
work time [s]=5
work time [s]=5
work time [s]=5
work time [s]=6
work time [s]=6
work time [s]=7
work time [s]=7
work time [s]=7
work time [s]=8
work time [s]=8
work time [s]=9
work time [s]=9
work time [s]=9
work time [s]=10
work time [s]=10
work time [s]=11
work time [s]=11
work time [s]=11
work time [s]=12
work time [s]=12
work time [s]=13
work time [s]=13
work time [s]=13
work time [s]=14
work time [s]=14
work time [s]=15
work time [s]=15
work time [s]=15
work time [s]=16
work time [s]=16
work time [s]=17
work time [s]=17
work time [s]=17
work time [s]=18
work time [s]=18
work time [s]=19
work time [s]=19
work time [s]=19
work time [s]=20
work time [s]=20
work time [s]=21
work time [s]=21
work time [s]=21
work time [s]=22
work time [s]=22
work time [s]=23
work time [s]=23
work time [s]=23
work time [s]=24
work time [s]=24
work time [s]=25
work time [s]=25
work time [s]=25
work time [s]=26
work time [s]=26
work time [s]=27
work time [s]=27
work time [s]=27
work time [s]=28
work time [s]=28
work time [s]=29
work time [s]=29
work time [s]=29
work time [s]=30
work time [s]=30
work time [s]=31
work time [s]=31
work time [s]=31
work time [s]=32
Fatal exception (0):
epc1=0x40106f82, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
rm match
pm close 7 0 0/31408242
del if0
usl
sul 0 0

 ets Jan  8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x40100000, len 28780, room 16
tail 12
chksum 0x06
ho 0 tail 12 room 4
load 0x3ffe8000, len 1548, room 12
tail 0
chksum 0x6c
load 0x3ffe8610, len 3024, room 8
tail 8
chksum 0x62
csum 0x62
r?scandone

scandone
add 0
aid 2
pm open phy_2,type:2 0 0

connected with @HomeCA72, channel 6
dhcp client start...
cnt
.ip:192.168.1.102,mask:255.255.255.0,gw:192.168.1.2
.
Connected to @HomeCA72
IP address: 192.168.1.102
MDNS responder started
HTTP server started
work time [s]=1
work time [s]=1
work time [s]=2
work time [s]=2

and so on