Snack Vending Machine powered by Arduino Uno

Hello, greetings from Indonesia.
This snack vending machine is my final project. This project was actually finished in end of 2015.

The aim of this project is to create a vending machine, powered by arduino microcontroller, using "any cheap and easy to get" components available in local store.

Goals: The vending machine has to accept certain amount of money (in coin), before let customer choosing their product, and of course delivering product.

So, this is what i did to achieve that goals:

  • First think first, the concept.
    This sketch is my very first idea of what i might build. Its gonna be a snack vending machine.
    Accepting coin as a payment, and using Acrylic case.
  • Then i create solidworks model. And i mean really fully completed model. I need to determine the dimensions of the product, in this case, a snack package. The size of accepted coins, size of push button, the size of rejected coins, size of coin slot, size of coin ramp. This step include Determine, Pick and Measure the size of arduino microcontroller used. What sensor used, where to placed, the dimension and sizes, where accepted coins goes to, i also think about where i sould put a monochrome LCD (its not necessary but i insist). And finally, still in solidworks model creation, dont forget to create holes for screw, for every parts.
    The case are made from Acrylic, and cutted using laser cutting method. Thats why i create model as detailed and accurate as i can.
    Because the more accurate my model, more preccission case i will get.

  • To filtering coins, first i am using coin dimension. By designing slot coin, i managed to determine what coins size are allowed to enter the machine. Then second filter, i determine what coin size are allowed to accepted and rolling down to the coin holder. Because by using gravity force, if coin sizes (diameter) are smaller than the length of coin ramp/track, then it will falling down and rejected.

On the pic above, coin on the left wont enter slot coin.
Coin on the middle will fall and rejected.
Coin on the right is accepted coin, goes down to coin holder.

This is video when i doing some coin testing, it will show you how this method working.
https://www.youtube.com/watch?v=yDRFBDbLNp0

  • Finally, Arduino and friends.

I use:
1 Arduino Uno. (should be use Arduino Mega, more IO)
1 Sensor shield.
3 Infrared (reflective) or line follower sensor, used for product detection.
1 Proximity (electromagnetic) sensor, used for coin sensor number 1.
1 Distance interupter (infrared/optocoupler) sensor for coin sensor number 2.
1 Power Supply 6V for DC motor.
3 DC motors, 6V, complete with the wheels, relay for DC Motor, and stuff, namely LCD (nokia 5110 LCD), LED, Push button, speaker (silent is boring). Note: lots of them are not on the pic

  • Then testing the LCD. Of course testing others too. Push button, relay, LED, just try to combine everything and learn different logic and coding.

  • This is one of the most important part on vending machine, delivering mechanism. i am using spiral mechanism, with alluminium wire (2mm wire diameter), manually shaped into spiral with the help of 9cm diameter PVC Pipe.


Spiral wire are tied to a wheel using cable ties. When DC motor ON, wheel rotating, and spiral wire wil rotate. Rotating spiral are actually converting rotational into linear movement of product.

Finished 3 spiral mechanism

  • This is coin sensor number 1, using proximity sensor, or induction electromagnet sensor.
    When accepted coin pass this sensor, it will trigger arduino to start counting time (in millisecond).


And when accepted coin pass coin sensor number 2, a distance interupter sensor, arduino will stop counting time, and get the time required for that particular coin, to travel from sensor number 1 to sensor number 2.


Using a magnets, attached alongside coin ramp, i can filter between coin that did not affected from magnetic field, and coin that being affected from magnetic field. Coins that affected by magnetic field will rolling down slower (just about 300 to 500 millisecond slower), but than again it depend on how many magnets attached along side coin ramp. Dont use too many magnet as it will jam and make coin stop in the middle of coin ramp. We dont want that to happen, because we need to counting time for every coin, to get "travel times" between sensor number 1 and number 2. This "travel times" (in millisecond), are used for arduino to determine the value of accepted coin.

LOGIC: if "travel times" more than or equal to xxx millisecond, then its yyy coin, else zzz.

This is a video when i testing this method, filtering coins using magnet.
https://www.youtube.com/watch?v=7RXVzYR_HE0

  • I am using 3 infared sensor for product detection when fall from being pushed/moved by spiral mechanism. When product fall, i will trigger sensor, sending OFF signal to DC Motor (via relay).
    So when product falls, spiral mechanism will simply stop rotating.

This video show how product detection working in this vending machine.

  • And LCD will show information (in Indonesian currency) about accepted coin value, how much total balance from accepted coin, and other general instruction about step by step to operate this machine.

  • Finally, finished Snack Vending Machine. After 3 months, or so, i am ready to do some final test to this machine, from payment/coin test, product selection, and product delivery.

This is Snack Vending Machine final test video, BIG thanks to Arduino, and Google.

I hope this project help some of you, maybe give you some inspiration or idea,
about building and creating the next Arduino powered vending machine.

Rooms for improvement:
Add some coin changes mechanism.
Accept paper money, bitcoin, digital payment.
Show product stock on LCD.
Notify via internet/network every time transaction happen.
Notify when product stock empty, and etc.

Beautiful project.

Nice. K+

Good Job