21st July 2015

Sorry I’ve got no head.

Strange title for a page on the blog but bear with me. The gist of what I’m about to tell you is this.

You don’t need to have your Raspberry Pi connected to your TV for it to work.

The RasPi is perfectly happy running without a screen or “head”. In fact you’ll find a lot of projects where a headless Pi is a bonus.

To run a headless Pi means to run it without physical input or output. So no standard keyboard, no mouse and no monitor/HDMI TV. The way you control the Pi is by remote, over your network. So some form of networking, cabled or cable less is needed.

Remember that screen that came up when we installed Raspbian?
It was called raspi—config. You can run it at any time using this command.

sudo raspi-config

This command can be typed into lxterminal if you’re running the graphical desktop. You will be prompted to enter your password. The default, unless you’ve changed it will be “raspberry”.

cfg2

Go into Advanced Options and select Advanced Option 4 to control the Secure Shell (SSH) feature.

We need this to be ENABLED, so highlight this option in red and press return on your keyboard. The program will process this command and the screen will tell you when it’s done. Select Finish to leave the rasps-config program.

Then restart your pi
If you’re running the graphical desktop this is easy, hit the power button in the menu bar.
Otherwise, type the following into the command.

sudo restart

Leave the screen and keyboard plugged in for now and on another computer try pinging your pi. Just type in this command into an MSDos or terminal window.

ping -t raspberrypi

Think of a ping like the sound sent out by sonar on a submarine. In this case, a digital signal is sent over the network to your Pi. If it gets there, the Pi is obligated to send an echo back to your computer to say it received it.

The “raspberrypi” bit is the default name for your pi on your network, something that can also be changed in raspi-config but we’ll stick with this name for now.

Remember, your RasPi won’t answer while it’s restarting but when it’s properly “up”, you’ll see responses on the screen. Press the Ctrl and the C keys at the same time to stop pinging.

On this other computer you’ll now need a program that can talk to your pi in more complicated ways than an echo ping. This will allow you take remote control over the Pi.

For this, I’m recommending putty. Almost everyone I know recommends putty. Download it here.

Run putty and put the name of your Pi (raspberrypi) into the host name box and press connect.

The first time you connect, it will give a warning about a security breach and tell you that certificates are missing.

Do not worry. This is ok.

We must fall here so we can pick ourselves back up for future connections. When asked to continue, just say yes.

You will now be asked to log into your pi.

The default login name is pi and the default password is raspberry. Both the login name and the password are lowercase ( no capitals) and have no spaces, punctuation or numbers in them.

Once you’ve logged in, you’ll see

>_

And the fun can begin.

Type in this command to tell you Pi to switch off…

sudo shutdown

…then go back to your pi, look at the screen it will tell you it is shutting down.

After a while the screen will go blank and the lights will go out on the Pi.

Back on your other computer, putty will tell you the session with the Pi has ended.

Turn off the power, disconnect the HDMI cable, the keyboard and the mouse. Leave only the network cable, the usb power supply and the sdcard plugged into the Pi.

Turn the power back on.

The lights will come back on and start flickering. From this you can infer the Pi is starting up.

On your other computer, try pinging the Pi again with that same command we used earlier. When it is responding, try putty again. You’ll be able to connect without warning this time and log in again with pi/raspberry username and password combination.

Congratulations. You now have a headless Raspberry Pi.

Instead of telling the pi to shutdown. Just type exit and your pi will disconnect your putty session and be waiting patiently for you to come back with another connection in the future.