{"id":49,"date":"2009-09-04T17:19:27","date_gmt":"2009-09-04T21:19:27","guid":{"rendered":"http:\/\/www.logicalzero.com\/blog\/?p=49"},"modified":"2014-05-23T01:15:41","modified_gmt":"2014-05-23T05:15:41","slug":"the-soda-machine-hack-project","status":"publish","type":"post","link":"http:\/\/www.logicalzero.com\/blog\/?p=49","title":{"rendered":"&#8216;The Soda Machine Hack Project&#8217;"},"content":{"rendered":"<div style=\"float: left; margin-right: 16px; margin-bottom: 10px; margin-left:24px;\"><a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3881793730\/in\/set-72157603808275537\/\"><img src=\"http:\/\/www.logicalzero.com\/blog\/images\/SodaMachineSchematic_thumb.jpg\" alt=\"Schematic of W&#038;B's vintage beverage dispenser.\" style=\"border: solid 2px #000000;\"\/><\/a><\/div>\n<p><a href=\"http:\/\/www.willoughbybaltic.com\/\">Willoughby &#038; Baltic<\/a> has acquired a vintage soda machine; if I were to guess, it dates back to the late 1950s or early 1960s. It&#8217;s a massive steel box with a wood veneer front, its sides an industrial non-color. In contrast to more modern machines, its only text is the words <i><b style=\"font-variant:small-caps;\">Cold Drink<\/b><\/i> in small, white-on-black, sans-serif lettering above a narrow, horizontal window displaying a representative can of each beverage within. I should have thought to photograph it, but I was distracted by the interior. Inside, the machine is a wonder of space-age technology: as you can see from the <a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3881793730\/\">schematic<\/a>, everything operates on 110V AC line current, and its works are almost entirely electromechanical relays and solenoids. Frankly, it&#8217;s pretty cool. <\/p>\n<p>Of course, the first thing that needs to be done to the machine is connect it to the Internet.  Why? I don&#8217;t know. I&#8217;m only interested in the &#8216;how&#8217; at the moment.<br \/>\n<br clear=\"all\"\/><br \/>\n<!--more--><\/p>\n<div style=\"float: left; margin-right: 16px; margin-bottom: 10px; margin-left:24px;\"><a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3881761576\/in\/set-72157603808275537\/\"><img src=\"http:\/\/www.logicalzero.com\/blog\/images\/SodaMachine_SelectionDetection_thumb.jpg\" alt=\"Optocoupler interface for detecting selections.\" style=\"border: solid 2px #000000;\"\/><\/a><\/div>\n<p>The first step of that first step is building microcontroller-compatible interfaces for the machine&#8217;s 110VAC inner workings. Since most microcontrollers operate on DC between 3 and 5 volts, this will take some doing. <\/p>\n<p>There are two basic functions that need to be exposed; the first is detecting the beverage selection. For this, I&#8217;ve <a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3881761576\/in\/set-72157603808275537\/\">built a board<\/a> (here&#8217;s the <a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3882178154\/in\/set-72157603808275537\/\">schematic<\/a>) that uses optocouplers to pass the signal but keep the two voltages electrically isolated. It&#8217;s really pretty simple. Every button is a SPDT switch, wired so that the first button pressed cuts the power to all the rest; only one button can be active at a time. The output from each of the seven buttons is split; one side goes where it was intended, the other to the board&#8217;s inputs. When a button is pressed, one of the seven low-voltage outputs on the other side of the board goes &#8216;high&#8217; (i.e. changing from ground to just below +5VDC). The signal will come through as a rapid series of pulses (half of the AC sine wave), but I&#8217;ll account for this in the software.<br \/>\n<br clear=\"all\"\/><\/p>\n<div style=\"float: left; margin-right: 16px; margin-bottom: 10px; margin-left:24px;\"><a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3880963167\/in\/set-72157603808275537\/\"><img src=\"http:\/\/www.logicalzero.com\/blog\/images\/SodaMachine_RelayBoard_thumb.jpg\" alt=\"Simple 12V relay board.\" style=\"border: solid 2px #000000;\"\/><\/a><\/div>\n<p>The other thing that a computer-enabled soda machine must be able to do is operate cashlessly. We use uniquely-identifiable <a href=\"http:\/\/www.maxim-ic.com\/products\/ibutton\/ibuttons\/\">iButton<\/a> keys for other purposes at W&#038;B, so I plan on using those to allow members to put a drink on their tab. Looking at the machine&#8217;s schematic, it appears that the coin box abstracts the credits put into it; it just closes one of four circuits when &#8216;enough&#8217; money has been put in. The four separate circuits apparently allow for four separate prices, although the W&#038;B machine has everything cost the same. The <a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3880963167\/in\/set-72157603808275537\/\">board<\/a> I put together for this (<a href=\"http:\/\/www.flickr.com\/photos\/27076997@N00\/3881379949\/in\/set-72157603808275537\/\">schematic<\/a>) is a fairly generic relay controller. When powered, the relay switches the credit circuit&#8217;s source away from the coin box. This circuit uses an optocoupler in a way opposite of the first board; it sends a signal <em>from<\/em> the low-voltage portion. There&#8217;s actually an extra step in this: the relay is what connects to the machine&#8217;s native 110VAC, and it operates on 12VDC. The optocoupler controls that 12V signal which in turn controls the 110VAC.<\/p>\n<p>The selection detection board is fairly straight forward to hook up; all the buttons are connected with standard &#8216;spade&#8217; connectors, all of which are accessible when the machine is open, so putting in a splitter is just a matter of plugging it in. The credit faker&#8217;s attachment is not so obvious. The coin box is a separate module, connected via a strange plug that looks like four standard grounded plugs stacked vertically. I&#8217;m going to have to open up what the schematic refers to as the <em>control box<\/em>, which is literally an ominously featureless steel box located next to the coin module. While I&#8217;ve tried to plan all my modifications to avoid making permanent changes to the machine, this will almost certainly need some &#8216;higher impact&#8217; hacking.<\/p>\n<p>If I don&#8217;t get a job in the meantime, I hope to do some additional work next week. I should really take some photos of the machine itself as well.<\/p>\n<p><a href=\"http:\/\/projects.logicalzero.com\/\">Stokes&#8217; Project Blog<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Willoughby &#038; Baltic has acquired a vintage soda machine; if I were to guess, it dates back to the late 1950s or early 1960s. It&#8217;s a massive steel box with a wood veneer front, its sides an industrial non-color. In contrast to more modern machines, its only text is the words Cold Drink in small, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,34],"tags":[35,16,36,37,38],"_links":{"self":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/49"}],"collection":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":37,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":803,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/803"}],"wp:attachment":[{"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.logicalzero.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}