Stufin
Home Quick Cart Profile

Raspberry Pi 5 4GB

Buy Now on Stufin

Dimensions

85 x 56 x 17 mm (3.37 x 2.21 x 0.67 inches)

Weight

approximately 40 grams (1.41 ounces)

Accessories

Optional cases and enclosures available for protection and aesthetics

Various adapter boards and accessories available for expanded functionality

In summary, the Raspberry Pi 5 4GB is a powerful, feature-rich SBC that offers improved performance, expanded memory, and enhanced functionality compared to its predecessors. Its affordability, compact size, and wide range of applications make it an attractive choice for developers, makers, and enthusiasts alike.

Pin Configuration

  • Raspberry Pi 5 4GB Pinout Guide
  • The Raspberry Pi 5 4GB is a popular single-board computer (SBC) designed for a variety of applications, including IoT projects, robotics, and automation. Understanding the pinout of the Raspberry Pi 5 is essential for connecting peripherals, sensors, and actuators to the board. This documentation provides a detailed explanation of each pin on the Raspberry Pi 5 4GB, along with guidance on how to connect them.
  • GPIO Header (P1 - 40 pins)
  • The GPIO header is divided into two rows of 20 pins each. The pins are numbered from 1 to 40, with the top-left pin being Pin 1 and the bottom-right pin being Pin 40.
  • Row 1 (Pins 1-20)
  • 1. 3V3: 3.3V power output pin. Provides a stable 3.3V power supply for external components.
  • 2. 5V: 5V power output pin. Provides a stable 5V power supply for external components.
  • 3. GPIO2: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 4. GPIO3: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 5. GPIO4: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an SPI clock pin.
  • 6. GPIO5: General-purpose input/output pin. Can be used as an input or output, and can be configured as an SPI MOSI pin.
  • 7. GPIO6: General-purpose input/output pin. Can be used as an input or output, and can be configured as an SPI MISO pin.
  • 8. GPIO7: General-purpose input/output pin. Can be used as an input or output, and can be configured as an SPI SCK pin.
  • 9. GPIO8: General-purpose input/output pin. Can be used as an input or output, and can be configured as a UART TX pin.
  • 10. GPIO9: General-purpose input/output pin. Can be used as an input or output, and can be configured as a UART RX pin.
  • 11. GPIO10: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 12. GPIO11: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 13. GPIO12: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 14. GPIO13: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 15. GPIO14: General-purpose input/output pin. Can be used as an input or output, and can be configured as a UART TX pin.
  • 16. GPIO15: General-purpose input/output pin. Can be used as an input or output, and can be configured as a UART RX pin.
  • 17. 3V3: 3.3V power output pin. Provides a stable 3.3V power supply for external components.
  • 18. GPIO17: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 19. GPIO18: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 20. GPIO19: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • Row 2 (Pins 21-40)
  • 21. GPIO20: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 22. GPIO21: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 23. GPIO22: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 24. GPIO23: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 25. GPIO24: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 26. GPIO25: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 27. ID_SD: I2C ID EEPROM data pin.
  • 28. ID_SC: I2C ID EEPROM clock pin.
  • 29. GPIO28: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 30. GPIO29: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 31. GPIO30: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 32. GPIO31: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 33. GPIO32: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 34. GPIO33: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 35. GPIO34: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 36. GPIO35: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 37. GPIO36: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 38. GPIO37: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • 39. GPIO38: General-purpose input/output pin. Can be used as an input or output, and can be configured as an I2C data pin.
  • 40. GPIO39: General-purpose input/output pin. Can be used as an input or output, and can be configured as a PWM output or an I2C clock pin.
  • Power Pins
  • 5V: 5V power output pin. Provides a stable 5V power supply for external components.
  • 3V3: 3.3V power output pin. Provides a stable 3.3V power supply for external components.
  • GND: Ground pin. Provides a ground connection for external components.
  • Connecting Pins
  • When connecting pins on the Raspberry Pi 5, make sure to use the correct pinouts and voltage levels to avoid damaging your board or external components. Here are some general guidelines:
  • Use a breadboard or a PCB to connect multiple components to the Raspberry Pi 5.
  • Use jumper wires or female-to-female jumper cables to connect pins on the GPIO header.
  • Make sure to connect power pins (5V and 3V3) to a suitable power source or a voltage regulator.
  • Use a voltage level converter if connecting 5V devices to 3V3 pins.
  • Avoid connecting pins with different voltage levels or incompatible signal types (e.g., digital and analog).
  • Remember to consult the official Raspberry Pi documentation and datasheets for specific pinout configurations and usage guidelines for your project.

Code Examples

Raspberry Pi 5 4GB Documentation
Overview
The Raspberry Pi 5 4GB is a powerful single-board computer (SBC) designed for IoT, robotics, and automation projects. With a quad-core Cortex-A55 CPU, 4GB of RAM, and a wide range of interfaces, it's an excellent choice for developing complex projects.
Hardware Specifications
Processor: Quad-core Cortex-A55 CPU
 RAM: 4GB
 Storage: MicroSD card slot
 Operating System: Raspberry Pi OS (based on Linux)
 Interfaces:
	+ HDMI 2.0
	+ USB 3.0 (x2)
	+ USB 2.0 (x2)
	+ Ethernet RJ45
	+ Wi-Fi 5 (802.11ac)
	+ Bluetooth 5.0
	+ GPIO (40-pin)
	+ Camera interface (CSI)
Code Examples
### Example 1: Python Script to Control LED using GPIO
This example demonstrates how to use the Raspberry Pi 5's GPIO pins to control an LED.
Hardware Requirements
Raspberry Pi 5 4GB
 LED
 1 k resistor
 Breadboard
 Jumper wires
Software Requirements
Raspberry Pi OS (latest version)
 Python 3.x
Code
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the GPIO pin for the LED
LED_PIN = 17
# Set up the LED pin as an output
GPIO.setup(LED_PIN, GPIO.OUT)
while True:
    # Turn the LED on
    GPIO.output(LED_PIN, GPIO.HIGH)
    time.sleep(1)
    # Turn the LED off
    GPIO.output(LED_PIN, GPIO.LOW)
    time.sleep(1)
```
Explanation
In this example, we use the RPi.GPIO library to interact with the GPIO pins. We set up the LED pin (GPIO 17) as an output and then use a `while` loop to toggle the LED on and off every second.
### Example 2: Node.js Script to Collect and Send Sensor Data to the Cloud
This example demonstrates how to use the Raspberry Pi 5 to collect sensor data and send it to the cloud using Node.js.
Hardware Requirements
Raspberry Pi 5 4GB
 DHT11 temperature and humidity sensor
 Breadboard
 Jumper wires
Software Requirements
Raspberry Pi OS (latest version)
 Node.js (latest version)
 npm packages:
	+ `dht-sensors`
	+ `axios`
Code
```javascript
const dht = require('dht-sensors');
const axios = require('axios');
// Set up the DHT11 sensor
const sensor = new dht.DHT11(4); // GPIO 4
// Set up the API endpoint
const API_ENDPOINT = 'https://your-cloud-api.com/temperature';
// Collect and send sensor data every 10 seconds
setInterval(() => {
  const temperature = sensor.readTemperature();
  const humidity = sensor.readHumidity();
const data = {
    temperature: temperature.toFixed(2),
    humidity: humidity.toFixed(2)
  };
axios.post(API_ENDPOINT, data)
    .then(response => {
      console.log(`Data sent to cloud: ${response.data}`);
    })
    .catch(error => {
      console.error(`Error sending data to cloud: ${error}`);
    });
}, 10000);
```
Explanation
In this example, we use the `dht-sensors` library to interact with the DHT11 sensor and collect temperature and humidity data. We then use the `axios` library to send the data to a cloud API endpoint using a `POST` request. The `setInterval` function is used to collect and send data every 10 seconds.
These examples demonstrate the flexibility and capabilities of the Raspberry Pi 5 4GB in various IoT contexts.