ESP8266 and Arduino UNO - issues with wiring/power and AT

In this way I am actually "doubling" the available devices:

Arduino board
NodeMCU

More flexibility.

If, again, I could easily use the sensors I am using with the Arduino already...
Well, they just send a signal to the Arduino through a digital pin (the DHT22) and an Analog pin (the Oxygen sensor)....

I like the WeMos D1 Mini because it's smaller and cheaper than the NodeMCU but either are fine. I have some NodeMCU I bought before the D1 Mini came out. You can just install the Arduino esp8266 core, install the CP2102 driver with the nodeMCU or CH340 driver for D1 Mini if you're using Windows or Mac, plug the USB cable in, and start programming it. There's only one analog pin and less IO pins in general and the 3.3 V logic can be limiting since a lot of the stuff Arduino people use is still 5 V.

pert:
There's only one analog pin and less IO pins in general and the 3.3 V logic can be limiting since a lot of the stuff Arduino people use is still 5 V.

1 analog pin will be enough (just for the Oxygen sensor).

Now you put me concerns re the power supply... Perhaps those 2 sensors need 5V :frowning: Well on the Arduino they are on 5V....

Sorry I think it was a silly question. I just noticed a Vin PIN that should be powered with 5V...

You beat me to this reply but it has some other info so I'll post it anyway.

You are powering the board at 5 V from the USB jack and there is a 5 V pin but the logic levels of the IO pins are 3.3 V. Actually the ADC pin might be only 1.8 V max on the NodeMCU, that's what the ESP8266 is but they put a voltage divider on the Wemos D1 Mini so it can go up to 3.3 V and NodeMCU might have done the same. There is some evidence that the digital pins on the ESP8266 are 5 V tolerant but I still don't like to feed mine over 3.3 V. The 3.3 V output can also be an issue in some cases. Most 5 V devices will still see 3.3 V as HIGH but apparently that's not reliable with the WS2812 addressable LEDs so I had to do level shifing to control those from the ESP8266, that wouldn't have been necessary with a 5 V Arduino board.

Shall we agree that the best idea at the moment is to try to play a bit with the NodeMCU (that from your comments seems to be the easier solution in this precise moment of my poor knowledge) and the 2 sensors and see how I get on?

I am playing a bit with NodeMCU.

Please may you kindly troubleshoot this code? I am trying to adapt it from a tutorial:

#include <WiFi.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>

#include <dht.h> // Includes the libraries for the sensor
#include <ESP8266wifi.h>

#include <ThingSpeak.h>
#define DHTPIN D5
#define DHTTYPE DHT22

dht DHT; // Creates a DHT object
const char* ssid = "WiFiName";
const char* password = "Password";
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

void setup()
{
  Serial.begin(115200);
  delay(10);
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  // Print the IP address
  Serial.println(WiFi.localIP());
  ThingSpeak.begin(client);
}

void loop()
{
  static boolean data_state = false;
  float t = DHT.temperature; // Gets the values of the temperature
  float h = DHT.humidity; // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

I received the error "WiFi was not declared in this scope" so I added the WiFi library from the list. I changed the board from "Arduino" to "generic ESP8266" (I also tried NodeMCU 0.9 and NodeMCU 1.0

Now I receive the following error:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

C:\Users\mario\Desktop\Arduino to the Web project 0317\WI-FI codes\NodeMCU_v1\NodeMCU_v1.ino: In function 'void setup()':

NodeMCU_v1:30: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

   WiFi.begin(ssid, password);

                            ^

In file included from C:\Users\mario\Desktop\Arduino to the Web project 0317\WI-FI codes\NodeMCU_v1\NodeMCU_v1.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\WiFi\src/WiFi.h:79:9: error:   initializing argument 1 of 'int WiFiClass::begin(char*, const char*)' [-fpermissive]

     int begin(char* ssid, const char *passphrase);

         ^

exit status 1
invalid conversion from 'const char*' to 'char*' [-fpermissive]

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

NOTE - If I change const char in char* it becomes lot worst with weird error that I do not have absolutely a clue about :frowning:
such as:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

In file included from C:\Users\mario\Documents\Arduino\libraries\dht\dht.h:19:0,

                 from C:\Users\mario\Documents\Arduino\libraries\dht\dht.cpp:41:

C:\Users\mario\Documents\Arduino\libraries\dht\dht.cpp: In member function 'int8_t dht::_readSensor(uint8_t, uint8_t, uint8_t)':

C:\Users\mario\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:226:63: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in initialization

 #define portInputRegister(port)     ((volatile uint32_t*) &GPI)

                                                               ^

C:\Users\mario\Documents\Arduino\libraries\dht\dht.cpp:121:29: note: in expansion of macro 'portInputRegister'

     volatile uint8_t *PIR = portInputRegister(port);

                             ^

exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Please help guys :frowning:

Don't include WiFi.h, use #include <ESP8266WiFi.h>.

You may want to read my Beginner's guide first, if you haven't already.

Pieter

#include <DHT.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ThingSpeak.h>


#define DHTPIN D5
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE); // Creates a DHT object
const char* ssid = "WiFiName";
const char* password = "Password";
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

void setup()
{
  Serial.begin(115200);
  delay(10);
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  // Print the IP address
  Serial.println(WiFi.localIP());
  ThingSpeak.begin(client);
}

void loop()
{
  static boolean data_state = false;
  float t = DHT.temperature; // Gets the values of the temperature
  float h = DHT.humidity; // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

yes I read it thanks (the question is "Did I understand it?" :frowning:

Now I have this error:

#include <DHT.h>
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ThingSpeak.h>


#define DHTPIN D5
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE); // Creates a DHT object
const char* ssid = "WiFiName";
const char* password = "Password";
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

void setup()
{
  Serial.begin(115200);
  delay(10);
  // Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  // Print the IP address
  Serial.println(WiFi.localIP());
  ThingSpeak.begin(client);
}

void loop()
{
  static boolean data_state = false;
  float t = DHT.temperature; // Gets the values of the temperature
  float h = DHT.humidity; // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

I will read that part you linked again, by the way :slight_smile:

#include <DHT.h>
#include <ESP8266WiFi.h> // Include the Wi-Fi library
#include <WiFiClient.h>
#include <ThingSpeak.h>


#define DHTPIN D5
#define DHTTYPE DHT22

DHT dht(DHTPIN, DHTTYPE); // Creates a DHT object
const char* ssid = "WiFiName"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "Password"; // The password of the Wi-Fi network
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

void setup()
{
  Serial.begin(115200); // Start the Serial communication to send messages to the computer
  delay(10);
  // Connect to WiFi network
  Serial.println('\n');
  WiFi.begin(ssid, password); // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid);
  Serial.println(" ...");
  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(++i); Serial.print(' ');
  }

  Serial.println('\n');
  Serial.println("Connection established!");
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
}
ThingSpeak.begin(client);
}

void loop()
{
  static boolean data_state = false;
  float t = DHT.temperature; // Gets the values of the temperature
  float h = DHT.humidity; // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

I liked more your code even if it seems it was doing the same in void setup re the connection bit...

Thanks for that.

It seems that I still have issue with the DHT now:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

In file included from C:\Users\mario\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:22:0:

C:\Users\mario\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

 #include <Adafruit_Sensor.h>

                             ^

compilation terminated.

exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I looked into this issue HERE - Arduino forum

And I installed that lib....

// NodeMCU IoT project with DHT22

// Libraries
#include <DHT.h>
#include <ESP8266WiFi.h> // Include the Wi-Fi library
#include <WiFiClient.h>
#include <ThingSpeak.h>

// Objects and variables definitions
#define DHTPIN D5
#define DHTTYPE DHT22
DHT DHT(DHTPIN, DHTTYPE); // Creates a DHT object
const char* ssid = "WiFiName"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "Password"; // The password of the Wi-Fi network
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

//========================================================================================

void setup()
{
  Serial.begin(115200); // Start the Serial communication to send messages to the computer
  delay(10);
  // Connect to WiFi network
  Serial.println('\n');
  WiFi.begin(ssid, password); // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid);
  Serial.println(" ...");
  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(++i); Serial.print(' ');
  }

  Serial.println('\n');
  Serial.println("Connection established!");
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
}
ThingSpeak.begin(client);
}

//========================================================================================

void loop()
{
  static boolean data_state = false;
  t = dht.readTemperature(); // Gets the values of the temperature
  h = dht.readHumidity(); // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

And now it got worst:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

NodeMCU_v1:10: error: 'D5' was not declared in this scope

 #define DHTPIN D5

                ^

C:\Users\mario\Desktop\Arduino to the Web project 0317\WI-FI codes\NodeMCU_v1\NodeMCU_v1.ino:12:9: note: in expansion of macro 'DHTPIN'

 DHT DHT(DHTPIN, DHTTYPE); // Creates a DHT object

         ^

NodeMCU_v1:43: error: 'ThingSpeak' does not name a type

 ThingSpeak.begin(client);

 ^

NodeMCU_v1:44: error: expected declaration before '}' token

 }

 ^

exit status 1
'D5' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

:frowning:

I looked into THIS example comments

And put "5" instead of "D5" (Do not know why in the tutorial was defined like that...)

// NodeMCU IoT project with DHT22

// Libraries
#include <DHT.h>
#include <ESP8266WiFi.h> // Include the Wi-Fi library
#include <WiFiClient.h>
#include <ThingSpeak.h>

// Objects and variables definitions
#define DHTPIN 5
#define DHTTYPE DHT22
DHT DHT(DHTPIN, DHTTYPE); // Creates a DHT object
const char* ssid = "WiFiName"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "Password"; // The password of the Wi-Fi network
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

//========================================================================================

void setup()
{
  Serial.begin(115200); // Start the Serial communication to send messages to the computer
  delay(10);
  // Connect to WiFi network
  Serial.println('\n');
  WiFi.begin(ssid, password); // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid);
  Serial.println(" ...");
  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(++i); Serial.print(' ');
  }

  Serial.println('\n');
  Serial.println("Connection established!");
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
}
ThingSpeak.begin(client);
}

//========================================================================================

void loop()
{
  static boolean data_state = false;
  t = dht.readTemperature(); // Gets the values of the temperature
  h = dht.readHumidity(); // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

Now I still have the ThingSpeak issue:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

NodeMCU_v1:43: error: 'ThingSpeak' does not name a type

 ThingSpeak.begin(client);

 ^

NodeMCU_v1:44: error: expected declaration before '}' token

 }

 ^

exit status 1
'ThingSpeak' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Just a typo:

// NodeMCU IoT project with DHT22

// Libraries
#include <DHT.h>
#include <ESP8266WiFi.h> // Include the Wi-Fi library
#include <WiFiClient.h>
#include <ThingSpeak.h>

// Objects and variables definitions
#define DHTPIN 5
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE); // Creates a DHT object
const char* ssid = "WiFiName"; // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "Password"; // The password of the Wi-Fi network
WiFiClient client;
unsigned long myChannelNumber = 174314;
const char * myWriteAPIKey = "JQPT38EM56K0MJM1";
uint8_t t, h;

//========================================================================================

void setup()
{
  Serial.begin(115200); // Start the Serial communication to send messages to the computer
  delay(10);
  // Connect to WiFi network
  Serial.println('\n');
  WiFi.begin(ssid, password); // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid);
  Serial.println(" ...");
  int i = 0;
  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(++i); Serial.print(' ');
  }

  Serial.println('\n');
  Serial.println("Connection established!");
  Serial.print("IP address:\t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
  ThingSpeak.begin(client);
}

//========================================================================================

void loop()
{
  static boolean data_state = false;
  t = dht.readTemperature(); // Gets the values of the temperature
  h = dht.readHumidity(); // Gets the values of the humidity
  Serial.print("Temperature Value is :");
  Serial.print(t);
  Serial.println("C");
  Serial.print("Humidity Value is :");
  Serial.print(h);
  Serial.println("%");
  // Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
  // pieces of information in a channel. Here, we write to field 1.
  if ( data_state )
  {
    ThingSpeak.writeField(myChannelNumber, 1, t, myWriteAPIKey);
    data_state = false;
  }
  else
  {
    ThingSpeak.writeField(myChannelNumber, 2, h, myWriteAPIKey);
    data_state = true;
  }
  delay(30000); // ThingSpeak will only accept updates every 15 seconds.
}

Final code is compiling!

I will try to upload it on the hardware and let you know guys :slight_smile:

Uploaded the last posted code and now I have this error:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

Sketch uses 234229 bytes (53%) of program storage space. Maximum is 434160 bytes.
Global variables use 32612 bytes (39%) of dynamic memory, leaving 49308 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I am looking at this guide but advices will be well accepted and appreciated:

Connections:

DHT22
V --> NodeMCU 5V
G --> NodeMCU GND
D --> NodeMCU D5

I am powering the NodeMCU with a Samsung Smartphone S6 charging cable connected to my PC

The standard pin numbers used by the ESP8266 core refer to the pins on the module. The various boards break those out to different places and number them differently so that they are in consecutive order so they use the Dn pin notation. For example, in the nodemcu variant file you will find this code:

static const uint8_t D0   = 16;
static const uint8_t D1   = 5;
static const uint8_t D2   = 4;
static const uint8_t D3   = 0;
static const uint8_t D4   = 2;
static const uint8_t D5   = 14;
static const uint8_t D6   = 12;
static const uint8_t D7   = 13;
static const uint8_t D8   = 15;
static const uint8_t D9   = 3;
static const uint8_t D10 = 1;

So that means if you use the number 5 in your code for a pin that will control the pin on the NodeMCU labeled as 1 on the silkscreen. The reason you got the error when using D5 is because you have the "Generic ESP8266 Module" board selected and the variant used by that board doesn't define any Dn pins:

LordKelvin:
Uploaded the last posted code and now I have this error:

Arduino: 1.8.1 (Windows 7), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"

Sketch uses 234229 bytes (53%) of program storage space. Maximum is 434160 bytes.
Global variables use 32612 bytes (39%) of dynamic memory, leaving 49308 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




I am looking at [this guide](https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/discuss) but advices will be well accepted and appreciated:

See this:
https://github.com/esp8266/Arduino/blob/master/doc/faq/a01-espcomm_sync-failed.md

Dear pert you are a very good man :slight_smile:

I solved straightway putting back D5 and changing the board to NodeMCU 1.0 :slight_smile:

I tried also NodeMCU 0.9 with NO DIFFERENCE.. weird?

The only issue now is:

Do you notice the weird string on top? :o :o :o

That's nothing to worry about.

LordKelvin:
yes I read it thanks (the question is "Did I understand it?" :frowning:

What are the parts you struggled with? Do you understand it now? How can I improve the guide?

Pieter

PieterP:
That's nothing to worry about.
What are the parts you struggled with? Do you understand it now? How can I improve the guide?

Pieter

Thanks really everyone. Next step I would like to connect also my Oxygen sensor and my analytical scale. I will have a go next week :slight_smile:

re your guide I believe it is very helpful, simple to understand. On my side the issue is not having enough understanding of some topic like networks or electronic in general but you tried to keep it simple anyway.
So I believe that is very worth it. Thanks for that great job mate.

M.

Hi...
I am using Arduino UNO with ESP 8266-01...
My project is to upload the temp & humidity values from DHT 11 to thingspeak account..
When I am uploading the following code I am getting the following errors:
"warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed"

Code:
#include <SoftwareSerial.h>
#include <dht.h>

#define DEBUG 1 // change value to 1 to enable debuging using serial monitor
#define dht_pin A0 // defining pin A0 for DHT sensor

dht DHT;
SoftwareSerial esp8266Module(10,11); // RX, TX

String network = "SSID"; // your access point SSID
String password = "PASSWORD"; // your wifi Access Point password
#define IP "184.106.153.149" // IP address of thingspeak.com
String GET = "GET/update?key=THINGSPEAK CHANNEL KEY"; // replace with your channel key

void setup()
{
if(DEBUG){
Serial.begin(9600); // Setting hardware serial baud rate to 9600
}
esp8266Module.begin(9600); // Setting softserial baud rate to 9600
delay(2000);
}

void loop()
{
setupEsp8266();
DHT.read11(dht_pin);
double humi = DHT.humidity;
double temp = DHT.temperature;

updateTemp(String(temp), String(humi));
delay(30000);
}

//-------------------------------------------------------------------
// Following function setup the esp8266, put it in station made and
// connect to wifi access point.
//------------------------------------------------------------------
void setupEsp8266()
{
if(DEBUG){
Serial.println("Reseting esp8266");
}
esp8266Module.flush();
esp8266Module.println(F("AT+RST"));
delay(7000);
if (esp8266Module.find("OK"))
{
if(DEBUG){
Serial.println("Found OK");
Serial.println("Changing esp mode");
}
esp8266Module.flush();
changingMode();
delay(5000);
esp8266Module.flush();
connectToWiFi();
}
else
{
if(DEBUG){
Serial.println("OK not found");
}
}
}

//-------------------------------------------------------------------
// Following function sets esp8266 to station mode
//-------------------------------------------------------------------
bool changingMode()
{
esp8266Module.println(F("AT+CWMODE=1"));
if (esp8266Module.find("OK"))
{
if(DEBUG){
Serial.println("Mode changed");
}
return true;
}
else if(esp8266Module.find("NO CHANGE")){
if(DEBUG){
Serial.println("Already in mode 1");
}
return true;
}
else
{
if(DEBUG){
Serial.println("Error while changing mode");
}
return false;
}
}

//-------------------------------------------------------------------
// Following function connects esp8266 to wifi access point
//-------------------------------------------------------------------
bool connectToWiFi()
{
if(DEBUG){
Serial.println("inside connectToWiFi");
}
String cmd = F("AT+CWJAP="");
cmd += network;
cmd += F("","");
cmd += password;
cmd += F(""");
esp8266Module.println(cmd);
delay(15000);

if (esp8266Module.find("OK"))
{
if(DEBUG){
Serial.println("Connected to Access Point");
}
return true;
}
else
{
if(DEBUG){
Serial.println("Could not connect to Access Point");
}
return false;
}
}

//-------------------------------------------------------------------
// Following function sends sensor data to thingspeak.com
//-------------------------------------------------------------------
void updateTemp(String voltage1,String voltage2)
{
String cmd = "AT+CIPSTART="TCP","";
cmd += IP;
cmd += "",80";
esp8266Module.println(cmd);
delay(5000);
if(esp8266Module.find("Error")){
if(DEBUG){
Serial.println("ERROR while SENDING");
}
return;
}
cmd = GET + "&field1=" + voltage1 + "&field2=" + voltage2 + "\r\n";
esp8266Module.print("AT+CIPSEND=");
esp8266Module.println(cmd.length());
delay(15000);
if(esp8266Module.find(">"))
{
esp8266Module.print(cmd);
if(DEBUG){
Serial.println("Data sent");
}
}else
{
esp8266Module.println("AT+CIPCLOSE");
if(DEBUG){
Serial.println("Connection closed");
}
}
}

Please help me in resolving the error..
Thanks in anticipation.