Controlling a Coin Hopper with Arduino + Code

Sdílet
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;
    }
    }

Komentáře • 78

  • @InsidetheArcade
    @InsidetheArcade Před 3 lety +1

    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 :)

  • @osamasegh8737
    @osamasegh8737 Před 3 lety

    Good Job ...

  • @arduino2000
    @arduino2000 Před 3 lety

    Спасибо. Отличное видео.

  • @smtsoftwaresolutions1966

    New subscriber, Great Video, thanks for sharing. Shane

  • @franzotto448
    @franzotto448 Před 6 lety +1

    gut gemacht, alle Achtung.

  • @ILyman
    @ILyman Před 4 lety

    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

  • @djpaulbailey
    @djpaulbailey Před 3 lety

    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?

  • @carlosenriquevaldes
    @carlosenriquevaldes Před 5 lety +1

    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?

  • @anythingunderthesun9930

    why bytes for the amounttodispense and not just normal integer?

  • @nounonarabara5702
    @nounonarabara5702 Před 4 lety +3

    pls Where to buy the product (the coin hopper)

  • @garydsouza2335
    @garydsouza2335 Před 3 lety

    Hi can you help, NP hopper A3.. not paired ... deal or no deal machine..sch5.... please help

  • @andreasmiller5448
    @andreasmiller5448 Před 4 lety

    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.

    • @riddles8888
      @riddles8888 Před rokem +1

      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.

    • @andreasmiller5448
      @andreasmiller5448 Před rokem

      @@riddles8888 Thank you!

  • @Sharkiuli
    @Sharkiuli Před 4 lety +1

    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

    • @Sharkiuli
      @Sharkiuli Před 4 lety

      nevermind, i'm just STUPID....
      in Serial window select : No line ending

  • @choloviloria5549
    @choloviloria5549 Před 4 lety

    hi sir, can you pls attached LCD.. thank you

  • @WorldwideArcades
    @WorldwideArcades Před 5 lety

    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?

    • @Messa5535
      @Messa5535 Před 4 lety +1

      How did it go?

    • @WorldwideArcades
      @WorldwideArcades Před 4 lety +1

      @@Messa5535 Hi, I have built all of the machinery for it, I've just got to order all the arduino parts.

    • @WorldwideArcades
      @WorldwideArcades Před 4 lety +1

      + 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..!

    • @Wnjshsuwksb7362
      @Wnjshsuwksb7362 Před 4 lety

      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

    • @WorldwideArcades
      @WorldwideArcades Před 4 lety +1

      @@Wnjshsuwksb7362 And..... Ive been busy. A video of what?

  • @singymini9491
    @singymini9491 Před 5 lety

    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!

    • @jpcontrol6759
      @jpcontrol6759  Před 5 lety +1

      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.

    • @singymini9491
      @singymini9491 Před 5 lety

      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.

    • @jpcontrol6759
      @jpcontrol6759  Před 5 lety +1

      Your looking at around £70 each

    • @anthonylucas1415
      @anthonylucas1415 Před 3 lety

      @@jpcontrol6759 do you build mfme emulator

  • @raza0101khulna
    @raza0101khulna Před 18 dny

    Awesome mate. I need little help. Do you have time?

  • @warrenbalona9782
    @warrenbalona9782 Před 4 lety

    hi, can i ask , is there a detector that it will inform you that your coin hopper is low on coins?

    • @cameronmcgehee
      @cameronmcgehee Před 4 lety +1

      Just make it wait for a certain time and if no coins come out declare an error

    • @cameronmcgehee
      @cameronmcgehee Před 4 lety +1

      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.

    • @cameronmcgehee
      @cameronmcgehee Před 4 lety +1

      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.

  • @davejones6313
    @davejones6313 Před 5 lety

    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 ???

    • @jpcontrol6759
      @jpcontrol6759  Před 5 lety

      the hopper is powered from 24 volts off a bench power supply. The GND from the power supply is shared with the Arduino

    • @davejones6313
      @davejones6313 Před 5 lety

      Okay thank you for that.

  • @bomtarat5136
    @bomtarat5136 Před 4 lety

    Sir, bat sakin pag bili ko, d umiikot, tumutunog lang ung motor?

  • @ronaldbaldomarro6841
    @ronaldbaldomarro6841 Před 4 lety

    what kind of arduino youve used for this project

    • @jpcontrol6759
      @jpcontrol6759  Před 4 lety +1

      I used a arduino mega for testing, any arduino with 5v compatability will work.

  • @scorpionsawrus
    @scorpionsawrus Před 4 lety

    How about a coin acceptor a lcd and a coin hopper can you please make a tutorial?

    • @InsidetheArcade
      @InsidetheArcade Před 3 lety

      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

  • @nicolasugrinovic2886
    @nicolasugrinovic2886 Před 4 lety

    Can this have a 1 coin precision? can that be controlled?

    • @jpcontrol6759
      @jpcontrol6759  Před 4 lety +1

      Yes it will eject exactly what you want

    • @nicolasugrinovic2886
      @nicolasugrinovic2886 Před 4 lety

      @@jpcontrol6759 where can I get one of those coin hoppers? Do you have any good store?

    • @jpcontrol6759
      @jpcontrol6759  Před 4 lety

      You might find on ebay or go straight to manufacturer

  • @paulvincent9744
    @paulvincent9744 Před 4 lety

    Can you do a change machine as the code on other places is not good

    • @jpcontrol6759
      @jpcontrol6759  Před 4 lety

      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

  • @little_vampy
    @little_vampy Před 4 lety

    Is it possible to do this with a arduino uno?

    • @InsidetheArcade
      @InsidetheArcade Před 3 lety

      Arduino Mega is basically a bigger version of an UNO. i tried this tonight and it works on an UNO

  • @collarfindermanagementcons4995

    The code doesn't stop. Please help me. Why is it not turning off? The relay module? :O

    • @jpcontrol6759
      @jpcontrol6759  Před 4 lety

      Double check wiring. It means that the pulse are not being counted by the software.

  • @roshininair3092
    @roshininair3092 Před 4 lety

    Hey...I'm completely new to all this. Is this the same as cctalk using Arduino for coin dispensers

    • @InsidetheArcade
      @InsidetheArcade Před 3 lety

      this is different to ccTalk. cctalk sends more information to addresses of peripherals and are daisy chained like a LAN network.

  • @YanneJhen
    @YanneJhen Před 4 lety

    sir i need code for coinchanger ..
    can help me sir ..

    • @InsidetheArcade
      @InsidetheArcade Před 3 lety

      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

  • @ESGPanda
    @ESGPanda Před 5 lety

    Cant make it work Please Help

    • @jpcontrol6759
      @jpcontrol6759  Před 5 lety

      Hello, double check all connections and if possible get hold of a multimeter to do any faultfinding.

    • @ESGPanda
      @ESGPanda Před 5 lety

      When i send from the serial monitor the hopper doesnt stops after the amount of coins fell

    • @jpcontrol6759
      @jpcontrol6759  Před 5 lety

      Does the manual test work when you physically place a coin in the optical sensor and you recieve data on serial port?

    • @ESGPanda
      @ESGPanda Před 5 lety

      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.

    • @jpcontrol6759
      @jpcontrol6759  Před 5 lety

      send me pictures of your setup jpcontrol@outlook.com

  • @javiersandovalvalenzuela6046

    Are you still looking at this comments?

  • @Vikashar
    @Vikashar Před 4 lety +1

    When I saw this video I farted