Raspberry Pi 3 Model B Setup (Headless setup without external monitor, no keyboard, no mouse, nothing!)
Today I decided to stop being so selfish and start to share with my knowledge. I wan to give something back to the world. Thanks to all StackOverflow community and thanks for awesome and friendly Raspberry documentation
My setup
- Linux PC (Windows should be good but probably there are some special gimmicks which I don’t want to discover)
- USB UART converter running on 3.3 Volts.
- Raspberry Pi 3 Model B
- 16 GB SanDisk micro SD Card (Class 4 means that it’s minimum write speed is 4 MB/second)
- micro SD Card adapter (to plug it to PC)
- USB charger with USB Micro B to power Raspberry (docs say at least 2.5 A, but mine from iPad Air with 2.1 A was sufficient.)
Download the image
Go to the download section on their documentation page and download the newest Raspbian image. I cfhose Raspbian Stretch Lite, because I had problems with my SD card. It seems that it’s either too slow or too small.
Insert the card to your PC. Linux should automatically detect it.
Once you download the image, fire up the terminal and run lsblk command.
You can see my SD card listed as mmcblk0. Let’s burn the image onto it. Remember to carefully select the device. If you fail at this moment, you might accidentally destroy your disk partition.
sudo unzip -p 2018–11–13-raspbian-stretch-lite.zip | sudo dd bs=4M of=/dev/mmcblk0 conv=fsync status=progress
Mine took somewhere around 10 minutes to flush, but it depends on the class of your SD card. If you get an error like this below
dd: failed to open ‘/dev/mmcblk0’: Read-only file system
You might have accidentally switched an SD card into read-only mode. There should be a little switch on the side of the SD card.
Let’s enable UART during boot time. You do that by appending line to the config.txt file on /boot partition (it is not a directory on rootfs partition)
enable_uart=1
Let’s connect our USB UART controller to PC and to the pins on the raspberry.
Put the mini SD card in the Raspberry Pi. Remember to set the UART to work on 3.3 Volts. Just set the jumper properly. Plug the serial connector to PC. Let’s fire up the program needed for serial connection. You can use anyone you prefer (running dmesg will help you to diagnose onto which port was it connected to. In my case it was /dev/ttyUSB0). Default baud rate on Raspberry Pi 3 Model B is 115200 bauds, 8 bits, no parity bit and no flow control.
minicom -D /dev/ttyUSB0 -b 115200 -8
No output should be visible of course. We have no power yet. Connect mini USB connector to the board. Raspberry will start to power up.
Default user and password for Raspberry are
user: pi
password: raspberry
😇😇😇 CONGRATS! You are now fired up! 😇😇😇
Let’s not reinvent the wheel and share a link to really cool Raspberry documentation:
Setting up the network
Setting up wlan: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
Remember that this Raspberry Pi 3 Model B supports only 2.4 GHz networks. Only Model B+ supports 5 GHz and there are special tricks which you have to do additionally to make it work on B+ model.
Set up static address. Just open the /etc/dhcpcd.conf with your favorite editor and ensure that the following lines are there (Uncommented)
# Example static IP configuration:
interface eth0
static ip_address=192.168.0.23/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
interface wlan0
static ip_address=192.168.0.23/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1
- static routers = your router address (Gateway)
- static ip_address = your desired IP (can be busy at the moment
Setting up a desktop environment
I chose LXDE, because it is light-weight and suitable for such solutions. It’s as simple as
sudo apt-get install lxde
sudo reboot now
Setting up remote desktop (VNC)
- to setup VNC on the raspberry: https://www.raspberrypi.org/documentation/remote-access/vnc/
- Install VNC Viewer on your PC: https://www.realvnc.com/en/connect/download/viewer/. I tried to make it work with Remmina but it was failing at trying to connect with something like this:
Unknown authentication scheme from VNC server… - Setting up connection is pretty straight-forward on PC side.
- You may need to adjust resolution on the board. In my case it was just 640x480. Raspberry supports up to 1920x1080 at 60 fps. Just go to
System->Preferences->Raspberry Pi Configuration->Set Resolution
Setting up camera and a stream
This page provides the best interface: https://elinux.org/RPi-Cam-Web-Interface
Additionally, it uses only 2% of the CPU while running and streaming. Stream does not require Flash so you can enjoy it even on your simple mobile device.
And that’s it. I know there are thousands of tutorials on the network but another one should not be a problem, right?