This is an old revision of the document!
Raspberry Pi
General Infos
Running scripts at startup
Modify the /etc/rc.local file (requires sudo)
$ sudo nano /etc/rc.local
Before the 'exit 0' line at the end insert lines like this one :
bash /path/to/script.sh
Temperature checks
CPU temp
$ cat /sys/class/thermal/thermal_zone0/temp
Divide by 1000 to get °C format
GPU temp
$ vcgencmd measure_temp $ /opt/vc/bin/vcgencmd measure_temp (Full Path)
These measures were done on a Rapsberry Pi 4 running Raspbian with no heavy-duty program running, no screen or USB devices attached and at a room temperature around 20°C
- With a 5V fan connected to 5V the temperature is stable around 35-38°C. Fan is loud and disturbing
- With a 5V fan connected to 3.3V the temperature is stable around 41-42°C
- With no fan connected the temperature is stable around 55-58°C
GPIO
Using GPIO through bash
# Exports pin to userspace $ echo "18" > /sys/class/gpio/export # Sets pin 18 as an output $ echo "out" > /sys/class/gpio/gpio18/direction # Sets pin 18 to high $ echo "1" > /sys/class/gpio/gpio18/value # Sets pin 18 to low $ echo "0" > /sys/class/gpio/gpio18/value # Exports pin to userspace $ echo "4" > /sys/class/gpio/export # Sets pin 4 as an input echo "in" > /sys/class/gpio/gpio4/direction # Read value of pin 4 cat /sys/class/gpio/gpio4/value