Coin Op Personal Vending Machine

A step by step guide to building a fully functioning, personal vending machine that will amaze everyone who sees it.

Feb 8, 2019

33598 views

29 respects

Components and supplies

1

Breadboard (generic)

1

Flat metal shelf divider

1

HiLetgo 2pcs 1602 Serial LCD Module Display

1

Pc Accessories - Connectors Pro IDC 1.27mm Pitch Rainbow Color Flat Ribbon Cable for 2.54mm Connectors (50P-10FT)

1

Glarks 635Pcs Dupont Connector Housing Male/Female Pin Connector 40 Pin

1

Tolako 5v Relay Module for Arduino ARM

1

LAFVIN 5 Sets 28BYJ-48 ULN2003 5V Stepper Motor + ULN2003 Driver Board for Arduino

4

1/4 Plywood

1

50 ft. 8-Gauge Solid SD Bare Copper Grounding Wire

2

LED Light Strips

1

30 Pcs Double Sided PCB Board Prototype Kit

1

3/4" plywood blocking

1

Gamelec-Illuminated-Replacement-Microswitch

1

Arduino Mega 2560

Tools and machines

1

Hot glue gun (generic)

1

Soldering iron (generic)

1

Table or power saw

Apps and platforms

1

Arduino IDE

Project description

Code

Vending Machine - WITH CHANGING LED LIGHTS

csharp

Take a look at the video!

Vending Machine - WITHOUT CHANGING LED LIGHTS

arduino

Everything you need to complete and understand the project

Coin Acceptor and complete copde

csharp

Complete code

Vending Machine - WITHOUT CHANGING LED LIGHTS

arduino

Everything you need to complete and understand the project

Vending Machine - WITH CHANGING LED LIGHTS

csharp

Take a look at the video!

Downloadable files

Wire Diagram

This is a complete Diagram of the system. It includes, ATX power supply, motors,LCD,LEDs, lights and controller

Wire Diagram

Wire Diagram

This is a complete Diagram of the system. It includes, ATX power supply, motors,LCD,LEDs, lights and controller

Wire Diagram

Comments

Only logged in users can leave comments

hibah110

2 years ago

hi there, do you have a wiring diagram on how to add the coin accepter?

Anonymous user

2 years ago

I am working on a vendor that uses a coil like yours. However I am relay driving a dc motor that has a rotation detect position no/nc switch. I like you project.

comptek4

2 years ago

Can not wait to see what you build. Make sure the DC motors you are using are not just direction detection but position detection also. The coil will need to start and finish in the same exact spot each time to ensure that it does not over or under rotate. Good luck

Anonymous user

2 years ago

Hi! comptek4 I study in your project for make project to school but I found the problem my lcd not have anything on it, it only have vertical straight line 11 line at the left side. I use arduino mega 2560 with coinaccepter and without led light. Thank!

comptek4

2 years ago

If you are still interested please let me know and I can assist.

comptek4

2 years ago

New coin mech was added. Still working out controls but should have updated this week.

comptek4

2 years ago

Coin Op complete. Works perfectly without a problem. System counts to $1 US before adding credit to stop the loop. Once a button is pushed the LEDs light in the color of the button and the item is dispensed. System clears credit and sets up for next count. Hope I have provided you with a quality project

seeyoutira

2 years ago

Great! Really liked it! I am working on a vending machine for fun but the coin acceptor doesn't read the actual value of the coin...for example, if I inserted a us quarter, the lcd will show 3.6 dollars instead of .25... do you know why?

comptek4

2 years ago

Sorry for the delayed response. This would be due to the number of pulses you are receiving from the coinop matched with the value of each pulse. These two variables would account for the total. Share your code with me and I can assist. Based on some possibilities it appears that each pulse is worth: 5 pules = .72 per pulse 6 pules = .60 per pulse 10 pules = .36 per pulse

comptek4

2 years ago

Share what you think about the project. Let me know what questions you have or if you have a change or advancement please share. Thank you for taking the time to evaluate my project - COMPTEK4

x_arduino_x

2 years ago

Maybe add a coin detector (with photointerrupter?) that detects quarters.

comptek4

2 years ago

This is a great idea. I have been searching for a coin acceptor to add a proper counter to the system. This was the last one I checked out but haven't made a purchase yet. https://www.amazon.com/BLEE-Different-Selector-Acceptor-Coin-Operated/dp/B07FYDPFGK/ref=sr_1_2?keywords=coin+acceptor&qid=1551578980&s=gateway&sr=8-2

Anonymous user

2 years ago

Great Project Comptek! The last few nights I have been working on porting a stripped down version of your project to run on an Esp32, the plan is to have this microcontroller be able to independently set 2 different relays to High for a set time before setting the selected relay back to Low. luckily I'm not running any servos so I was able to remove that library & a lot of the code related to servos, I also changed lcd.prints to Serial.prints but I've run into a wall & I could use some help figuring this out. With serial monitor turned on all I can see it do is provide me with a coin count & credit earned count "0 Coin Count, & 1 credit earned" but that just matches what was established in Ints, & it does not refresh so I can't tell if it reads my coinpin at all (currently I'm just using a Momentary switch to ground) but the ledpin which is gpio2 does not light up when the switch is pressed. I have experimented with using INPUT as well as INPUT_PULLUP to no avail for the coinpin & button1pin in terms of connectivity differences I'm using all digital pins & my buttons are going to ground which seems to work fine in other sketches. "#include <arduino.h> // Relay Setup #define WR 18 #define DR 19 // Constants const int coinpin = 23; const int ledpin = 2; const int targetcents = 200; // Variables volatile int cents = 0; int credits = 1; //define buttons pin ports const int button1Pin = 5; // Push Button 1 Analog Pin A0 const int button2Pin = 13; // Push Button 2 Analog Pin A1 const int button3Pin = 12; // Push Button 3 Analog Pin A2 void myInter(); void setup() { // Assign interupt to Pin and condition attachInterrupt(digitalPinToInterrupt(coinpin), coinInterrupt, RISING); // Assign Push Button Pin input: pinMode(button1Pin, INPUT_PULLUP); pinMode(button2Pin, INPUT); pinMode(button3Pin, INPUT); pinMode(coinpin, INPUT_PULLUP); pinMode(ledpin, OUTPUT); // Assign relay pin output pinMode(WR, OUTPUT); pinMode(DR, OUTPUT); } void loop() { // If we've hit our target amount of coins, increment our credits and reset the cents counter if (cents >= targetcents) { credits = credits + 1; cents = cents - targetcents; } // If we haven't reached our target, keep waiting... else { } // Debugging zone Serial.begin(115200); Serial.print(cents); Serial.print(" Coin Count, & "); Serial.print(credits); Serial.print(" credit earned"); delay(1000); // Now, write your own code here that triggers an event when the player has credits! if (credits > 0) { // read button assignment int button1State, button2State, button3State; button1State = digitalRead(button1Pin); button2State = digitalRead(button2Pin); button3State = digitalRead(button3Pin); // digitalWrite(WR, HIGH);// Set state // for (i = 0; i < 5; i++); // define action when button 1 is pressed if (((button1State == RISING) && !(button2State == RISING)))// if we're pushing button 1 OR button 2 { digitalWrite(WR, HIGH); //engage relay // digitalWrite(WR, LOW); Serial.println("Dispensing"); delay(500); digitalWrite(WR, LOW; //disengage relay // digitalWrite(WR, LOW); credits = credits - 1; cents = cents - cents; } } } // Coin Increase loop void coinInterrupt() { // Each time a pulse is sent from the coin acceptor, interrupt main loop to add 5 cent and flip on the LED cents = cents + 5; digitalWrite(ledpin, HIGH); }" I'd appreciate any help you can provide.

comptek4

2 years ago

Did you get this to work? Still willing to help!

Anonymous user

2 years ago

Hello ! your project is very cool ! But i have some questions : whats the measure of the holes at the front ? Thank you from France :)

comptek4

2 years ago

The buttonholes are 3/4" and the glass is 8" x 12". the coin acceptor would be custom cut to the unit you are using so the bolt holes lineup with enough material to make it secure.

Anonymous user

2 years ago

and what should I change to have my coin detector in euro ?

comptek4

2 years ago

Depends on the coin detector but in most cases, it is about how much each pulse is worth. In my case, each pule is worth .5 of a credit as seen at the bottom of the code. If the coin acceptor needs to be worth .05, .1, or .25 per pule you can control that so whatever type of currency it will equal out to 1 credit. Most coin acceptors are learning so you can teach it each type of coin being inserted so the number of pules matches its worth. Hope that helps

Anonymous user

2 years ago

This is a well done project! I am currently using this design for my highschool capstone project and so far so good! Thank-you for putting in so much effort in simplifying and the extra details!

comptek4

2 years ago

How did your project work out? Please post your comments on the process and how well it worked or not and if needed what issues did you run into. Thank you! Comptek4

Anonymous user

2 years ago

How to configure coin acceptor for indian rupees ? Please tell me ...

comptek4

2 years ago

I can help, I should have responded earlier but I am here to help. Let me know if you still need it.

Anonymous user

2 years ago

i am making the same project but i am having trouble regarding coins acceptor... i want my coin acceptor to accept coins after i push a button... when the button is not triggered the coin acceptor will reject the coin inserted. can you please help me out on how to make it work? thank you so much..

comptek4

2 years ago

Did you get it figured out or would you still like some help?

comptek4

2 years ago

I can help with this, can you explain further on the goal you are looking to achieve? I am not sure I completely understand. Comptek4

Anonymous user

2 years ago

Hi, this is a really cool project. Don't know if you will read this or not but hopefully, you will be able to help me.

comptek4

2 years ago

I can help, what would you like help with?

Anonymous user

2 years ago

Thanks for the reply. I don't know why we need an L293D chip because it seems like we can just control the relay directly using the signal pin. (adjust the output of socket 10) or we can just use L293D and control pin 1.

Anonymous user

3 years ago

Hi, this is a really cool project. Don't know if you will read this or not but hopefully, you will be able to help me.

Anonymous user

2 years ago

Thanks for the reply. I don't know why we need an L293D chip because it seems like we can just control the relay directly using the signal pin. (adjust the output of socket 10) or we can just use L293D and control pin 1.

comptek4

2 years ago

I can help, what would you like help with?

Anonymous user

3 years ago

Hi! comptek4 I study in your project for make project to school but I found the problem my lcd not have anything on it, it only have vertical straight line 11 line at the left side. I use arduino mega 2560 with coinaccepter and without led light. Thank!

comptek4

2 years ago

If you are still interested please let me know and I can assist.

justaprogrammerforfun

4 years ago

Great Project Comptek! The last few nights I have been working on porting a stripped down version of your project to run on an Esp32, the plan is to have this microcontroller be able to independently set 2 different relays to High for a set time before setting the selected relay back to Low. luckily I'm not running any servos so I was able to remove that library & a lot of the code related to servos, I also changed lcd.prints to Serial.prints but I've run into a wall & I could use some help figuring this out. With serial monitor turned on all I can see it do is provide me with a coin count & credit earned count "0 Coin Count, & 1 credit earned" but that just matches what was established in Ints, & it does not refresh so I can't tell if it reads my coinpin at all (currently I'm just using a Momentary switch to ground) but the ledpin which is gpio2 does not light up when the switch is pressed. I have experimented with using INPUT as well as INPUT_PULLUP to no avail for the coinpin & button1pin in terms of connectivity differences I'm using all digital pins & my buttons are going to ground which seems to work fine in other sketches. "#include <arduino.h> // Relay Setup #define WR 18 #define DR 19 // Constants const int coinpin = 23; const int ledpin = 2; const int targetcents = 200; // Variables volatile int cents = 0; int credits = 1; //define buttons pin ports const int button1Pin = 5; // Push Button 1 Analog Pin A0 const int button2Pin = 13; // Push Button 2 Analog Pin A1 const int button3Pin = 12; // Push Button 3 Analog Pin A2 void myInter(); void setup() { // Assign interupt to Pin and condition attachInterrupt(digitalPinToInterrupt(coinpin), coinInterrupt, RISING); // Assign Push Button Pin input: pinMode(button1Pin, INPUT_PULLUP); pinMode(button2Pin, INPUT); pinMode(button3Pin, INPUT); pinMode(coinpin, INPUT_PULLUP); pinMode(ledpin, OUTPUT); // Assign relay pin output pinMode(WR, OUTPUT); pinMode(DR, OUTPUT); } void loop() { // If we've hit our target amount of coins, increment our credits and reset the cents counter if (cents >= targetcents) { credits = credits + 1; cents = cents - targetcents; } // If we haven't reached our target, keep waiting... else { } // Debugging zone Serial.begin(115200); Serial.print(cents); Serial.print(" Coin Count, & "); Serial.print(credits); Serial.print(" credit earned"); delay(1000); // Now, write your own code here that triggers an event when the player has credits! if (credits > 0) { // read button assignment int button1State, button2State, button3State; button1State = digitalRead(button1Pin); button2State = digitalRead(button2Pin); button3State = digitalRead(button3Pin); // digitalWrite(WR, HIGH);// Set state // for (i = 0; i < 5; i++); // define action when button 1 is pressed if (((button1State == RISING) && !(button2State == RISING)))// if we're pushing button 1 OR button 2 { digitalWrite(WR, HIGH); //engage relay // digitalWrite(WR, LOW); Serial.println("Dispensing"); delay(500); digitalWrite(WR, LOW; //disengage relay // digitalWrite(WR, LOW); credits = credits - 1; cents = cents - cents; } } } // Coin Increase loop void coinInterrupt() { // Each time a pulse is sent from the coin acceptor, interrupt main loop to add 5 cent and flip on the LED cents = cents + 5; digitalWrite(ledpin, HIGH); }" I'd appreciate any help you can provide.

comptek4

2 years ago

Did you get this to work? Still willing to help!

comptek4

2 years ago

Hello and thank you for the contact. I would happy to assist with this. Let start by verifying your board and board type. Then showing a diagram of your wiring so we can determine if there is an issue. Also include pics of the connections. I am reviewing your code and will mount it to one of my boards to verify functionality and recommendations.

Anonymous user

4 years ago

i am making the same project but i am having trouble regarding coins acceptor... i want my coin acceptor to accept coins after i push a button... when the button is not triggered the coin acceptor will reject the coin inserted. can you please help me out on how to make it work? thank you so much..

comptek4

2 years ago

Did you get it figured out or would you still like some help?

comptek4

2 years ago

I can help with this, can you explain further on the goal you are looking to achieve? I am not sure I completely understand. Comptek4

maurice_bosch

5 years ago

This is a well done project! I am currently using this design for my highschool capstone project and so far so good! Thank-you for putting in so much effort in simplifying and the extra details!

comptek4

2 years ago

How did your project work out? Please post your comments on the process and how well it worked or not and if needed what issues did you run into. Thank you! Comptek4

Anonymous user

5 years ago

How to configure coin acceptor for indian rupees ? Please tell me ...

comptek4

2 years ago

I can help, I should have responded earlier but I am here to help. Let me know if you still need it.

iZenko

6 years ago

and what should I change to have my coin detector in euro ?

comptek4

2 years ago

Depends on the coin detector but in most cases, it is about how much each pulse is worth. In my case, each pule is worth .5 of a credit as seen at the bottom of the code. If the coin acceptor needs to be worth .05, .1, or .25 per pule you can control that so whatever type of currency it will equal out to 1 credit. Most coin acceptors are learning so you can teach it each type of coin being inserted so the number of pules matches its worth. Hope that helps

iZenko

6 years ago

Hello ! your project is very cool ! But i have some questions : whats the measure of the holes at the front ? Thank you from France :)

comptek4

2 years ago

The buttonholes are 3/4" and the glass is 8" x 12". the coin acceptor would be custom cut to the unit you are using so the bolt holes lineup with enough material to make it secure.

comptek4

6 years ago

Coin Op complete. Works perfectly without a problem. System counts to $1 US before adding credit to stop the loop. Once a button is pushed the LEDs light in the color of the button and the item is dispensed. System clears credit and sets up for next count. Hope I have provided you with a quality project

comptek4

2 years ago

Sorry for the delayed response. This would be due to the number of pulses you are receiving from the coinop matched with the value of each pulse. These two variables would account for the total. Share your code with me and I can assist. Based on some possibilities it appears that each pulse is worth: 5 pules = .72 per pulse 6 pules = .60 per pulse 10 pules = .36 per pulse

Anonymous user

2 years ago

Great! Really liked it! I am working on a vending machine for fun but the coin acceptor doesn't read the actual value of the coin...for example, if I inserted a us quarter, the lcd will show 3.6 dollars instead of .25... do you know why?

comptek4

6 years ago

New coin mech was added. Still working out controls but should have updated this week.

Anonymous user

6 years ago

I am working on a vendor that uses a coil like yours. However I am relay driving a dc motor that has a rotation detect position no/nc switch. I like you project.

comptek4

2 years ago

Can not wait to see what you build. Make sure the DC motors you are using are not just direction detection but position detection also. The coil will need to start and finish in the same exact spot each time to ensure that it does not over or under rotate. Good luck

x_arduino_x

6 years ago

Maybe add a coin detector (with photointerrupter?) that detects quarters.

comptek4

2 years ago

This is a great idea. I have been searching for a coin acceptor to add a proper counter to the system. This was the last one I checked out but haven't made a purchase yet. https://www.amazon.com/BLEE-Different-Selector-Acceptor-Coin-Operated/dp/B07FYDPFGK/ref=sr_1_2?keywords=coin+acceptor&qid=1551578980&s=gateway&sr=8-2

comptek4

6 years ago

Share what you think about the project. Let me know what questions you have or if you have a change or advancement please share. Thank you for taking the time to evaluate my project - COMPTEK4