Introduction to ESP...
 
Notifications
Clear all

Introduction to ESP32 - Getting Started  


DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 2 years ago
Posts: 911
Topic starter  

Today we will get started with the ESP32, a low-cost and extremely versatile microcontroller with integrated WiFi and Bluetooth. I’ll show you how to set up your Arduino IDE for the ESP32 and then we’ll try out several example sketches.

Full Article with code: https://dbot.ws/esp32

I apologize for the delay in getting another video out for you, the current situation has greatly impacted me as I’m sure it has you. Please stay safe and isolate!

After many requests, I am finally bringing the ESP32 into the workshop, and it’s here to stay - I’ll be doing a lot of ESP32 projects going forward. And when you see all of the features that this incredible microcontroller has I’m sure you see why!

The ESP32 is a microcontroller from Espressif Systems that has a wealth of features, including multiple I/O ports, analog inputs AND outputs, WiFi, Bluetooth and BLE, touch switches, timers, and real-time clocks, and much more.

This inexpensive processor is available on a number of modules, some of which include displays, microSD card sockets or even cameras.

Today we will get started using the ESP32. And the first thing we will do is set up our Arduino IDE to add the ESP32 boards to it.

After we get our programming environment ready we'll write the obligatory “hello world” program, which for microcontrollers is the good old Blink sketch. You’ll see how uploading code to the ESP32 differs from the Arduino AVR boards we are used to using.

After that, we will go through some of the many example sketches that get installed with the ESP32 board manager, including examples for WiFi and Bluetooth.

It’s a long video (like always LOL) so here’s a breakdown if you want to skip directly to a specific section:

0:00 - Intro
1:56 - ESP32 Introduction
6:11 - ESP32 Boards
10:24 - Setting up the Arduino IDE
12:33 - ESP32 Hookup
14:10 - ESP32 Blink Sketch
19:04 - WiFi Introduction
21:05 - WiFi Scanner
24:23 - WiFi Access Point
26:51 - WiFi Simple Server
30:09 - Bluetooth Introduction
31:20 - Serial to Serial Bluetooth
34:37 - Simple Time
39:17 - Hall Sensor
40:48 - LED Software Fade
42:27 - Repeat Timer
43:40 - Touch Read

You can use just about any ESP32 board with these experiments, and the only other components you’ll need are an LED (with dropping resistor), a push-button switch and something metal to use as a touch sensor.

"Never trust a computer you can’t throw out a window." — Steve Wozniak


Quote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 2 months ago
Posts: 130
 

I've been going thru this video and doing the examples on an Adafruit ESP32 Huzzah which means I have to pick different I/O pins.  Really not an issue until I hit the Repeat timer.  I had the switch on GPIO 32 so I made that change, but that's it.  I get nothing from the serial monitor after reset except the usual ESP power on info. Anyone else have any issues with this?

 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


ReplyQuote
MadMisha
(@madmisha)
Trusted Member
Joined: 12 months ago
Posts: 67
 

@jfabernathy

Posting your code here would really help. The usual applies here, make sure your serial monitor is on the correct com port and baud rate. Now that the obvious is said, I would print lines just as a check to see how far its gotten, or even to see if it made it past the setup.

 

ESPs are a little tricky sometimes. With so many manufactures, some don't behave how you would expect and you need to use alternate methods to accomplish your goal. Expect pins to be a little different and always do your best to find a good pinout. At least Adafruit does a good job of documentation. Although the documentation does seem to match what I saw, some ESPs do not necessarily use the same number printed on the PCB as the GPIO.

 

You might also try different pins.

 

Edit: I should note that I was half listening and typing at the same time. I did not copy and paste. I will have to see if I entered something by habit that needs to be there but I really doubt I caught something that Bill did not.


Centari liked
ReplyQuote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 2 months ago
Posts: 130
 

My code is attached which other than pin numbers and a printf statement is the same as Bill's example, which is the same as the Arduino ESP32 example.

I tried this on PlatformIO with a JTAG debugger and not getting very far other than to tell it's looping deep inside the FREERTOS part of ESP32 Arduino.

The only console out I have is at the end of setup and pressing the button does nothing.  I've not played with timers used this way on a ESP32.  However I do use a WDT on an ESP32 to protect me from weirdness.

 

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
end of setup

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


ReplyQuote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 2 months ago
Posts: 130
 

Okay, I figured it out.  Turns out on my ESP32, I needed a Pullup resistor on the pin side of the button.  It was staying '0' so nothing ever started. 

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


MadMisha liked
ReplyQuote