Controlling a vending machine with an Arduino

Discussion in 'Embedded Systems and Microcontrollers' started by Sandahl, Jun 6, 2016.

  1. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    Hey guys.
    I am currently rebuilding an vending machine in order to control it with an Arduino.
    The vending machine i am using is the FAS Spirali, similar to the one below. [​IMG]
    It is a spiral style vending machine controlled by a series of dc motor connected to spirals for dispensing. The motor are similar to these: http://www.amazon.com/Molon-CJM-2407-122X-Gear-Motor-Volt/dp/B00WO6M2EA. However they also include what i assume is a sensor for controlling the rotation. I have attached a picture of the motor including a small circuit board and the aforementioned sensor. The only wires running to the DC motor are power and ground.
    My question is can any of you tell me how to control these, and what role does the small rotation sensor play?

    N.B I have included the full schematic.
     
  2. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
  3. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,771
    971
    Just need to read the switch on an input and apply power to the motor as needed..
    You start the motor.. the switch will then be depressed and you stop the motor as soon as the switch is not depressed anymore..
     
  4. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    The motor board only has two wires.
    [​IMG]
    I tried to draw out the diagram here:
    [​IMG]
     
  5. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,149
    205
  6. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    Your right D2 is reversed. But the motor i powered regardless of the switch state.

    The link you included is for a circular connector not a motor.
     
  7. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,149
    205
    Here's https://des.az.gov/sites/default/files/media/national_780_cold_food_operators_manual.pdf a similar machine. No schematics. More wires on the motor.

    In your case, I would sort of, expect one good motor controller that keeps an eye on current and dynamically brakes the motor when the current stops briefly. It would keep track of the time it takes to rotate for jamming purposes.

    It would use a matrix or linear switching scheme to select the motor.

    In the schematic you posted, in one case the motor would drive and in the other, the leads would short which, I think would be bad for the switch. That's why I think one of the diodes is reversed.

    The 680 resistor or maybe smaller, would provide some braking and some noise suppression.
     
  8. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,149
    205
    If you monitored the current, I'll bet it will drop for a short time during rotation. That's your cue to stop the motor.
     
  9. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    Thanks!
    Can you give any pointers towards how to monitor current with the arduino?
     
  10. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,149
    205
    First, take a suitable resistor and look at the voltage across it with a scope to see if the assumption is correct.
    The 680 ohm resistor can also be used to determine if a motor is present in the position. e.g. attempt to move (timeout) and test for current from 680 ohms.

    Then look here https://www.pololu.com/category/11/brushed-dc-motor-drivers for some ideas.

    There are some high side IC's used for current monitoring which is also an option especially if you don't have to brake.

    This https://www.canakit.com/dual-motor-l298-h-bridge-control-ck1122-uk1122.html is a motor driver on the cheaper side that has resistors for current monitoring.

    The better motor drivers will allow fwd, rev, brake and coast.

    DC motors tend to overrun, so if you operate them into a load or a short, the DC motor now coasting and operating as a DC generator stops faster. I think the 680 ohm resistor just makes it stop faster.

    Here's a blurb on high side current sensing: http://www.analog.com/library/analogDialogue/archives/44-12/high_side.html
     
  11. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    Thanks a bunch!
    I will order the components and update when i get the solution implemented!
     
  12. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,149
    205
    Cool.

    In the long run, you may be able to combine high and low side drivers in a matrix with one high side current sense. The high side drivers could be relays or specific high side driver chips. The low side drivers could be specific low side driver chips, MOSFETs or Ultra-reliable transistors (e.g. LM395).

    Relay selection would have to be done carefully. Matrix based on expense. There are usually more columns than rows. Don't forget that some vending machines have the possibility to have double slots. e.g. Potato chips an candy bars. I haven't seen gum in a vending machine for quite a while. They used to have separate compartments.
     
  13. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    Yeah i thought about that.
    But i think i will just drive the motors from the stackable motorshields from adafruit. I have 18 spirals so i can do it with 5 shields. I think that will save me a bunch of headache in the long run.
     
  14. Sandahl

    Thread Starter New Member

    Jun 6, 2016
    11
    0
    Update:
    It worked! Each flick of the switch generates a drop in current i was able to measure using the INA219 Current sensor from adafruit.
    The rest should be somewhat straight forward i just wanted to update the thread in case someone needs the information for later reference.
     
  15. KeepItSimpleStupid

    Well-Known Member

    Mar 4, 2014
    1,149
    205
    Cool! Thanks.
     
Loading...