2

I want to design a python script that would allow me to check whether it's currently in a standard Pi 3 or it's in a Compute Module 3. But I have no idea even on how Raspbian OS know itself is currently in a Pi 3 or a CM3.

Any help?

1

2 Answers 2

9

The command is:

cat /proc/cpuinfo

And the list over the different hardware is here: http://elinux.org/RPi_HardwareHistory#Board_Revision_History

Table over hardware differences: https://www.element14.com/community/community/raspberry-pi/blog/2016/11/21/how-to-identify-which-model-of-the-raspberry-pi-you-have

4
0

I have this script that show what Pi you have and its relevant data. However I do not have all possible RPi's so a 100% test is not possible. Still it may be of some use.

#!/bin/bash
echo "Start WhichPi"



rev=$(grep Revision /proc/cpuinfo | cut -f 2 -d: | tr -d '[:space:]')
echo $rev
case $rev in
        0002)
            echo " A RPi B Rev 1.0 with 256MB RAM   Released: Q1 2012"
            ;;
        0003)
        echo "A RPi B Rev 1.0 (ECN0001 - no fuses , D14 removed with  256MB RAM   Released: Q3 2012"
            ;; 
        0004)
            echo "A RPi B Rev 2.0 with  256MB RAM   Released: Q3 2012 Manfacturer: Sony"
            ;;
        0005)
            echo "A RPi B Rev 2.0 with  256MB RAM   Released: Q3 2012 Manufacturer: Qisda "
            ;;

        0006)
            echo "A RPi B Rev 2.0 with  256MB RAM   Released: Q4 2012 Manufaturer Egoman"
            ;;
        0007)
            echo "A RPi A Rev 2.0 with  256MB RAM   Released: Q1 2013 Manfacturer: Egoman"
            ;;
        0008)
            echo "A RPi A Rev 2.0 with  256MB RAM   Released: Q1 2013 Manufacturer: Sony "
            ;;

        0009)
            echo "A RPi A Rev 2.0 with  256MB RAM   Released: Q1 2013 Manufaturer Qisda"
            ;;
        000d)
            echo "A RPi B Rev 2.0 with  512MB RAM   Released: Q4 2012 Manfacturer: Egoman"
            ;;            
        000e)
            echo "A RPi B Rev 2.0 with  512MB RAM   Released: Q4 2012 Manfacturer: Sony"
            ;;            
        000f)
            echo "A RPi B Rev 2.0 with  512MB RAM   Released: Q4 2012 Manfacturer: Qisda"
            ;;            
        0010)
            echo "A RPi B+ Rev 1.0 with  512MB RAM   Released: Q3 2014 Manfacturer: Sony"
           ;;
        0011)
            echo "A RPi Compute Module Rev 1.0 with  512MB RAM   Released: Q4 2014 Manfacturer: Sony"
            ;;            
        0012)
            echo "A RPi A+ Rev 1.1 with  256MB RAM   Released: Q4 2012 Manfacturer: Sony"
            ;;            
        0013)
            echo "A RPi B+ Rev 1.2 with  512MB RAM   Released: Q1 2015 Manfacturer: ?"
            ;;            
        0014)
            echo "A RPi Compute Module Rev 1.0 with  512MB RAM   Released: Q2 2014 Manfacturer: Embesty"
            ;;            
        0015)
            echo "A RPi A+ Rev 1.1 with  256MB/512MB RAM   Released: ? Manfacturer: Embesty"
            ;;            
       a01040)
            echo "A RPi 2 Model B Rev 1.0 with  1GB   Released: ? Manufacturer : ?"
            ;;            

       a01041)
            echo "A RPi 2 Model B Rev 1.1 with  1GB RAM   Released: Q1 2015 Manfacturer: Sony"
            ;;            
       a21041)
            echo "A RPi 2 Medel B  Rev 1.1 with 1GB RAM   Released: Q1 2015 Manfacturer: Embest"
            ;;            
       a22042)
            echo "A RPi 2 Model B (with BMC2837  Rev 1.2 with  1GB RAM   Released: Q3 2016 Manfacturer: EMbest"
            ;;            
       a02082)
            echo "A RPi 3 Model B Rev 1.2 with  1GB RAM   Released: Q1 2016 Manfacturer: Sony"
            ;;            
       a22082)
            echo "A RPi 3 Model B Rev 1.2 with  1GB RAM   Released: Q1 2016 Manfacturer: Embest"
            ;;            

       *)
            echo "BuM--"$rev"--"
            ;;



esac
1
  • Hi, thanks! it's working! But in my case, I've to say sorry to you mate, the team is preferring the cat /proc/cpuinfo method Commented Sep 18, 2017 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.