Setting Up a Raspberry Pi: the short answer
A Raspberry Pi is a small computer that runs Linux. Unlike an Arduino or ESP32, it boots an operating system from a microSD card (or an NVMe SSD on a Pi 5), so it can run Python, a web server, a database and a camera at the same time. Example: Use the official 27 W supply (or a powered USB hub for the drive). The fix is the supply, not the software.
- Level
- Beginner
- Time
- About 6 min
- Topic
- Raspberry Pi
Install Raspberry Pi OS, power the board correctly and log in over the network with SSH.
Before this: Voltage, Current & Resistance
A Raspberry Pi is a small computer that runs Linux. Unlike an Arduino or ESP32, it boots an operating system from a microSD card (or an NVMe SSD on a Pi 5), so it can run Python, a web server, a database and a camera at the same time. The trade-off is that it takes time to boot, must be shut down properly, and is not a real-time controller.
The easiest way to start is Raspberry Pi Imager on your laptop. Pick your board, pick Raspberry Pi OS (64-bit), pick the card, and open the OS customisation settings before writing. There you set a hostname (for example lab-pi), a user name and password, your Wi-Fi name and password with the country set to IN, and you switch on SSH. Then the Pi joins your Wi-Fi on first boot and you never need a keyboard or monitor.
Power matters more than most beginners expect. A Pi 5 wants the official 27 W USB-C supply (5 V at up to 5 A); with a 5 V 3 A phone charger it still boots but limits the current available to USB devices. A Pi 4 needs 5 V 3 A. A weak supply or thin cable shows up as a lightning-bolt warning, random resets or a corrupted card. Always shut down with sudo shutdown now before pulling the plug.
Why a Pi is a different kind of project
A Pi runs a full operating system, so many things happen at once and out of your sight: logging, networking, updates, other programs. That is a strength for a camera, a web server or a database. It is a weakness for tight timing: Linux can pause your program for a few milliseconds at any moment, so do not use a Pi alone to generate precise pulses or to drive a motor's timing.
A common and sensible design is a Pi for the clever, slow work (network, camera, display, storage) and a small microcontroller beside it for the fast, simple work (sensors, motors, real-time timing).
Choosing storage you can trust
A microSD card is the Pi's disk, and cards wear out and corrupt when power is cut mid-write. Use a good-quality card from a known maker, 16 GB or larger, and shut down with sudo shutdown now before unplugging. For a Pi that runs every day, boot from an SSD if your model supports it, or reduce writes by logging to memory or a USB drive.
Keep a spare copy of the card for any project you care about. Imager can write one image to many cards, and a backup that takes 15 minutes can save a day of rebuilding.
Headless setup, step by step
In Imager's settings, choose a hostname, user name and password, Wi-Fi details, the right country and enable SSH, then write the card, put it in the Pi and power it. After a minute or two, find it at hostname.local, or in your router's list of connected devices, and connect with ssh yourname@hostname.local. The first connection asks you to accept the Pi's key: answer yes.
If the Pi does not appear, check the Wi-Fi name and password you typed, that the network is 2.4 or 5 GHz as the model supports, and that the green activity light flickers after power-up. A slow, steady red light only and no green means the card is not being read.
First things to do after you log in
Run sudo apt update and sudo apt full-upgrade to get fixes, then sudo reboot. Change nothing with sudo raspi-config you do not understand. Set up SSH keys instead of typing the password each time, and keep the Pi off the open internet: do not forward its SSH port through your router.
A Pi has no off switch. If a project must be switched off by a button, use a proper shutdown button wired to a GPIO pin that calls shutdown, rather than pulling the plug.
- Unplugging the Pi while it is writing to the card.
- Using a weak phone charger and then chasing random resets.
- Exposing the Pi's SSH port to the internet with a default or weak password.
Why does the Pi 5 reboot when a USB drive is plugged in?
- The Pi 5 is powered from a 5 V 3 A phone charger.
- With less than 5 A available, the Pi limits USB ports to 600 mA in total.
- A portable hard drive can draw 500 mA or more when spinning up, plus a keyboard and webcam.
- vcgencmd get_throttled reports a non-zero value, showing under-voltage was detected.
Result. Use the official 27 W supply (or a powered USB hub for the drive). The fix is the supply, not the software.
Flash a card with Raspberry Pi Imager using the OS customisation settings, boot the Pi, and from your laptop run ssh yourname@lab-pi.local. Then run sudo apt update && sudo apt full-upgrade, and finally vcgencmd get_throttled; a result of 0x0 means no under-voltage was seen.
3 quick questions
What is the main difference between a Raspberry Pi and an ESP32?
Where do you set Wi-Fi, user name and SSH before the first boot?
Why should you run sudo shutdown now before unplugging?
