Raspberry Pi is a great device to have on hand if you are interested in electronics. This small computer can do all sorts of cool things, and today we're going to show you three simple tricks that will help make your Raspberry Pi experience more interesting.
Use the GPIO to securely shut down.
It's never a good idea to just disconnect your Raspberry Pi to turn it off. When your board freezes, you've probably already shut it down, but doing it this way might damage your microSD card. Fortunately, GPIO shutdown, which can be used without a monitor or remote access, is a safer approach to shut down your Raspberry Pi. This may be configured as follows GtHub:
- The Raspberry Pi's terminal should be opened (either via SSH or a graphical interface).
- Enter sudo nano /boot/config.txt in your terminal to edit the file.
- dtoverlay=gpio-shutdown,gpio pin=3,active low=1,gpio pull=up should be added as a line within the file.
- To save the file, hit Y and Ctrl+X together.
- Power off your board and turn it off.
- Connect a button to pins 5 and 6 on your Raspberry Pi (GPIO3 and GND).
Push the button after starting your board. It ought to securely terminate. To start the board, press the button once more.
To keep track of the temperature of the board, use terminal commands.
Your Raspberry Pi can only function within a particular temperature range before it overheats, just like any other electrical equipment. The Raspberry Pi documentation states that the board's maximum temperature for all versions is 85°C. When it hits this point, the CPU begins to throttle, which reduces performance. Overheating might potentially harm your microSD card.
This problem is frequently encountered while executing performance-demanding code or programmes on your board (or keeping the board somewhere with poor ventilation). It's always crucial to keep an eye on the temperature of your Raspberry Pi in situations like these so you can determine when to turn the device off in order to avoid harm. Here's how to go about it:
- Open the terminal on your board (via SSH or graphical interface).
- To find out your CPU's temperature, use cat /sys/class/thermal/thermal zone0/temp.
- To convert the figure to degrees Celsius, divide it by 1000.
- To obtain the GPU temperature, type vcgencmd measure temp (via Raspberry Pi).
Activate SSH to allow remote access.
There will frequently be situations when having a display attached to your board is cumbersome and unneeded when fiddling with your Raspberry Pi projects. Neither project would require a display to operate properly, and adding one would merely make the final product too heavy to be transported.
How do you manage your board, though, without a monitor? The useful SSH capability is useful in this situation. As long as both devices are networked, the SSH protocol enables remote PC access to the Raspberry Pi command line. This is how you use the command line to activate the tool:
- Launch the terminal.
- Run raspi-config with sudo.
- interfacing options, then click.
- Choose SSH.
- Tap Yes.
- Select OK.
- Choose Finish.
Using the advanced settings of the Raspberry Pi Imager, you can enable SSH even if the Raspberry Pi OS isn't yet installed on your microSD card (via Raspberry Pi). Before writing the image, just click the gear button on the app.