What is the proper wiring for connecting ESP8266 to Arduino UNO

  • Thread starter Deleted member 750607
  • Start date

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
the purpose of the circuit is to track the International Space Station and display the coordinates in the serial monitor

I know rx and tx go to corresponding arduino pins, and 3v3/GND are straight forward...but there are also RST, IO0, EN, and IO2 pins...there are many schematics online but im not sure what's right for my project

(also, my sketch is getting "error compiling for Arduino UNO board" message, but I thought maybe that was due to improper wiring?)

is it ok to run the esp8266 on Arduino UNO's 3.3v pin? my esp8266 is getting warm, if not hot

thx in advance, you guys are awesome!
 
Last edited by a moderator:

djsfantasi

Joined Apr 11, 2010
9,156
the purpose of the circuit is to track the International Space Station and display the coordinates in the serial monitor

I know rx and tx go to corresponding arduino pins, and 3v3/GND are straight forward...but there are also RST, IO0, EN, and IO2 pins...there are many schematics online but im not sure what's right for my project

(also, my sketch is getting "error compiling for Arduino UNO board" message, but I thought maybe that was due to improper wiring?)

is it ok to run the esp8266 on Arduino UNO's 3.3v pin? my esp8266 is getting warm, if not hot

thx in advance, you guys are awesome!
First, the error you receive has nothing to do with the wiring and everything to do with the sketch.

I recommend you either attach the sketch to a post (you may have to temporarily rename it to a .txt file) or include the sketch in the post between CODE tags.
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
I got this example code from a book...also can you help with the wiring too and not just the code?:
#include "USE_ESP8266.h"
#include <TimeLib.h>
char server [] = "api.open-notify.org";
int digitalClockDisplay();

void setup ()
{
  Serial.begin(9600);
  if (!configureNetwork()) //start the network
  {
    Serial.println("Failed to condigure the network");
    while(1)
    {
      delay(0); //halt; ESP8266 does not like infinity loop without a delay
    }
  }
int ret = client.connect(server, 80);
if (ret == 1)
{
  Serial.println("Connected");
  client.println("GET /iss-now.json HTTP/1.0"); //the http request
  client.print("Host: "); client.println(server);
  client.println("Connection: close");
  client.println();
}
else
{
  Serial.println("Connection failed, error was: ");
  Serial.print(ret, DEC);
  while(1)
  {
    delay(0); //halt; esp8266 does not like infinite loop without a delay
  }
}
}

char timestampMarker[] = "\"timestamp\":";
char posMarker[] = "\"iss_position\":";

void loop ()
{
  if (client.available())
  {
    String id = client.readStringUntil('"');
    if (id.equals("timestamp")) //start of timestamp
    {
      if (client.find(':')) //a ":" follows each identifier
      {
      unsigned long timestamp = client.parseInt();
      setTime(timestamp);
      digitalClockDisplay();
      }
      else
      {
        Serial.println("failed to parse timestamp.");
      }
    }
    if (id.equals("iss_position")) //start of position data
    {
      if (client.find(':'))
      {
       while(client.peek () != '}' && client.find('"'))
       {
        String id = client.readStringUntil ('"');
        float val = client.parseFloat ();
        client.find ('"');
        Serial.print(id + ":"); Serial.println(val, 4);
       }
      }
      else
      {
        Serial.print("Failed to parse position data.");
      }
    }
  }
if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    while(1)
  {
    delay (0); //halt, esp8266 does not like loop w/o delay
  }
}
}
String padDigits(int digit)
{
  String str = String("0") + digit; //put a zero in front of digit
  return str.substring(str.length() - 2);
}


THEN, HERE IS MY HEADER FILE from the exemple code:

Code:
#include <SPI.h>
#include <WiFiNINA.h>
const char ssid[] = "Home25";
const char password[] = "6033216098";
WiFiClient client;

bool configureNetwork()
{
  int status = WL_IDLE_STATUS; //wifi status

  if (WiFi.status() == WL_NO_MODULE)
  {
    Serial.println("Couldn't find WiFi hardware.");
    return false;
  }
  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION)
  {
    Serial.println("Please upgrade your WiFi firmware");
  }
  while (status != WL_CONNECTED)
  {
    Serial.print("Attempting Wifi connection to ");
    status = WiFi.begin("Home25","6033216098");
    delay (1000);
  }
  return true;
}
 
Last edited by a moderator:

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
I got this example code from a book...also can you help with the wiring too and not just the code?:
#include "USE_ESP8266.h"
#include <TimeLib.h>
char server [] = "api.open-notify.org";
int digitalClockDisplay();

void setup ()
{
  Serial.begin(9600);
  if (!configureNetwork()) //start the network
  {
    Serial.println("Failed to condigure the network");
    while(1)
    {
      delay(0); //halt; ESP8266 does not like infinity loop without a delay
    }
  }
int ret = client.connect(server, 80);
if (ret == 1)
{
  Serial.println("Connected");
  client.println("GET /iss-now.json HTTP/1.0"); //the http request
  client.print("Host: "); client.println(server);
  client.println("Connection: close");
  client.println();
}
else
{
  Serial.println("Connection failed, error was: ");
  Serial.print(ret, DEC);
  while(1)
  {
    delay(0); //halt; esp8266 does not like infinite loop without a delay
  }
}
}

char timestampMarker[] = "\"timestamp\":";
char posMarker[] = "\"iss_position\":";

void loop ()
{
  if (client.available())
  {
    String id = client.readStringUntil('"');
    if (id.equals("timestamp")) //start of timestamp
    {
      if (client.find(':')) //a ":" follows each identifier
      {
      unsigned long timestamp = client.parseInt();
      setTime(timestamp);
      digitalClockDisplay();
      }
      else
      {
        Serial.println("failed to parse timestamp.");
      }
    }
    if (id.equals("iss_position")) //start of position data
    {
      if (client.find(':'))
      {
       while(client.peek () != '}' && client.find('"'))
       {
        String id = client.readStringUntil ('"');
        float val = client.parseFloat ();
        client.find ('"');
        Serial.print(id + ":"); Serial.println(val, 4);
       }
      }
      else
      {
        Serial.print("Failed to parse position data.");
      }
    }
  }
if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    while(1)
  {
    delay (0); //halt, esp8266 does not like loop w/o delay
  }
}
}
String padDigits(int digit)
{
  String str = String("0") + digit; //put a zero in front of digit
  return str.substring(str.length() - 2);
}


THEN, HERE IS MY HEADER FILE from the exemple code:

Code:
#include <SPI.h>
#include <WiFiNINA.h>
const char ssid[] = "Home25";
const char password[] = "6033216098";
WiFiClient client;

bool configureNetwork()
{
  int status = WL_IDLE_STATUS; //wifi status

  if (WiFi.status() == WL_NO_MODULE)
  {
    Serial.println("Couldn't find WiFi hardware.");
    return false;
  }
  String fv = WiFi.firmwareVersion();
  if (fv < WIFI_FIRMWARE_LATEST_VERSION)
  {
    Serial.println("Please upgrade your WiFi firmware");
  }
  while (status != WL_CONNECTED)
  {
    Serial.print("Attempting Wifi connection to ");
    status = WiFi.begin("Home25","6033216098");
    delay (1000);
  }
  return true;
}
EDIT:
its not warm anymore, I had the wrong pin connected
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
First, the error you receive has nothing to do with the wiring and everything to do with the sketch.

I recommend you either attach the sketch to a post (you may have to temporarily rename it to a .txt file) or include the sketch in the post between CODE tags.
I fixed a few things I noticed were wrong in the header file, and now this is the error message

"pyserial or esptool directories not found next to this upload.py tool.
An error occurred while uploading the sketch"
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
trying to use example code from a book, Arduino UNO and esp8266 to track the international space station and display longitude and latitude on serial monitor
but don't understand this error message:

pyserial or esptool directories not found next to this upload.py tool.
An error occurred while uploading the sketch

main code:
#include "USE_ESP8266.h"
#include <TimeLib.h>
char server [] = "api.open-notify.org";
void digitalClockDisplay();

void setup ()
{
  Serial.begin(9600);
  if (!configureNetwork()) //start the network
  {
    Serial.println("Failed to configure the network");
    while(1)
    {
      delay(0); //halt; ESP8266 does not like infinity loop without a delay
    }
   }
int ret = client.connect(server, 80);
if (ret == 1)
{
  Serial.println("Connected");
  client.println("GET /iss-now.json HTTP/1.0"); //the http request
  client.print("Host: "); client.println(server);
  client.println("Connection: close");
  client.println();
}
else
{
  Serial.println("Connection failed, error was: ");
  Serial.print(ret, DEC);
  while(1)
  {
    delay(0); //halt; esp8266 does not like infinite loop without a delay
  }
}
}

char timestampMarker[] = "\"timestamp\":";
char posMarker[] = "\"iss_position\":";

void loop ()
{
  if (client.available())
  {
    String id = client.readStringUntil('"');
    if (id.equals("timestamp")) //start of timestamp
    {
      if (client.find(':')) //a ":" follows each identifier
      {
      unsigned long timestamp = client.parseInt();
      setTime(timestamp);
      digitalClockDisplay();
      }
      else
      {
        Serial.println("failed to parse timestamp.");
      }
    }
    if (id.equals("iss_position")) //start of position data
    {
      if (client.find(':'))
      {
       while(client.peek () != '}' && client.find('"'))
       {
        String id = client.readStringUntil ('"');
        float val = client.parseFloat ();
        client.find ('"');
        Serial.print(id + ":"); Serial.println(val, 4);
       }
      }
      else
      {
        Serial.print("Failed to parse position data.");
      }
    }
  }
if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    while(1)
  {
    delay (0); //halt, esp8266 does not like loop w/o delay
  }
}
}
String padDigits(int digit)
{
  String str = String("0") + digit; //put a zero in front of digit
  return str.substring(str.length() - 2);
}

void digitalClockDisplay ()
{
  String datestr = String(year()) + "-" + padDigits(month()) +
                   "-" + padDigits(day());
  String timestr = String(hour()) + ":" + padDigits(minute()) +
                   ":" + padDigits(second());
  Serial.println(datestr + " " + timestr);
}
header file:
#include <SPI.h>
#include <ESP8266WiFi.h>
const char ssid[] = "Home25";
const char password[] = "6033216098";
WiFiClient client;

bool configureNetwork()
{
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay (1000);
    Serial.print("Waiting for connection to "); Serial.println(ssid);
  }
    return true;
  }
 
Last edited by a moderator:

Ya’akov

Joined Jan 27, 2019
9,072
I fixed a few things I noticed were wrong in the header file, and now this is the error message

"pyserial or esptool directories not found next to this upload.py tool.
An error occurred while uploading the sketch"
That's a MacOS problem with Bug Sur and Python. The solution is to edit:

Code:
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial/serial/tools/list_ports_osx.py
You need to comment out two line, they should be 20 and 30 and add these just under:

Code:
  iokit = ctypes.cdll.LoadLibrary(‘/System/Library/Frameworks/IOKit.framework/IOKit’)
   cf = ctypes.cdll.LoadLibrary(‘/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation’)
The two lines will look the same with different details.

For now, any time you change ESP library versions and get this error, it is because these lines are wrong and need to be changed. This will fix it.
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
That's a MacOS problem with Bug Sur and Python. The solution is to edit:

Code:
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/tools/pyserial/serial/tools/list_ports_osx.py
You need to comment out two line, they should be 20 and 30 and add these just under:

Code:
  iokit = ctypes.cdll.LoadLibrary(‘/System/Library/Frameworks/IOKit.framework/IOKit’)
   cf = ctypes.cdll.LoadLibrary(‘/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation’)
The two lines will look the same with different details.

For now, any time you change ESP library versions and get this error, it is because these lines are wrong and need to be changed. This will fix it.
so I add /* ... *\ ? also, which lines get this? I don't know how to do this
 

Ya’akov

Joined Jan 27, 2019
9,072
so I add /* ... *\ ? also, which lines get this? I don't recognize the ones you sent
Locate the file ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py

Find the two lines (lines 29,30) that look like the replacements. Use # in front of each to comment them, then replace them with the new ones just below, as:

Code:
#iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
#cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))

iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
Locate the file ~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py

Find the two lines (lines 29,30) that look like the replacements. Use # in front of each to comment them, then replace them with the new ones just below, as:

Code:
#iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
#cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))

iokit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/IOKit.framework/IOKit')
cf = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation')
ok, one more thing, where is that file located?
 

Ya’akov

Joined Jan 27, 2019
9,072
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py is the full path to the file. The ~ is your home directory. So, /Users/<home> in front of that, but ~ is auto expanded into your directory.
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py is the full path to the file. The ~ is your home directory. So, /Users/<home> in front of that, but ~ is auto expanded into your directory.
I don't see it when I search in my "finder"
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py is the full path to the file. The ~ is your home directory. So, /Users/<home> in front of that, but ~ is auto expanded into your directory.
Is the file somewhere on my Mac already? Where?
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py is the full path to the file. The ~ is your home directory. So, /Users/<home> in front of that, but ~ is auto expanded into your directory.
does it start like this? :

Arduino build test log started on Mon May 1 14:19:22 JST 2017

sketches=examples/Gyro/Gyro.ino examples/Interrupt/Interrupt.ino
boards= arduino:avr:uno Intel:arc32:arduino_101

## sketch=examples/Gyro/Gyro.ino
##################################
/Applications/Arduino-1.8.2.app/Contents/MacOS/Arduino --board arduino:avr:uno --verbose --verify examples/Gyro/Gyro.ino
Loading configuration...
Initializing packages...
Could not find boards.txt in /Users/johndoe/Documents/Arduino/hardware/Arduino_STM32/examples. Is it pre-1.5?
Preparing boards...
Verifying...
 

Ya’akov

Joined Jan 27, 2019
9,072
Is the file somewhere on my Mac already? Where?
I'm sorry. I have told you twice now. This:

~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py

is the path to the file. That's where it is. It's in that directory. The last part: list_ports_osx.py is the name of the file, the rest is the path to the folder it is in.

It is in your home directory;
in the Library folder;
In the Arduino15 folder in the Library folder;
in the packages folder in the Arduino15 folder in the Library folder;
in esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the esp8266 folder in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the 2.7.3 folder n the esp8266 folder in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the tools folder in the 2.7.3 folder n the esp8266 folder in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder
 

Thread Starter

Deleted member 750607

Joined Dec 31, 1969
0
I'm sorry. I have told you twice now. This:

~/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.3/tools/pyserial/serial/tools/list_ports_osx.py

is the path to the file. That's where it is. It's in that directory. The last part: list_ports_osx.py is the name of the file, the rest is the path to the folder it is in.

It is in your home directory;
in the Library folder;
In the Arduino15 folder in the Library folder;
in the packages folder in the Arduino15 folder in the Library folder;
in esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the esp8266 folder in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the 2.7.3 folder n the esp8266 folder in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder;
in the tools folder in the 2.7.3 folder n the esp8266 folder in the hardware folder in the esp8266 folder in the packages in the Arduino15 folder in the Library folder
sorry but one more question...is this file definitely already on my Mac or will I need to download it?
 
Top