Coin Acceptor or Coin Sensor Tutorial with Arduino

In this tutorial we will use the cheap Chinese Coin Acceptor GD-100F.

The wiring diagram is like this :

This Coin Acceptor works by compare the coin that already inserted in this sensor (blue color at sensor) with the coin that inserted at the front hole. If the coin is the same, the coin will accepted, but if coin is different, the coin will be rejected.

We will make a sketch that will print Coin Detected when a match coin is inserted.

const int coin = 2;
boolean insert = false;
volatile int pulse = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(2), coinInterrupt, RISING);
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (insert) {
    insert = false;
    Serial.println("coin detected!");
    delay(1000);
  }
}

//interrupt
void coinInterrupt() {
  pulse++ ;
  insert = true;
}

And then we want to make a program that will add balance by 1000 every a match coin is inserted.

const int coin = 2;
boolean insert = false;
volatile int pulse = 0;
unsigned long balance;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  attachInterrupt(digitalPinToInterrupt(2), coinInterrupt, RISING);
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (insert) {
    insert = false;
    //Serial.println("coin detected!");
    balance+=1000;
    Serial.println("Balance : "+(String)balance);
    delay(1000);
  }
}

//interrupt
void coinInterrupt() {
  pulse++ ;
  insert = true;
}

And here’s the complete tutorial on video.

6 Replies to “Coin Acceptor or Coin Sensor Tutorial with Arduino”

  1. Hi brother
    first thank you for this tutorial
    i have 3 days work to app this tutorial but i can not success pls help me
    I bought a coin-acceptor (09 values coins ) and i programmed it for just 06 coins
    coin 01 represent 05 DA —->represent 01 pulse
    coin 02 represent 10 DA —->represent 02 pulses
    coin 03 represent 20 DA —->represent 04 pulses
    coin 04 represent 50 DA —->represent 10 pulses
    coin 05 represent 100 DA —->represent 20 pulses
    coin 06 represent 200 DA —->represent 40 pulses
    i remake your code(sketch) to add the sum of the inserted coins (in the serial monitor ) but it give me random numbers and i dont know where is the problem
    thanks and sorry for this language English .

  2. Hey so I’m just getting into my second project, I’m having trouble finding any info on these coin machines and my lack of experience is showing. Can you please tell me why you need the pull-up 10k resistor on the coin signal cable?

    From what I’ve read, that IOREF port gives a steady 5V+, if the machine runs on 12V, is the resistor because the internal pullup resistor isn’t able to bring the voltage of the coin signal line up to a HIGH signal because it’s 12V not 5V?

    Thanks in advance!!

  3. My coin acceptor doesn’t reject the coin and the coin is stock at the point of transformers and also the coin doesn’t even read to finally indicate that the coin has been accepted

Leave a Reply

Your email address will not be published. Required fields are marked *