Sophomore college men, New Yorkers, late-night techies, and the truly lazy: welcome to your fantasy. Introducing the ultimate upgrade in gastronomical technology, the Pizza Button. No need to pick up the phone to order pizza anymore. Simply press this button and wait while it orders delivery pizza to your address.
The Pizza Button uses a BeagleBone Black (BBB) board to do the heavy-lifting in this project. A button press triggers the board to run a web scraper. The web scraper logs into your Grub Hub account and orders pizza from the famous San Francisco North Beach Pizza (meaning that currently this button only works in San Francisco, but honestly, would you really want to be anywhere else?) It orders a large cheese pizza, pays for the pizza, and has it delivered right to your door. This project is very simple to make and irresistible to use!
Future updates to this project include:
- Internal GPS
- Pizza Smell to only enhance your appetite
- (x3) pizza boxes from your favorite pizza shop
- (x1) Massive Arcade Button with LED - 100 mm White Adafruit 1187
- (x1) Proto Cape Kit for the BeagleBone Adafruit 572
- (x1) 470 ohm 1/4 W resistor RadioShack 271-1317
- (x1) 1 k-ohm 1/4 W resistor RadioShack 271-1321
- vinyl or LC Glossy Inkjet Photo Sticker Paper (8.5" x 11") Amazon B000VKV2H4
Step 1: Print the Pizza Sticker
Find a mouth-watering picture of a pizza and print it out on sticky paper. I used a vinyl cutter, but a standard printer would work as well.
Step 2: Take the Arcade Button Apart
The arcade button comes with a switch locked into its base. Simply twist the switch counterclockwise and feel it unlock. Pull the switch out from inside the button's tapped neck (tapping is the grooves you see in objects like screws). There will be an LED attached to the switch. Next, unscrew the small black ring from the tapped neck so the button's base can be pulled away. Inside the neck are two white tabs. Push them inward and down to push the plastic button face away from the neck. Now all that is left is the clear button face attached to the white platform with the tabs. Use a small screwdriver to pry the button face off the white platform.
Step 3: Apply the Sticker and Reassemble the Button
Cut the sticker out and attach it to the smooth white platform. This way, it will be seen through the clear button face. Reassemble the button.
Step 4: Make the Box
I started with flat pizza boxes I bought from the container store. However, feel free to use your favorite pizza boxes! This base requires three pizza boxes stacked on top of each other, which will accommodate the rather larger arcade button and house the electronics. Begin with the bottom box. Find and mark the box's center with a ruler, and use a cup to draw a circle around it. Cut the hole out with an X-Acto knife. Cut a hole on the top of the bottom box, and holes on both the top and bottom of the middle and top boxes. Stack the boxes together and glue them together with a hot glue gun. Place the button on the top to make sure the switch fits through the hole.
Step 5: The Circuit
This circuit is fairly straight forward. When pressed, the arcade button triggers both the code to run and the LED inside the button to light up.
Step 6: Communicating With the Beagle Bone Black
This project is my first experience with the BeagleBone Black Board. In my opinion, the BeagleBoard is quite similar to the RaspberryPi board but with more gpio pins. Read more about the BeagleBoard at its official community site and discover the main differences between the BeagleBoard and Raspberry Pi here.
This project uses a Rev C BeagleBone Black board running off a 16G micro SD card flashed with the Debian environment. You can use any size micro SD card greater than 8G. Although the new BeagleBone Black Board has a 4G onboard processor, Debian's desktop environment requires more storage space. To interact with the board, simply plug it into your computer with the micro HDMI to USB cable that comes with your board. The 'user leds' located next to the ethernet port should flash in a pattern programmed to mimic the human pulse (the beagle makers are cool, right?) and the board's icon should pop onto your Desktop. If you are using a mac, you can program your board two different ways:
METHOD 1: THE TERMINAL
Open the terminal and type into the command line
ssh firstname.lastname@example.orgIf when you are prompted for a password, type
** If this doesn't work because of an "offending ssh key" **
Type into the command line
rm -f .ssh/known_hosts ssh email@example.com
** If this still doesn't work **
Type into the command line
sudo ssh firstname.lastname@example.org
METHOD 2: DEBIAN ENVIRONMENT
You can also vnc into the board's desktop environment and program it from there. Follow the steps below to do this.
- Download Remote Desktop Connection for mac from here.
- Open Remote Desktop Connection and in the input box for 'Computer' type '192.168.7.2'
- Inside the remote desktop pop-up, type 'root' for both the username and password.
- You will be presented with the Beagle Board's desktop.
Step 7: The Code
This code automatically signs into your personal GrubHub account, navigates to the menu for North Beach Pizza, and orders a large cheese pizza. It's all trigger by a press of a button!
It does all this with by interacting with webpages with Selenium using a headless web browser PhantomJS. What's selenium? It's a software package that does all the clicking through webpages for you (remember, this project is for the ultimate lazies out there). What's a headless web browser? Learn more here, but in short, it's a web browser (think of Safari, Firefox and, dare I say, Netscape) without a graphical user interface. This makes automating web page navigation MUCH faster (you're hungry for pizza, so you want your order to be sent as fast as possible).
Things you will have to edit within the code:
- GrubHub login information, which includes your username and password
- Credit card info
Step 8: File Transfer From Your Computer to the BBB
You can transfer files like 'code.py' from your computer to the BBB with simple commands in the terminal environment.
Generically, the way to transfer a file from your computer to the BBB looks like
scp /home/filename.file user@IPAddress:/directory
Breaking this down:
- 'scp': The command 'scp' allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.
- '/home/filename.file': The file location on your computer.
- 'user@IPAddress:/directory': The BBB's login information and where on the board you want to copy the file to.
For example, let's say I downloaded and saved 'code.py' to my computer's Desktop. Now I want to transfer it to the BBB's Desktop. I will open my computer's terminal and type
scp /Users/dot/Desktop/code.py email@example.com:/home/root/Desktop/
Don't copy this example word for word, since the paths on your computer and BBB will be different than mine.
I found this information from a useful website here, where you can also learn how to transfer folders of content.
Step 9: Installing the Proper Libraries Onto the BBB
You'll have to install a few libraries for the code to work properly. To install anything on your BBB, it must:
- Be plugged into ethernet
- Powered by your computer (if you are communicating to your board through the terminal)
- Powered by a 5V wall wart (if you are connecting the board to a monitor)
I personally powered my board through my computer and programmed it via the ssh command, which was previously described in "Communicating With The Beagle Bone Black".
You will have to install:
- Adafruit's GPIO python library
- PhantomJS headless web browser
Step 10: Installing Python and Adafruit's I/O Library
The Beaglebone Black Board has lots of gpio pins, 65 in total, making it unique amongst the many mini computers and microprocessor boards on the market. Two gpio libraries compatible with the Beagle's gpio pins are BoneScript's built-in library and Adafruit's Python GPIO library. Because I am personally more comfortable with Python, I decided to use the Python GPIO library. The library is fairly simple to download. First, ssh into the Beagle Board and install the following dependencies:
sudo ntpdate pool.ntp.org sudo apt-get update sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus -y
Then type the following command into install the python gpio library
sudo pip install Adafruit_BBIO
Step 11: Installing Selenium
To install selenium, ssh into the BBB and type into the command line
> sudo pip install selenium
Step 12: Using Selenium With a Headless Webbrowser
To install PhantomJS so you can use the PhantomJS headless web browswer, ssh into the BBB and type into the command line
sudo apt-get install build-essential chrpath git-core libssl-dev libfontconfig1-dev git clone git://github.com/ariya/phantomjs.git cd phantomjs git checkout 1.9 ./build.sh
These instructions came from the PhantomJS website here. I ran into many problems trying to install PhantomJS, but was finally successful following these commands.
Step 13: Pizza Time
Now sit back and enjoy your pizza.