# Arduino vs Raspberry PI

## 1. Overview

### 1.1 Arduino

Arduino is an open-source hardware and software company, project, and user community that designs and manufactures very low-powered single-board microcontrollers and microcontroller kits for building digital devices. It can easily be programmed with an Arduino IDE from a computer/laptop using C++ Programming Language.


|![Arduino](https://cdn.hashnode.com/res/hashnode/image/upload/v1647876582343/JKnxLFYxj.png)|
|:--:|
|<b>Fig.1 - Arduino Uno</b>|


### 1.2 Raspberry PI

Raspberry Pi is a series of small low powered single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in association with Broadcom. It is a full-fledged computer with USB/HDMI/audio/browser, Operating System, and GPIO (General Purpose Input Output) Pins to connect sensors and other devices. As It has an OS, it can be programmed with any programming language.


|![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1647876208909/c-ySOF8y2.png)|
|:--:|
| <b>Fig.2 - Raspberry PI 4B</b>|


## 2. Comparison

### 2.1 Type
Arduino is a series of microcontrollers/development boards that can be programmed from another computer. Read data from sensors/switch and control motors/led etc.

Raspberry PI is a series of minicomputers for edge computing with a Linux operating system, Browser, Display, Keyboard, Mouse, with additional GPIO functionality where we can attach sensors to read data and actuators to control them.

### 2.2 Portability

Both controllers' main focus is on portability and edge computing. Arduino with Low power and Shields is highly portable but with low processing power and memory.

### 2.3 Power

Arduino requires very low power 5V from USB Port or 6-12V from Barrel Jack with the current in mA. It can run with a battery pack for days.

PI requires 5V 0.5-3A Current Range to power processor, USB, Display, and Ethernet Port

### 2.4 Processing

Arduinos has a processor of low-frequency 16MHz ATMega328P (Arduino Nano) for low-end processing

PI have multicore processors to run the browser, app, software like normal computers 1.5GHz quad-core ARMv8-A	 (PI 4)

### 2.5 Memory 

Arduino has SRAM range from 2KB (Arduino Nano) - to 64MB (Arduino Portenta H7)
Arduino has internal Flash Memory of 32KB - 128MB.

Raspberry PI has DRAM range from 512MB (PI Zero) - to 8GB (PI 4B)
PI requires separate storage SD Card/USB for storing OS, Data, and code.

### 2.6 Applications 

Arduino is used for simpler Applications Including
- I/O pins to Sense, Control, and Display on LCD.
- Real-Time Control
- Simple Web Server
- Simple Low-Resolution Camera/Image Processing 

PI is used for More Software-based Applications Including
- GPIO pins to connect sensors, controllers, LCD displays.
- Web Server Control
- Camera/Image Processing
- GUI Application/Control
- Edge Networking
- AI and ML


### 2.7 Durability 

The diode on Arduino Uno's Barrel Jack protects it from reverse voltage and the Voltage regulator regulates voltage to 5V. The internal EEPROM of Arduino has a lifetime of 100,000 write cycles. So Refrain from writing to EEPROM too much. It can function 24/7 for a long time and don't get heated up easily.

Running PI with Low Current/Voltage may damage the SD Card (can be replaced). PI gets hot easily, proper heat management can cool the processor.

### 2.8 Price (pkrs) 

Arduino has a price range from 500 (Arduino Nano) - to 25K (Arduino Portenta H7)

Raspberry PI has a price range from 5K (PI Zero) - to 30K (PI 4B 8GB Model)


## 3. Using Arduino over Raspberry PI

Arduino is preferred over Pi when


####  Your application is very simple

The application includes using any sensor to control the actuator/display information on LCD Display.

#### Real time processing

Unlike PI handling hardware/Ports/OS, Arduino runs a single function compiled in a loop. It can be used when you have real-time constraints.

#### Analog/PWM Hardware pins

Analog inputs: Arduino can be used to read analog values from sensors 0-5V (0-1023)

PWM: Some Pins on Arduino can use PWM (Pulse Width Modulation) to control motors/devices and faster switching to create analog output signals.


## 4. Using Raspberry PI over Arduino

PI is preferred over Arduino when you have

#### A Complex application – Software Based

When you need high-end processing and memory or need a web server or display for GUI Application

#### Want to use other languages

PI has an OS which means you can install and program on any Language eg. Python, C++, Javascript, etc.

#### Multi-threading Task

Arduino runs on a single function running in a loop on a single processor. Due to Multi-Cores present on the PI with an OS, It can easily be programmed for multi threading.



