Introduction: Open Wifi Finder

Sometimes, it’s nice to feel like a Hollywood hacker and flex your superpowers! With this project, we will see how to detect if there’s a non-secure wifi around us. This is also handy when you travel and don’t have your usual places to connect to the Internet. You could be walking down the street until the GrovePi+ finds a coffee place or a restaurant that offers free WiFi. This is often referred to as 'wardriving'

With Great Powers Comes Great Responsibility!

Knowing where there are open wifi networks is fine. Using those open networks for your own needs is most likely NOT fine, and may even be illegal. Better safe than sorry. Gain the knowledge but don’t use it unless given explicit permission by the wifi owner.

Step 1: What You Will Need

  1. a Raspberry Pi (and the usual: Raspian for Robots SD card, power supply, wifi dongle)
  2. a GrovePi+ board
  3. a GrovePi+ compatible LED
  4. a GrovePi+ compatible buzzer
  5. a GrovePi+ compatible LCD RGB screen

Or you could all this by getting the Starter Kit or, if you already have a Raspberry Pi, you could get the Base Kit

Recommended: a cell phone charger for stealth mode

Step 2: Starting Point

We are going to assume that your GrovePi is already set up and going. If it is not the case, please follow the first four steps in our Getting Started with GrovePi tutorial to get going

  1. Connect the GrovePi to the Raspberry Pi
  2. Setup the Software
  3. Connect your computer to the GrovePi
  4. Update & Test the GrovePi

You may want to go through the basic examples available on the same page, just to make yourself familiar with the GrovePi+.

Step 3: Hardware Assembly

With the Raspberry Pi and GrovePi+ already assembled, the SD card and WiFi dongle in place:

  1. plug the LED into port D3
  2. plug the buzzer into port D2
  3. plug the LCD screen into port I2C-1
  4. plug the WiFi dongle into one of the USB ports (not seen in the picture)
  5. if you have a GrovePi+ protective case, please use it, as this project is meant to be taken outside.

Step 4: Finding the Code

If you’re running the latest Raspbian for Robots, the code for this project should already be on your SD card. You will find it in the GrovePi folder on the Desktop, then Projects, then Open_Wifi_Finder. The full path is as follows:

/home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder/wifi_finder.py

as shown in the second photo. Note that you do not need to navigate to the Open_Wifi_Finder folder via the desktop interface, as the program needs to be launched from a command prompt anyway. This step is only to see if you have the code already, or if you wish to see what the code does.

If the code is not on your SD card, then run the DI Software Update tool.

You can find the code on Dexter Industries' repository and get it onto your card by entering the following in a Terminal window. (you will still need to install the GrovePi library)

sudo wget https://raw.githubusercontent.com/DexterInd/GrovePi/master/Projects/Open_Wifi_Finder/wifi_finder.py

Step 5: Getting Wifi Powers

Wifi detection needs another library that is not currently on your SD card. A library is a file that contains a lot of functionality, and we need one that can handle some wifi detection for us.

Start up a terminal window, and let’s get those new powers by typing the following

sudo pip install wifi

Raspbian will then pull in the appropriate piece of software for us.

Step 6: Launching Our New Powers

First we need to launch a terminal. If you're using SSH to control your Pi, you're already using the equivalent of a terminal. If you're using the Desktop, VNC, or noVNC, then you have to double click the Terminal icon.

You then have to go to where the code is kept, by using the cd command (for change directory, the old way of saying change folder) followed by the path to the code

cd /home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder

Capital letters are important.

Pro tip: after each '/', you can type the first two letters then the TAB key. Raspbian will autocomplete the name for you, if there's no conflict. Then launch the code by entering

sudo python wifi_finder.py

If there's an open wifi nearby, you will be alerted promptly!

Step 7: Taking Our Project on the Road

If we want to take our project outside where we can get the info from stores or neighbors, we have one extra step to do. After all, we don’t want to bring a screen and a keyboard to launch the software! So let’s make it that it runs right away when the Pi boots up. This way, we only need to power up the Pi+GrovePi with a cell phone charger, and everything will work on its own.

There are many approaches to making something start at boot time, but here’s one of them.

  1. Copy the files into your home directory. That way, we will save the original files, and will simplify our paths.

    cp /home/pi/Desktop/GrovePi/Projects/Open_Wifi_Finder/wifi_finder.py ~/.

  2. Let's create a start file

    nano start.sh

    The contents of start.sh will be:

    #!/bin/bash
    sudo python /home/pi/wifi_finder.py


    Type Ctrl-X to exit, followed by 'y' and the enter key
  3. Now we need to edit rc.local which Raspbian Wheezy uses to know which programs need to start at boot.

    sudo nano /etc/rc.local

    Scroll down to the end of the file, and add the following lines right at the bottom

    sudo sh /home/pi/start.sh
    exit 0


    That's it! Reboot and test! To reboot, you can type

    sudo reboot

Step 8: Going Undercover

It's time to go undercover and canvas the neighborhood.

We've selected a paper bag as our cover. It looks innocent enough. Inside, the Pi and GrovePi are being powered by a cell phone charger. As the paper bag is too small to accommodate the GrovePi case, we need to protect the LED, buzzer and LCD screen with a piece of black foam. It's important that there never be a contact between the various parts while the system is running. It can create a short circuit and crash the Pi. In our experimentation, we were lucky and no part was permanently damaged. Still, better be safe and avoid any contacts.

The LED can be seen through the paper bag if it's positioned near the bag itself. The buzzer is definitely heard through it. And you only need to take a peak inside to see the name of the detected network on the LCD screen.

Now you can go outside and have fun with this! Use your new powers wisely.

Raspberry Pi Contest 2016

Participated in the
Raspberry Pi Contest 2016