The machine has five can trays. Each of which has a 24VAC motor, a switch indicating a full rotation of the motor and a switch indicating the presence of cans.
The 10 switches could just be directly connected to an Arduino. The switches have a common wire, connected to ground. Each of the switches is connected to it's own pin on the Arduino Uno, which uses it's internal pull-up resistors to make a functional circuit.
Driving the motors is a bit harder: the motors use 24 volts, but not DC, which I could easily switch with a mosfet, but AC. I don't have any triacs in my pile of electronics so I chose to use relays to switch the power to the motors.
The Arduino runs a sketch which implements a simple algorithm:
- Move the motor until the limit switch opens - Continue moving the motor until the limit switch closes or until a timeout is reached
Using the technique from the blink without delay example sketch provided with the Arduino software the sketch was implemented in such a way that it can receive commands from the serial interface while also running the statemachines and algorythm for each of the trays, all at the "same" time.
While implementing this sketch I found that the rotation limit switch on one of the trays was not functional. I replaced the microswitch with a new one, but unfortunately I forgot to take pictures (documenting projects is harder than it looks).
The good news is that this explains one of the issues described by the seller, and that the issue is now definitely solved!
Next up is getting the front panel to work and to fix the loud and rattling fan of the refrigerator part.
Day 1: I bought the vending machine, which is a Vendo 75X-5 machine for dispensing 5 kinds of cans from a company in the neigbourhood.
The seller indicated in his ad that there are a number of problems with the machine: - The lock is missing - One of the trays does not work - Display is broken
Upon arriving the seller tried to demo the machine, showing me that the refrigerator part of the machine works. But he could not demo anything else, the electronics seemed dead and not even the TL in the banner on the front worked.
I decided to buy the machine, even with the machine itself completely non-functional.
First things first: I checked the fusebox. One of the fuses seemed broken, bingo! ... or not ... after replacing it still nothing worked. Of course I checked if the new fuse was burned through, but it wasn't.
So... time to check the manual: it contained a full pinout of the controller board. This allowed me to check the supply voltages, which are 24VAC, 26VAC and 9.5VAC. All of the voltages are there, so that shouldn't be the problem.
The next thing I did was checking the voltage the motors work at. This turned out to be 24VAC, just like available on the incoming power supply plug.
After connecting both the common and the wire of the first tray it started turning, vending can after can! Next I of course verified that the motors of all trays, including the broken (?) one functioned. They all work fine.