Return to site

Espressif ESP32 Quick Connection Guide

· embedded

Espressif ESP32 Quick Connection Guide

Wednesday, 01-FEB-17, by Wolf Scott @ IOIHAN Development (www.ioihan.com)

How to connect the ESP32 development board as a client via WiFi to an access point without setting up the entire tool-chain or writing any code. If you want to use the AT command set, you can find the reference on how to download the firmware here: ESP32 AT Instruction Set & Firmware Download My goal was a code-less test.

There isn’t a lot of information out there on this little device. I quickly discovered a very simple task quite frustrating, namely, connect to my access point and send an HTTP POST request via the serial port. The ESP32 is NOT compatible with the ESP8266 at this command level.

I’ve broken this down into 2 posts and wanted to share what I’ve discovered to hopefully speed things up on what should be a very simple task for such a tiny device, and so that I have this information handy in the future as well.

The goal: Connect my ESP32 Development board as a client via WiFi to my access point without installing the tool-chain or writing any code.

 

I’ll cut to the chase and give you the commands for those that hate to read. See the notes below for additional details. I am running Windows 10, 64bit with the Arduino IDE version 1.6.12. (The Arduino IDE is only being used for the serial terminal)

 

I’m using the Espressif ESP32 development board – Developer Edition, from adaFruit. https://www.adafruit.com/products/3269 This thing is too big to be useful on my proto board but since I’m only using the USB connection, no worries; it keeps it from flopping around.

This development board has a USB connector which makes it quite easy to kick the tires and see how this little chip performs. So, let’s do some kicking.

  • Connect the ESP32 using the USB to your PC and observe the COM port  (First time I connected this, the drivers automatically installed)
  • Launch the Arduino IDE (or your favorite Serial Terminal – I’ve used RealTerm too)
  • Change the COM Port to match where the ESP32 resides with 115200 Baud,  N/8/1
  • My Arduino IDE defaulted to NL & CR on send (but CR only will work just fine;  NL only will NOT)

Press the RESET button on the ESP32 Development board and you should get a screen full of info. My ESP32 wanted to be an AP, while interesting, wasn’t where I wanted to begin. I’m going to show the commands on their own line and the description of what it does on the line following; type the whole line as you see it or cut-paste. Case IS important. There IS a space between the command and the options.

  • op -Q
    • Query the current mode of the board
  • op -S -o 1
    • SET into Station mode; 1 = Station Mode, 2 = AP mode, 3 = both
  • sta -Q
    • Query the current mode of the STAtion (should show Disconnected)
  • sta -S
    • SCAN for available access points; the prompt returns immediately but the data shows up a moment or two after. “+SCAN_DONE:OK!” is the immediate reply, with the list shortly after showing the MAC,  encryption method, channel, signal strength and 2 more parameters I’ve not confirmed, but believe to be # of allowed connections and hidden ssid flag. (if you know, please leave a comment)
  • sta -C -s YOURSSID -p YOURPASSWORD
    • if “YOURSSID” was in range and accepts the password, you should get “+JAP:WIFICONNECTED” and you’re online. I did not use quotes around the SSID and Password parameters.
  • sta -D
    • Disconnect: I received “+JAP:DISCONNECTED,0,8”

These two command sections deal with the Operation (op) and the Station (sta). The first group set the ESP32 into Station mode. If you query after performing these commands, you will see the ESP32 is now in Station Mode. (op -Q)

 

The “sta -C” was undocumented but I saw it being used in an example and surmised that was the “connect” command and was rewarded with a connected ESP32 – yay!

 

There are a few other interesting tidbits in the “sta” command lineup;

 

sta -S -n 11

 

Scan a specific channel. Replace 11 with your channel of choice. The scan command by itself lists all the SSID’s it can see which includes the associated channel in the data, so not quite sure how useful a channel filter is unless perhaps you were seeking a very specific access point when there are duplicate SSID’s in your environment instead of relying on the system to vote on which it should accept.

 

I’ve noticed that on various commands, when they have invalid data, wrong password for example, cause what appears to be an endless retry and constant replies of +JAP:DISCONNECTED,0,xx; (and more) To stop the constant retries I send a disconnect command: sta -D to regain steady control.

 

I heard somewhere that the ESP32 supports WAP2 Enterprise Authentication for the client to join Enterprise Class networks but have not found any references. Would have expected a User ID field in the above connection command list, but no reference.

 

The document I used as reference can be found here: https://github.com/CHERTS/esp32-devkit/blob/master/Espressif/docs/ESP32/ESP32%20Getting%20Started%20Guide%20for%20SDK%20based%20on%20FreeRTOS.pdf

 

I may follow up with chip state monitoring and other topics, but this first test was to kick the tires and test some chip responses and ranges to determine just how useful this little gem will be. I’m optimistic despite the lack of docs and so far am quite impressed. I’m a long-time fan of the ESP8266 so let the fun begin.

 

Drop me a comment if any of this is useful.

 

Cheers,

\\//\\//olf

Wolf Scott, IOIHAN Development

These two command sections deal with the Operation (op) and the Station (sta). The first group set the ESP32 into Station mode. If you query after performing these commands, you will see the ESP32 is now in Station Mode. (op -Q)

The “sta -C” was undocumented but I saw it being used in an example and surmised that was the “connect” command and was rewarded with a connected ESP32 – yay!

There are a few other interesting tidbits in the “sta” command lineup;

sta -S -n 11

Scan a specific channel. Replace 11 with your channel of choice. The scan command by itself lists all the SSID’s it can see which includes the associated channel in the data, so not quite sure how useful a channel filter is unless perhaps you were seeking a very specific access point when there are duplicate SSID’s in your environment instead of relying on the system to vote on which it should accept.

I’ve noticed that on various commands, when they have invalid data, wrong password for example, cause what appears to be an endless retry and constant replies of +JAP:DISCONNECTED,0,xx; (and more) To stop the constant retries I send a disconnect command: sta -D to regain steady control.

I heard somewhere that the ESP32 supports WAP2 Enterprise Authentication for the client to join Enterprise Class networks but have not found any references. Would have expected a User ID field in the above connection command list, but no reference.

The document I used as reference can be found here: https://github.com/CHERTS/esp32-devkit/blob/master/Espressif/docs/ESP32/ESP32%20Getting%20Started%20Guide%20for%20SDK%20based%20on%20FreeRTOS.pdf

I may follow up with chip state monitoring and other topics, but this first test was to kick the tires and test some chip responses and ranges to determine just how useful this little gem will be. I’m optimistic despite the lack of docs and so far am quite impressed. I’m a long-time fan of the ESP8266 so let the fun begin.

Drop me a comment if any of this is useful.