Are you planning to put your Raspberry Pi in some cool system that operates outside on the field – maybe a drone?? Or are you on a trip where you don’t have access to a monitor, extra keyboard and mouse?

Sometimes it would be great to have access to the Raspberry Pi without having to connect it to the WiFi and without the need of a Monitor, an additional keyboard and a mouse, which is sometimes referred to as “going headless”.

This post shows you how to prepare your Raspberry Pi before going on the trip, so you can use a simple Ethernet cable to log onto your Raspberry Pi.

Preparing the Raspberry Pi

To have a safe copy to come back to, make a copy of your interfaces file with:

Before going headless with the Raspberry Pi use a Monitor, keyboard and mouse or the method described in the post “Raspberry Pi Zero Setup with no Monitor” using your router to change on the Raspberry Pi the content of the file /etc/network/interfaces to the following:

To connect to your Raspberry using an Ethernet tether you will have to take a note of the eth0 address that you chose in the above “address” line of the /etc/network/interfaces file (here e.g 192.168.1.111).

This was the part you have to do on the Raspberry Pi side do be ready to connect to it headless. Short and simple.

Preparing your PC or Laptop

Preparing your Laptop on the other end is relatively simple too:

  1. Connect the Ethernet cable from your Raspberry Pi to the port on your Laptop.
  2. img_0850
  3. On your Laptop find “Network Connections”: You can for example do that by typing “Network Connection” at Start à “Search Programs and Files” then choose “View Network Connections”.
  4. viewnetworkconnections
  5. The “Network Connections” window that pops up might have one or more “Local Area Connection” symbols. The one shown in the example picture has 2, from which the second one is slightly grayed out.
  6. networkconnections1
  7. Right click on the one that is not grayed out and choose “Properties”.
  8. properties
  9. A new window pops up and you are likely already on the tab “Networking”. Click on the IPv4 line, which has a check-mark in the box, then click on “Properties”.
  10. networking
  11. In the following window “Internet Protocol Version 4 (TCP / IPv4) Properties” choose the option “Use the following IP address”. If you chose on the Raspberry Pi “address 192.168.1.111” you should choose in this window in the line “IP address” a value such as 192.168.1.1.
    Note that it is important that the first 3 number blocks between Raspberry Pi and Laptop (192.168.1) are the same so that they can communicate. The fourth number needs to be different so they don’t have a conflict. So preferably the Laptop acts as the “server” and gets a 1 (that is 192.168.1.1) and the Raspberry Pi is the “client” and gets some other number (such as here 192.168.1.111).
    For the “Subnet mask” we choose the same number as the “netmask” on the Raspberry Pi (255.255.255.0).
    The “Default gateway” field stays empty.
    Click ok and close.
  12. ipaddress
  13. This was to enable the wired (Ethernet) connection between Raspberry Pi and Laptop.
    If you want the Laptop to still have internet access and it did not happen automatically (red cross at each of the “Wireless Network Connection”), then right click on the “Wireless Network Connection” symbol. There you will see the menu with the option “Connect / Disconnet”. You will notice that when you click that item the menu with the available network will pop up on the right where you can choose your relevant router to connect wireless to. Make sure you check the box at “Connect automatically” if you want your Laptop to connect after the next reboot.
    At this point you need to reboot your Laptop. After the bootup you should check if the “Local Area Network” setting we just made is still there.
  14. wifinetwork
  15. Now you should be able to “ping” the Pi from your laptop with e.g.:
    • ping 192.168.1.111
      (note: this is the example address we were using above. Yours might be different – just the three first numbers must be same between Laptop and Pi)
      This ping should show you a list of send trial data packages to the Pi and confirm that they were received.

    If you have a Monitor and keyboard you should be also able to ping in the same way the Laptop from the Pi using in above example:
    • ping 192.168.1.1



    pig

That was it. You should have now a wired LAN (Ethernet) connection between your Laptop and your Pi. You should be able to log into the Pi using for example PuTTy and do there almost anything. You should also be able to exchange between Pi and Laptop files using for example FileZilla.

With this you have a system that is very independent from the outside world. The downside though is that the Pi has no connection to the internet and so it is not possible to install anything on the Pi.

The method shown in the next post is similar to this but allows the Pi to connect to the internet using the Laptop’s internet access.

As usual please let me know your questions and thoughts. I am looking forward to hearing from you.