Pets, Plants, and Computer Vision

Raspberry Pi Network Configuration

March 24th, 2014 | Posted by admin in code | computer vision | RaspberryPi | Uncategorized

I’ve been playing with my Raspberry Pi a lot but getting the networking working on it is a pain. To me the /etc/networks/interface file is cryptic black magic. Here are a couple tools I am using to allow me to move between networks. Basically I have three networks setup: home, work, and mobile. The mobile connection is my phone’s tethering. The tethering allows me to setup the pi whereever I am and point the pi to the local network. To set up everything you need to edit /etc/network/interfaces and /etc/wpa_supplicant/wpa_supplicant.conf and make them look like the ones below. To test your changes on the pi while you are logged in you can use sudo ifdown wlan0 and sudo ifup wlan0. Basically you edit your wpa_supplicant.conf file on the pi and then use these commands to have the changes take effect.
My /etc/network/interfaces file:

My /etc/wpa_supplicant/wpa_supplicant.conf file. Make sure to add your own access points and passwords.

Another useful tool is fping. Fping can automatically ping every device on a network. So, for example, let’s say I go to a coffee shop and I want to use the pi. I turn on my cellphone tether, turn on the pi, and ssh in. I then edit the /etc/wpa_supplicant/wpa_supplicant.conf file, and either ifdown/ifup wlan0 or turn off the tether and reboot the pi. I then run ifconfig on my machine to get my laptop’s ip address on the coffee shop network. If my laptop’s IP is I use fping to scan the entire subnet (e.g. thru . For example I can run:

sudo fping -s -g -r 1

This will give me a list of IPs to ping. I can iterate through these IPs and find my pi.

This weekend I went to MicroCenter and picked up a couple of cool toys for the pi. The first thing I bought is a the Raspberry Pi IR camera. I didn’t have any IR LEDs to test with so in a pinch I used my TV remote control. TV remotes use IR light so it works as an IR flashlight. You can see the results of me taking a photo in a dark room.

Raspberry Pi IR Camera with TV Remote Flashlight.

Raspberry Pi IR Camera with TV Remote Flashlight.

I also picked up a 2600 mAH battery pack at Micro Center. I am really happy with its performance for $10. It has enough juice to run the pi remotely along with a bunch of peripherals like a small stepper motor.

You can follow any responses to this entry through the RSS 2.0 Both comments and pings are currently closed.