Exploring what all the esp32 has to offer

I have been wanting for a while now to delve into Micropython and see what all the fuss was about and did not expect it to go so smoothly, so I have for that reason decided to enter the #devember2020 challenge and post here what I am able to finish by years end and perhaps continue on.

First goal is to familiarize myself with the hardware, in this case I have been eyeing the esp32 for a while now. Datasheet here It is hard to believe what it can do especially for buying a board from microcenter for $10.

Second goal is just simply finding out what can I do with this board and micropython.

edit: Micropython was incredibly simple to get going and coding with it on this platform. I would recommend this to any beginner wanting to explore micros.

I have decided to not limit myself to python and explore this board.
I will be using this post to somewhat record my en-devour.

1 Like

Very nice, looking forward to follow your progress. I just ordered 10 of the new ESP-32-S2-Saola developer boards. Funny though, there’s an export restriction from US to EU, so I was unable to order them with mouser. Order did however go through using Digikey, should arrive Monday.

I’m going to build a Bluetooth command line terminal for the esp32, so I can learn some c++ and create a framework to remote control them in other projects.

The ESP32 is an awesome MCU!. It looks like you linked the general datasheet. You’ll want to find the one specific to the version you have, that being WROOM, WROVER, ect. I only ever used C on the ESP32s. I wonder if Micropython takes advantage of the dual core system.

yeah, but that gets the point across.

Fun Fact! Or maybe I’m late to this party, but sd cards support spi. Who knew…
Well, when sd cards operate at 3.3v and your micro is 3.3v logic, you break out the soldering iron. Enjoy the professional cringe images.

And just in case you need to see, here’s the shell screen of REPL using the Thonny IDE.
image

The biggest surprise to me was really the 4 lines of code I used to mount the sd card after only wiring it to my micro.

  1. from machine import Pin
  2. import kit, time, os, uos, machine
  3. mysd = machine.SDCard(slot=2,width=1, cd=None, wp=None, sck=18, miso=19, mosi=23, cs=5, freq=20000000)
  4. uos.mount(mysd, “/sd”)

It is pretty strait forward, line 3 is where the magic happens. You can follow the doc on interfacing with sd cards. SPI is way to easy.

Last note, pinout of sd and micro sd cards are different! The adapter flips 2 pins so you can not follow the pin out of a full sd if you want to use an adapter and a micro.

5 Likes

This is great, keep 'em coming

well sir…
image
My external RAM has failed to init, but both cores are up! Now I have to multi process something…

Looks like you can compile micropython to run on core 0 or 1, and have the RTOS start any process on core 1 or 0. But core 1 is a little reduced in resources…

Well, having experience with python before coming into this really made this easy. I thought there were more differences, and it wasn’t so easy to write, load, and run scripts. I am going to have to change the title of this post to reflect the change of this project. I am going to switch gears and just delve into the world of the ESP32. See what neat things it all has and not limit myself to micropython.

There’s this thing called esphome. It’s a home automation framework for esp8266 and esp32 built using platform.io, and it integrates very nicely into home assistant.

Esphome in particular can do things like OTA flashing and A/B booting.

Anyway, if you’re looking for interesting stuff, turns out that esp32 has another core called ULP coprocessor (ULP==ultra low power). Turns out, you can access pins and talk i2c or SPI on this ULP, and write code for it in C… which makes it perfect for like battery operated sensors… e.g. you can log temperature and humidity from a bme280 for example every 30s,… and then wake up the main cpu to upload history over wifi or LoRa every 5min or 15min and check for a config update before going back to sleep.

Just something I found interesting, … have fun!

3 Likes

I just threw away a small bag of sd to microsd converters thinking to myself… what do I need so many of these for. I’m kicking myself now! DUH! It’s a “free” microSD card reader for projects like this.

3 Likes

You know if the reduced resources are because micropython or is it because of ESP? Arduino when running on ESP runs on core 1.

Perhaps I’m talking out my rear end, cause now I cant find the source I was refrencing. Looks like I need to keep on reading.

Looking forward, already learned something, so it’s great

1 Like

I have played around a bit with 3 different environments for the esp32. Here’s what I have found and think of them. Anyone reading this, feel free to correct any mistakes and leave their opinions as well.

First, not much of an environment but micropython is capable. Obviously you can pick any editor but Thonny was an excellent choice since it can “flash” directly to the board, or even an sd card if its connected. I think this is best if you want to quickly make projects that do not require the full control of all cores. If you are coming from a simpler micro such as Arduino, I’d say this is a great start, especially to get started on python in general.

Secondly, the arduino ide, here we have more control of the hardware and a familiar and well supported environment. Many professional tutorial and complete projects using this ide. Less setup than micropython, since there you have to flash the board, but still some setup. Probably the best environment to just code and build your projects.

Last, ESP-IDF, I used VSCode with esp-idf. Pain in the ass till I understood how it wants you to build your project workspaces. This is definitely the most professional way to go. As your projects get more complex, organizing is key and this is the way to go. With the terminal this lets you build your projects and flash the boards fairly easily.

I have one board I will leave with micropython just because it is convenient to have that available, but think all other projects will be with vscode & esp-idf.

Hope this rambling is helpful to anyone.

1 Like

Have you used platform.io with esp-idf ? … or just straight download from espressif?

1 Like

My initial intentions with this was just get this board and play around with it and perhaps find a use for it. I didn’t care to play with different environments, that kind of just happened. I did like the esp-idf addon to vscode. But if there is something else I should check out, I don’t mind doing so.

Instead of vscode, try jetbrains clion with platformio, works pretty much out of the box. I used vscode in the beginning, but I found the UI messy, a lot of space is wasted on visual fluff that leads to nothing productive. Jetbrains however, has a fairly clean and minimalistic ui.

Found the esp32 internet radio project after the wife suggested such a desire. One hell of a project here, lots of useful stuffs used to make it work so I will definitely be referencing some code.
Put the bare minimum on a bread board and it “worked”, the audio board I am using has a bad channel. :unamused:

Anyways, a co worker has also expressed interest in a low power board that can get a web audio stream, and produce a clock signal starting at .5MHz and step up by 10KHz up to 2MHz. Wonder if @hem is also a ham???

Thanks, but looks like not free…