Tutorial: How to remotely control your Raspberry Pi

raspberry_intro

So you just received a Raspberry Pi and you put everything together to start playing with it: keyboard, mouse, wifi dongle, USB hub, HDMI wire and power supply.

Wires went all over the place and you wondered: if I need so much stuff to make this small computer work, what’s the point?

“Would it be possible to make things simpler?” you asked yourself, before typing a few keywords in Google and finally landing here.

Well, fellow geek, you are at the right place! We are going to make your Raspberry Pi headless. You will be able to control it directly from your Mac! (Or from your PC) 🙂

I translated this tutorial directly from French. Therefore, it’s possible that a few French words appear from time to time in the pictures.

I) Hardware

First, you need a Raspberry Pie, of course. I have the Zero version, which is quite minimalist, but the process described below should work with all the versions.

Then, you need:

  • A microSD memory card (or just SD depending on the Raspberry Pi you have) with an 8 go capacity at least
  • A USB hub (the Raspberry Pie Zero has only one USB entry for the hardware. The second one is used for power.)
  • A mouse and a keyboard. (You will need them for literally 5 minutes. So, if you don’t have them, ask a friend.)
  • A USB wifi dongle (and, of course, a wifi network connected to the Internet)
  • A HDMI wire (Again, just for 5 minutes)

raspberry_accessoire

Be aware that, if you have the Zero, all the connectors are mini. You will need specific adaptors. If you don’t know where to get them, several retailers deliver starter packages.

raspberry_pack

 

II) Raspbian setup

Raspbian is a free operating system customized for the Raspberry Pi and managed by the community. It’s based on Debian, which is a free Linux operating system as well.

On the official webpage, you’ll have the choice between the full version and the light version. Choose the full one (NOOBS).

Once the .zip file downloaded, extract it.

noob_raspberry

Then, format your memory card. SDFormatter works well for that.

sd_formatter

When you’re done formatting, copy all the files from the folder you downloaded. Paste them on your memory card.

You are ready to boot your Raspberry Pi!

carte_sd_fichiers

 

III) First boot

Insert your SD card into your Raspberry Pi. Plug your keyboard, mouse and wifi dongle. With the HDMI wire, connect it to a screen (I use my TV). And, last but not least, plug the power supply.

Here we go! A small green light should blink and a setup screen should show up.

Choose to install Raspbian. Take a break. This step will take a few minutes.

raspberry_tele

When everything is installed, you should see the start screen. On the right top corner, click on your wifi network and type the password.

wifi_raspberry

Now that you are connected to the Internet, we need to know your Raspberry Pi IP address.

Open the terminal (small black screen on the top left corner).

ecran_raspberry

Type the following line:

 

host_name_raspberry

And write down the IP address that will appear.

We now have everything we need to remotely control you Raspberry Pi!

 

III Remote access with SSH

Secure Shell (also called SSH) allows you to gain access of a computer on the same network with the command line. Go on your Mac and open your Terminal.

If you are on PC, you have to install a software. Follow the instructions here.

Now, type the following line. Replace ip_address by you Raspberry Pi IP address (the one you wrote down earlier):

Your computer will ask you if you wish to continue. Type yes and press Enter. A password will be requested. Per default, it’s raspberry. (When you’ll be typing it, nothing will appear. It’s just a security measure.)

Voilà! You now have full control over your Raspberry Pi, from your Mac!

ssh_raspberry_revu

IV Screen sharing with VNC

VNC means Virtual Network Computing. Your Mac uses this system for screen sharing. On PC, you have to install a software,, but we will talk about that later.

A small library exists for your Raspberry Pi. To install it, we will take advantage of the SSH connection.

In your terminal, on your Mac, type the following lines (the SSH connection needs to be active):

It will probably take a few minutes again. Wait for the installation to be completed.

vnc_raspberry_revu_bon

Once done, start the program you just installed. Just type tightvncserver in the Terminal and press Enter.

vnc_confi_raspberry_revu_bon

The software will ask you for a password. I suggest you to use raspberr (8 characters limit) to keep it simple. You will be able to change it later if you want.

Your computer will also ask for a screen sharing password. Say no, to keep it simple again.

Now, if you are on Mac, go on Finder, click on “Go” menu and choose “Connect to server…” (or just press Cmd + K).

connexion_serveur_raspberry

Type the following access path: vnc://RASPBERRY_IP_ADDRESS:5901

vcn tells the computer what system to use. Right after, you need to write the IP address of your Raspberry Pi to connect to it. And the “5901” means that you want to connect to the default screen, which the number 1.

Your computer will ask you for the password raspberr.

partage_ecran_raspberry

It works! You can now directly control your Raspberry Pi from your Mac.

If you are on PC, follow the instructions given here.

So, from now on, to remotely control your new toy:

  • Boot your Raspberry Pi. (Wait for 30 seconds, just to be sure everything is ready)
  • Connect your computer to the Raspberry Pi through SSH (ssh pi@ip_address in Terminal and the password is raspberry)
  • Start VNC on your Raspberry Pi (tightvncserver in Terminal, with SSH)
  • Connect to the screen sharing with Finder (vnc://raspberry_ip_address:5901 and password raspberr)

No need for a keyboard, a mouse or even a screen! A wifi dongle is enough. And if you want your Raspberry Pi to be really wireless, just buy a small battery. 🙂

The only thing left to do now is to find a project idea! Tell me in comments what are your plans. 🙂

 

3 thoughts on “Tutorial: How to remotely control your Raspberry Pi

  1. joao

    Hey. I’m new to the blog and i would like to congratulate you on the tutorials you have here.
    It’s amazing how scarse is the internet for “noobies” like me.
    I didn’t test anything but from the networking point of view is worth mentioning that for you to access your RP from outside your house you’ll need a VPN since what you will have is a private adress/IP.
    Thank you so much for the tutorials. Keep it coming.
    Btw, happy new year.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *