getting started

just got a raspberry pi to play with. Nothing special, just a regular b+.
I do not plan to use it as a regular computer, just interface it to some lights and hide it. And for that, I need to set it up headless, without a screen/keyboard/mouse. I also need wireless network, to avoid a long network cable.

A headless setup takes a little bit of effort. Here are the steps I used to set it up using my macbook.

  • Download raspbian.  You can download it from the following link: Latest raspbian image .
  • Unzip the image.  If you are on a mac, you can run into a small snag like I did. double clicking does not generate a correct image file, since it’s larger than 4GB.  I opened a terminal window and did it as follows: ditto -x -k 2015-09-24-raspbian-jessie.zip .  But even the old tar command can be used here. tar -xvf 2015-09-24-raspbian-jessie.zip
  • Get a larger SD card. The latest images have gone over 4GB, which I only noticed after step 2. I had originally an old 4GB sd card that I planned on using, but a quick trip to Frys solved that and I got a 16GB card. Those things have gotten pretty cheap.
  • Put the image on the card. Terminal is easiest, let’s open a terminal window.
    • Type df -h,
    • pop the sd card in the built-in sd card reader, using the adapter that comes with almost every sd card.
    • Type df -h again, note which disk got added.
    • unmount it: sudo diskutil unmount /dev/disk2s1
    • sudo dd bs=1M if=2015-09-24-raspbian-jessie.img of=/dev/rdisk2
    • sudo diskutil eject /dev/rdisk2
    • Wait a long time
  • Stick the card in the raspberry.
  • Before powering up, connect an ethernet cable. This is to allow to get into the pi, and setup the wifi. Once the wifi is set up, we can disconnect the ethernet cable.

After all this we have a raspberry pi that can connect with the wired network, use dhcp and you can log in with ssh. I check the router to see which address got assigned to it, then log in:ssh pi@10.0.1.14

getting the pi on the wlan is (if you’re on a mac) easiest by modifying the needed files directly on the pi. A wifi dongle that works with the pi is easy to find on ebay for about 3$.

after logging in with ssh,
sudo nano /path/to/sd/card/etc/network/interfaces

then change the wlan0 part as follows:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "your-network-name"
wpa-psk "password-here"

save it, shut down the pi correctly (sudo shutdown now), unplug and unplug the ethernet cable. Presto. Now the pi only needs a power cable and you can connect to it with ssh over the wifi.

Don’t forget to run

raspi-config

and grow the disk size to the full sd card.

Leave a Reply

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