Skip to content

5.Embedded programming

Assignment

Group Assignment:

Demonstrate and compare the toolchains and development workflows for various embedded architectures.

Individual Assignment:

1.Browse through the data sheet for your microcontroller.
2.Write a program for the microcontroller, and simulate its operation:
- The program should interact with local input and/or output devices.
- The program should communicate with remote devices via wired or wireless connections.
3. **Extra credit**: Test the program on a development board.
4. **Extra credit**: Try different languages and/or development environments.

My Embedded System Board Setup

My Experience with Embedded Systems

I have experience working with various embedded systems platforms, including:

  • Arduino
  • Raspberry Pi
  • ESP32
  • STM32
  • Orange pi

Currently, I am focusing on STM32 microcontrollers, with the goal of developing more complex and advanced projects.

This journey allows me to create innovative solutions and improve my expertise in embedded system design, helping me achieve my goal of building cutting-edge technology.

Arduino VS STM32

Comparison of STM32F103C and Arduino UNO

The image compares the specifications of two microcontroller boards: STM32F103C and Arduino UNO.

STM32F103C:

  • 32-bit architecture
  • 72 MHz CPU
  • 20 KB RAM
  • 64 KB FLASH
  • 37 GPIO pins
  • 10 ADC pins
  • Supports SPI, I2C, UART, CAN

Arduino UNO:

  • 8-bit architecture
  • 16 MHz CPU
  • 2 KB RAM
  • 32 KB FLASH
  • 14 GPIO pins
  • 6 ADC pins
  • Supports SPI, I2C, UART

STM32F103C offers better performance and more features, while Arduino UNO is simpler and more beginner-friendly.

My experience with embedded boards.

My Experience with ESP32

I have experience with the ESP32 microcontroller, and I wrote code in C++ using the Arduino core. It was very exciting to work with ESP32, as it offers more capabilities than Arduino.

Currently, I am focusing on writing code using Espressif IDF to ensure that my projects run efficiently. Additionally, I plan to use FreeRTOS to take advantage of its real-time multitasking features.

This setup will help me achieve more complex and faster-running embedded projects.

My Experience with Orange pi

Orange Pi R1

The Orange Pi R1 is a single-board computer designed for networking and routing applications. It features:

  • Processor: Allwinner H3 (Quad-core Cortex-A7)
  • RAM: 1 GB DDR3
  • Storage: 8 GB eMMC (expandable via microSD)
  • Networking: 1 x 1000M Ethernet port, 1 x 100M Ethernet port
  • USB: 1 x USB 2.0
  • Power Supply: 5V 2A via micro-USB
  • Operating System: Supports Linux and Android distributions

The Orange Pi R1 is ideal for home networking, routers, and other embedded applications requiring basic computing power and multiple network interfaces.

I worked with the Orange Pi R1, installed Linux Armbian, and controlled the GPIO pins. I also tried running OpenCV, but the FPS was only 2. The Orange Pi R1 is a single-board computer, which makes it better than STM32, Arduino, and ESP32 because it runs an operating system, opening up greater possibilities. With it, I can create small computer vision projects or even set up my own server.

My Experience with Raspberry pi

I have worked on a projects with Raspberry Pi, considering it a powerful tool. I have developed projects in computer vision and machine learning, and have interfaced with various microcontrollers like Arduino, ESP32, and STM32.

My Trash Sorting Project

I developed a project that sorts trash into three types (for three containers) using Raspberry Pi 3. I collected a dataset of 3,000 photos and trained it with YOLOv8, running it with TensorFlow Lite. The Raspberry Pi sends the data to an Arduino, which then controls the servos to manage the sorting process.

My Experience with STM32

Blue Pill Microcontroller

The Blue Pill is a popular and inexpensive development board based on the STM32F103C8T6 microcontroller, part of the STM32 family. It's widely used for embedded systems and robotics projects.

Key Features:

  • Microcontroller: STM32F103C8T6 (32-bit ARM Cortex-M3)
  • Clock Speed: 72 MHz
  • RAM: 20 KB
  • Flash Memory: 64 KB
  • GPIO Pins: 37
  • ADC Channels: 10
  • Timer: 3 timers (16-bit)
  • Communication Interfaces:
  • 1x UART
  • 1x I2C
  • 1x SPI
  • USB: USB 2.0 Full Speed (can be used for device or host mode)
  • Operating Voltage: 3.3V (note: logic level voltage is 3.3V, so ensure compatibility with other 5V devices)
  • Power Supply: 5V via USB or external supply
  • Programming Interface:
  • SWD (Serial Wire Debug)
  • ST-Link or USB-to-serial adapter for programming and debugging
  • Form Factor: 32x20mm (small size, suitable for compact projects)

Applications:

  • Embedded systems: Ideal for DIY projects, IoT, and robotics.
  • Development platform: Works well with popular IDEs like Arduino IDE and STM32CubeIDE.
  • Prototyping: Suitable for quick prototyping with low-cost hardware and flexibility.

Pros:

  • Inexpensive, with a lot of power and flexibility for various projects.
  • STM32 microcontroller provides solid performance for embedded applications.
  • Wide community support with lots of tutorials and resources.

Cons:

  • Not as user-friendly as some other boards (like Arduino) for beginners, requiring some setup and familiarity with ARM-based development.

The Blue Pill is a great option for users looking to work with more powerful microcontrollers in embedded systems at a low cost.

I have developed several projects based on STM32 and work in STM32CubeIDE using the HAL library. My first project based on STM32 was a traffic light project.