Embedded programming

Week 4 - Documentation

About some microcontrollers' datasheet...

Arduino

Arduino Uno is a microcontroller board based on the microprocessor ATmega328P.

Descriptimage

Tech Specs (Data taken from Arduino.cc)

Descriptimage

Features:

(Data taken from Arduino Datasheet)

Memory

Security

Peripherals

ATMega16U2 Processor

Memory

Power


Arduino Pin Layout (Image taken from Arduino.cc)

Descriptimage

Reference Documentation (Table taken from Arduino Datasheet)

Descriptimage

ESP32 dev kit

ESP32 is a microcontroller that integrates a ESP32-WROOM-32 SMD microprocessor.

Descriptimage

Tech Specs (Data taken from ESP32-tutorial)

Descriptimage

Features:

(Data taken from ESP32 features)

ESP32 Dev Kit - Pin Layout (Image taken from ESP32 Pins)

Descriptimage

Thoughts on the microcontrollers

Arduino is the classic microcontroller, and I believe that the most famous one of them all. As most of electronic enthusiasts and engineers in the field, I began using Arduino as my main MCU. Arduino Uno is a simple and functional dev board. Nevertheless, Arduino Uno is now a little bit limited compared to other more recent microcontrollers. The ESP32 Dev kit is a prominent example of the newer and better microcontrollers in the market. In terms of pins the Arduino has 13 digital GPIOS and 6 analog pins, while the Esp32 has 32 digital GPIOS and 16 analog pins. The esp32 also has a Wi-Fi and Bluetooth module integrated, and if you consider that the esp32 is smaller than the Arduino uno it gives a clear example of which MCU has the advantage.

I think that the esp32 is better for project given all the characteristics shown in the previous sections, but I still use the Arduino for some things. I like Arduino because it's easier to connect to a breadboard and to analyze pin by pin for small and simple projects.

Embedded Programming

Arduino Uno - Blinking inbuilt LED

Descriptimage

After connecting my Arduino to the computer, I open the Arduino IDE.

Descriptimage

To “warm up” the Arduino I'm going to create a super difficult, out of my mind program, which will make a led blink every second… Just kidding about being mine and difficult jaja. I'll use one of the examples that the interface already gives me.

Descriptimage

This is the program:

Descriptimage

Make sure to select the microcontroller you are using:

Descriptimage

Then just download the program, and you'll see your Arduino with its inbuilt led blinking.


**ESP32 on Arduino IDE**

If this is the first time you will use ESP32 on the Arduino IDE, you will have to add the support to this type of boards with the following steps:

1 / 6


Step 1: Go to File > Preferences.
2 / 6







Step 2: In the opened window, go to Additional boards manager URLs and paste the following links: http://arduino.esp8266.com/stable/package_esp8266com_index.json, https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
This will add the support to esp32 and esp8266. Then press OK.
3 / 6


Step 3: Go to Tools > Board > Boards Manager…
4 / 6


Step 4: Search for esp32 and press Install to esp32 by Espressif Systems.
5 / 6



Step 5: The installation will start, it will take a few minutes, then you will receive a notification the platform esp32 was successfully installed.
6 / 6



Step 6: Now, if you go to the available boards, you will see all the esp32 supported in the software.

ESP32 Uno - Blinking inbuilt LED

Descriptimage

After connecting my ESP32 to the computer, I open the Arduino IDE and select the board I'm using.

Descriptimage

Then I wrote the blinking led program:

Descriptimage

Then just download the program, and you'll see your ESP32 with its inbuilt led blinking.


Here are the the two microcontrollers blinking:


Serial Communication

We are going to use both microcontrollers to with serial communication. Let's make them count to ten and show the counting in the computer screen!

Descriptimage

Arduino

ESP32 (video speed x2)


Now, using serial communication both ways, we are going to ask the user for a number and the microcontroller will start from 1 to that number and show the counting in the computer screen!

Descriptimage

Arduino

ESP32 (video speed x2)


If you noticed, Arduino takes about three seconds to compile and upload the program, but ESP32 takes about 20 seconds (normal speed) to do so!

Comparing other microcontrollers

For this week assignments I focused in comparing and analyzing the esp32 dev board and Arduino uno, but there are other microcontrollers worth knowing. Here are the links for my classmates' week assignments.


You can download the counting-numbers program:

Counting-numbers