Coin acceptor with relay project

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Coin acceptor with relay project

#1 Post by asuz » 17 Aug 2022, 22:24

Hello to all, I decided to make a coin acceptor relay board with nodemcu with your helps. I have a cheap chinese coin acceptor mechanism. There are Ground, coin and dc+12 pinout at hte coin mechanism. Which pins should I use at the nodemcu? Later I will connect an LCD to the nodemcu.
Attachments
2.jpg
2.jpg (115.64 KiB) Viewed 2257 times
1.jpg
1.jpg (326.8 KiB) Viewed 2257 times

TD-er
Core team member
Posts: 7502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Coin acceptor with relay project

#2 Post by TD-er » 17 Aug 2022, 22:37

What voltage is there at the "coin" pin?
Or is it a mechanical switch and if so, will it connect to GND or +12V?

asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Re: Coin acceptor with relay project

#3 Post by asuz » 17 Aug 2022, 23:07

TD-er wrote: 17 Aug 2022, 22:37 What voltage is there at the "coin" pin?
Or is it a mechanical switch and if so, will it connect to GND or +12V?
Sorry I am not familiar with that mechanism but can you look at that page "https://miliohm.com/coin-acceptor-or-co ... h-arduino/" and help me. Somebody make it with arduino.

TD-er
Core team member
Posts: 7502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Coin acceptor with relay project

#4 Post by TD-er » 17 Aug 2022, 23:25

OK, that's very simple indeed.

Image

You simply add some pull-up resistor between 3V3 and the "coin" pin.
The "coin" pin should then be connected to a GPIO pin on the ESP.
Please consult these tables to pick the right GPIO pin: https://espeasy.readthedocs.io/en/lates ... on-esp8266

Then connect the ESP ground to the ground of the coin acceptor.

Just make sure both are powered via either the same power supply (and thus have a voltage regulator from 12V to what is needed for the ESP) or 2 separate power supplies which can share a common ground.
In other words, if you join both grounds, nothing should start to smoke ;)


For the chosen GPIO pin, you must then add a pulse-counter task in ESPEasy.
I think you may also need to set some "debounce time", like 100 msec.
Set the trigger to "rising" in the pulse counter task.

asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Re: Coin acceptor with relay project

#5 Post by asuz » 18 Aug 2022, 20:51

TD-er wrote: 17 Aug 2022, 23:25 OK, that's very simple indeed.

Image

You simply add some pull-up resistor between 3V3 and the "coin" pin.
The "coin" pin should then be connected to a GPIO pin on the ESP.
Please consult these tables to pick the right GPIO pin: https://espeasy.readthedocs.io/en/lates ... on-esp8266

Then connect the ESP ground to the ground of the coin acceptor.

Just make sure both are powered via either the same power supply (and thus have a voltage regulator from 12V to what is needed for the ESP) or 2 separate power supplies which can share a common ground.
In other words, if you join both grounds, nothing should start to smoke ;)


For the chosen GPIO pin, you must then add a pulse-counter task in ESPEasy.
I think you may also need to set some "debounce time", like 100 msec.
Set the trigger to "rising" in the pulse counter task.
Thank you very much.
Attachments
page2.png
page2.png (48.74 KiB) Viewed 2214 times
page1.jpg
page1.jpg (85.95 KiB) Viewed 2214 times

asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Re: Coin acceptor with relay project

#6 Post by asuz » 18 Aug 2022, 21:15

I want to coin activated relay. Here is my project. LCD's first row type "please insert 3 coin" then if somebody insert 3 coin LCD's same (or second) row type "please push green button to start" then if green push button is pressed relay activated for 300 second by the way same (or third) row types "until finish ...... (countdown second)second remains. After 300 second later relay will off. At fourth row will type "push red button whenever to stop". Can you help me for coding it?
Attachments
project.jpg
project.jpg (83.62 KiB) Viewed 2211 times

TD-er
Core team member
Posts: 7502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Coin acceptor with relay project

#7 Post by TD-er » 18 Aug 2022, 21:40

Maybe others can help you first here as right now I'm working hard on other issues regarding ESP32 issues regarding the flash and sending data via HTTP (2 separate issues)

asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Re: Coin acceptor with relay project

#8 Post by asuz » 18 Aug 2022, 21:42

TD-er wrote: 18 Aug 2022, 21:40 Maybe others can help you first here as right now I'm working hard on other issues regarding ESP32 issues regarding the flash and sending data via HTTP (2 separate issues)
Thank you, I hope somebody help me

asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Re: Coin acceptor with relay project

#9 Post by asuz » 17 Mar 2023, 16:25

It is been long to activate my coin acceptor with relay project. I have a big issue at the Pulse counter. As I attach the video, when I just touch the coin acceptor with coin, the pulse counter start to count without insert the coin. Please see the video and see what I mean. How can solve that issue?
Attachments
ask1.png
ask1.png (52.07 KiB) Viewed 133 times
ask gif2.gif
ask gif2.gif (4.25 MiB) Viewed 133 times
ask.jpg
ask.jpg (3.37 MiB) Viewed 133 times

User avatar
Ath
Normal user
Posts: 2540
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Coin acceptor with relay project

#10 Post by Ath » 17 Mar 2023, 16:58

Check your wiring, and GND to earth connection, as you seem to be injecting some external interference.

Have you tried increasing the Debounce-time to a larger number? 200 mSec seems more appropriate to me.

And adding a small capacitor across the pulse-counter input and GND, close to the ESP, might also help suppressing the interference.
/Ton (PayPal.me)

asuz
Normal user
Posts: 166
Joined: 31 Oct 2018, 18:22

Re: Coin acceptor with relay project

#11 Post by asuz » 17 Mar 2023, 17:30

Ath wrote: 17 Mar 2023, 16:58 Check your wiring, and GND to earth connection, as you seem to be injecting some external interference.

Have you tried increasing the Debounce-time to a larger number? 200 mSec seems more appropriate to me.

And adding a small capacitor across the pulse-counter input and GND, close to the ESP, might also help suppressing the interference.
incereasing debounce time not help to me, please sugget me the capacitor value to add ?

User avatar
Ath
Normal user
Posts: 2540
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Coin acceptor with relay project

#12 Post by Ath » 17 Mar 2023, 19:00

That capacitor couls be around 100 nF, I think.
/Ton (PayPal.me)

TD-er
Core team member
Posts: 7502
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Coin acceptor with relay project

#13 Post by TD-er » 17 Mar 2023, 23:14

You can compute the rise/fall time of the signal for a capacitor + resistor.

For example: https://www.digikey.nl/en/resources/con ... e-constant

The RC time should roughly be 10 msec...
So 10 uF and 1k resistor... or 100 nF and 100k resistor should be fine.

User avatar
chromo23
Normal user
Posts: 643
Joined: 10 Sep 2020, 16:02
Location: germany

Re: Coin acceptor with relay project

#14 Post by chromo23 » 18 Mar 2023, 11:20

asuz wrote: 17 Mar 2023, 16:25 As I attach the video, when I just touch the coin acceptor with coin, the pulse counter start to count without insert the coin.
Does this also happen when only the coin module is connected and you measure the output with a multimeter for example?
If it produce the same results, than probably the coin module is broken / has issues...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest