Subscribe to Comments for "Vending Machine Electronics" Subscribe to SYN Shop - All comments

Some of you may remember the vending machine Dataman and I picked during the summer. It's an old cigarette vending machine that we want to modify to sell electronics kits and other do-dads. We've decided that the best way to do this is to turn the vending maching into the fulfillment system for a web store.

The first step to doing this is to turn the 20+ year old electronics into something that can be connected to the internet. The old controller is pretty rudimentary (although very clever for the time). After poking it for a bit at one of our Hackup meetings, we figured out that pushing the each of the buttons directly closes the circuit that powers one of the motors for a brief period of time. The controller board simply enables turns the buttons on. We need to have a bit more control over the system, so we decided to ditch the existing controller board.

The motors in the machine are all 24 volt AC motors. Built into the drive system are switches (one for each motor) that turn on when the motors are preturbed from the home position. These switches are hooked up to drive the motor itself. What this means is that the motor only needs to be turned on from an external source for less than a second, and after the motor is perturbed from the home position, it will drive itself until it is back in the home position (and the internal switch turns itself back off).

To control the 24V AC motors, we need a way to switch the higher voltage from a lower voltage. TRIACs would work for this, but they would require a custom PCB because they are a bit uncommon. Relay boards are fairly easy to find and inexpensive. The down side is that relays are less reliable than solid state components, but the price and ease of sourcing seemes to be a worthwhile tradeoff. I found these on DealExtreme to do the job. They have 2mm pitch connectors to tonnect to the control lines and screw terminals for the power connections. We need one relay for each of the channels (motors) and there are 30 channels in the machine, so I bought 4 of them. The traces are tinned, but not soldermasked, which is actually very helpful for this application. Because each of the motors is driven from a single 24V AC source, I soldered a jumper wire across common pins on each of the relays so the 24V line needs to be hooked up only once per board. 

To turn on the relays, we again have 30 channels to drive, this time at 5V and very low current. Microcontrollers are capacble of controlling this sort of load, but the non-mega arduinos doen't have enough availible channels to do this. Arduino's are also a bit limited in their web interfacing capabilities (I can't imagine performing web key encryption on one), so we will  need a bit more horsepower in the vending machine anyways. Raspberry Pi's are capable of communicating with perepherals using I2C. I found these I2C expander breakout boards at Sparkfun that are relatively inexpensive and are perfect for this sort of thing. I2C is a digital communication protocol and in this case, the Raspberry Pi sends an address over three wires to the chip on the breakout board and the chip turnes one of the 16 pins on the board on or off. We'll expand on this later.

The relays on the relay board I picked are 12v relays, and although they can be controled with 5v on the control pins, they require 12v DC to trigger the magnetic switch inside. The boards have opto-isolators and transistors inside that handle converting the 5v microcontroller signal into a 12v signal at enough current to drive the magnetic switch. But they we still need separate 12v and 5v DC supplies. Once again, deal extreme sells both of these things (110v AC to 5v DC and 12v DC). I might use a Murata 5V DC converter with the 12v supplier instead of the 5v supply.

To keep all of this stuff organized, I drafted out something is skechup to cut out on a laser cutter. I still have to add the raspberry pi, the power supplies and a few odds and ends on there, but it's getting there.