Skip to content

4. Embedded Programming

For week number 4, Embedded Programming we will program a board that can interact with input and output elements, with a demonstration example.

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)

Assignment Checklist.

item Activity Status
task 1 Linked to the group assignment page IN PROGRESS
task 2 Documented what you have learned in electronics design IN PROGRESS
task 3 Checked your board can be fabricated IN PROGRESS
task 4 Explained problems and how you fixed them. IN PROGRESS
task 5 Included original design files (Eagle, KiCad, etc.) IN PROGRESS
task 6 Included a ‘hero shot’ IN PROGRESS

Group Assignment.

Seeed XIAO RP2040.

For this occasion within the FabAcademy international training program, the SEEED XIAO RP2040 development board will be used, so we will see the main features of the board; as well as the technical part of it, then let’s go…

Technical Details SEEED XIOA RP2040

SEEED XIAO RP2040 connection pin outputs.

Main Technical Differences between SEEED XIAO RP2040 and SEEED XIAO ESP32 C3

  • SEEED XIAO RP2040 Microcontroller: RP2040 (Raspberry Pi) CPU: Dual-core ARM Cortex-M0+ Clock speed: Up to 133 MHz Memory: 264 KB SRAM, no onboard flash memory Storage: 2 MB external flash memory Connectivity: No wireless connectivity Interface: USB 1.1, GPIO, SPI, I2C, UART Advantages: Higher processing power in applications that do not require wireless connectivity. Dual-core architecture for more efficient tasks. Disadvantages: No native wireless connectivity, which limits IoT applications. Requires external storage for large programs.
  • SEEED XIAO ESP32 C3 Microcontroller: ESP32-C3 CPU: RISC-V Single-core Clock speed: Up to 160 MHz Memory: 400 KB SRAM, 4 MB flash memory Connectivity: Wi-Fi 802.11 b/g/n, Bluetooth 5.0 Interface: USB 2.0, GPIO, SPI, I2C, UART, ADC Advantages: Wi-Fi and Bluetooth integration, ideal for IoT projects. Higher clock speed and onboard memory. Support for a robust and widely used development ecosystem. Disadvantages: Higher power consumption compared to microcontrollers without wireless connectivity. Additional complexity in configuring connectivity. Advantages and Disadvantages in Programming SEEED XIAO RP2040:

Advantages: Support for multiple languages ​​(C/C++, MicroPython), ideal for educational and learning projects. Disadvantages: No wireless connectivity, which limits network and IoT applications. SEEED XIAO ESP32 C3:

Advantages: Wide support for IoT, programming in C/C++, MicroPython and Arduino IDE. Integrated connectivity facilitates the development of connected applications. Disadvantages: Requires higher power consumption and more complex management of connectivity.

Individual assignment

Design for a programming board, where we can work with Arduino programming.

Example for programming.

For this case we can carry out several projects, but we are going to develop a project that controls a motor with a joystick.

#include <Servo.h>

Servo myServo;

const int servoPin = 0; // Pin de señal del servomotor
const int joystickXPin = A1; // Pin de señal X del joystick

int joystickXValue; // Valor de lectura del joystick en el eje X
int servoAngle; // Ángulo del servomotor

void setup() {
  myServo.attach(servoPin);
}

void loop() {
  joystickXValue = analogRead(joystickXPin);

  // Mapear el valor del joystick al rango de 0 a 180 (ángulo del servomotor)
  servoAngle = map(joystickXValue, 0, 1023, 0, 180);

  // Controlar el servomotor con el ángulo calculado
  myServo.write(servoAngle);

  delay(15); // Pequeña pausa para evitar vibraciones en el servomotor
}

Connection

We guide ourselves with the programming and also the connection pins part to complete the task

Learning

In the case of using development boards other than Arduino, but which can be worked within the programming environment, it is good to configure them correctly within the ARDUINO IDE.


Last update: July 12, 2024