Raspberry Pi Zero - Initial Setup

The first in a series of Raspberry Pi Zero tutorials and projects.

pi_zero

alt tag

The Good, The Bag, & The Fugly

Like most people, I'm a fan of the Raspberry Pi Foundation and what they are trying to do, but also like most people... I'm forever wanting more from the Pi. I actually think its rather cripiling that they don't include wifi in every model given how connected our world has become...but thats a topic for another time.

Pros

  • Power Consumption can be as low as 80mah idle.
  • Plentiful GPIO
  • $5 bucks!!!, though you'll need some peripherals to get started.
  • Full-ish Linux Ecosystem, unlike Arduino or EPS8266 (though that isn't a fair comparison)
  • Excellent form factor

Cons

  • Requires a few peripherals, so its not really $5 but more like $15 - $20.
  • No built in wifi
  • Requires a mico-sd card, no built in storage
  • Really tough to find, though MicroCenter seems to have plenty if you are lucky enough to have one near by like me. :)

Parts List

Here you can find all the parts used throughout these tutorials, I've tried to mark the ones that are required for the basics vs ones for special projects.

Tutorials

Pi Zero Setup

This section will walk you through installing an OS on your PiZero. This instalation procedure is based on Adafruit's guide, their wiki has imensely helpful to many of my projects. I encourage everyone to check it out and support them.

Step 1 - OS Imaging

Download Raspberry-PI-SD-Installer-OS-X from this git repo.

Ray Vijoen has created a useful script to handle much of the sdcard formating and initial installation for you on MACthat makes it really easy to make an SD card using a Mac.

Alteranatively, you can use a Apple Pi Baker to setup your SD card, and make backups once you have your Pi setup the way you like.

Step 2 - Initial Wiring

Connect a USB Hub to an OTG Cable that goes to your Pi's Micro USB OTG Port. The plug your USB Wifi Dongle and Keyboard into the hub. Now you are ready to power up your Pi via the other micro USB port. Lastly, plug in your mini-HDMI to HDMI adapter as well as your HDMI cable for your monitor/tv.

Step 3 - Initial Configuration

Power on your Pi and once the loging prompt appears log in using the username: pi and the password: raspberry. You'll want to change the password at some point but I'll leave that up to you to decide. Once you are at the command prompt you'll want to setup the wifi so we can switch to using SSH instead of having the pi cabled directly to our monitor and keyboard.

You can do this by editing /etc/network/interfaces via the following command:

sudo nano /etc/network/interfaces

You may need to edit your keyboard mappings if you notice that the double quotes you type show up as @-signs. This can be done by running sudo dpkg-reconfigure keyboard-configuration and following the instructions to switch to a US keyboard. This will mostly likely require a reboot to take affect fully (it did for me).

Now that you have your keyboard working, you can edit your interfaces file to look something like the below.

source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
auto wlan0

iface wlan0 inet static
        wpa-ssid "your_ssid_here"
        wpa-psk "your_password_here"
        address 192.168.1.139
        netmask 255.255.255.0
        gateway 192.168.1.1

Now you can reload your networking services to see if the changes worked. You can do this by running the following command sudo service networking reload

Now lets see if your network interface came up as expected. You can do this by running ifconfig, if it worked your should see wlan0 with a valid IP Address like the one below.

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 74:da:38:83:c1:47
          inet addr:192.168.1.139  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::76da:38ff:fe83:c147/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14071 errors:0 dropped:148 overruns:0 frame:0
          TX packets:1602 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7283899 (6.9 MiB)  TX bytes:200898 (196.1 KiB)

Now lets install ssh by running sudo apt-get install ssh. Once this completes, you should be able to ssh to your pi from another machine.

Posted on Aug 16
Written by Anthony Virtuoso