Raspberry Pi 3 Model B Setup (Headless setup without external monitor, no keyboard, no mouse, nothing!)

Kamil
5 min readJan 19, 2019

--

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

Things you will need to set your Raspberry (Bare Minimum!)
Handy debugging tool, I had problems booting the image up and would have never found out about it

My setup

  1. Linux PC (Windows should be good but probably there are some special gimmicks which I don’t want to discover)
  2. USB UART converter running on 3.3 Volts.
  3. Raspberry Pi 3 Model B
  4. 16 GB SanDisk micro SD Card (Class 4 means that it’s minimum write speed is 4 MB/second)
  5. micro SD Card adapter (to plug it to PC)
  6. 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.

It will show you a list of block devices (A block device is a computer data storage device that supports reading and (optionally) writing data in fixed-size blocks[..])

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.

Once finished you should see that output (I flushed the imaged to /dev/null just not to wait again, because I flushed my SD card earlier)

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.

https://www.element14.com/community/docs/DOC-73950/l/raspberry-pi-3-model-b-gpio-40-pin-block-pinout
And real life :D

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.

It has two LEDs next to the power port. The red one informs you that voltage is ok when it glows red. If the red LED is blinking there are problems with voltage. Check your charger if it supplies enough current or change the cable. The green one informs you about the state of the Raspberry (more info here).

Default user and password for Raspberry are

user: pi

password: raspberry

If everything goes smooth, you should be presented with the image above. Serial port start-up has this big advantage that you will always see any problems during booting and you can always ask Google for help.

😇😇😇 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.

A nice tool to have on your phone is an app called Fing. It lists all the devices connected to your network. If not you can always use nmap on your PC.

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)

  1. to setup VNC on the raspberry: https://www.raspberrypi.org/documentation/remote-access/vnc/
  2. 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…
  3. Setting up connection is pretty straight-forward on PC side.
  4. 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?

--

--

Kamil

A tech guy with artistic soul. I will post everything I find worth sharing.