Facebook Like + Coke Machine Credit

WHAT I WOULD LIKE TO DO:

When someone "likes" my facebook page, it automatically adds credits to my coke machine (80s model dr pepper machine). Giving them access to get a coke for free.

I'd like to be able to handle this from a website, so someone could even use their phone's browser.

Any ideas? or can you point me in the right direction...maybe even samples?

Thanks in advance.

The important bits: 1. What type of FB account is it? Public Figure? Non-profit? Product? There are mild but sometimes important differences in those when it comes to tracking bits like this unless: 2. Do you run a web server? Can it run a language like PHP? 3. Do you get emails every time someone likes your page? 4. Do the coke credits need to INSTANTLY take effect? 5. Is this in-home or will it need to run automated and somewhat hacker proof in the world? 6. EXACTLY which model machine is it? the process for adding credits can vary widely.

The important bits: 1. What type of FB account is it? Public Figure? Non-profit? Product? There are mild but sometimes important differences in those when it comes to tracking bits like this unless:

*This will be a product/page, for example my friends design company: http://www.facebook.com/39Argyle *

  1. Do you run a web server? Can it run a language like PHP?

I do have a server and yes it can run PHP.

  1. Do you get emails every time someone likes your page?

At the moment I have this notification turned off, but I can turn that on.

  1. Do the coke credits need to INSTANTLY take effect?

As quick as possible, since someone might be standing there in front of the machine on their phone. Waiting for their coke.

  1. Is this in-home or will it need to run automated and somewhat hacker proof in the world?

I'd prefer that this be able to be out in the world. Or maybe we can build it just for my apartment, and you can just explain to me what I'd need to add to it to make it hacker proof later on.

  1. EXACTLY which model machine is it? the process for adding credits can vary widely.

Cavalier - 07-483-266 and the credit portion is a CoinCo S75-9800B Coin Changer

Just an idea, but you might have a script send the person and an Ethernet-linked Arduino a 5+ digit pin code. I'm not sure what the best way is to write the script, but it seems like a pin code would be an easy way to authenticate people with an Arduino.

Okeydoke.

Possible but involves a lot of programming. Are you a programmer type, a hardware type, or just a guy with a great idea?

I have a small web design firm in dallas, and am the idea/creative guy. I have a programmer that works with me who can do php and flex/air. But we are all novice to working on physical items. We thought this would be a fun project for us to all work on...but we're all stumped as to where to start...what hardware to buy...setup...etc.

make it hacker proof later on

like > coke > unlike > like > coke > unlike > like > coke...

Essentially you need to setup a php web service to list off the people who like your page. Tell your developer to look into graphs.facebook.com/yourname/members in the SDK. The oauth authentication will be the most annoying part there. The service will fill a DB with names + 4 digit pins (generated from the name is easy). Another column called REDEEMED or similar will track if they've USED it. The last necessary column is the date and time they liked you.

Then you setup a web service that takes a 4 digit input on the get line (easiest to program in arduino) and if it finds a record that isn't redeemed in the last x minutes/hours/etc it will return a GO string of some kind that will tell the arduino to trigger a relay on the 25 cent line that will then dispense a drink. Gotta flip the toggles to make .25 the cost of a soda. If you want to keep the machine working and accepting coins AS WELL, you'll need to google search for your coin mechanism + "free vend" to make it happen.

Please note that these old units work at CMOS levels. It's POSSIBLE to use things like transistors to manage this, but there's NO benefit that I can think of to this and you should just use a relay. If you want a CHEAP relay mechanism that's really quite well made, you can look at this one: http://www.mdfly.com/index.php?main_page=product_info&cPath=9_138&products_id=647 Yup, the optocoupler isolation is overkill in this instance, but it's a CHEAP board that comes pre assembled.

Other than that, you would want either an Arduino UNO and ethernet shield (both available widely) or the new (to me) Ethernet Pro (http://www.sparkfun.com/products/10536) or similar.

There are MANY sketches out there showing how to trigger a pin to go high (ALL you need to do to make the relay close) based on the result from a URL query.

Good luck! Great idea, btw.

sorry, one more bit. if you get the ethernet pro, you'll need a FTDI adapter to program it: This would do it: http://www.sparkfun.com/products/9716

If you DO go the uno+ethernet shield approach, you can make it nice and enclosed with one of these: http://www.sparkfun.com/products/10088

Everything I've mentioned except the relay is available elsewhere as well. The "etherten" from freetronics is a combo arduino+ethernet that doesnt require an FTDI adapter. The uno, ethernet shield and enclosure are all available from amazon etc.

Can't THANK YOU enough. I'm trying to see if there are any local spots that I can pick up this hardware, I'm pumped to start on this. I'll take some photos and let you see the progress.

thankyou

Ray

@raydawg88 & @brucethehoon could you please share the code and hardware used in this project? This seems to be a interesting one and i'm tempted to try this...