Stufin
Home Quick Cart Profile

Raspberry Pi 4 Model B (2GB RAM)

Buy Now on Stufin

Dimensions

85mm x 56mm x 17mm (3.34in x 2.22in x 0.67in)

Weight

Approximately 45g (1.59oz)

Thermal Dissipation

The Raspberry Pi 4 Model B has a built-in heat spreader to dissipate heat generated by the SoC. In addition, the board's design allows for easy attachment of heat sinks or fans for further thermal management.

Compliance and Safety

The Raspberry Pi 4 Model B complies with relevant safety and regulatory standards, including CE, FCC, and RoHS.

Warranty and Support

The Raspberry Pi 4 Model B is supported by the Raspberry Pi Foundation, which provides extensive documentation, community support, and a 12-month warranty.

Conclusion

The Raspberry Pi 4 Model B (2GB RAM) is a powerful, feature-rich, and affordable SBC ideal for IoT projects, robotics, and embedded systems. Its compact size, low power consumption, and versatility make it an excellent choice for a wide range of applications.

Pin Configuration

  • Raspberry Pi 4 Model B (2GB RAM) Pinout Guide
  • The Raspberry Pi 4 Model B has a 40-pin GPIO header, which provides access to various interfaces and functionality. Here's a detailed explanation of each pin, numbered from 1 to 40:
  • Power Pins
  • 1. 3.3V Power (Pin 1): Provides 3.3V power output from the Raspberry Pi.
  • 2. 5V Power (Pin 2): Provides 5V power output from the Raspberry Pi.
  • 3. 5V Power (Pin 4): Provides 5V power output from the Raspberry Pi.
  • 4. Ground (Pin 6): Provides a ground connection.
  • GPIO Pins
  • 5. GPIO 2 (Pin 3): General-purpose input/output pin.
  • 6. GPIO 3 (Pin 5): General-purpose input/output pin.
  • 7. GPIO 4 (Pin 7): General-purpose input/output pin.
  • 8. GPIO 14 (Pin 8): General-purpose input/output pin, also used as TXD (transmit) for UART.
  • 9. Ground (Pin 9): Provides a ground connection.
  • 10. GPIO 15 (Pin 10): General-purpose input/output pin, also used as RXD (receive) for UART.
  • 11. GPIO 17 (Pin 11): General-purpose input/output pin.
  • 12. GPIO 18 (Pin 12): General-purpose input/output pin.
  • 13. GPIO 27 (Pin 13): General-purpose input/output pin.
  • 14. Ground (Pin 14): Provides a ground connection.
  • 15. GPIO 22 (Pin 15): General-purpose input/output pin.
  • 16. GPIO 23 (Pin 16): General-purpose input/output pin.
  • 17. 3.3V Power (Pin 17): Provides 3.3V power output from the Raspberry Pi.
  • 18. GPIO 24 (Pin 18): General-purpose input/output pin.
  • 19. GPIO 10 (Pin 19): General-purpose input/output pin, also used as MOSI (master out slave in) for SPI.
  • 20. GPIO 9 (Pin 20): General-purpose input/output pin, also used as MISO (master in slave out) for SPI.
  • 21. GPIO 25 (Pin 21): General-purpose input/output pin, also used as SCLK (serial clock) for SPI.
  • 22. GPIO 11 (Pin 22): General-purpose input/output pin, also used as CE0 (chip enable 0) for SPI.
  • 23. GPIO 8 (Pin 23): General-purpose input/output pin, also used as CE1 (chip enable 1) for SPI.
  • 24. Ground (Pin 24): Provides a ground connection.
  • Additional interfaces
  • 25. UART TXD (Pin 32): Transmit data line for UART ( serial communication).
  • 26. UART RXD (Pin 33): Receive data line for UART (serial communication).
  • 27. I2C SDA (Pin 35): Data line for I2C (inter-integrated circuit) communication.
  • 28. I2C SCL (Pin 36): Clock line for I2C communication.
  • 29. SPI MOSI (Pin 37): Master out slave in line for SPI communication.
  • 30. SPI MISO (Pin 38): Master in slave out line for SPI communication.
  • 31. SPI SCLK (Pin 39): Serial clock line for SPI communication.
  • 32. SPI CE0 (Pin 40): Chip enable 0 line for SPI communication.
  • Connecting the Pins
  • When connecting pins on the Raspberry Pi, it's essential to follow proper connection guidelines to avoid damaging the board or the devices connected to it. Here are some general tips:
  • Use jumper wires or breadboard-friendly connectors to connect devices to the GPIO pins.
  • Ensure that the voltage levels of the devices connected to the GPIO pins match the 3.3V or 5V power outputs.
  • Use pull-up or pull-down resistors as required for specific GPIO configurations.
  • Avoid connecting devices that require more current than the Raspberry Pi can provide (max 50mA per GPIO pin).
  • Use isolating components or level shifters when connecting devices with different voltage levels.
  • Remember to consult the Raspberry Pi documentation and the datasheet of the devices you're connecting to ensure compatible connections.

Code Examples

Raspberry Pi 4 Model B (2GB RAM) Documentation
Overview
The Raspberry Pi 4 Model B is a single-board computer that offers a powerful and affordable solution for various IoT projects. This model features 2GB of RAM, making it suitable for applications that require more memory. The Raspberry Pi 4 Model B is equipped with a quad-core Cortex-A72 CPU, Gigabit Ethernet, Wi-Fi, Bluetooth 5.0, and multiple USB ports.
Hardware Specifications
CPU: Quad-core Cortex-A72 (ARMv8) 64-bit
 RAM: 2GB LPDDR4-2400
 Storage: MicroSD card slot
 Operating System: Raspberry Pi OS (formerly Raspbian)
 Networking: Gigabit Ethernet, 802.11ac Wi-Fi, Bluetooth 5.0
 USB: 2x USB 3.0, 2x USB 2.0
 Video: 2x HDMI 2.0, 4Kp60 H.265 decode
 Audio: 3.5mm analog audio jack
Programming Languages
The Raspberry Pi 4 Model B supports various programming languages, including:
Python
 Java
 C++
 Scratch
Code Examples
### Example 1: Python Script for LED Blinking
In this example, we will use the Raspberry Pi's GPIO pins to blink an LED.
Hardware Requirements:
Raspberry Pi 4 Model B
 Breadboard
 LED
 1k resistor
 Jumper wires
Code:
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define the LED pin
LED_PIN = 17
# Set up the LED pin as an output
GPIO.setup(LED_PIN, GPIO.OUT)
while True:
    # Turn on the LED
    GPIO.output(LED_PIN, GPIO.HIGH)
    time.sleep(1)
    # Turn off the LED
    GPIO.output(LED_PIN, GPIO.LOW)
    time.sleep(1)
```
Explanation:
We import the `RPi.GPIO` module, which provides an interface to the Raspberry Pi's GPIO pins.
 We set up the GPIO mode to use the Broadcom numbering scheme.
 We define the LED pin as GPIO 17.
 We set up the LED pin as an output.
 In the main loop, we toggle the LED on and off using the `GPIO.output()` function.
### Example 2: Python Script for Temperature and Humidity Reading using DHT11 Sensor
In this example, we will use the Raspberry Pi to read temperature and humidity values from a DHT11 sensor.
Hardware Requirements:
Raspberry Pi 4 Model B
 DHT11 temperature and humidity sensor
 Breadboard
 Jumper wires
Code:
```python
import Adafruit_DHT
import time
# Set up the DHT11 sensor
DHT_SENSOR = Adafruit_DHT.DHT11
# Define the pin connected to the DHT11 sensor
DHT_PIN = 17
while True:
    # Read the temperature and humidity values
    humidity, temperature = Adafruit_DHT.read_retry(DHT_SENSOR, DHT_PIN)
    
    # Print the values
    print("Temperature: {:.1f}C  Humidity: {:.1f}%".format(temperature, humidity))
    
    # Wait for 1 second before taking the next reading
    time.sleep(1)
```
Explanation:
We import the `Adafruit_DHT` module, which provides an interface to the DHT11 sensor.
 We set up the DHT11 sensor as a DHT11 type.
 We define the pin connected to the DHT11 sensor as GPIO 17.
 In the main loop, we read the temperature and humidity values using the `Adafruit_DHT.read_retry()` function.
 We print the values to the console.
 We wait for 1 second before taking the next reading using the `time.sleep()` function.
Note: These code examples are just a starting point, and you may need to modify them to suit your specific project requirements. Additionally, ensure that you have installed the necessary libraries and dependencies before running the code.