members
Basics: Project 070l ESP32 Development board Static IP Address
of Acoptex.com in ESP8266 ESP-32
Basics: Project 070l
Project name: ESP32 Development board Static IP Address
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, Static IP Address
Attachments: sketch1
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.Arduino IDE ( you can download it from here )
General
We will learn how to assign a static (fixed) IP address to your ESP32 development board.
We will use this project code as an example to show you how to fix your ESP32 development board IP address.
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
You can read more about it 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.
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.
1. Installing ESP32 add-on in Arduino IDE (Windows 10 OS)
- Download and install the latest Arduino IDE Windows Installer from arduino.cc
- Download and install Git and Git GUI from git-scm.com
- Search for Git GUI, right-click the icon and select “Run as administrator“
- Select the Clone Existing Repository option.
- Select source and destination. Source Location: https://github.com/espressif/arduino-esp32.git
- Target Directory:C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32
- Do not create the espressif/esp32 folders, because they will be created automatically.
- Click Clone to start cloning the repository.Wait a few seconds while the repository is being cloned.
- Open the folder: C:/Users/[YOUR_USER_NAME]/Documents/Arduino/hardware/espressif/esp32/tools
- Right-click the get.exe file and select “Run as administrator“.
- You will see that necessary files will be downloaded and upzipped. It will take some time.
- When get.exe finishes, you should see the following files in the directory.
2. Uploading sketch to ESP32 development board
- Do wiring.
- Plug the ESP32 development board to your PC and wait for the drivers to install (or install manually any that might be required).
- Open Arduino IDE.
- Open Boards manager. Go to Tools -> Board -> Boards Manager… (in our case it’s the DOIT ESP32 DEVKIT V1)
- Select COM port that the board is attached to (if you don’t see the COM Port in your Arduino IDE, you need to install the ESP32 CP210x USB to UART Bridge VCP Drivers)
- Open sketch1 and modify SSID, password, IP address, gateway for your network.
- Compile and upload the sketch1 to your ESP32 development board. If everything went as expected, you should see a “Done uploading” message. (You need to hold the ESP32 on-board Boot button while uploading).
- Press the ESP32 on-board EN button to reboot it.
- Open the Serial Monitor at a baud rate of 115200. It should automatically assign the static IP address 192.168.0.109.
- Open web browser.
- Enter your static IP address (we had 192.168.0.109)
- If you’ve tried to assign a fixed IP address to the ESP32 Development board and it doesn’t work, we recommend assigning an IP address directly in your router settings through the ESP32 MAC Address.
- If you login into your router admin page, there should be a menu page where you can assign an IP address to a network device. Each router has different menus and configurations. So, we can’t provide instructions on how do to it for all the routers available. Search in Google "assign IP address to MAC address" followed by your router name. You should find some instructions that show how to assign the IP to a MAC address for your specific router.
Code
You define the following variables with your own static IP address and corresponding gateway IP address. By default, the next code assigns the IP address 192.168.0.109 that works in the gateway 192.168.0.1.
You need to use an available IP address in your local network and the corresponding gateway.
In the setup() you need to call the WiFi.config() method to assign the configurations to your ESP32 Development board.
// Configures static IP address
if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
Serial.println("STA Failed to configure");
}
The primaryDNS and secondaryDNS parameters are optional and you can remove them.
In the setup(), after connecting to your network, it prints the ESP32 MAC Address in the Serial Monitor:
// Print ESP MAC Address
Serial.println("MAC address: ");
Serial.println(WiFi.macAddress());
Summary
We have learnt how to assign a static (fixed) IP address to your ESP32 development board.
Libraries
- No libraries required for this project
Sketch
- See attachments on the begining of this project
Other projects of Acoptex.com










jobs.viewed