![]() |
![]() |
Please note: The pin numbers IOxx on the ESP32 correspond to the GPIO pin numbers
Datasheet: https://
www.espressif.com
/sites/default/files/documentation/esp32-wrover-b_datasheet_en.pdf
![]() |
![]() |
![]() |
Several development tools are available:
Please see:
see: https://docs.espressif.com/projects/esp-idf/en/latest
see: |
We can however also execute esptool directly.
First we need a Micropython interpreter!
You find the sources here:
https://github.com/micropython/micropython/
In the repository you find ports for the ESP8266 and the ESP32.
In order to compile the code you need the ESP-IDF and its cross compilers
The code compiles into a binary file (firmware-combined.bin) which contains a boot loader and the interpreter.
This binary must be uploaded and flashed.
For documentation of the ESP32port of Micropython look at
http://docs.micropython.org/en/latest/esp32/tutorial/intro.html
We use a serial connection passing through the micro USB connection.
As soon as we connect the processor card to the PC we see the serial port to connect for communication
You see the command prompt and you can interact with Micropython.
But … how to upload scripts?
Thonny is a complete Integrate Development Environment (IDE)
which lets you
Thonny is an IDE for Python which has provisions for Micropython.
Under Tools → Options button you can select the type of
Python interpreter you intend to use.
Compiling a new version of Micropython is substantially much easier with Thonny.
You still need to install esptool first. You just select your port and firmware then install.
A “Hello World” program, just printing “Hello World” on the screen
does not look very exciting.
However, this is generally used to verify that the infrastructure
Compiler, linker, downloader, flash program
are working correctly
In embedded systems printing can be quite complex
and a blinking LED is used instead.
The ESP32-WROVER-B have a “user LED” connected to GPIO 19.
How do we control this LED?
Now we put the code into a script and run it
The LED is connected to a digital line which can only be set to 0 or Vcc.
How can we change the light intensity and dim the LED?
The light intensity depends on the average current flowing through the LED.
The answer is PWM: pulse width modulation.
A more complex LED:
For all the details on the ws2812b look at
https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf
24 bit of colour data puts 2e24 colours at your disposal
Coding of a single bit
The control word:
We have a single neopixel connected to
GPIO pin 4 (ESP8266)
or
GPIO pin 21 (ESP32)
This code works on both CPUs!
-- Isaac Armah-Mensah - 2021-02-28
I | Attachment | History | Action | Size | Date![]() |
Who | Comment |
---|---|---|---|---|---|---|---|
![]() |
esp32board.png | r1 | manage | 2095.9 K | 2021-02-28 - 01:28 | IsaacArmahMensah | |
![]() |
esptool.png | r2 r1 | manage | 385.0 K | 2021-02-28 - 16:01 | IsaacArmahMensah | |
![]() |
MPY1.png | r1 | manage | 423.0 K | 2021-03-02 - 08:20 | IsaacArmahMensah | |
![]() |
esp32board.jpg | r1 | manage | 279.8 K | 2021-03-02 - 00:20 | IsaacArmahMensah | |
![]() |
interpret.png | r1 | manage | 105.0 K | 2021-03-02 - 00:42 | IsaacArmahMensah |