Twitter-enabled Candy Machine Dispenses Treats On Command


[Michael Nilsson] and [Markus Olsson] were contemplating how to motivate members of their dev team when they came up with the idea of a candy machine that automatically dispenses treats when someone has earned it.

They picked up a candy machine, a continuous rotation servo and a controller, then got busy automating the dispenser. The mechanism behind the operation is actually pretty simple as you can see in [Michael’s] writeup. They disassembled the machine, removing the gear from the manual crank, attaching it to the servo. Once the servo was mounted place, they installed the servo controller and connected it up to a spare laptop.

The heavy lifting is done by a Ruby script that uses the Twitter API to scrape any mentions of @_macke_ or @sidpiraya. Incoming messages are checked for the words “give” and “candy”, triggering the machine to fork out some sweets.

If you think that their hard work deserves a bit of recognition, feel free to send them some candy by tweeting “give @_macke_candy” or “give @Sidpiraya candy”. Just remember to be considerate – nobody likes spam, not even candy machines!

If you’re interested in seeing the machine in action, be sure to check out the candy dispenser’s live stream at

4 thoughts on “Twitter-enabled Candy Machine Dispenses Treats On Command

  1. Oooh, you might want to remove those real names from the post. I can imagine that thing is going to be dispensing several tons of candy when the internet gets hold of it.
    (except it will run out in a few minutes, I have a mental image of a torrent of jelly beans flooding an office, spilling out through the doors and starting to block the exits. Strong men swimming to keep afloat in the flood, tiring and sinking to their doom under waves of multi-coloured beans…)

    1. Very true, though they are well aware of the probability of having their candy machine spammed. I believe they said the previous record was about 45 minutes until empty, so they’ve been hit pretty hard before.

      Perhaps overuse would inspire them to make some additions to the setup, such as a servo-controlled plate at the dispensing end of the machine, which dumps unconsumed candy back into the hopper. I think that would be pretty cool.

  2. What’s with twitter and device?

    It’s not like twitter has much to do with it, the simplest explanation is that the servo is controlled based on a command from the computer.

    How the computer gets that command isn’t relevant (Twitter, Email, SMS, mouse click, OCR, eye ball scan, DNA test… )

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.