Controlling a Coin Hopper with Arduino + Code
Vložit
- čas přidán 5. 03. 2018
- A video showing the SH-400 coin dispenser and interfaced with Arduino.
Please ask any questions in the comments.
#define sensorPin 3
#define motorPin 2
byte amountToDispense = 0;
volatile byte amountDispensed = 0;
void setup() {
Serial.begin(9600);
attachInterrupt(digitalPinToInterrupt(sensorPin), coinPulse, FALLING);
pinMode(sensorPin, INPUT_PULLUP);
pinMode(motorPin, OUTPUT);
digitalWrite(motorPin, HIGH);
}
void loop() {
if (Serial.available())
{
amountToDispense = Serial.read() - 48;
digitalWrite(motorPin, LOW);
}
}
void coinPulse()
{
++amountDispensed;
if (amountDispensed == amountToDispense)
{
Serial.print("Completed");
digitalWrite(motorPin, HIGH);
amountDispensed = 0;
}
}
You have got some skills there mate. Get more vids on CZcams as your info is Golden. You definitely deserve more views and subs than you've got. Good Job Matey :)
Good Job ...
Спасибо. Отличное видео.
New subscriber, Great Video, thanks for sharing. Shane
gut gemacht, alle Achtung.
HI, can you please make it so when i push a button it dispenses 5 coins or if i push button many times in a row multiples of 5? thanks
Hi I've tried this and everything works apart from the last bit where I want it to dispense a number of coins when I type that number in serial....it doesn't seem to read anything from the sensor pin at that point...any ideas?
Hi, i followed your code but with no success. sometimes the device dispenses less coins. I am assuming there is a faulty or bouncy sensor. how would you implement it on this scenario? iam controlling 3 devices with an arduino pro micro (because of the number of available interrupts), would you say is this a reliable device?
why bytes for the amounttodispense and not just normal integer?
pls Where to buy the product (the coin hopper)
Hi can you help, NP hopper A3.. not paired ... deal or no deal machine..sch5.... please help
Hi jpcontrol, Very nice video! Thank you. I was wondering if you knew the pin assignments of a 4 pin "blue coin hopper?" It is something I just purchased, but there seems to be no documentation on it.
I know this is two years later but I was in the same place trying to find information about this blue coin hopper. For the one I have at least going from left to right
Pin 1: 5v Pin 2: output Pin 3: gnd Pin 4: unused
Pin 2 output
NO(normally open) stays at .13v and goes to 3.7v when a coin passes
NC(normally closed) stays at 2.9v and goes to .01 when a coin passes
Hope this helps someone looking for this info at some point.
@@riddles8888 Thank you!
i have a problem, the motor starts, but doesn't stop, i went through all the steps, if i do it manually with 1 and 2(in serial) it works, but with the final code it doesn't stop the motor(i checked the connections), any help would be appreciated
nevermind, i'm just STUPID....
in Serial window select : No line ending
hi sir, can you pls attached LCD.. thank you
Hi, I have a programme on my laptop that I have made, it is like arcade reels, similar to Bar X. I have got the reels spinning, and it comes up with some winners, like X - X - X or BAR - BAR - BAR, where i want it to dispense 5x 10p coins from a hopper. Do you think there is anyway I could do this?
How did it go?
@@Messa5535 Hi, I have built all of the machinery for it, I've just got to order all the arduino parts.
+ I couldn't find anyone to just check over the code + I got no reply from jp control, as I wanted to know where all of the wires go..!
But its been a year since you posted that comment, anyways.. could you post a video showing the inside? There are no tutorials online that i can find
@@Wnjshsuwksb7362 And..... Ive been busy. A video of what?
Hey! I was just researching into this in order to make a Slot Machine. I was just wondering if you could provide a link to where you bought this? Thanks!
Asahi Seiko is the company who makes them. If you contact their sales team they can provide you with one. They are surprisingly affordable. I recommend purchasing the flying lead connector that goes with them so you can connect to your control system easily.
Wow that was a quick response! I have emailed them. Do you know how much I am looking at (price wise) exactly as I am a teenager looking into this as an electronics project.
Your looking at around £70 each
@@jpcontrol6759 do you build mfme emulator
Awesome mate. I need little help. Do you have time?
hi, can i ask , is there a detector that it will inform you that your coin hopper is low on coins?
Just make it wait for a certain time and if no coins come out declare an error
But unless you made something like a plumbob that moves down and activates a switch when coins reach a low level, there is nothing natively on the hopper that will tell you.
Oh wait actually, you know those little pins on the plastic part? I don't know exactly how to use them, but I know you can send small amounts of current through them to see if coins are still in that area. When the coins get low, it will stop sending a signal. You could fool around with it though.
Interesting information, I'm not really very familiar with Arduino, which I think you said 5 volts, I noticed the Hopper showed 24 volts, am I missing something ???
the hopper is powered from 24 volts off a bench power supply. The GND from the power supply is shared with the Arduino
Okay thank you for that.
Sir, bat sakin pag bili ko, d umiikot, tumutunog lang ung motor?
what kind of arduino youve used for this project
I used a arduino mega for testing, any arduino with 5v compatability will work.
How about a coin acceptor a lcd and a coin hopper can you please make a tutorial?
I will be releasing a video on my channel with build and code for a change machine. i has LCD, coin mech and hopper. its been filmed, just editing now. SUB to get notified when video is live
Can this have a 1 coin precision? can that be controlled?
Yes it will eject exactly what you want
@@jpcontrol6759 where can I get one of those coin hoppers? Do you have any good store?
You might find on ebay or go straight to manufacturer
Can you do a change machine as the code on other places is not good
I did interface coin acceptor with an arduino but not for a coin changer. It will be straight forward to manipulate this code to include a coin acceptor.
www.robotshop.com/uk/programmable-coin-acceptor.html?gclid=Cj0KCQjwh8jrBRDQARIsAH7BsXe2mmbcEIHb_ceKGvnpJEDbcx33s7Uy2H4HP4kzOwyUg6KR_8HYED8aAgcEEALw_wcB
These are perfect
Is it possible to do this with a arduino uno?
Arduino Mega is basically a bigger version of an UNO. i tried this tonight and it works on an UNO
The code doesn't stop. Please help me. Why is it not turning off? The relay module? :O
Double check wiring. It means that the pulse are not being counted by the software.
Hey...I'm completely new to all this. Is this the same as cctalk using Arduino for coin dispensers
this is different to ccTalk. cctalk sends more information to addresses of peripherals and are daisy chained like a LAN network.
sir i need code for coinchanger ..
can help me sir ..
I will be releasing a video on my channel with build and code for a change machine. its been filmed, just editing now. SUB to get notified when video is live
Cant make it work Please Help
Hello, double check all connections and if possible get hold of a multimeter to do any faultfinding.
When i send from the serial monitor the hopper doesnt stops after the amount of coins fell
Does the manual test work when you physically place a coin in the optical sensor and you recieve data on serial port?
It does. And i tried to do it like when i push the button the hopper turns and when i release it stops too. Also, I use a relay module to connect the hopper to the ac.
send me pictures of your setup jpcontrol@outlook.com
Are you still looking at this comments?
What is the problem with your set up?
When I saw this video I farted