Raspberry Pi 3 Headless Setup: Installing Raspbian & NOOBS on Raspberry Pi 3

Published By

The Raspberry Pi 3 offers an incredible amount of capabilities in a very small and cheap package. You can turn it into all sorts of things, from a media center hiding on the back of your TV to a smart sprinkler system, but you need to get it up and running first.

I recommend a dedicated monitor, keyboard, and mouse so your Pi 3 sits as an independent computer, but I know that this isn’t always possible. So what do you do if all you have is your laptop to get things done, limited space, and limited funds? Don’t worry. The Raspberry Pi system is completely functional over an SSH or serial connection and really doesn’t need any of the extra items to run. To make an effective headless setup you need to do two things: get the OS installed and get connectivity established. Here’s how:

See related product

Raspberry Pi 3 Model B

Raspberry Pi Foundation Embedded System Development Boards and Kits View

Raspberry Pi 3 Serial to USB Mistakes

My first thought was to utilize a serial to USB adapter like the Adafruit Raspberry Pi Serial Cable. I have used them reliably in the past for the Pi 1 and 2 as well as on various other programming projects. I thought it would be relatively straightforward, but I quickly learned otherwise. Remember that RX and TX mean receiving into a device and transmitting out of a device so the RX of the adapter needs to be plugged into the TX of the Raspberry Pi and the TX into the RX of the Pi. On the Raspberry Pi the proper pins are 8 and 10 for TX and RX respectively. Be sure to hook up the ground to either pin 9 or 6. I prefer to use pin 9 for ground since I have a small fan utilizing pins 4 and 6 for 5V power and ground which helps keep the Pi cool under heavy workloads.

See related product

954

Adafruit Industries Cable Assembly USB View

0816 Headless image 1

After I got the serial cable all hooked up and NOOBS loaded onto an SD card ready to get the system up and running, I immediately ran into two issues: NOOBS will not do a headless install out of the box in a default configuration and the serial port piped me into a recovery console that I could not interact with. The SD card was reloaded with straight Raspbian to bypass the issue of NOOBS struggling to install without more interface devices. During this whole process I had the Pi hooked into a secondary monitor just to view its progress and make sure things were moving along. Raspbian successfully installed but my serial console refused to show anything or react to any inputs.

After some research I discovered that there is a unique issue on the Raspberry Pi 3 with attaching a serial console. Since there are more capabilities packed into the new Pi like wifi and Bluetooth, connections were co-opted to support them. Specifically, the UART on which the serial console had previously resided is now used for Bluetooth communication. The reason this UART was needed is that its bus speed is able to be set without being dependent on the system clock speed, which is necessary for the Bluetooth module. A secondary UART exists on the Raspberry Pi 3 but it has an issue: its baud rate is tied to the system frequency, meaning that it will vary as the processor speed varies. Without a fixed baud rate it is almost impossible to get effective communication. The solution to this is a config flag that fixes the system frequency and allows for a consistent baud rate of 115200. This has the unfortunate side effect of reducing the overall performance of the Raspberry Pi but this can be countered by forcing the Raspberry Pi into constant turbo mode. Remember: Only force turbo mode if you’ve heatsinked your Pi and have a fan cooling it.

Consequences of Enabling the Serial Interface

To enable the serial connection on the mini-UART add “enable_uart=1” to the config.txt file which resides in the root directory when you have an SD card with Raspbian inserted into a Windows machine. Config.txt is also present in /boot/ when looking at the filesystem from within the Raspberry Pi. By doing this you will have a serial console to access as soon as the Pi is up and running. Now you can insert a microSD card that is loaded with Raspbian and pull up a terminal such as Putty to connect to the Pi.

0816 Headless image 2

0816 Headless image 3

With the serial interface open to the Raspberry Pi you can now connect to wifi using the command line. To list all the access points within range of your Pi use the command “sudo iwlist wlan0 scan”. You need to identify the ESSID of the wifi you wish to connect to and the authentication style used which is listed below the SSID. The rest of this method works well with WPA and the newer WPA2 protections but you will need another guide if you are authenticating using a RADIUS server or WPA2 enterprise. I would strongly recommend against using WEP on any wireless setup since it is easily broken. Once you have your SSID and wifi key you will be editing the wpa-supplicant config file using “sudo nano /etc/wpa_supplicant/wpa_supplicant.conf”. You want to add the following text to the end of the file replacing the SSID and key with your info:

network={

ssid="The_ESSID_from_earlier"
                psk="Your_wifi_password"
}

Press Ctrl+X then Y followed by Enter to exit nano and save the file. Now WPA-supplicant should notice the changes and attempt to connect to the listed network. If it doesn’t you can manually restart the interface with “sudo ifdown wlan0 && sudo ifup wlan0”, or by rebooting with “sudo reboot now”. You can verify a network connection and determine the IP address to connect to via SSH using “ifconfig wlan0”. The inet addr is the IP address of the Pi on your network.

Using serial like this is my preferred method for getting the Raspberry Pi 3 online when I don’t have a dedicated keyboard and mouse since this lets me configure wifi and determine the IP address quickly to move from serial to SSH. Once you have finished using the serial interface I would recommend changing “enable_uart” to 0 in the config.txt file that we modified earlier to re-enable higher clock speeds on the Pi. This last step helps you to avoid the consequences that the serial connection brings with it.

Raspbian WiFi Setup on Raspberry Pi 3: A Simpler Method

Another, much simpler method to getting wifi up and running is to just drop your configured wpa_supplicant.conf file into the root of a recently made Raspbian SD card. It is important for this to be a freshly made SD card that has not yet gone through the install process. Once you boot up the SD card in the Raspberry Pi the install process will also pull your customized configuration file into the main system allowing for the Pi to hop on your network. One of the downsides to this method over the serial connection is that it does not readily tell you the IP address so that you can connect via SSH. A freshly booted Pi that has not been customized will have a network name of “raspberrypi” meaning you can easily ping it if it is on the same network as your primary machine to get the IP address for SSH connections.

Installing NOOBS on Raspberry Pi 3 via SD Card

The available NOOBS installer takes a little more work but will leave you with NOOBS for multiple OS functionality. To use NOOBS headless it needs to be configured for a silent install and have the ability to move the wpa-supplicant file after installing Raspbian. To enable silent install in NOOBS you need to edit the recover.cmdline file in the root directory of the SD card. Initially the file looks like:

runinstaller quiet ramdisk_size=32768 root=/dev/ram0 init=/init vt.cur_default=1 elevator=deadline

The modified version for silentinstall and default to a US keyboard looks like:

runinstaller quiet ramdisk_size=32768 root=/dev/ram0 init=/init vt.cur_default=1 elevator=deadline keyboard=us silentinstall

This version of recovery.cmdline will automatically install the OS present on the SD card. It is important for there to be only a single OS on the SD card or silent install will not work. The current NOOBS offline installer has Raspbian on it and worked fine without modification.

In order to support copying over the wpa_supplicant.conf file we need to add a third party tool called NOOBSConfig by Procount. It has an example specifically for copying the wpa file for Raspbian.

Adding silentinstall and NOOBSConfig gives us an SD card that can be put into a Raspberry Pi and completely self install and hop onto a network. You can follow the same steps listed above to find the IP address using ping and then SSH into your new tiny linux machine.

Headless Raspberry Pi 3 Setup Complete

After running through any of the above methods to achieve a headless Raspberry Pi 3 I would recommend a few other steps to finish up. Using “sudo raspi-config” you will enter a menu with a bunch of useful tools. The first one to do is “Expand Filesystem” which expands the system to make sure it uses all of the available space since burning an image to an SD card can result in unallocated space left over. Definitely change the user password using the second option in the menu, default passwords leave your system insecure and open to attack. The fifth option allows you to change the locale, timezone, keyboard layout, and wifi country to make sure everything lines up with what you expect in a system. The advanced options menu includes a lot more options but specifically you can find the option to enable and disable serial communication here which toggles the enable_uart variable I talked about previously.

0816 Headless image 4

Now you have a Raspberry Pi that can hop online, has more computing power than what took us to the moon, and a vibrant community with a ton of project examples. Enjoy creating whatever comes to mind and share your passion with those around you. The Raspberry Pi 3 is an excellent, low cost option to get anybody started in electronics.

 Looking for Raspberry Pi 3 accessories? Shop some of the most popular accessories on the market here.

Related news articles

Latest News

Sorry, your filter selection returned no results.

We've updated our privacy policy. Please take a moment to review these changes. By clicking I Agree to Arrow Electronics Terms Of Use  and have read and understand the Privacy Policy and Cookie Policy.

Our website places cookies on your device to improve your experience and to improve our site. Read more about the cookies we use and how to disable them here. Cookies and tracking technologies may be used for marketing purposes.
By clicking “Accept”, you are consenting to placement of cookies on your device and to our use of tracking technologies. Click “Read More” below for more information and instructions on how to disable cookies and tracking technologies. While acceptance of cookies and tracking technologies is voluntary, disabling them may result in the website not working properly, and certain advertisements may be less relevant to you.
We respect your privacy. Read our privacy policy here