Python/Raspberry Pi to read model name

Python code run on Raspberry Pi to get model name, by reading /proc/device-tree/model.

exPy_model.py
"""
Python run on Raspberry Pi to get model name
"""

def read_f(file):
    print(file, ":")
    with open(file, encoding='UTF-8') as reader:
        content = reader.read()
    return content
    
print(read_f("/proc/device-tree/model"))



Output run on Raspberry Pi 5/8G running Raspberry Pi OS 64-bit (bookworm).
/proc/device-tree/model :
Raspberry Pi 5 Model B Rev 1.0



Comments

Popular posts from this blog

MicroPython/ESP32-C3 + 1.8" 128x160 TFT ST7735 SPI, using boochow/MicroPython-ST7735 library.

CameraWebServe: ESP32-S3 (arduino-esp32) + OV5640 camera module