The board I have is a esp32-wroom-32
... so I tried to follow these instructions to enable compiling and uploading programs to the board.
https://samueladesola.medium.com/how-to-set-up-esp32-wroom-32-b2100060470c
The sketch compiled ok but failed to upload.
My Mega seems to have no trouble finding a port, in my case COM 3
Any suggestions welcome.
The laptop I am using is a Lenovo, 64-bit operating system, x64-based processor, Windows 11 Home.
update:
Well I downloaded and installed some more of the usb drivers in the hope one would work and one appears to have worked in that the test program compiled and uploaded although nothing happened.
Searching for more tutorials up came "Getting started with ESP32" tutorial on the dronebot workshop!!!
I must have skipped it not having the esp32 at the time. So now I will spend time watching and learning 🙂
Thanks Bill.
Hello, are you missing the driver CP210x driver by any chance?
Hello, are you missing the driver CP210x driver by any chance?
Used these:
The test program compiles and downloads ok but doesn't flash the led.
Will figure out the problem eventually 🙂
void setup(){ pinMode(2,OUTPUT); } void loop() { digitalWrite(2, HIGH); delay(1000); digitalWrite(2, LOW); delay(1000); }
Hi @robotbuilder,
ESP32 cards do not always have an LED attached to GPIO2.
I may be mistaken, but I suspect your card is variant based (loosely or otherwise) on the Espressif ESP32-DevKitM-1.
https://dl.espressif.com/dl/schematics/SCH_ESP32-DEVKITM-1_V1_20200910A.pdf
This schematic shows 3 LEDs.
- D3 ... USB_DN
- D4 ... USB UP
- D5 ... 3.3V power via a resistor to limit current
Hence D5, maybe red, will light when board is powered, and D3 and D4 flash when there is some USB data traffic, such as when uploading code from PC to the ESP32.
Suggest you wire a spare LED and resistor in series, between an unused GPIO pin and ground.
LED can be any simple red, yellow or green one, and resistor of say 220 Ohm (not critical). Then change the '2' s in the script to the new GPIO number. (Remember to wire LED diode the right way round.)
I recommend you avoid picking one of the GPIOs which change what happens at boot time, which includes GPIO2.
The Random Nerds have kindly published a web page, listing the pins that are tricky:
https://randomnerdtutorials.com/esp32-pinout-reference-gpios/
Hope this helps. Best wishes, Dave
Thank you for your suggestion. I was kind of suspecting it myself and using a magnifying glass I think it is indeed missing the blue LED. There is only the red one that comes on when I connect it to the PC.
In,
https://dronebotworkshop.com/esp32-intro/
Bill wrote:
If you go back into the Boards: submenu you should now see a number of ESP32 boards. You’ll need to select the board that matches (or is equivalent to) the ESP32 board you have purchased.
For the record, I used an ESP-32S NodeMCU board and chose the “Node32s” board in the Boards Manager.
These are the only esp32 boards that were listed in the Arduino IDE. There was no "ESP-32S NodeMCU board. How to choose the right one? I chose ESP32-WROOM-DA MODULE.
When it uploaded the two last lines in the output were,
Leaving...
Hard resetting via RTS pin...
Does anyone know what that means?
HI @robotbuilder,
"RE Hard resetting via RTS pin..."
This should be just after the uploading process has actually succeeded -- which is a good sign!
--------------
To perform the upload, the ESP32 runs a small programme which is flashed onto it during manufacture, and is not NORMALLY overwritten by the standard Arduino upload process. This programme is selected by the PC sending a code through the USB to hold one of the ESP32 pins in the 'upload' state when it is booted.
i.e. the upload process on the PC is a Python programme that it is commanded to leave that bit of the ESP32 EPROM untouched. Then the PC's Python programme and the ESP32's upload support programme work together to take and store the user's Arduino sketch, with checksums. etc., so data transmission errors can be flagged.
When the code has been safely received and stored on the ESP32, the PC then sets the 'upload/normal boot' pin to the 'normal' boot level, and sends another reset pulse to the ESP32 reset pin. This causes the ESP32 to do the 'hard reset' and boot, this time starting with the new user code.
----------------
As for the board you have, I am somewhat dubious, albeit I am relying on just 1 photo, so please forgive me if I am just confused.
The Nodemcu-32s data sheet is at https://docs.ai-thinker.com/_media/esp32/docs/nodemcu-32s_product_specification.pdf
which includes the board 'photos'
and the schematic includes
and
The schematic would suggest just 2 LEDS, a Red one for power and a blue one controlled by GPIO2, plus also a D1 Schottky
--------------------
But your photo shows 4 diodes, D1, D3, D4 & D5, in this corner
and D2 in the middle
--------------------
which is more in line with the schematic for the Espressif ESP32-DevKitM-1 I referred to previously.
which has D1, D2, D3 & D4 by the USB socket
and D5 in the middle of the board
--------------------
Admittedly, D1 to D5 have been swapped around, but the total quantity is the same.
-----------------
Both schematics used the CP2102, so that doesn't provide clarity.
Do you have a photo of the underside of your board?
But on the basis of the data I have so far, if I was to bet a penny/cent, then I think you have a near clone of the ESP32-DevKitM-1
-----------------------------
Hope this helps a bit.
Best wishes, Dave
@robotbuilder The DA version is a bit special, I don't KNOW that is the problem, but switch to the DOIT version, that always works for me regardless of esp32 variety and is what the NERDS recommend.
As far as the Resetting message, that is the normal end of upload message, it just means your sketch is now running.
First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and 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.
Hi @robotbuilder,
Using the logo on the underside of your ESP32 card, I found a wiki by the company for it at:
https://wiki.keyestudio.com/KS0413_keyestudio_ESP32_Core_Board
Not many surprises or revelations, and its reference to Arduino software is a bit dated, being for 1.8.7, so I don't recommend their installation procedure, but I notice the board selection recommendation in Arduino is for "ESP32 Dev Module", which I think matches my empirical finding for a roughly similar clone I acquired some time ago.
Good to see you have got a basic push button and LED example working. Having established a start, which can often be much more tricky than might be expected, I hope you can expand it to something interesting.
Best wishes, Dave
@robotbuilder The DA version is a bit special, I don't KNOW that is the problem, but switch to the DOIT version, that always works for me regardless of esp32 variety and is what the NERDS recommend.
It *was* working fine with ESP32-WROOM-DA. There is no DOIT on offer.
I chose ESP32-WROOM-DA because the chip had WROOM written on the tin bit.
It all worked great!
Just changed it to ESP32 Dev Module as a test. It compiled and downloaded but the LED barely glowed (no flash) and the button failed to work just got nonsense Serial output.
Changed back to ESP32-WROOM-DA but the problem is still there.
I then realised I had forgotten to turn on the power supply. Turned the power supply back on but it still doesn't work 🙁
Have to go now will come back to it later...
Ahh! I was compiling and downloading the wrong sketch!!
Had swapped in another esp32 board in case I had damaged the other and then realised I was compiling and downloading the wrong sketch!!
With the correct sketch and replaced esp32 board I then got this on trying to download ...
Sketch uses 281309 bytes (21%) of program storage space. Maximum is 1310720 bytes.
Global variables use 20208 bytes (6%) of dynamic memory, leaving 307472 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.6
Serial port COM4
Connecting......................................
A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x13)! The chip needs to be in download mode.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
Failed uploading: uploading error: exit status 2
Working again!!
New problem when I pull out the usb connection it stops so I assume I need to wire in a connection from the power supply rail but I wasn't sure about this 3.3v and 5v issue. Will I just connect the 5v to the VIN pin or does it need a 3.3v connection? It wasn't shown in the circuit diagram.
Hi @robotbuilder,
PS. I was writing this, while unbeknown to me, you added some extra messages. I think it covers most of your queries, but obviously it seems to ignore your prompts, and is not as direct. Rather than rewrite it, I hope you will not mind if I just post it, as is. If there are any outstanding queries, that I have missed, please just ask again.
--------
It is difficult to see your wiring clearly in the photo, but for simple circuits with low power peripherals like an LED and a switch, the power supplied by the USB from your PC should be enough. You do not need an external power source, whist the USB is plugged in and the PC is powered on.
--
Remember that such external circuits should only take power from a 3.3V pin of the ESP32 card, NOT 5V, since the maximum voltage a GPIO pin sees should never exceed 3.3V.
(Of course, if you want the ESP32 to work, when the USB connection is removed, then you will need an external supply.)
If you still have a faulty system, but cannot see a wiring error, I would initially suspect the breadboard connections ... they can be annoying! Use a meter around the switch and LED wiring, and check 3.3V and 0V (ground) are both actually reaching the components.
---------------------------
The most common reason for nonsense on the Serial Monitor is a mismatch between the Serial Monitor Baud Rate and the programmed rate in the user program. Half a line or so, of similar nonsense, during the processor boot up (from Power on or Reset) is also normal.
--------------------------
Of course, if you start connecting higher current peripherals, like motors, then they will need their own supply. Bill's sketches provide lots of such examples.
---------------------
If you look carefully, you will see your ESP32dev card is actually 2 PCBs, sandwiched together. The upper (smaller) PCB is mainly covered by the rectangular metal can with the ESP32 WROOM-DA label, which contains most of the computing logic, including the ESP32 itself, and usually some flash memory. This board also provides the WiFi/(+Bluetooth when supported) antenna. These PCBs, complete with a metal lids, are intended for volume sales to manufacturers, so they can mount them onto their application PCBs.
The larger PCB underneath is basically a small 'application' PCB, albeit the 'application' is 'dev board', intended for development engineers to prototype their own application designs, prior to designing PCBs, enclosures, software, etc. Hence, the 'application' part on your 'dev board' is mainly a 5V to 3.3V regulator, and a USB to serial port, including code upload and processor reset logic when commanded from the Arduino IDE, to connect to your development PC.
Some dev boards have additional peripherals, memory etc, as well, but not yours.
Hence, it is not surprising that an Arduino environment for "ESP32 WROOM-DA" will be a pretty good match, although I would still pick the recommended ESP32 Dev Board option.
--------
Best wishes, Dave