GongPi
Rings the gong in the Envoy office every time we make a sale.
Requirements
- RPi GPIO library
- PIGPIO library
- Web.py
- Raspberry Pi (we used Adafruit Raspberry Pi Rev. B+)
- Internet connection (wired or wireless)
- Servo on GPIO pin 4
- One LED on GPIO pin 22
Instructions
Note: These are very loose instructions to help get you started. This guide won't cover the basics of electronic wiring, Raspbian (the Raspberry Pi flavored Linux distro), and setting up a server to send webhooks from.
- Install Raspbian Wheezy β I recommend using NOOBS (linked) because it's easier.
- Use the
raspi-config
menu to change the default password and set your time zone. Don't skip this step. - Once at the command prompt, run
apt get update
andapt-get upgrade
to update your base system. - Run
apt-get install git
- Clone the repo
git clone git@github.com:OutrageousLabs/gongpi.git
-
sudo mv rc.local /etc/rc.local
β this overwrites the default rc.local with one that runs the required scripts on boot. - Install PIGPIO β this gives us a Python library to easily control the servo.
-
easy_install web
andeasy_install simplejson
-
Try running
sudo python stripe.py
β it should return the following:http://0.0.0.0:8080/ _
If so, your webserver is now running and listening for incoming webhooks. You can test if incoming webhooks are correctly interprereted by running the following from your machine (not the Pi):
curl -d '{"type":"charge.succeeded"}' [PI's IP ADDRESS]:8080
The LED should start blinking, and your servo should activate.
stripe.py
will print text in the console, and output an access log tostripe.log
. Restart your Pi
sudo shutdown -r now
- When the Pi reboots, it will automatically start the network monitor (which will auto-reconnect WiFi if disconnected),
pigpiod
, and thestripe.py
server.
Comments