Ordering Pizza with cloudBit

Hi Bitsters!

I built a cloudBit project so I can order pizza by emailing my local paesanos pizza delivery service. The idea is that my cloudBit would send my pizza restaurant a different email depending on the percentage input going into the cloudBit.

%. Pizza Type
1-12 = pepperoni
15 - 28. = mushroom
31 - 50 = cheese
54 - 69 = sausage
74 -87 = veggie
91 - 99 = Hawaiian

If the restaurant receives the order, they will send a confirmation email with a #orderconfirmation tag in the subject line, which will then turn on the bright led “Yum!” sign through an IFTTT recipe, IF Email THEN littleBits.

Here’s the circuit:
USB power + dimmer + wire + button + cloudBit + wire + bright led

The IFTTT recipes don’t allow % inputs (just on or off). I guess that means I need to use API’s.
I’ve never used an API to communicate with the cloud (only IFTTT.com recipes).
I could use some help. :wink:
@sssyed, can you please help me?


Hi @JackANDJude!

Good news and OK news.

First the good news!

  • We’re on our way to develop a new version of our ifttt software to work better with input thresholds.

OK news!

  • One way to accomplish this is via writing a script that hooks into our api and emails your pizza place according to the state of your input amount. It’s certainly more involved then ifttt and I’ll look into making this easier in the short run before we release the next version of our ifttt driver.
  • But pi day is tomorrow so I have an idea on how to get this to work now by jury rigging:

Create a recipe that takes input from the cloudBit and sends a tweet to some twitter account and add a hashtag that looks like this: #PowerPercent{{PowerPercent}}. In the recipe you’ll have to add the {{PowerPercent}} because it’s not given by default.

Now you have to create another series of recipes that listen to those hashtags that contain the different input percentages, then email your pizza place with the appropriate order. So you’ll have have a different recipe for each input value.

I haven’t tested this, but I think it should work!


@JackANDJude :+1: I mildly tested it out this afternoon. So it goes:

Give the recipe it’s own hashtag with input value (it actually tweets as you):
If input received by meowbit, then post a tweet to @sssyed

Then create another recipe for each input value you want and send the input value in the body of an email (I did a search for this hashtag since it was unique but you can limit it to your own tweets as well):
If new tweet from search for #PowerPercent100, then send an email from syedamins@gmail.com

It’s essentially using twitter and hashtags as a way to reference data. In the context of computer programming we’re kind of using twitter and it’s hashtags as variables.

Also! @JackANDJude you can use the same concept with gmail if you want to avoid twitter. So you can send an input value to gmail then use another recipe to search gmail with that input value then send another email to your pizza place accordingly.

I know it’s a little round about but it should work!

Happy Pi day!

I don’t think I’ll get this up and running today, but I’ve been working on it. Exact variables are hard to achieve, and I don’t want 100 recipes. I’m thinking #PowerPercent1 or #PowerPercent2 would cover all values from #PowerPercent10 to #PowerPercent29. Do you agree?

@JackANDJude right you probably want to just have the lower bounds of those values, but totally that does make it tricky since they’re ranges. Hm. I think about this a bit more deeply and see if I can come up with more solutions!

Thanks, @syedBits . I’m testing the gmail channel now with the OR operator. Pretty sweet. I’ll let you know if #PowerPercent1 will cover double digits that start with 1. :wink:

@JackANDJude I think this is a really cool project and I feel curious about the Tips & Tricks that you’re dealing with @syedBits, namely ranges, thresholds, and accuracy of data. I understand that if you want to eat a sausage pizza, you or Jack or whoever, wont be happy to receive a veggie, because the system made a mistake.

I feel that some of the clues on how to get this done, are tackled in your first post. When you’re leaving some “black percentage spaces” between the ranges of each pizza and when you consider an #orderconfirmation tag.

I don’t know how to solve this, but I want to share my thinking process and some things I tried, to see if this can help you, or even unblock more ideas in my head, juts simply by writing them here.

The first thing I thought, was using an Arduino to take the input value from the dimmer and map those ranges to constant values, that you could easily differentiate at the output, and limit the number of IFTTT recipes. But, you would still have some trouble in the boundaries, so maybe you could have a part of the code that lets you know when you’re in a safe zone (like in the middle of the range) to assure that your choice is safe, and then continue to order.

But the thing is, that although you can fix a stable value at the output of the Arduino, the cloudBit input always have kind of a “data noise” (I’ve been trying this with a power + dimmer + arduino + cloudBit circuit). I know that with the Arduino you can filter the input values to get rid of that noise by making an average. Maybe @syedBits this can be a good feature for the new version of IFTTT littleBits channel. I mean that you could select an average value of X times the input to have a more stable averageValue besides the inputValue.

Ok, as I warned you before, I don’t know how to solve this and I’m looking forward to see the result of your tests!

And if I come up with more ideas, of course I will share them with you :smile:

1 Like

Thanks for your thought process, @leo. :slight_smile: :thought_balloon:

I agree with your idea about the Arduino, that it would reduce the range of numbers and thus the number of recipes. It feels to me that is not enough of a payoff to bring in the Arduino. As you said, there will still be some fluctuation on the receiving end.

Gmail search
I was hoping gmail could search within a word so that #PowerPercent2 would be found in #PowerPercent27 or #PowerPercent21, for example. This does not work. However, I did learn about the Gmail channel, which I had never used before. :books:

Power Bit
Due to my rough handling of the usb power Bit, it has come apart at the seams. It was pulled to the floor by the usb cable too many times. I’ve fixed it enough for other bits to be happy, but the cloudBit will no longer work with my FrankenBit power. I ordered two new ones. :smile:

Alternate method
If anyone is still interested in ordering pizza with the cloudBit, I know the use of NFC (Near Field Communication) chips are a viable option. You could place your phone over an NFC chip taped to a menu board. The cloudBit would send a specific email and send a certain output level to a servo to confirm the order.

I’ll wait patiently for the new IFTTT - littleBits software update. Thanks so much for your ideas, @syedBits. :smile:


@JackANDJude No problem!

Building on what @leo said you could write some code that filters those ranges and sends specific values to the cloudBit.

I wrote a really quick and dumb arduino sketch on how this could work:
If you take a peek at the code by hitting the code editor and start the serial monitor after you’ve hit start simulator you can turn the knob down to20 and you’ll see pepperoni printed out on the serial monitor. In the code that’s where the output value from the arduino will be sent to the cloudBit. It’ll happen once so the cloudBit doesn’t get flooded with output.


I hope this helps a bit! I love pizza so much!


@syedBits This circuit simulator is fun! :smile:

1 Like

Neat idea, and is similar in some respects to my query about “reading” cloudBit state. I used the v3 interface and cURL to send/receive data from the cloudBit, but right now it’s hard to integrate that into the IFTTT sort of framework.

I don’t see any IFTTT channels that let you run an arbitrary script somewhere, which is really what we need. Unless one of the 170 channels I don’t know about provides that sort of functionality. Excited to see what @syedBits has for the new interface.

@jeffriv Today’s community calls will be on the Internet of Things, and @syedBits will be answering cloudBit questions. I hope you join us. :slight_smile:

I think you could just have it email them the stuff to put on. I don’t know.

1 Like