Skip to content

Week 6. Embedded programming

This week I worked with the XIAO ESP32 C3 microcontroller, exploring its characteristics and then programming a small project in Arduino.

Group assignment:

  • Browse through the datasheet for your microcontroller.
  • Compare the performance and development workflows for other architectures.
  • Document your work to the group work page and reflect on your individual page what you learned.

Individual assignment:

  • Write a program for a microcontroller development board to interact (with local input &/or output devices) and communicate (with remote wired or wireless devices)

Learning Outcomes

Implement programming by communication protocols.

Group Assignment

  • Here is the LINK where you can see the development of the week’s group assignment.

What I learned in group work

On this occasion, as a group, we decided to collaborate on an online file in which we would compare various microcontrollers with their respective technical characteristics.

Through virtual connectivity we share what we have found out about microcontrollers with their technical characteristics.

Datasheet Comparison for Diverse Architectures

As a group, we worked collaboratively on this comparison chart of the ATTINY412, SAMD11C, XIAO RP2040, XIAO ESP32-C3 and ATTINY 1624 microcontrollers by first looking at and then displaying the following features: architecture, clock speed, flash memory, RAM memory, communication interfaces, integrated peripherals, development tools and board compatibility.

The following TABLE shows the finished work.


Results:

  • Architecture: Higher capacity (32bits) = SAMD11C, XIAO RP 2040 and XIAO ESP 32-C3. All microcontrollers use the Harvard architecture.
  • Clock frequency: Higher clock frequency = XIAO RP2040 and ESP32-C3
  • Flash memory: Higher data transfer = XIAO RP2040 and ESP32-C3
  • RAM memory: Higher memory = XIAO RP2040 and ESP32-C3
  • Communication interfaces: The most versatile serial communication protocols belong to the XIAO ESP32-C3 Integrated peripherals: The most versatile integrated communication protocols belong to the XIAO ESP32-C3
  • Power consumption: SAMD11C has the lowest power consumption, which implies a longer lifespan. The rest of the microcontrollers studied consume from 3.3V to 5V (except the Atiny412 which consumes from 3V). The energy consumption will depend on its use.
  • Development tools: The microcontrollers that use free languages ​​are XIAO RP2040 and ESP32-C3
  • Compatibility with boards: The microcontrollers are compatible with several boards. The choice will depend on your use.

Individual Assignment: Programming my Board

This week I have entered the world of Arduino programming to investigate the world of the XIAO ESP32 C3 microcontroller that I had the mission of assigning to the outputs of the microcontroller with the connection of a potentiometer thus decreasing or increasing the output signal by sending different signals from the potentiometer.


Making the connection with the XIAO Esp32 c3 microcontroller with a potentiometer


Once the potentiometer is moved with the code in the microcontroller, the voltage shown is measured with the signal from port 4.


By lowering the intensity of the potentiometer, the voltage shown is measured with the signal from port 4


And finally a third signal once the signal from the potentiometer has been modified.


Code Example

As a short introduction, I detail the codes that work with Arduino software and hardware and that I will describe later.

void setup() {              
  Serial.begin(9600);
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
}

void loop() {
  for (int i = 10; i <= 5000; i = i + 50) {
    Serial.println(i);
    digitalWrite(13, LOW);
    delay(i);
    digitalWrite(13, HIGH);
    delay(i);
  }
}

Second Exercises


First of all visit the arduino website to browse the topic of software and hardware that this good application offers.


Then visit the area of the classic family of the arduino where you can see from the arduino uno, mega, etc.


The following image shows the arduino uno that I chose to see its description.


The figure shows the technical specifications where it can be seen that it works with the ATmega328p architecture.


That link takes me to see the ATmega328p manual where the architecture of how this microcontroller works is described.


This section discusses the AVR core architecture in general. The main function of the CPU core is to ensure correct program execution. The CPU must therefore be able to access memories, perform calculations, control peripherals, and handle interrupt


Here the characteristics of the microcontroller are shown.


Timer/Counter0 is a general purpose 8-bit Timer/Counter module, with two independent Output Compare Units, and with PWM support. It allows accurate program execution timing (event management) and wave generation.


Here the SDRAM main memory is described.


Next I will begin to describe the practice of using the arduino uno hardware with its respective cable.


Then visit the arduino page in the software category to download it.


If you wish, you contribute voluntarily since this program is free.


Here waiting for the download of the program to finish.


Now it’s time to start the installation in the windows operating system.


Choosing that anyone who uses this computer can use.


Accepting the conditions established by the program.


Waiting for windows to install the necessary files for the use of the arduino IDE.


Finally finished the installation and then run the program.


Connecting the arduino one to the laptop


Programming in the arduino in the C language the Hello world with pin 13 on and off with a wait of 1 second.


In the arduino IDE configuring the board that is being connected.


Then configuring the COM3 communication port for the arduino one.


Uploading the code to the arduino and receiving confirmation without errors.


Video of project

Code of program


Last update: November 19, 2024