Differences Between STM32, Arduino, and Raspberry Pi Development

Recently, I saw someone asking: Are there significant differences in the development methods of STM32, Arduino, and Raspberry Pi?
In terms of similarities, there are many common points among them. However, if we talk about the differences in development, there are indeed quite a few.

Similarities and Differences Among STM32, Arduino, and Raspberry Pi

STM32, Arduino, and Raspberry Pi are three different hardware platforms, each with unique characteristics and applicable scenarios.

1. Hardware Characteristics

Hardware Platform STM32 Arduino Raspberry Pi
Type Microcontroller Open-source electronic prototyping platform Linux-based single-board computer
Core ARM Cortex-M core Atmel 8-bit microprocessor Broadcom ARM architecture processor
Performance High performance, low power consumption Lower power consumption, easy to get started Higher computing capability
Peripheral Interfaces Rich (e.g., UART, SPI, I2C, etc.) Rich interfaces, easy to expand Various interfaces and communication protocols

2. Software and Programming

Hardware Platform STM32 Arduino Raspberry Pi
Programming Language C/C++ Simplified C-like language (based on Wiring) Python, C++, various Linux distributions supported
Development Environment Various development toolchains Arduino IDE Various Linux development environments, official Raspberry Pi OS
Software Ecosystem Rich software libraries and community support Rich open-source projects and tutorials Extensive software support and community resources

3. Application Scenarios

Hardware Platform STM32 Arduino Raspberry Pi
Applicable Fields Embedded systems, industrial automation, wireless communication, etc. Education, maker projects, hobbies, rapid prototyping IoT, multimedia centers, education, development learning, etc.
Project Examples Smart cars, drones, smart homes, etc. Interactive art installations, automation control, etc. IoT applications, smart cars, face recognition, etc.

4. Usability and Learning Curve

  • STM32: Requires a certain level of electronics and embedded systems knowledge, has a steep learning curve, but is powerful and suitable for complex projects.

  • Arduino: Easy to get started, no complex configuration required, suitable for beginners and rapid prototyping, but has relatively limited functions and performance.

  • Raspberry Pi: Offers high computing power, based on Linux, easy to learn and use, suitable for various computer projects and IoT applications.

5. Price and Cost

  • STM32: Prices vary based on model and configuration, but are generally affordable, suitable for mass production.

  • Arduino: Relatively low price, suitable for personal and small projects.

  • Raspberry Pi: Prices vary based on model and configuration, but are generally cheaper compared to traditional desktop computers.

LED Control Program for STM32, Arduino, and Raspberry Pi

Here, we will show you the differences among STM32, Arduino, and Raspberry Pi through source code.
STM32 LED Control Program
STM32 is based on the Cortex-M core, and its LED control program is quite similar to that of most Cortex-M microcontrollers.
It mainly includes configuring the clock, pin, and other information, and then uses a delay to implement the blinking of the LED.
// Assume the LED is connected to GPIOA's Pin5#define LED_PIN GPIO_PIN_5#define LED_PORT GPIOA
// GPIO initialization function (generated by STM32CubeMX)void MX_GPIO_Init(void){    GPIO_InitTypeDef GPIO_InitStruct = {0};
    // Enable clock for GPIOA    __HAL_RCC_GPIOA_CLK_ENABLE();
    // Configure GPIOA Pin5 as output mode    GPIO_InitStruct.Pin = LED_PIN;    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;    GPIO_InitStruct.Pull = GPIO_NOPULL;    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;    HAL_GPIO_Init(LED_PORT, &GPIO_InitStruct);}
int main(void){    // HAL library initialization    HAL_Init();    // Configure system clock    SystemClock_Config();    // Initialize all configured peripherals    MX_GPIO_Init();
    while (1)    {        // Turn on LED        HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_SET);        // Delay 500 milliseconds        HAL_Delay(500);        // Turn off LED        HAL_GPIO_WritePin(LED_PORT, LED_PIN, GPIO_PIN_RESET);        // Delay 500 milliseconds        HAL_Delay(500);    }}
Arduino LED Control Program
Arduino encapsulates many existing libraries, and we only need to call those libraries. Furthermore, Arduino is an open-source hardware and software platform that makes it easier to create electronic projects.
// Assume the LED is connected to pin 13const int ledPin = 13;
void setup() {  // Initialize digital pin as output  pinMode(ledPin, OUTPUT);}
void loop() {  // Turn on LED  digitalWrite(ledPin, HIGH);  // Delay 500 milliseconds  delay(500);  // Turn off LED          digitalWrite(ledPin, LOW);  // Delay 500 milliseconds  delay(500);}
Raspberry Pi LED Control Program
The Raspberry Pi usually runs a Linux operating system, and there are multiple programming languages available for development on the Raspberry Pi.
Python is a popular language, and since Raspberry Pi supports it, many people choose to develop using Python for simplicity and convenience.
import RPi.GPIO as GPIOimport time
# Use BCM GPIO numberingGPIO.setmode(GPIO.BCM)# Assume the LED is connected to GPIO17LED_PIN = 17
# Set GPIO pin as output modeGPIO.setup(LED_PIN, GPIO.OUT)
try:    while True:        # Turn on LED        GPIO.output(LED_PIN, GPIO.HIGH)        # Delay 500 milliseconds        time.sleep(0.5)        # Turn off LED        GPIO.output(LED_PIN, GPIO.LOW)        # Delay 500 milliseconds        time.sleep(0.5)except KeyboardInterrupt:    # Catch Ctrl+C to clean up GPIO settings    passfinally:    # Clean up all GPIO settings    GPIO.cleanup()
Finally, all three platforms are currently popular hardware platforms, and you can choose based on your preferences.

Source | Embedded Column

Copyright belongs to the original author. If there is any infringement, please contact to delete.


END






About Anxin Education

Anxin Education is an innovative education platform focused on AIoT (Artificial Intelligence + Internet of Things), providing comprehensive AIoT education solutions from primary and secondary schools to higher education.
Anxin Education relies on Arm technology to develop the ASC (Arm Smart Connectivity) curriculum and talent training system. It has been widely applied in the industry-university-research cooperation of higher education institutions and STEM education in primary and secondary schools, aiming to cultivate talents in the field of smart connectivity that meet the demands of the times.

Leave a Comment