Coin Acceptor not receiving any pulses [solved]

Hi, currently i'm using an ALLAN coin acceptor connected to my MEGA 2560 With WiFi Built-in - ESP8266, i have tried to follow the following tutorials on youtube:

however when i tried running their code, and did the wirings right for the coin acceptor, no pulse was shown on the arduino. I tried running it on a spare uno, but it still wont show any pulses.

Code i am currently using (provided in one of the tutorials):

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

#define coinslot 6

int coinslotstats;
int pulse;

void setup()
{
   lcd.init();
   lcd.begin(16,2);
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.backlight();
   pinMode(coinslot, INPUT_PULLUP);
   lcd.print("hello world");
   delay(2000);
   lcd.clear();
}

void loop()
{
 coinslotstats = digitalRead(coinslot);
 lcd.setCursor(0, 0);
 lcd.print(coinslotstats);
 delay(35);
}

show your exact circuit (not the one from the video - draw the one you currently have and mention power lines and components )

it looks like you did not join the GND of the Arduino with the GND of the coin acceptor.
That's likely needed.

1 Like

Hello markyrider,

I can see that you are powering the coin acceptor from a power supply that is out of the picture.
You need to have a connection between the Arduino GND and the coin acceptor GND.
Without that connection, the Arduino input has no reference to determine whether the input is high or low.

Also that code is poor.
The output of the coin acceptor is a series of pulses, whose width can be set to one of three widths using the Fast/Medium/Slow slide switch on the coin acceptor.

The code just reads the state of the coin acceptor output, and displays a 1 or 0 on the LCD.
After a delay of 35ms it will test the output of the coin acceptor again and display the result.

With the combination of that delay and the pulse width, the code might or might not accurately capture all the pulses from the coin acceptor.

All you are going to see on the LCD is a a number that flickers between 1 and 0.

Better code would use the techniques shown in the Arduino IDE example "StateChangeDetection" to count the pulses, and display the total.

1 Like

Ok, thanks for informing me. It works for me now

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.