Mario Ramirez Neria - Fab Academy

4. Embedded programming

This week we programming diffetent kind of development kit in order to compare its main features and functionality. we will identify features that could be used in our final proyect.

ESP32 FEATURES

ESP32 is a single 2.4 GHz Wi-Fi-and-Bluetooth combo chip designed with the TSMC low-power 40 nm technology. It is designed to achieve the best power and RF performance, showing robustness, versatility and reliability in a wide variety of applications and power scenarios. The ESP32 series of chips includes ESP32-D0WD-V3, ESP32-D0WDR2-V3, ESP32-U4WDH, ESP32-S0WD (NRND), ESP32-D0WDQ6-V3 (NRND), ESP32-D0WD (NRND), and ESP32-D0WDQ6 (NRND), among which, • ESP32-S0WD (NRND), ESP32-D0WD (NRND), and ESP32-D0WDQ6 (NRND) are based on chip revision v1 or chip revision v1.1. • ESP32-D0WD-V3, ESP32-D0WDR2-V3, ESP32-U4WDH, and ESP32-D0WDQ6-V3 (NRND) are based on chip revision v3.0 or chip revision v3.1. For details on part numbers and ordering information, please refer to Section 7. For details on chip revisions, please refer to ESP32 Chip Revision v3.0 User Guide and ESP32 Series SoC Errata.

UltraLowPower Solution

ESP32 is designed for mobile, wearable electronics, and Internet-of-Things (IoT) applications. It features all the state-of-the-art characteristics of low-power chips, including fine-grained clock gating, multiple power modes, and dynamic power scaling. For instance, in a low-power IoT sensor hub application scenario, ESP32 is woken up periodically only when a specified condition is detected. Low-duty cycle is used to minimize the amount of energy that the chip expends. The output of the power amplifier is also adjustable, thus contributing to an optimal trade-off between communication range, data rate and power consumption.

Complete Integration Solution

ESP32 is a highly-integrated solution for Wi-Fi-and-Bluetooth IoT applications, with around 20 external components. ESP32 integrates an antenna switch, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. As such, the entire solution occupies minimal Printed Circuit Board (PCB) area. ESP32 uses CMOS for single-chip fully-integrated radio and baseband, while also integrating advanced calibration circuitries that allow the solution to remove external circuit imperfections or adjust to changes in external conditions. As such, the mass production of ESP32 solutions does not require expensive and specialized Wi-Fi testing equipment.

WiFi Key Features

Bluetooth Key Features

Advanced Peripheral Interfaces

ESP32 Pinout

Programing the ESP32 using ARDUINO IDE

We use the ARDUINO IDE due to it is easy to use and really intuitive.

The following program blink 10 leds consecutive one after another in one direction, if we push the button the blinking direction change.

ESP32 code development

//ESP32 BLINKING LEDS

int LEDS[10]={15,2,16,17,5,18,19,21,22,23};

//pines of ESP32 used to blink LEDs.

// the setup function runs once when you press reset or power the board

void setup() {

// initialize digital pin LED_BUILTIN as an output.

for(int i=0;i<10;i++)

{ pinMode(LEDS[i],OUTPUT);}

pinMode(34,INPUT);

}

// the loop function runs over and over again forever

void loop() {

if (digitalRead(34)==0)

{

for(int i=0;i<10;i++)

{digitalWrite(LEDS[i], HIGH); // turn the LED on (HIGH is the voltage level)

delay(10); // wait for a 0.05 second

digitalWrite(LEDS[i], LOW); // turn the LED off by making the voltage LOW

delay(10);} // wait for a 0.05 second

}

else

{

for(int i=9;i>=0;i--)

{digitalWrite(LEDS[i], HIGH); // turn the LED on (HIGH is the voltage level)

delay(10); // wait for a 0.01 second

digitalWrite(LEDS[i], LOW); // turn the LED off by making the voltage LOW

delay(10);} // wait for a 0.01 second

}

}

Video of ESP32 blinking LEDs

STM32F407 Discovery kit

The STM32F4DISCOVERY Discovery kit leverages the capabilities of the STM32F407 high-performance microcontrollers, to allow users to develop audio applications easily. It includes an ST-LINK/V2-A embedded debug tool, one ST-MEMS digital accelerometer, one digital microphone, one audio DAC with integrated class D speaker driver, LEDs, push-buttons, and a USB OTG Micro-AB connector.

STM32F407 ALL FEATURES

STM32F407 Discovery kit Pinout

Programing the STM32F407 Discovery kit using ARDUINO IDE

We use the ARDUINO IDE due to it is easy to use and really intuitive.

The following program blink 10 leds consecutive one after another in one direction, if we push the button the blinking direction change.

STM32F407 DISCOVERY KIT code development

#include STM32Examples.h

//STM32F407 DISCOVERY KIT BLINKING LEDS

char LEDS[10]={PC7,PC9,PA9,PA13,PA15,PC11,PD0,PD2,PD4,PD6}; //pines of STM32F407 DISCOVERY KIT used to blink LEDs.

// the setup function runs once when you press reset or power the board

void setup() {

// initialize digital pin LED_BUILTIN as an output.

for(int i=0;i<10;i++)

{ pinMode(LEDS[i],OUTPUT);}

pinMode(PB7,INPUT);

}

// the loop function runs over and over again forever

void loop() {

if (digitalRead(PB7)==0)

{

for(int i=0;i<10;i++)

{digitalWrite(LEDS[i], HIGH); // turn the LED on (HIGH is the voltage level)

delay(10); // wait for a 0.05 second

digitalWrite(LEDS[i], LOW); // turn the LED off by making the voltage LOW

delay(10);} // wait for a 0.05 second

}

else

{

for(int i=9;i>=0;i--)

{digitalWrite(LEDS[i], HIGH); // turn the LED on (HIGH is the voltage level)

delay(10); // wait for a 0.01 second

digitalWrite(LEDS[i], LOW); // turn the LED off by making the voltage LOW

delay(10);} // wait for a 0.01 second

}

}

Video of ESP32 blinking LEDs

The files of this project available to download on the following links