Posted on by & filed under hardware, python, Safari Flow.

What the heck is a Dancing Bird Subscription Notifier?

Like many companies, Safari’s projects are given an internal secret codename that follow a pattern. In Google’s case that pattern is alphabetically ordered confectionary; in our case it’s bird names.

With Safari Flow, an all-new product, we re-architected many of our systems, and we decided to build the user database in I realized that we could have some fun whenever a new subscriber joined, alerting the team in the San Francisco office to the good news. So we (OK, I) built Chirpy as a side project, unknown to the rest of the team. Chirpy is a dancing mechanical “bird” who alerts us in a spectacular manner for each new subscription to Safari Flow.

The short version is that whenever a new subscription is created in Salesforce, that event triggers an email to an internal gmail account, which is then picked up by Chirpy. Chirpy – built out of a combination of an old wine box, some oak flooring scraps, a Lego Gearbox, a Raspberry Pi, powered speakers and a lot of cardboard, wire and hot glue – then plays a mating call and spins its spirograph (early Flow Beta testers may recognize these?), all while flapping its wings and flashing some LEDs (Flow colors, of course).

Early versions of Safari Flow used spirographs instead of book covers

Early versions of Safari Flow used algorithmically generated spirographs instead of book covers

Here’s what happens when you make Chirpy happy:


For those of us in the office when it happens, this is truly motivational, so keep those subscriptions coming!

The longer version of how Chirpy came to be follows, along with links to the individual chapters and books I used to help me (from Safari Flow of course)


As a Product Manager working on Safari Flow, I came across a lot of books on the Raspberry Pi and was immediately hooked on the possibilities of Physical Computing. Plus, since Safari Flow is based on a Django/Python framework, and we rely heavily on GitHub for our collaborative development, I figured what better way to earn a deeper connection with our platform than to build my own stuff in Python with our own content guiding the way AND having a little fun for the launch at the same time…

Right off the bat, I wanted my Pi to be as compact as possible with the bare minimum amount of wires tying it down so I decided that Running Headless via SSH over Wi-Fi was the way I wanted to go. This allowed me to set up Netatalk and attach my Pi as NAS in order to write code in Eclipse (PyDev) on my full-sized/full speed Mac so I don’t have to sit near an ethernet jack—or worse, write code in front of my TV with USB-port hogging/power hungry peripherals and a slow(er) LXDE. Plus, I could drop it into this cool wooden box I had lying around AND SSH from my Android Phone to check my log file and start/stop Chirpy!

I also came across a few neat tricks like having my Pi email its IP address to me at startup so I can plug in anywhere and easily obtain my IP address and be able to ssh in to control my Pi.  (AsideI haven’t (yet) found a good way to connect to a new WiFi access point while headless due to the need to edit the .conf files and/or enter passwords although I would love to see one — I’m thinking a startup script, external LCD & Bluetooth keyboard to re-write wpa_supplicant.conf? Please add any tips to the comments below!)

As an added bonus,  I greatly improved my Linux skills and command line tricks such as working with files, crontab and regex among others and my fluency with Version Control using GIT & GitHub to obtain, manage & share my code. highlights (blevien/chirpy on Github committed from Raspberry Pi)

  • Cron job runs Chirpy on every minute since startup
  • Chirpy obtains “Last Subscription” date in log file
  • Chirpy checks the Gmail Atom feed every minute for new subscriptions
  • If a new email is found since last checked, cue stepper motor and LEDs for as long as the sound is playing
  • Write new “Last Subscription” time to file, or skip if no new subscription is found

Server Triggers Setup

  • Set up a Gmail rule to assign a label to incoming emails that you want to be notified about
    • Parse the Gmail Inbox ATOM feed
    • Note that the subject has to be unique or the atom feed always thinks they are part of a conversation and only shows you the newest in the thread, regardless of conversation settings in Gmail Inbox.
    • Also note that atom feed only returns the newest 20 emails, so that limits the usefulness of using the number of new emails in the inbox as a counter
  • markReadMidnight.js runs in a Google Spreadsheet at midnight to mark all “yesterday’s” emails as read


Wiring: Mockup of Raspberry Pi Chirpy gmail notifier circuit Mockup of Raspberry Pi Chirpy gmail notifier circuit


I had been excited to learn about Raspberry Pi but didn’t know what I wanted to build -which is half the battle- until this project came along. In the sprit of dogfooding, I learned pretty much everything I needed from the content in Safari Flow, and I even used my experience to make a new topic set in the product called “DIY & Hardware”.

Start a free trial to Safari Flow to get started with some help from these books:

9781449344252_large (1)


6 Responses to “Meet Chirpy – The Raspberry Pi Dancing Bird Subscription Notifier”

  1. dezldog

    This is sooo cool! For what it is worth the Raspberry boots both the k/v/m *and* serial consoles by default – just connect via screen or minicom and config your WiFi away!

  2. Neil Lathwood

    Great blog post and it’s given me a few ideas, thanks :)

    With regards to configuring Wifi, why don’t you load a config file onto a usb stick with the details of the wireless ap you are connecting to and have the pi read from that at boot and re-configure wpa_supplicant.conf.

    • Bill Levien

      That’s a great idea, I will have to play around with that though Chirpy is now a permanent fixture in our office and I have gotten a few more Pi’s for home so he is less “migratory” these days :-)

  3. RonaldKn

    Hi to all members on this community i am thanks to the administrator of this forum for approve my account i am sure here i got better knowledge thanks again. My name is Ronald.


  1.  Meet Chirpy – The Raspberry Pi Dancing Bird Subscription Notifier @RaspberryPi #piday #raspberrypi « adafruit industries blog
  2.  Meet Chirpy – The Raspberry Pi Dancing Bird Subscription Notifier @RaspberryPi #piday #raspberrypi | electronics-trade blog