Reid Carlberg

Connected Devices, & Other Adventures

Create a Case in with a Staples Easy Button


I’ve mentioned a couple of times  it would be interesting if we could create a case in by pressing something like a Staples “Easy” button.  So I did it using a Raspberry Pi and an Easy Button.  Turns out, it’s not that hard. I did it with a standard Developer Edition and a couple of Node.js libraries.

Bill of Materials



I started by following my standard Raspberry Pi configuration steps.  This created a simple environment where I could work with Node.js.

Next, I wanted to find the right library to help me work with the Raspberry Pi’s GPIO board. There are a few out there, and they all have one challenge: you can only use the GPIO if you are a superuser.  The most popular library appears to be “pi-gpio“.  It requires “gpio-admin” to work around the superuser requirement, but it didn’t seem to fail in a friendly way when I didn’t have gpio-admin, so I kept looking (note, this may not be pi-gpio’s fault).  I came across “GpiO“.  GpiO inherits the same superuser requirements, but if doesn’t require gpio-admin and offers some additional approaches, including gpio-admin.  I did a quick test, which succeeded, so I moved on.

Next, I wanted to review a bit about how to connect a button on a Raspberry Pi.  Now, buttons are pretty easy at their core.  You press one, and it completes a circuit.  But there’s always a little wiring required.  Adafruit has a great learning section which describes the basic hardware configuration in detail.  I also needed to double check how to configure an LED. Unsurprisingly, they have that as well.  My simple adaptation is below.  Note that I used a spare half-sized breadboard rather than the full-sized one that comes with the kit.  The button connects to pin 23, the LED to pin 24.


The sample code Adafruit shows you is in Python.  Nothing wrong with Python.  However, I was thinking Node.js, which means I couldn’t use Adafruit’s example. No problem, I figured, there are great examples on the Github repos.

I then started to wonder about the best way to integrate with There are a lot of ways, but I wanted to do the simplest thing that could possibly work and so landed on “Web to Case.”  Not a universally perfect approach, but it’s easy to get started (in fact, I simply used the default configuration), and it led me to the useful request library which you’ll see I’ve used below.

My final code is pretty simple.  I import a couple of libraries, declare a couple of gpio variables for specific pins, and have a request with form data that’s fired off.

var gpio = require("gpio");
var request = require("request");

function sendWebToCase() {
	var fields = {
			'orgid': '00DU0000000YYhQ',
			'name': 'Reidberry Carlberg',
			'email': '',
			'phone': '773-870-5554',
			'subject': 'Auto case submission',
			'description': 'Here is the detail -- we could also send a log'

	var r ='', 
			{ form: fields },
			function (error, response, body) {

function flashLed(led, state) {
	if (state == 1) {
		setInterval(function() { flashLed(led, 0); }, 5000);

var gpio23 = gpio.export(23, {
   direction: "in",
   ready: function() {
var gpio24 = gpio.export(24, {
   direction: "out",
   ready: function() {

gpio23.on("change", function(val) {
   // value will report either 1 or 0 (number) when the value changes
   console.log("23" + val);
	if (val == 0) {

That’s it!  All that was left was to modify the Easy button.

There are quite a few guides on line on how to hack the Easy button–turns out this has been popular the entire time it’s been around.  Most of them require some kind of soldering and circuit modification (example), which to my mind was unnecessary.  The button itself has several parts: a speaker, battery case, some weights, a piece of metal to make that clicking sound, a small circuit board and the actual button.


The only think I really care about is the button.  As I said earlier, all a button does is complete a circuit, right? If that’s the case, I wondered, why couldn’t I just add a new circuit?  I started by covering the existing circuit with plain old tape, put on two new wires that would form the new circuit and taped them in place.  Voila!  The button is now mine, no soldering required.


Now, about that gift box.  Turns out it is just about the perfect size to contain all these guts.  Just about.  I had to turn the Raspberry Pi case upside down,  stack the breadboard on top of it, and feed the power supply through a special hole I added, but it worked.

Conclusions, Questions & Opportunities

Overall, I’m glad I did this, but I’m not convinced I have landed on the perfect solution just yet. I find myself wondering if an Electric Imp wouldn’t be a better choice.  I also have an Arduino Yun that, with its smaller form factor, is an appealing option.  Finally, I wonder how useful the Web to Case approach really is.  It certainly creates Cases, which is the point, but it’s very one-way.  It would be super interesting to to have some sort of bi-directional communication so the button could display the status of the case, or so that the initial case creation could include a richer set of data. This also begs the question of whether cases should move to a completely data-driven predictive model requiring zero human intervention, but that my friends is a subject for another day.

Questions, comments — I’d love to hear em.  @ReidCarlberg

5 thoughts on “Create a Case in with a Staples Easy Button

    1. Reid Carlberg Post author

      My original idea was to connect it to a Mophie. It will work technically, but it didn’t fit inside the gift box with the rest of the stuff, so I stuck with the regular power supply. Good times.

  1. eliz_beth

    I’ve got a small NewTrent that may work- or one of those super slender power bars Pardot gave away last Dreamforce (as an example).

    I was thinking of something like this for the MVP expert bar (formerlly the genius bar since we can’t call it that). Maybe hook it up with some of the little spin lights (like woot off lights) that someone can click, make it light up, then web to case would be perfect. I’d love getting the details of the people who come by- maybe integrate a barcode reader? Hrmmmmm. But at minimum, get a count of the people we’ve helped, by the time stamps on the case we can get an idea of flow and staff accordingly, be able to publish our end results and maybe even a monitor where we can show the current dashboard with breakdowns.

    Wait– how did you guys do the pinball machines? That would be perfect to get the info!

    Geeking out in the AM 🙂 You’re an inspiration Reid!

  2. Pingback: Five Enterprise Internet of Things (IoT) System Architecture Patterns | Reid Carlberg

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: