Accessing System Information with Raspberry Pi Model Names and Revisions
Learn how to check your Raspberry Pi model name and revision using the command line. This is essential for configuring and troubleshooting your device. …
Updated September 28, 2023
Learn how to check your Raspberry Pi model name and revision using the command line. This is essential for configuring and troubleshooting your device.
Checking Your Raspberry Pi Model Name and Revision
- Open the terminal on your Raspberry Pi by clicking on the icon or using the keyboard shortcut Ctrl+Alt+T.
- Type
cat /proc/device-tree/model
and press Enter. This command will display the model name of your Raspberry Pi. Here is an example output:
Raspberry Pi 3 Model B Plus Rev 1.3
This tells us that our Raspberry Pi is a Model B Plus with revision 1.3.
Checking Your Raspberry Pi Revision Number
- Open the terminal on your Raspberry Pi as described above.
- Type
cat /proc/cpuinfo
and press Enter. This command will display information about the CPU, including the revision number. Look for a line that starts with “Revision”. Here is an example output:
processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
In this example, the revision number is “4”.
Checking Your Raspberry Pi Model Using Python
- Open a text editor and create a new file called
model.py
. - Add the following code to the file:
import os
def get_pi_model():
with open('/proc/device-tree/model', 'r') as f:
model = f.read()
return model.strip()
def get_pi_revision():
with open('/proc/cpuinfo', 'r') as f:
for line in f:
if line.startswith('Revision'):
revision = line.split(':')[1].strip()
return revision
model = get_pi_model()
revision = get_pi_revision()
print(f'Model: {model}\nRevision: {revision}')
- Save and close the file.
- Move
model.py
to your home directory using the commandmv model.py ~/
. - Open the terminal on your Raspberry Pi as described above.
- Type
python3 ~/model.py
and press Enter. This will run the Python script and display your Raspberry Pi’s model name and revision number. Here is an example output:
Model: Raspberry Pi 3 Model B Plus Rev 1.3
Revision: a020d3
This method provides a convenient way to access your Raspberry Pi’s information programmatically, which can be useful for scripting or automation purposes.
In conclusion, checking your Raspberry Pi model and revision is essential for proper configuration and troubleshooting. We have demonstrated three methods to do so: using the command line, reading /proc/device-tree/model
and /proc/cpuinfo
, and creating a Python script to display this information. Now you can easily identify your Raspberry Pi’s model name and revision number whenever needed.