Skip to content

6. Embeded Programing

Introduction to Embedded Programs Week

Welcome to Week 6: Embedded Programs! This week, we dive into the fascinating world of microcontrollers, where we’ll explore the fundamentals of embedded systems and learn how to program them to control various hardware components. For many of us, including myself, this marks our first foray into the realm of embedded programming, and we’re excited to embark on this learning journey together.

Throughout the week, we’ll acquaint ourselves with microcontrollers, understanding their architecture, capabilities, and applications in real-world projects. From blinking LEDs to interfacing with sensors and actuators, we’ll delve into hands-on experiments to grasp the essentials of writing code for embedded systems.

As someone new to this field, I look forward to overcoming challenges, experimenting with different programming techniques, and gaining valuable insights into the inner workings of microcontroller-based systems. Together, let’s embrace the learning process, celebrate our achievements, and unlock the potential of embedded programming in our journey through Fab Academy.

Group Assignment

Browse through the data sheet for your microcontroller and compare the performance and development workflows for other architectures

This was the assignment that was given to us as a group, the microcontroller we have taken up is Seed xiao RP2040 that was available in our lab.

First we went through the datasheet of RP 2040 and noted down all the features of RP2040 and basically how the components are arranged on it (architecture of the microcontoller)

Datasheet of RP2040

What is Architecture

Architectures encompass families of chips, defining the core design and instruction set of a microcontroller or processor. As there are blueprint guiding the construction of a house, dictating layout, materials, and connections between rooms. Similarly, in microcontrollers and processors, architecture determines internal design, computational processes, and inter-component communication.

Comparison

We have compared 3 microcontrollers togather this time that is RP2040,ATtiny44 and ESP8266, here it is we have compared it in their performance, features,devlopment workflow, conectivity and applications

Performance

  • RP2040: Dual-core ARM Cortex-M0+ processor running at up to 133 MHz, with ample SRAM and peripherals.
  • ATTiny44: 8-bit AVR RISC-based microcontroller running at up to 20 MHz, with limited resources compared to RP2040.
  • ESP8266: 32-bit Tensilica Xtensa LX106 processor running at up to 80 MHz, with onboard Wi-Fi connectivity.

Features

  • RP2040: Multifunction GPIO pins, multiple communication interfaces (SPI, I2C, UART), USB support.
  • ATTiny44: Limited I/O pins and peripherals, basic communication interfaces (SPI, I2C).
  • ESP8266: Onboard Wi-Fi connectivity, GPIO pins, SPI, I2C, UART interfaces.

Development Workflows

  • RP2040: Extensive ARM ecosystem with a wide range of development tools, compilers, and comprehensive documentation.
  • ATTiny44: Supported by Atmel/Microchip ecosystem with tools like Atmel Studio, AVR-GCC compiler.
  • ESP8266: Supported by Espressif ecosystem with tools like ESP-IDF, Arduino IDE support.

Connectivity Options

  • RP2040: Can interface with external modules for Wi-Fi, Bluetooth, or other communication protocols.
  • ATTiny44: Requires external modules for networking capabilities.
  • ESP8266: Onboard Wi-Fi connectivity for direct internet access.

Applications

  • RP2040: Suitable for IoT devices, wearables, robotics, consumer electronics.
  • ATTiny44: Suitable for simpler embedded applications such as sensor nodes, LED control, and basic motor control.
  • ESP8266: Ideal for IoT applications requiring internet connectivity such as home automation, remote monitoring.

Our Conclusion

After the comparison we concluded that each microcontroller has its strengths and is suited for different types of applications. The RP2040 offers high performance and versatility, the ATTiny44 is more cost-effective and suitable for simpler tasks, while the ESP8266 provides built-in Wi-Fi connectivity, making it ideal for IoT applications requiring internet connectivity. The choice depends on the specific requirements and constraints of your project.

Assignment

Seed Xiao RP2040

The Xiao RP2040 is the microcontroller we have used for this assignment. The Xiao RP2040 is a compact and powerful microcontroller designed for electronics projects and IoT applications that require a small form factor and efficient processing capabilities. Equipped with a dual-core ARM Cortex M0+ processor that can run at up to 133 MHz, it offers an optimal combination of power efficiency and processing performance.

Arduino IDE

Arduino is a development platform known for its user-friendly software environment, enabling easy programming of microcontrollers and creation of electronic projects. Utilizing the Arduino IDE, the primary programming software, individuals can code in C/C++ and upload it to their Arduino board to control interactions with connected electronic components. For boards like the Xiao RP2040, based on the Raspberry Pi RP2040 microcontroller, users can employ the Arduino IDE by installing the RP2040 board package. This enables programming in the Arduino language, utilizing available functions and libraries for diverse project development, from basic LED blinking to advanced IoT applications. The Arduino IDE boasts an intuitive interface, catering to users of all skill levels, while the active Arduino community offers abundant resources, tutorials, and examples to support learning and project development.

Configuring ArduinoIDE and Xiao RP2040

For this I reffered to my fab instructor Jesal Meheta’s Page neat step by step instructions, the steps I followed:

Step 1

Go to your file and into the preferences. Here you will get an option called Additional board manager Url as shown in the below screen here you have copy the file Url of - Arduino-Pico

Step 2

Install the Arduino Pico by Earlephilhower

Step 3

After the Installation select the board on your device as RP2040, This step is actually very important because if you dont have the right port selected to in your IDE the code wont work and will give an error.

Error

I ran the code by neil for the blink on the IDE but while uploading was getting an error again and again as shown below. Neil’s Code

I thought that it was a port issue and not any software issue so I went on to the device manager and saw on which port the Xiao is connected to

Then corrected the port from 5 to 3 and the problem was solved the code got uploaded

when I uploaded the code for the neopixel to blink I had to add library from the tools section. <Adafruit_NeoPixel.h> This was the library that needed to be installed in order for the code to work fine.

The Final Output

Hero Shot with the serial Monitor

The neopixel started to blinking the number of alphabets present in the word.

Code File

Neopixel Code