Warning: Declaration of Db::query($query) should be compatible with mysqli::query($query, $resultmode = NULL) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 29

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Deprecated: Function get_magic_quotes_runtime() is deprecated in /var/www/u1300519/data/www/acoptex.com/_lib/CacheLite/Lite.php on line 757

Warning: Cannot modify header information - headers already sent by (output started at /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php:0) in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 168

Warning: session_start(): Cannot start session when headers already sent in /var/www/u1300519/data/www/acoptex.com/_config/config.php on line 169

Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 92

Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64

Warning: mysqli_fetch_array() expects parameter 2 to be int, string given in /var/www/u1300519/data/www/acoptex.com/_lib/class.Db.php on line 64
jobs.html_title
2

members

Easy Basics: Project 072w ESP32 Development board - Programming with Atom Text Editor and PlatformIO IDE

of Acoptex.com in ESP8266 ESP-32

Basics: Project 072w

Project name: ESP32 Development board - Programming with Atom Text Editor and PlatformIO IDE

Tags: ESP32 Dev Module, ESP32 development board, ESP32 Development board with WiFi and Bluetooth, ESP32-DevKitC V4 development board, ESP-WROOM-32 module with ESP32‑D0WDQ6 chip, Espressif Systems, ESP32-based development board, ESP32 modules, ESP32-WROOM-32, ESP32-WROOM-32U, ESP32-WROOM-32D, ESP32-SOLO-1, USB-UART bridge, IOT, ESP-WROOM-32 Dev Module, ESP32 DEVKITV1, Installing the ESP32 Board in Arduino IDE, Uploading sketch, Programming with Atom Text Editor and PlatformIO IDE, Atom, Platformio IDE

Attachments: main.cpp

In this project, you need these parts :

1. ESP32 development board with WiFi and Bluetooth and USB A / micro USB B cable 1 pc

2. Atom Text Editor ( you can download it from here )

3. Python 2.7.X ( you can download it from here )

4. Clang ( you can download it from here )

5. PlatformIO IDE (we will show you howto get it)

6. Breadboard 1 pc

7. Jumper cables F-M

8. LED 1pc

9. Resistor 220 Ohm 1 pc

General

We recommend to use the Arduino IDE to program the ESP32 development board. However it can be difficult to install the ESP32 add-on using Git GUI due to permission errors, Arduino IDE version, or multiple Arduino IDE installations on some PCs.

There’s also another popular method to program ESP32 development boards using the Atom text editor combined with PlatformIO IDE. With this method you can still use the same programming language you use on Arduino IDE.

This next tutorial was tested on a Windows 10 PC and on a Mac OS X computer.

There is another method to program ESP32 development boards - to use the Atom text editor combined with PlatformIO IDE. You use the same programming language with this method. We will descriibe how to use it here, this project was tested on a Windows 10 PC and on a Mac OS X computer.

There are a lot of different development boards made. You can find more information about them here

Understanding the ESP32 Development board with WiFi and Bluetooth

We will discuss here an Espressif Systems products. Our development board is using ESP-WROOM-32 module from Espressif Systems.

Espressif offers a wide range of fully-certified Wi-Fi & BT modules powered by their own advanced SoCs.

1. Dual-core Modules with Wi-Fi & Dual-mode Bluetooth

Features

  • Two independently-controlled CPU cores with adjustable clock frequency, ranging from 80 MHz to 240 MHz
  • +19.5 dBm output at the antenna ensures a good physical range
  • Classic Bluetooth for legacy connections, also supporting L2CAP, SDP, GAP, SMP, AVDTP, AVCTP, A2DP (SNK) and AVRCP (CT)
  • Support for Bluetooth Low Energy (BLE) profiles including L2CAP, GAP, GATT, SMP, and GATT-based profiles like BluFi, SPP-like, etc
  • Bluetooth Low Energy (BLE) connects to smart phones, broadcasting low-energy beacons for easy detection
  • Sleep current is less than 5 μA, making it suitable for battery-powered and wearable-electronics applications
  • Integrates 4 MB flash
  • Peripherals include capacitive touch sensors, Hall sensor, low-noise sense amplifiers, SD card interface, Ethernet, high-speed SPI, UART, I2S and I2C
  • Fully certified with integrated antenna and software stacks

2. Single-core Modules with Wi-Fi & Dual-mode Bluetooth

Features

  • High-performance 160 MHz single-core CPU
  • +19.5 dBm output at the antenna ensures a good physical range
  • Classic Bluetooth for legacy connections, also supporting L2CAP, SDP, GAP, SMP, AVDTP, AVCTP, A2DP (SNK) and AVRCP (CT)
  • Support for Bluetooth Low Energy (BLE) profiles including L2CAP, GAP, GATT, SMP, and GATT-based profiles like BluFi, SPP-like, etc
  • Bluetooth Low Energy (BLE) connects to smart phones, broadcasting low-energy beacons for easy detection
  • Sleep current is less than 5 μA, making it suitable for battery-powered and wearable-electronics applications
  • Peripherals include capacitive touch sensors, Hall sensor, low-noise sense amplifiers, SD card interface, Ethernet, high-speed SPI, UART, I2S and I2C
  • Fully certified with integrated antenna and software stacks

3. Single-core Modules with 802.11b/g/n 2.4 GHz Wi-Fi

Features

  • High-performance 160 MHz single-core CPU
  • +19.5 dBm output at the antenna ensures a good physical range
  • Sleep current is less than 20 μA, making it suitable for battery-powered and wearable-electronics applications
  • Peripherals include UART, GPIO, I2C, I2S, SDIO, PWM, ADC and SPI
  • Fully certified with integrated antenna and software stacks

There are different development Boards made by Espressif Systems and other manufacturers. We will publish some information about Espressif Systems boards but you can also find out more information about other development boards here.

1. 2.4 GHz Wi-Fi & BT/BLE Development Boards

Features

  • PC connectivity: USB
  • Power supply options: USB (by default), or 5V/GND header pins, or 3V3/GND header pins
  • SDK: ESP-IDF source code and example applications

2. 2.4 GHz Wi-Fi Development Boards

Features

  • PC connectivity: USB
  • SDK: ESP8266 SDK source code and example applications

3. 2.4 GHz Wi-Fi + BT/BLE + Sensor Development Boards

Features

  • PC connectivity: USB
  • SDK: ESP-IOT-SOLUTION source code and example applications

You can find more information (datasheets, schematics, pins descriptions, functional desgn descriptions) about each board by pressing Getting started link close to each board here.

ESP32 chip

ESP32 is a series of low cost, low power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. The ESP32 series employs a Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations and includes in-built antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese company, and is manufactured by TSMC using their 40 nm process. It is a successor to the ESP8266 microcontroller.

ESP32 can perform as a complete standalone system or as a slave device to a host MCU, reducing communication stack overhead on the main application processor. ESP32 can interface with other systems to provide Wi-Fi and Bluetooth functionality through its SPI / SDIO or I2C / UART interfaces.

ESP32 is highly-integrated with in-built antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. ESP32 adds priceless functionality and versatility to your applications with minimal Printed Circuit Board (PCB) requirements.

ESP32 is capable of functioning reliably in industrial environments, with an operating temperature ranging from –40°C to +125°C. Powered by advanced calibration circuitries, ESP32 can dynamically remove external circuit imperfections and adapt to changes in external conditions.

Engineered for mobile devices, wearable electronics and IoT applications, ESP32 achieves ultra-low power consumption with a combination of several types of proprietary software. ESP32 also includes state-of-the-art features, such as fine-grained clock gating, various power modes and dynamic power scaling.

Functional Block Diagram:

Features of the ESP32 include the following:

Processors:

  • CPU: Xtensa dual-core (or single-core) 32-bit LX6 microprocessor, operating at 160 or 240 MHz and performing at up to 600 DMIPS
  • Ultra low power (ULP) co-processor
  • Memory: 520 KiB SRAM

Wireless connectivity:

  • Wi-Fi: 802.11 b/g/n
  • Bluetooth: v4.2 BR/EDR and BLE

Peripheral interfaces:

  • 12-bit SAR ADC up to 18 channels
  • 2 × 8-bit DACs
  • 10 × touch sensors (capacitive sensing GPIOs)
  • Temperature sensor
  • 4 × SPI
  • 2 × I²S interfaces
  • 2 × I²C interfaces
  • 3 × UART
  • SD/SDIO/CE-ATA/MMC/eMMC host controller
  • SDIO/SPI slave controller
  • Ethernet MAC interface with dedicated DMA and IEEE 1588 Precision Time Protocol support
  • CAN bus 2.0
  • Infrared remote controller (TX/RX, up to 8 channels)
  • Motor PWM
  • LED PWM (up to 16 channels)
  • Hall effect sensor
  • Ultra low power analog pre-amplifier

Security:

  • IEEE 802.11 standard security features all supported, including WFA, WPA/WPA2 and WAPI
  • Secure boot
  • Flash encryption
  • 1024-bit OTP, up to 768-bit for customers
  • Cryptographic hardware acceleration: AES, SHA-2, RSA, elliptic curve cryptography (ECC), random number generator (RNG)

Power management:

  • Internal low-dropout regulator
  • Individual power domain for RTC
  • 5uA deep sleep current
  • Wake up from GPIO interrupt, timer, ADC measurements, capacitive touch sensor interrupt

You can find ESP32 chip datasheet here, hardware design here, technical reference manual here.

Signals and connections of the ESP32 Development board with WiFi and Bluetooth

You can find more information (datasheets, schematics, pins descriptions, functional desgn descriptions) about each board (made by Espresiff Systems) by pressing Getting started link close to each board here.

Let's check our development board - ESP32 DEVKITV1 with ESP-WROOM-32 module from Espressif Systems:

Pinout diagram for the ESP Wroom 32 breakout:

ESP32-WROOM-32 - ESP32-WROOM-32 module soldered to the development board. Optionally ESP32-WROOM-32D, ESP32-WROOM-32U or ESP32-SOLO-1 module may be soldered instead of the ESP32-WROOM-32.

USB-UART Bridge - A single chip USB-UART bridge provides up to 3 Mbps transfers rates.

BOOT button - Download button: holding down the Boot button and pressing the EN button initiates the firmware download mode. Then user can download firmware through the serial port.

EN button - Reset button: pressing this button resets the system.

Micro USB Port - USB interface. It functions as the power supply for the board and the communication interface between PC and the ESP module.

TX0, TX2 - transmit pin. GPIO pin

RX0, RX2  - receive pin.  GPIO pin

3V3 (or 3V or 3.3V) - power supply pin (3-3.6V). 

GND - ground pin.

EN - Chip enable. Keep it on high (3.3V) for normal operation.

Vin - External power supply 5VDC.

Wiring

Step by Step instruction

The ESP32 is currently being integrated with the Arduino IDE like it was done for the ESP8266. There’s an add-on for the Arduino IDE that allows you to program the ESP32 using the Arduino IDE and its programming language.

We will use GIT GUI method here. There is also the alternative method which described here.

1. Installing ESP32 add-on into Arduino IDE

  1. Download and install the latest Arduino IDE Windows Installer from arduino.cc
  2. Download and install Git and Git GUI from git-scm.com
  3. Search for Git GUI, right-click the icon and select “Run as administrator
  4. Select the Clone Existing Repository option.
  5. Select source and destination. Source Location: https://github.com/espressif/arduino-esp32.git
  6. Target Directory:C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32
  7. Do not create the espressif/esp32 folders, because they will be created automatically.
  8. Click Clone to start cloning the repository.Wait a few seconds while the repository is being cloned.
  9. Open the folder: C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32/tools
  10. Right-click the get.exe file and select “Run as administrator“.
  11. You will see that necessary files will be downloaded and upzipped. It will take some time.
  12. When get.exe finishes, you should see the following files in the directory.

2.Preparations (installing additional programms-Atom)

  1. You need to install Atom text editor. Go to Atom.io website and download the free Atom text editor.
  2. Open the downloaded installation file AtomSetup-x64.exe and run it. The installation is quite easy. You will see the message that Atom is being installed and it will launch automatically when installation done.
  3. You need to install Python 2.7.X on your PC to use PlatformIO IDE and program your ESP32 boards. Go to python.org website and download the latest version of Python 2.7.X for your OS (Operating System) (We are using Python 2.7.15 version in this project. Any other Python 2.7.X version should work too).
  4. Open the downloaded file to start the Python installation wizard. 
  5. Press Next button. Select destination directory.
  6. Press Next button.
  7. Scroll down in the Customize Python 2.7.15 window and open the Add python.exe to Path. Select the option Will be installed on local hard drive.
  8. Press Next button to complete the installation. Press Yes button to give access to the drive.
  9. After Python 2.7.X installation open the Command Prompt desktop app.
  10. Run the next sequence of commands to check the Python and pip version installed: python --version pip --version

  11. Both commands should return a similar output (the version might be slighter different in your case).
  12. Check if you have virtualenv installed: virtualenv --version If it’s already installed, you can go to the next section. Otherwise you need to install it with this command: pip install virtualenv
  13. Run this command again to check if virtualenv was installed properly: virtualenv --version
  14. Installing Python 2.7.X on Mac OS X. Run the next sequence of commands to install Python 2.7.X. Then, check if Python, pip, and virtualenv are installed: $ brew install python2     $ python --version Python 2.7.15 $ pip --version pip 9.0.3 $ virtualenv --version   $ pip install virtualenv
  15. You need to have Clang as PlatformIO IDE uses it for the Intelligent Code Completion. Open Terminal/Command Prompt to check if Clang is available in your system and run: clang --version
  16. If Clang is not installed, then you need to go to releases.llvm.org website to download and install it by following the instructions for your OS (Windows 32bit, Windows 64 bit)(We use Clang version 3.9.1, do not use higher versions: 3.9.4...)
  17. Press Next button.
  18. Press I agree button. 
  19. Select Add LLVM to the system PATH for all users option. 
  20. Select destination folder and press Next button.
  21. Press Install button.
  22. Mac OS X - install the latest Xcode along with the latest Command Line Tools. They are installed automatically when you run clang in Terminal for the first time or manually by running: xcode-select --install
  23. Linux - using package managers: apt-get install clang or yum install clang.
  24. Other systems - download the latest Clang for the other systems here.
  25. Open Atom text editor and go to File -> Settings.

  26. Open Install tab.


  27. Search for platformio , select platformio-ide and press Enter button.
  28. When installation completed restart the Atom text editor for the changes to take effect.
  29. When you open Atom text editor a new window should load with the Welcome to PlatformIO screen.

3. Testing PlatformIO IDE installation, uploading sketch to ESP32 development board

  1. Press New Project button in the quick access menu.
  2. You will see the pop up window that allows you to create a new project for your board: Name your project, search for ESP32 and select your ESP32 board (example: DOIT ESP32 DEVKIT V1), select Arduino framework. Press Finish button.
  3. When the new project created you’ll see the project folder on the left menu that you can use to navigate through files and folders.
  4. Open the src folder and double-click the main.cpp file to open it. A new window opens in Atom with that file so you can edit it.
  5. The main.cpp file is like your Blink.ino file used in the Arduino IDE. You can write your Arduino code, but you need to start with the file by including the Arduino framework. So, basically all the Arduino sketches work with PlatformIO IDE.
  6. Let’s blink a LED connected to ESP 32 GPIO14. Enter the code to the Atom text editor, save it File->Save or open main.cpp file File->Open.
  7. Do wiring.
  8. Plug the ESP32 development board to your PC and wait for the drivers to install (or install manually any that might be required).
  9. Install the ESP32 CP210x USB to UART Bridge VCP Drivers
  10. Press Upload button. You need to hold the ESP32 on-board Boot button while uploading. Wait a few seconds while the sketch uploads to your board.
  11. Press the ESP32 on-board EN button to reboot it. 
  12. You can see that the LED blinks every second. Yo are done! The PlatformIO was successfully installed and you can use it to program your ESP32 development board now.
  13. Open the serial monitor by pressing the icon (12).
  14. The PlatformIO software should automatically complete your settings. Otherwise select your ESP32 COM port and its baudrate. Press Start button.
  15. You will see the window that outputs all the Serial.println() commands used in your code like the Serial Monitor in Arduino IDE.
  16. Additional Tips about PlatformIO IDE. Let's see what each button in the PlatformIO IDE means: 1. PlatformIO Home, 2. PlatformIO Build, 3. PlatformIO Upload, 4. Upload to remote device, 5. PlatformIO Clean, 6. PlatformIO Test, 7. PlatformIO Debug, 8. Run other target, 9. Toggle Build Panel, 10. Find in Project, 11. Terminal, 12. Serial Monitor, 13. Atom Settings
  17. You can use following links as a resource to explore the additional functionalities and features that PlaformIO offers: PlatformIO IDE official website, PlatformIO IDE user guide, PlatformIO IDE documentation, PlatformIO IDE Espressif 32 (ESP32) boards.

Summary

We have learnt how to use the another method to program ESP32 development boards - the Atom text editor combined with PlatformIO IDE.

Libraries

  • No libraries required in this project

Sketch

  • Main.cpp file attached on the beginning of this project description.


Other projects of Acoptex.com
Medium Basics: Project 083w Sipeed Maixduino board - Using PlatformIO IDE of Acoptex.com in Sipeed Maixduino 08-08-2019
Medium Basics: Project 083e Sipeed Maixduino board - Uploading MaixPy of Acoptex.com in Sipeed Maixduino 04-08-2019
Medium Basics: Project 083f Sipeed Maixduino board - Using MycroPython of Acoptex.com in Sipeed Maixduino 04-08-2019

jobs.published_at
jobs.viewed