Close

Day 2: figuring out how the machine works

A project log for Restoration of a vending machine for cans

This project is about a vending machine I bought.

renze-nicolaiRenze Nicolai 05/23/2019 at 19:380 Comments

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.

Discussions