ESPRESSIF SYSTEMS ESP32WROOM32U Wi-Fi & Bluetooth Internet of Things Module User Manual ESP32 WROOM 32U User Guide EN pages
ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD Wi-Fi & Bluetooth Internet of Things Module ESP32 WROOM 32U User Guide EN pages
Users Manual
![!Version 1.0 Copyright © 2017ESP32-WROOM-32U User Guide](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-1.png)
![About This Guide This document is intended to help users set up the basic software development environment for developing applications using hardware based on the ESP32-WROOM-32U. Through a simple example, this document illustrates how to use ESP-IDF (Espressif IoT Development Framework), including the menu based configuration wizard, compiling the ESP-IDF and firmware download to the ESP32 module. Release Notes DateVersionRelease notes2017.11V1.0First release.](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-2.png)
![Table of Contents 1. Introduction!1".............................................................................................................................1.1. ESP32-WROOM-32U!1".................................................................................................................1.2. ESP-IDF!1".....................................................................................................................................1.3. Preparation!1".................................................................................................................................2. Get Started!2".............................................................................................................................2.1. Standard Setup of Toolchain for Linux!2".......................................................................................2.1.1. Install Prerequisites!2".......................................................................................................2.1.2. Toolchain Setup!2"............................................................................................................2.2. Get ESP-IDF!3"...............................................................................................................................2.3. Set up Path to ESP-IDF!3".............................................................................................................3. Start a Project!4".........................................................................................................................4. Connect!5"..................................................................................................................................5. Configure!6"................................................................................................................................6. Build and Flash!7".......................................................................................................................6.1. Build and Flash!7"..........................................................................................................................6.2. Monitor!8".......................................................................................................................................7. SSC Command Reference!9".....................................................................................................7.1. op!9"...............................................................................................................................................7.2. sta!9"..............................................................................................................................................7.3. ap!10".............................................................................................................................................7.4. mac!10"..........................................................................................................................................7.5. dhcp!11".........................................................................................................................................7.6. ip!11"..............................................................................................................................................7.7. reboot!12".......................................................................................................................................7.8. ram!12...........................................................................................................................................](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-3.png)
![!1. Introduction1. Introduction 1.1. ESP32-WROOM-32U ESP32-WROOM-32U is a powerful, generic Wi-Fi+BT+BLE MCU module that targets a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding. ESP32-WROOM-32U integrates a U.FL connector. At the core of this module is the ESP32-D0WD chip. ESP32 integrates Wi-Fi (2.4 GHz band) and Bluetooth 4.2 solutions on a single chip, along with dual high performance cores and many other versatile peripherals. Powered by 40 nm technology, ESP32 provides a robust, highly integrated platform to meet the continuous demands for efficient power usage, compact design, security, high performance, and reliability. Espressif provides the basic hardware and software resources that empowers application developers to build their ideas around the ESP32 series hardware. The software development framework provided by Espressif is intended for rapidly developing Internet-of-Things (IoT) applications, with Wi-Fi, Bluetooth, flexible power management and other advanced system features. The RF frequency range is 2.412 GHz to 2.484 GHz. The maximum RF transmit power is 21.5 dbm. The manufacturer is Espressif Systems (Shanghai) Pte., Ltd (referred to as ESPRESSIF SYSTEMS), which is shown at the bottom of the product. 1.2. ESP-IDF The Espressif IoT Development Framework (ESP-IDF for short) is a framework for developing applications based on the Espressif ESP32. Users can develop applications in Windows/Linux/MacOS based on ESP-IDF. It is recommended to use Linux distribution. Lubuntu 16.04 has been used as an example in this document for illustration purposes. 1.3. Preparation To develop applications for ESP32 you need: •PC loaded with either Windows, Linux or Mac operating system •Toolchain to build the Application for ESP32 •ESP-IDF that essentially contains API for ESP32 and scripts to operate the Toolchain •A text editor to write programs (Projects) in C, e.g. Eclipse •The ESP32 board itself and a USB cable to connect it to the PC Espressif!/1212017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-4.png)
![!2. Get Started2. Get Started 2.1. Standard Setup of Toolchain for Linux The quickest way to start development with ESP32 is by installing a prebuilt toolchain. Pick up your OS below and follow provided instructions. 2.1.1. Install Prerequisites To compile with ESP-IDF you need to get the following packages: •CentOS 7: sudoyuminstallgitwgetmakencurses-develflexbisongperfpythonpyserial•Ubuntu and Debian: sudoapt-getinstallgitwgetmakelibncurses-devflexbisongperfpythonpython-serial•Arch: sudopacman-S--neededgccgitmakencursesflexbisongperfpython2-pyserial2.1.2. Toolchain Setup ESP32 toolchain for Linux is available for download from Espressif website: •for 64-bit Linux: https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz •for 32-bit Linux: https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-61-gab8375a-5.2.0.tar.gz Download this file, then extract it in ~/esp directory mkdir-p~/espcd~/esptar-xzf~/Downloads/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gzThe toolchain will be extracted into ~/esp/xtensa-esp32-elf/ directory. To use it, you will need to update your ``PATH`` environment variable in ~/.bash_profile file. To make xtensa-esp32-elf` available for all terminal sessions, add the following line to your ~/.bash_profile file: exportPATH=$PATH:$HOME/esp/xtensa-esp32-elf/binAlternatively, you may create an alias for the above command. This way you can get the toolchain only when you need it. To do this, add different line to your ~/.bash_profile file: aliasget_esp32="exportPATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin"Espressif!/1222017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-5.png)
![!2. Get StartedThen when you need the toolchain you can type get_esp32 on the command line and the toolchain will be added to your PATH. 2.2. Get ESP-IDF Once you have the toolchain (that contains programs to compile and build the application) installed, you also need ESP32 specific API / libraries. They are provided by Espressif in ESP-IDF repository. To get it, open terminal, navigate to the directory you want to put ESP-IDF, and clone it using gitclone command: cd~/espgitclone--recursivehttps://github.com/espressif/esp-idf.gitESP-IDF will be downloaded into ~/esp/esp-idf. 2.3. Set up Path to ESP-IDF The toolchain programs access ESP-IDF using IDF_PATH environment variable. This variable should be set up on your PC, otherwise projects will not build. Setting may be done manually, each time PC is restarted. Another option is to set up it permanently by defining IDF_PATH in user profile. To do so, follow instructions specific to :ref:`Windows <add-idf_path-to-profile-windows>`, :ref:`Linux and MacOS <add-idf_path-to-profile-linux-macos>` in section :doc:`add-idf_path-to-profile`. 📖 Note: •While cloning submodules on Windows platform, the gitclone command may print some output starting ':notavalididentifier.... This is a known issue but the git clone still succeeds without any problems. •Do not miss the --recursive option. If you have already cloned ESP-IDF without this option, run another command to get all the submodules: cd~/esp/esp-idfgitsubmoduleupdate--initEspressif!/1232017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-6.png)
![!3. Start a Project3. Start a Project Now you are ready to prepare your application for ESP32. To start off quickly, we will use :example:`get-started/hello_world project from :idf:`examples` directory in IDF. Copy :example:`get-started/hello_world` to ~/esp directory: cd~/espcp-r$IDF_PATH/examples/get-started/hello_world.You can also find a range of example projects under the :idf:`examples` directory in ESP-IDF. These example project directories can be copied in the same way as presented above, to begin your own projects. 📖 Note: The ESP-IDF build system does not support spaces in paths to ESP-IDF or to projects.Espressif!/1242017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-7.png)
![!4. Connect4. Connect You are almost there. To be able to proceed further, connect ESP32 board to PC, check under what serial port the board is visible and verify if serial communication works. If you are not sure how to do it, check instructions in section :doc:`establish-serial-connection`. Note the port number, as it will be required in the next step.!Espressif!/1252017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-8.png)
![!4. Configure 5. Configure Being in terminal window, go to directory of hello_world application by typing cd~/esp/hello_world. Then start project configuration utility menuconfig: cd~/esp/hello_worldmakemenuconfigIf previous steps have been done correctly, the following menu will be displayed: ! In the menu, navigate to Serial flasher config > Default serial port to configure the serial port, where project will be loaded to. Confirm selection by pressing enter, save configuration by selecting < Save > and then exit application by selecting < Exit >. Here are couple of tips on navigation and use of menuconfig: •Use up & down arrow keys to navigate the menu. •Use Enter key to go into a submenu, Escape key to go out or to exit. •Type ? to see a help screen. Enter key exits the help screen. •Use Space key, or Y and N keys to enable (Yes) and disable (No) configuration items with checkboxes “[*]“. •Pressing ? while highlighting a configuration item displays help about that item. •Type / to search the configuration items. 📖 Notes: •On Windows, serial ports have names like COM1. On MacOS, they start with /dev/cu.. On Linux, they start with /dev/tty. (See :doc:`establish-serial-connection` for full details.) •If you are Arch Linux user, navigate to SDK tool configuration and change the name of Python 2 interpreter from python to python2. •Most ESP32 development boards have a 40 MHz crystal installed. However, some boards use a 26 MHz crystal. If your board uses a 26MHz crystal, or you get garbage output from serial port after code upload, adjust the :ref:`CONFIG_ESP32_XTAL_FREQ_SEL` option in menuconfig.Espressif!/1262017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-9.png)
![!5. Build and Flash6. Build and Flash 6.1. Build and Flash Now you can build and flash the application. Run: makeflashThis will compile the application and all the ESP-IDF components, generate bootloader, partition table, and application binaries, and flash these binaries to your ESP32 board. esptool.pyv2.0-beta2Flashingbinariestoserialport/dev/ttyUSB0(appatoffset0x10000)...esptool.pyv2.0-beta2Connecting........___Uploadingstub...Runningstub...Stubrunning...Changingbaudrateto921600Changed.AttachingSPIflash...Configuringflashsize...Auto-detectedFlashsize:4MBFlashparamssetto0x0220Compressed11616bytesto6695...Wrote11616bytes(6695compressed)at0x00001000in0.1seconds(effective920.5kbit/s)...Hashofdataverified.Compressed408096bytesto171625...Wrote408096bytes(171625compressed)at0x00010000in3.9seconds(effective847.3kbit/s)...Hashofdataverified.Compressed3072bytesto82...Wrote3072bytes(82compressed)at0x00008000in0.0seconds(effective8297.4kbit/s)...Hashofdataverified.Leaving...Hardresetting...Espressif!/1272017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-10.png)
![!5. Build and FlashIf there are no issues, at the end of build process, you should see messages describing progress of loading process. Finally, the end module will be reset and “hello_world” application will start. If you'd like to use the Eclipse IDE instead of running make, check out the :doc:`Eclipse guide <eclipse-setup>`. 6.2. Monitor To see if “hello_world” application is indeed running, type makemonitor. This command is launching :doc:`IDF Monitor <idf-monitor>` application: $makemonitorMONITOR---idf_monitoron/dev/ttyUSB0115200------Quit:Ctrl+]|Menu:Ctrl+T|Help:Ctrl+TfollowedbyCtrl+H---etsJun8201600:22:57rst:0x1(POWERON_RESET),boot:0x13(SPI_FAST_FLASH_BOOT)etsJun8201600:22:57...Several lines below, after start up and diagnostic log, you should see “Hello world!” printed out by the application. ...Helloworld!Restartingin10seconds...I(211)cpu_start:StartingscheduleronAPPCPU.Restartingin9seconds...Restartingin8seconds...Restartingin7seconds...To exit monitor use shortcut Ctrl+]. To execute makeflash and makemonitor in one shoot type makeflashmonitor. Check section :doc:`IDF Monitor <idf-monitor>` for handy shortcuts and more details on using this application. That's all what you need to get started with ESP32! Now you are ready to try some other :idf:`examples`, or go right to developing your own applications. Espressif!/1282017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-11.png)
![!6. SSC Command Reference 7. SSC Command Reference Here lists some common Wi-Fi commands for you to test the module. 7.1. op Description op commands are used to set and query the Wi-Fi mode of the system. Example op-Qop-S-owmodeParameter 7.2. sta Description sta commands are used to scan the STA network interface, connect or disconnect AP, and query the connecting status of STA network interface. Example sta-S[-sssid][-bbssid][-nchannel][-h]sta-Qsta-C[-sssid][-ppassword]sta-DParameter Table 6-1. op Command ParameterParameterDescription-QQuery Wi-Fi mode.-S Set Wi-Fi mode.wmodeThere are 3 Wi-Fi modes: •mode = 1: STA mode •mode = 2: AP mode •mode = 3: STA+AP modeTable 6-2. sta Command ParameterParameterDescription-S scanScan Access Points.Espressif!/1292017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-12.png)
![!6. SSC Command Reference 7.3. ap Description ap commands are used to set the parameter of AP network interface. Example ap-S[-sssid][-ppassword][-tencrypt][-nchannel][-h][-mmax_sta]ap–Qap–LParameter 7.4. mac Description mac commands are used to query the MAC address of the network interface. Example mac-Q[-omode]-s ssidScan or connect Access Points with the ssid.-b bssidScan the Access Points with the bssid.-n channelScan the channel.-hShow scan results with hidden ssid Access Points.-QShow STA connect stutus.-DDisconnected with current Access Points.ParameterDescriptionTable 6-3. ap Command ParameterParameterDescription-SSet AP mode.-s ssidSet AP ssid.-p passwordSet AP password.-t encryptSet AP encrypt mode.-hHide ssid.-m max_staSet AP max connections.-QShow AP parameters.-LShow MAC Address and IP Address of the connected station.Espressif!/12102017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-13.png)
![!6. SSC Command Reference Parameter 7.5. dhcp Description dhcp commands are used to enable or disable dhcp server/client. Example dchp-S[-omode]dhcp-E[-omode]dhcp-Q[-omode]Parameter 7.6. ip Description ip command are used to set and query the IP address of the network interface. Example ip-Q[-omode]ip-S[-iip][-omode][-mmask][-ggateway]Table 6-4. mac Command ParameterParameterDescription-QShow MAC address.-o mode•mode = 1: MAC address in STA mode. •mode = 2: MAC address in AP mode.Table 6-5. dhcp Command ParameterParameterDescription-SStart DHCP (Client/Server).-EEnd DHCP (Client/Server).-Qshow DHCP status.-o mode•mode = 1 : DHCP client of STA interface. •mode = 2 : DHCP server of AP interface. •mode = 3 : both.Espressif!/12112017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-14.png)
![!6. SSC Command Reference Parameter 7.7. reboot Description reboot command is used to reboot the board. Example reboot7.8. ram ram command is used to query the size of the remaining heap in the system. Example ramTable 6-6. ip Command ParameterParameterDescription-QShow IP address.-o mode•mode = 1 : IP address of interface STA. •mode = 2 : IP address of interface AP. •mode = 3 : both-SSet IP address.-i ipIP address.-m maskSubnet address mask.-g gatewayDefault gateway.Espressif!/12122017.11](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-15.png)
![Disclaimer and Copyright Notice Information in this document, including URL references, is subject to change without notice. THIS DOCUMENT IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER, INCLUDING ANY WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESS FOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL, SPECIFICATION OR SAMPLE. All liability, including liability for infringement of any proprietary rights, relating to use of information in this document is disclaimed. No licenses express or implied, by estoppel or otherwise, to any intellectual property rights are granted herein. The Wi-Fi Alliance Member logo is a trademark of the Wi-Fi Alliance. The Bluetooth logo is a registered trademark of Bluetooth SIG. All trade names, trademarks and registered trademarks mentioned in this document are property of their respective owners, and are hereby acknowledged. Copyright © 2017 Espressif Inc. All rights reserved.Espressif IOT Team"www.espressif.com](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-16.png)
![FCCLabel:TheFCCIDisonthefrontofthedevice.Itiseasilyvisible.ThedeviceFCCIDis2AC7Z‐ESP32WROOM32U.Alabelwiththefollowingstatementsmustbeattachedtothehostendproduct:ThisdevicecontainsFCCID:2AC7Z‐ESP32WROOM32U.ThemanualprovidesguidancetothehostmanufacturerwillbeincludedinthedocumentationthatwillbeprovidedtotheOEM.Themoduleislimitedtoinstallationinmobileorfixedapplications.Theseparateapprovalisrequiredforallotheroperatingconfigurations,includingportableconfigurationsanddifferentantennaconfigurations.TheOEMintegratorsareresponsibleforensuringthattheend‐userhasnomanualorinstructionstoremoveorinstallmodule.ThemoduleislimitedtoOEMinstallationONLY.Modulegrantee(thepartyresponsibleforthemodulegrant)shallprovideguidancetothehostmanufacturerforensuringcompliancewiththePart15SubpartBrequirements.Thehostmanufacturerisresponsibleforadditionaltestingtoverifycomplianceasacompositesystem.WhentestingthehostdeviceforcompliancewiththePart15SubpartBrequirements,thehostmanufacturerisrequiredtoshowcompliancewiththePart15SubpartBwhilethetransmittermodule(s)areinstalledandoperating.Themodulesshouldbetransmittingandtheevaluationshouldconfirmthatthemodule’sintentionalemissionsarecompliant(i.e.fundamentalandoutofbandemissions)withtheRadioessentialrequirements.ThehostmanufacturermustverifythattherearenoadditionalunintentionalemissionsotherthanwhatispermittedinthePart15SubpartBoremissionsarecomplaintwiththeRadioaspects.CAUTION:Anychangesormodificationsnotexpresslyapprovedbythegranteeofthisdevicecouldvoidtheuser’sauthoritytooperatetheequipment.](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-17.png)
![FCCRFExposureRequirementsThisdevicecomplieswithFCCRFradiationexposurelimitssetforthforanuncontrolledenviroment.Theantenna(s)usedforthistransmittermustnotbeco‐locatedoroperatinginconjunctionwithanyotherantennaortransmitterandmustbeinstalledtoprovideaseparationdistanceofatleast20cmfromallpersons.FCCRegulationsThisdevicecomplieswithpart15oftheFCCRules.Operationissubjecttothefollowingtwoconditions:(1)Thisdevicemaynotcauseharmfulinterference,and(2)thisdevicemustacceptanyinterferencereceived,includinginterferencethatmaycauseundesiredoperation.ThisdevicehasbeentestedandfoundtocomplywiththelimitsforaClassBdigitaldevice,pursuanttoPart15oftheFCCRules.Theselimitsaredesignedtoprovidereasonableprotectionagainstharmfulinterferenceinaresidentialinstallation.Thisequipmentgenerates,usesandcanradiateradiofrequencyenergyand,ifnotinstalledandusedinaccordancewiththeinstructions,maycauseharmfulinterferencetoradiocommunications.](https://usermanual.wiki/ESPRESSIF-SYSTEMS/ESP32WROOM32U/User-Guide-3717250-Page-18.png)