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.
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
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.
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.
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
I've watched Bills excellent tutorial about getting started with the ESP32. I thought I understood the two different Wi-Fi approaches, Station and Soft Access Point. I gathered that Station requires Internet Access and the ESP32 board and my phone or computer use the Internet to communicate back/forth. I tried the examples and they seem to work.
I also gathered that Soft Access Point means that the Internet is not needed or used. The communication between my ESP32 board and say my phone is done directly. The advantage being that internet access is not needed. The disadvantage can be limited range.
I have been successful in using an ESP32 Dev board in Soft Access Point to communicate with my iPhone. I have noticed that when the connection app is active, the ESP32 shows as a possible connection on my iPad. However the app will not work with it as long as the phone is working with it. I can see that this would be good especially in my situation. Is this always the case that in Soft Point Access Mode that the ESP32 can only work with one other device at a given time?
Now I read about Access Points being "hotspots". I thought "hotspots" referred to using another device for the WiFi Internet connection. For example, I don't have a cellular plan for my iPad so in the house it can use my WiFi network there. In an area without Internet Access the iPad can use my iPhone as a hotspot via its cellular connection.
Are Soft Access Point and Access Pont two different things? Most things I read seem to assume that internet access is available and that one will be using it. This is not always the case down on the farm.
@tedbear A lot to unpack there Ted. A hotspot is USUALLY associated with an internet access very likely a cell phone. It's not a 3rd type, it is an access point. I don't know for sure about two clients on one access point but I would put money on only one unless the access point is specifically coded for more than one client. Access points do NOT need the internet, although the most common use is that. If @Inq is around, I am sure he can and will correct me if I got anything wrong. I am still learning and he is my goto networking guy.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
I don't know for sure about two clients on one access point but I would put money on only one unless the access point is specifically coded for more than one client. Access points do NOT need the internet, although the most common use is that.
In fact, a soft access point is UNABLE to access the internet or your home network for that matter... you'll need station mode for that, or both modes at once depending on your needs:
@frogandtoad In your picture re ESP32 WiFi modes I don't see 'Soft AP'. I also don't see in that definition where the internet connects. This is why I get confused by all these terms. In fact upon reading it again, the definitions are circular. Stations connect to AP that connect to stations. Did terminology change at some point and I didn't notice? It gets super confusing when I see @Inq with his SEE PIC attached one line of code and both a SoftSSID and a RouterSSID. I am 100% sure I am missing a key point somewhere and would really like to get myself educated.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@frogandtoad In your picture re ESP32 WiFi modes I don't see 'Soft AP'. I also don't see in that definition where the internet connects. This is why I get confused by all these terms. In fact upon reading it again, the definitions are circular. Stations connect to AP that connect to stations. Did terminology change at some point and I didn't notice? It gets super confusing when I see @Inq with his SEE PIC attached one line of code and both a SoftSSID and a RouterSSID. I am 100% sure I am missing a key point somewhere and would really like to get myself educated.
Hi Ron,
The operating modes are applied to the WiFi object, whereas "svr.begin(...) is related to the http web server component.
@frogandtoad I know and appreciate you are trying to help, but I am on the spectrum and learn some things easily and others not. This all sounds like static to me. Remember I was almost retired when the internet became widely available to the average person. I NEVER had any internet stuff in my professional life.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@frogandtoad I know and appreciate you are trying to help, but I am on the spectrum and learn some things easily and others not. This all sounds like static to me. Remember I was almost retired when the internet became widely available to the average person. I NEVER had any internet stuff in my professional life.
I understand, it's not the most intuitive thing to comprehend. Have a look at the following link, which provides some good detail around the use of the WiFi object modes etc:
@frogandtoad It's starting to sink in. I have never seen the method SoftAP used before. So is this like a network that is NOT connected to any other network by wires or wireless. The ESP32 functions as a router so to speak and my client phone app connects to the ESP32 ONLY. What are the practical uses of that?
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
@frogandtoad It's starting to sink in. I have never seen the method SoftAP used before. So is this like a network that is NOT connected to any other network by wires or wireless. The ESP32 functions as a router so to speak and my client phone app connects to the ESP32 ONLY. What are the practical uses of that?
Glad to hear. A Soft-AP is a new self sustained network, not at all connected to your real network, that's why you can give it any SSID and PASSWORD you like. There are certainly many uses for it... some recent irrigation discussions are a perfect example where no internet is required. You can have many "WIFI_STA" reporting back to a "WIFI_STA_AP (station + access point in one)", which could in turn report all sensor readings back to an MQTT server / dashboard, web server page, log them, control them etc...
The stations don't need internet access, so this is a perfect scenario for such use.
@frogandtoad Ok, well I am certainly aware of networks that exist outside the internet, but somehow I never noticed the term soft-ap and never saw the softap method used. I am probably overthinking this or somehow confusing myself. Thanks for taking the trouble to point me in the right direction. I have used the RandomNerds both for education and to point newbies to, I think I need to go back and read some and pay attention a little more. Slowly but surely I learn especially with the help of understanding patient friends.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, 360, fairly knowledge in PC plus numerous MPU's & MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.
We use cookies on the DroneBot Workshop Forums to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.