Questions tagged [raspberry-pi]

The Raspberry Pi is a small, inexpensive ARM-based PC device. PROGRAMMING QUESTIONS ONLY. Questions about using it should be asked on https://raspberrypi.stackexchange.com/

Raspberry Pi.SE

There is a Stack Exchange site dedicated to the Raspberry Pi. If your question is about using the Raspberry Pi, it should be asked there. However, general programming questions, which you happen to encounter on the Raspberry Pi are appropriate on Stack Overflow.


The Raspberry Pi is a low cost, credit card sized, ARMv6 instruction set based PC device developed by the Raspberry Pi foundation.

The Raspberry Pi currently has twelve models, Model A , Model B , Model A+, Model B+, Model 2 B, Zero, Zero W, Model 3 A+, Model 3 B, Model 3B+ and Model 4B with 1, 2, 4 or 8 GB RAM. Model A was the first model of the Pi to be released (in February 2012), at an average price of $25. Model B was a higher spec variant (first released in June 2012) at an average price of $35. Currently, among the twelve models, Model 4B 8GB has the highest spec (released in June 2019) at an average price of $75.

Only most notable specs listed

Model A consists of:

  • ARM11 CPU
  • OpenGL ES 2.0 capable GPU
  • 256 MB RAM (shared with GPU)
  • HDMI and RCA video
  • 1x USB 2.0 port
  • 3.5 mm audio jack
  • SD card slot

Model B consists of:

  • ARM11 CPU
  • OpenGL ES 2.0 capable GPU
  • 512 MB RAM (shared with GPU)
  • HDMI and RCA video
  • 2x USB 2.0 port
  • 3.5 mm audio jack
  • Ethernet port
  • SD card slot

Model A+ consists of:

  • ARM11 CPU
  • OpenGL ES 2.0 capable GPU
  • 256 MB RAM (shared with GPU)
  • HDMI and composite video via 3.5mm TRRS jack (shared with audio)
  • 1x USB 2.0 port
  • 3.5 mm audio jack
  • MicroSD card slot

Model B+ consists of:

  • ARM11 CPU
  • OpenGL ES 2.0 capable GPU
  • 512 MB RAM (shared with GPU)
  • HDMI and composite video via 3.5mm TRRS jack (shared with audio)
  • 4x USB 2.0 port
  • 3.5 mm audio jack
  • Ethernet port
  • MicroSD card slot

Model 2 B consists of:

  • 4 USB ports
  • 40 GPIO pins
  • Full HDMI port
  • Ethernet port
  • Combined 3.5mm audio jack and composite video
  • Camera interface (CSI)
  • Display interface (DSI)
  • Micro SD card slot
  • VideoCore IV 3D graphics core
  • A 900MHz quad-core ARM Cortex-A7 CPU
  • 1GB RAM

Model Zero consists of:

  • 1GHz single-core CPU
  • 512MB RAM
  • Mini HDMI and USB

Model Zero W additionally consists of:

  • 802.11b/g/n wireless LAN
  • Bluetooth 4.1 (BLE)

Model 3 A+ consists of:

  • 1.4GHz 64-bit Cortex-A53 (ARMv8) CPU
  • 512MB LPDDR2 SDRAM
  • 2.4GHz / 5GHz 802.11.b/g/n/ac wireless LAN
  • Bluetooth 4.2 (BLE)
  • 1x USB 2.0

Model 3 B consists of:

  • 1.2GHz 64-bit quad-core (ARMv8) CPU
  • 1GB RAM
  • 802.11n Wireless LAN
  • Bluetooth 4.1 (BLE)
  • 4x USB 2.0

Model 3 B+ consists of:

  • 1.4GHz 64-bit Cortex-A53 (ARMv8) CPU
  • 1GB LPDDR2 SDRAM
  • Gigabit Ethernet over USB 2.0 (maximum throughput 300 Mbps)
  • 2.4GHz / 5GHz 802.11.b/g/n/ac Wireless LAN
  • Bluetooth 4.2 (BLE)
  • 4x USB 2.0

Model 4 B consists of:

  • 1.5GHz 64-bit quad-core Cortex-A72 ARM v8 CPU
  • 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
  • Gigabit Ethernet
  • 2.4 / 5GHz 802.11ac Wireless LAN
  • Bluetooth 5.0 BLE
  • 2x USB 2.0, 2x USB 3.0
  • 2x micro HDMI ports (both support up to 4kp60)

The most recently released and presently leading the features and power columns is the Model 400. This model varies a bit from previous ones in that it comes packed within a keyboard containing the ports, etc. You may check out the official page and find more information.

Model 400

  • Broadcom BCM2711 quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1.8GHz
  • 4GB LPDDR4-3200
  • Dual-band (2.4GHz and 5.0GHz) IEEE 802.11b/g/n/ac wireless LAN
  • Bluetooth 5.0, BLE
  • Gigabit Ethernet
  • 2 × USB 3.0 and 1 × USB 2.0 ports
  • Horizontal 40-pin GPIO header
  • 2 × micro HDMI ports (supports up to 4Kp60)
  • H.265 (4Kp60 decode); H.264 (1080p60 decode, 1080p30 encode); OpenGL ES 3.0 graphics
  • MicroSD card slot for operating system and data storage
  • 78- or 79-key compact keyboard (depending on regional variant)
  • 5V DC via USB connector
  • Operating temperature: 0°C to +50°C ambient
  • Maximum dimensions 286 mm × 122 mm × 23 mm

The Raspberry Pi has no on-board operating system and requires an OS to be loaded onto an SD card, which it then boots from.

Common OS images (Official download page)

  • NOOBS (New Out Of Box Software - ideal for first time users)
  • Raspberry Pi OS, previously called Raspbian (Buster - suitable for beginners)
  • Ubuntu (Core or classic)
  • Soft-Float Debian
  • Pidora
  • Kali Linux - IT security and penetration testing

Related tags:

  • The tag with tag wiki, especially for assembly programming on the Raspberry Pi
  • Especially with tag wiki for programming on 64-bit systems

Further links:

Further information on the processors and their instruction set can be found in the arm and arm64 tag wikis.

17501 questions
430
votes
25 answers

Cannot find module cv2 when using OpenCV

I have installed OpenCV on the Occidentalis operating system (a variant of Raspbian) on a Raspberry Pi, using this script by jayrambhia. It installed version 2.4.5. When I try import cv2 in a Python program, I get the following…
user2971844
  • 4,317
  • 2
  • 12
  • 3
171
votes
7 answers

Python AttributeError: 'module' object has no attribute 'Serial'

I'm trying to access a serial port with Python 2.6 on my Raspberry Pi running Debian. My script named serial.py tries to import pySerial: import serial ser = serial.Serial('/dev/ttyAMA0', 9600) ser.write("hello world!") For some reason it refuses…
hao_maike
  • 2,929
  • 5
  • 26
  • 31
126
votes
9 answers

How to install the Raspberry Pi cross compiler on my Linux host machine?

I am attempting to get cross-compiling for Raspberry Pi working on my Ubuntu machine. During my initial attempts I was using the arm-linux-gnueabi compiler, which is available in the Ubuntu repo. I got this working. I was able to build all my…
pqvst
  • 4,344
  • 6
  • 33
  • 42
106
votes
10 answers

Hook up Raspberry Pi via Ethernet to laptop without router?

I'm working on a balloon project with a Raspberry Pi. When we potentially recover the Raspberry Pi, it will most likely be in a rural location and I'd like to turn off the Pi at that point safely. Without a router or network nearby, I was wondering…
user2170780
  • 1,189
  • 4
  • 10
  • 7
97
votes
6 answers

Flask - Calling python function on button OnClick event

I am new to python and Flask. I have a Flask Web App with a button. When I click on the button I would like to execute a python method not a Javascript method. How can I do this? I have seen examples with python where it redirects me to a new page…
Amaan
  • 1,473
  • 2
  • 12
  • 11
85
votes
9 answers

How to change screen resolution of Raspberry Pi

I am using 7" TFT LCD Display with the Raspberry pi, can anyone tell how i can change the screen resolution of Raspberry Pi and what should be the resolution for the 7" TFT LCD Display.
lkkkk
  • 1,999
  • 4
  • 23
  • 29
79
votes
8 answers

Mono on Raspberry Pi

I've seen a lot of talk about running Mono/.NET code on the Raspberry Pi. Has there been any success in actually running any Mono code on a Raspberry Pi? On their site, they list several Linux distributions that work on the device and some of these…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
78
votes
4 answers

How do I use setsockopt(SO_REUSEADDR)?

I am running my own http server on a raspberry pi. The problem is when I stop the program and restart it, the port is no longer available. Sometimes I get the same issue when receiving lots of requests. I want to use SO_REUSEADDR so that I can keep…
user3735849
  • 893
  • 1
  • 6
  • 6
67
votes
5 answers

Docker Access to Raspberry Pi GPIO Pins

When running Docker on the Raspberry Pi 2, how can we expose the GPIO pins to the Docker container?
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
54
votes
11 answers

hcitool lescan shows I/O error

I'm trying to do a lescan using hcitool on the raspberry pi. The command prints out Set scan parameters failed: Input/output error. I'm not sure, what exactly happens here. My iPhone is advertising here. I'm using a BLE dongle from IOGear.…
arpwal
  • 895
  • 1
  • 9
  • 17
51
votes
8 answers

Cross-compilation for Raspberry Pi in GCC. Where to start?

TL/DR: Where can I find more information about building a GCC 4.7.0 cross-compiling toolchain for ARM (gnueabi) platform (intended to run on a Raspberry Pi device)? I have just got a brand new Raspberry Pi and I am very eager to start programming…
user267885
47
votes
0 answers

libusb: error [op_open] getcap failed in C++ on Linux

I am running into trouble calling libusb_open in C++ on Linux (running on Raspberry Pi but virtualized to x86 using Exagear). I can find a device using libusb_get_device_list but it appears translating a device to a device handler using libusb_open…
Edmund Gentle
  • 736
  • 1
  • 6
  • 16
47
votes
10 answers

Check for internet connectivity in NodeJs

Installed NodeJS on Raspberry Pi, is there a way to check if the rPi is connected to the internet via NodeJs ?
Donald Derek
  • 2,529
  • 2
  • 23
  • 17
43
votes
1 answer

Execute terminal commands in python3

I am on a Raspberry Pi, and I am using a program called fswebcam, which allows you to take pictures with a webcam. ~$ fswebcam image.jpg That command if entered in terminal takes a picture and saves it to your computer, however I want to build a…
BrandonMayU
  • 726
  • 2
  • 6
  • 13
42
votes
4 answers

Docker run does not display any output

I installed docker on a raspberry-pi (Connected via ssh) Installation is successful. But running docker run hello-world produce no output. Note on very first time I got additional messages regard installing image Unable to find image…
shakthi
  • 1,597
  • 2
  • 17
  • 29
1
2 3
99 100