January 20, 2017

How to use the DOIT ESP32 DEVKIT

ESP32

I have successfully used the WeMos D1 mini ESP8266 dev board for a while. This is a high quality, well documented board available for $2.60 here.

Now that the ESP32 is released, a number of dev boards have arrived. They are a lot more expensive than the ESP8266 boards. Recently I found the DOIT ESP32 DEVKIT for a reasonable price, on Ebay. I payed GBP19 for ESP-32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi+Bluetooth Antenna Module.


This board is not as well documented and there is not much information at all from the seller.
But I got it working after a lot of work and here's how. I used a Mac, but it should work with linux and Windows too.

Steps

  1. Download and install Arduino IDE
  2. Open web page  https://github.com/espressif/arduino-esp32 and follow the instructions under Installation Instructions/Using through Arduino IDE, for your operating system
  3. Install driver for the serial chip used to connect the board to your PC by USB, from the page http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx
  4. Connect the board to your PC with a USB to micro USB cable
  5. In Arduino IDE, use File/New and paste the test program below
  6. Select Tools/Board ESP32 Dev Module
  7. Select Tools/Port /dev/cu.SLAB_USBtoUART (on Windows and Linux the name is different)
  8. Press the small BOOT button and click the Upload button in Arduino IDE, and wait until alot has happened in the log in the bottom of the window - it takes about 15 seconds (I kept the BOOT button pressed during the whole upload, but that may not be neccessary) 
  9. Open the Tools/Serial Monitor and select 115200 baud
  10. Now you should see the word Hello printed every second (you may push the EN button to reset the board, in order to see this)

Test program

void setup() {
  Serial.begin(115200);
  delay(200);
}
void loop() {
  Serial.write("Hello!\n");
  delay(1000);
}

Not achieved yet

  • I haven't found how to control the on-board LED yet
  • I haven't found any schematics for the board

PlatformIO

I prefer to use PlatformIO when developing for Arduino, EPS etc. But according to https://github.com/platformio/platform-espressif32/issues/5, the Arduino IDE has to be used the first time, to get the DOIT ESP32 properly initialized.

In PlatformIO, I select the board Espressif/Espressif ESP32 Dev Module.

26 comments:

  1. Dag, Thanks for the instructions. I have my DOIT Ver 01 board running. Were you able to discover a pin for the blue LED?

    ReplyDelete
    Replies
    1. Good to hear from you. I haven't looked for the LED pin. I let my ESP32 wait until a decent bluetooth driver is avalable, that supports pairing etc. And some way to utilize the second core.

      Delete
  2. I found the blue LED on pin 2. I have not located a schematic for the DOIT V1 board. If you have a link or photo of the schematic would you mind sharing? I tried one of the WiFi Arduino sketches but I haven't gotten it to run correctly, the WiFi RF portion of module transmits but something is not correct in the data/handshake portion of the test sketch.
    I have to keep the Boot button pressed during code upload; doesn't work if I let it go before upload is complete. With the WiFi sketch running the serial USB data path is broken and I get repeated USB warnings from my laptop.

    ReplyDelete
  3. I received a pdf of the schematic from Nicholas Wang.

    https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0

    Alan

    ReplyDelete
  4. Execllent, Alan! Are we free to publish it anywhere? The dropbox link may expire.
    The schematic show that the boot button can be pressed by a serial interface RTS signal, so it looks that it should be possible to flash without having to press the button.
    I'll try WiFi code on the DOIT when I get time.

    ReplyDelete
  5. Alan, about Wifi: I have been so naive that I assumed that all my ESP8266 apps would work unchanged on the ESP32. I don't know why, but my apps have to be changed. I tried the example https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiScan/WiFiScan.ino, and it used Wifi.h instead of esp8266wifi.h, for example. Now it didn't compile anyway. I found that my Arduino IDE was corrupted in some way. So I renamed the Sketches folder (~/Documents/Arduino on my Mac), to Arduino-170225 to hide it, and restarted the IDE. It created a fresh Arduino folder and I repeated the ESP32 platform installation as above in my blog post. Now I could upload the sketch and it scanned the wifi networks correctly.

    ReplyDelete
  6. Dag, Nicholas Wang didn't caution me so I believe you can publish the schematic. While the RTS can cause a reset and the boot loader used by the PC causes a reset, I still have to hold the Boot switch all during the code loading process.
    I too had to rename the Arduino folder to get the espressif/esp32 to "work". I am using Arduino 1.8.1 successfully.
    Here a some links to BT examples that have had a refresh in the past few weeks;
    https://github.com/espressif/esp-idf/tree/master/examples
    https://github.com/search?utf8=%E2%9C%93&q=esp32
    https://github.com/espressif/esptool
    I am waiting on some NodeMCU boards to experiment with, a very small OLED display, a HTsensor and a microSD card slot.
    I too thought the ESP8266 code would run on the ESP32. I suspect the structure is the same so there is the ability to "just" make minor mods to library calls, etc.
    No big project, just playing around.
    By the way, excellent English !

    ReplyDelete
  7. Hi Alan,
    Strange that you have to push the boot button. I use Arduino IDE 1.6.12, if that changes anything. Maybe you use Windows, that runs a different driver.
    I'll wait with BT until pairing is supported in an easy way.
    Why do you use NodeMCU? in my opinion the Wemos D1 mini is superior in all aspects except having fewer pins. IT has an OLED display and a microSD adapter that can be stacked on top of it.
    Thanks about the language! My father was an English teacher and I've had language nerds in my family since generations. I prefer programming languages.

    ReplyDelete
  8. Dag, I ended up with NodeMCU beause I didn't know what I was doing! I have a Wemos D1 mini too, mainly I ended up with various types based on Ebay price. I ran across this book:
    https://leanpub.com/ESP8266_ESP32

    and think it worth the money. It was updated in January of this year.

    Another URL I have used recently that has a lot of links is:
    http://esp32.net/

    I think the boot button issue has a lot to do with the Flash loader and I suspect there is a big difference between Apple and my Intel version.

    Programming languages do tend to be well structured, unfortunately they are far too few people to communicate with.
    I was in Stockholm about five year ago for business and enjoyed my stay immensely. I was the guest of the Swedish Defense Ministry and got to travel across Sweden from Gothenburg to Stockholm, by car. Wonderful trip!

    ReplyDelete
  9. Dag, I should have pointed to this e-book instead of the combined one.
    https://leanpub.com/kolban-ESP32
    Alan

    ReplyDelete
  10. Hi Alan,
    Thanks for the book tip. I bought it right away. It was really a comprehensive one. 700 interesting pages for $5!

    Take a look at my github too: https://github.com/dagrende.

    Fine that you enjoyed Sweden. In my opinion the Gothenburg - Stockholm road is quite boring. If you plan to go to Sweden again I can recommend some really beautiful and interesting routes and places. I live in the western part of Stockholm.

    ReplyDelete
  11. Dag, I noticed this BT GITHub entry and thought of your needs.
    https://github.com/wolfeidau/esp32-blufi

    ReplyDelete
  12. Thank you Alan! That looks interesting. One reason to put the doit board on my lab desk again. But first I will finish making a lora radio shield for wemos d1 mini.

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Hi! Thank you guys for the tipps! The schematic I found on https://github.com/SmartArduino/ESP/blob/master/SchematicsforESP32.pdf. The book from Kolban is really good! You should whatch the videos too! See you!

    ReplyDelete
  15. Thanks!
    What do you use the ESP32 for?

    Here is an iot lab evening I organized for my company, using ESPs: https://github.com/FindOut/iotlab - Ooops! I found that it was written in Swedish... maybe Google Translate will help.

    ReplyDelete
  16. Stupid question: I don't see an ESP32 Dev Module in my board list, so where does it come from ? I see lots of other ESP modules but not the DOIT module. What am I missing ? Thanks.

    ReplyDelete
  17. Hi everyone,

    I also recently bought a DOIT ESP32 DevKit.
    Thanks for the schema and the tip on the blue LED.

    I found on another forum that before flashing from Arduino IDE on Windows, you need to press the BOOT button, keep it pressed while pressing also the EN (reset) button for half a second then release both. Right after that you can flash from Arduino IDE without having to keep any button pressed. At least it works for me on Windows 7.
    (I also work under Linux VirtualBox VM, and from there I don't have to press any button)

    I too am a bit frustrated about the bluetooth not working neither from Arduino, nor from Linux Espressif original development stack. I hope they'll fix that soon.

    ReplyDelete
  18. Hey i am also using do it board but the ota doesn't seem to work. Did you try it ?
    Any suggestions ?

    ReplyDelete
  19. Is there a kind of graphical datasheet available for this board ( like sparkfun make for their boards ) That will show me what each pin on the break out is?

    ReplyDelete
    Replies
    1. https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0

      Delete
  20. I also do not see any OTA network option in the arduino IDE 1.8.3, while connecting by USB and uploading sketches works fine. The BasicOTA sketch compiles well and seems to run on the board.

    ReplyDelete
  21. Did you have issues having the esp32 doit board recognized on OSX? I have attempted several usb cables and yet I cannot see /dev/cu.SLAB_USBtoUART
    serial port available. I have installed the VCP driver from SILABS.

    OSX version: OS Sierra 10.12.5
    16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

    Thanks,

    ReplyDelete
  22. Does anyone know which of the digital pins of esp32 dev kit v1 are pwm?

    ReplyDelete
  23. The only thing I've found is to compare GPIO's between this board and the ESP32 Dev Board pinmap. There is info out there about which GPIO's are pwm on the ESP32 Dev Board, and you may be able to simply use that to decide on the OIT ESP32 DEVKIT. I use a sketch that I modified (for LED's) that works just fine; "D" designation seems to translate directly from the GPIO numbers on the ESP32 Dev Board. If you are interested, here's a link to a pinout comparison between the two boards: https://www.dropbox.com/s/a0jkgczj0wcq8rs/ESP32%20diff%20pinouts%20PDF.pdf?dl=0

    Doc

    ReplyDelete