Coin acceptor with relay project

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
asuz
Normal user
Posts: 175
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 5938 times
1.jpg
1.jpg (326.8 KiB) Viewed 5938 times

TD-er
Core team member
Posts: 8643
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: 175
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: 8643
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: 175
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 5895 times
page1.jpg
page1.jpg (85.95 KiB) Viewed 5895 times

asuz
Normal user
Posts: 175
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 5892 times

TD-er
Core team member
Posts: 8643
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: 175
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: 175
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 3814 times
ask gif2.gif
ask gif2.gif (4.25 MiB) Viewed 3814 times
ask.jpg
ask.jpg (3.37 MiB) Viewed 3814 times

User avatar
Ath
Normal user
Posts: 3416
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: 175
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: 3416
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: 8643
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: 821
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...

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

Re: Coin acceptor with relay project

#15 Post by asuz » 27 Apr 2023, 14:30

I tried a lot on the project, but I couldn't stop the impact triggering without inserting money. I also changed the money mechanism, I used a different brand of money mechanism, but I couldn't stop the triggering without inserting money. I think it is affected by environmental factors. For example, if a motorbike passes by the box containing this mechanism, triggering starts. If I run the box containing this mechanism next to the microwave oven, triggering occurs every time I turn on the microwave oven. Do you have any ideas on this subject? I really need help? Should I use a metal box instead of plastic?

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

Re: Coin acceptor with relay project

#16 Post by Ath » 27 Apr 2023, 14:42

What value pull-up resistor is installed on GPIO-35?
/Ton (PayPal.me)

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

Re: Coin acceptor with relay project

#17 Post by asuz » 27 Apr 2023, 14:44

Even if the wires of the coin acceptor are not connected to the esp, if I apply the above scenario, a trigger will occur. In other words, if I switch on the microwave when the money mechanism is not connected, a pulse is produced, so I don't think there is a problem with the money mechanisms.

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

Re: Coin acceptor with relay project

#18 Post by asuz » 27 Apr 2023, 14:48

Ath wrote: 27 Apr 2023, 14:42 What value pull-up resistor is installed on GPIO-35?
10K

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

Re: Coin acceptor with relay project

#19 Post by Ath » 27 Apr 2023, 15:07

It still feels like a GND issue, as when you only touch the coin input it will count, suggesting the voltage is changed enough to be detected as a pulse.
Are the GND of the ESP and the GND of the coin mechanism connected to each other?
/Ton (PayPal.me)

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

Re: Coin acceptor with relay project

#20 Post by asuz » 27 Apr 2023, 15:20

Ath wrote: 27 Apr 2023, 15:07 It still feels like a GND issue, as when you only touch the coin input it will count, suggesting the voltage is changed enough to be detected as a pulse.
Are the GND of the ESP and the GND of the coin mechanism connected to each other?
yes I use a dual output (12 volt and 5 volt) common ground power supply

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

Re: Coin acceptor with relay project

#21 Post by chromo23 » 27 Apr 2023, 16:28

asuz wrote: 27 Apr 2023, 14:44 Even if the wires of the coin acceptor are not connected to the esp, if I apply the above scenario, a trigger will occur.
chromo23 wrote: 18 Mar 2023, 11:20 than probably the coin module is broken / has issues...
You could take a closer look at the circuit board of the device.
Sometimes components in these cheap devices have slipped while soldering or a cold solder joint could be the cause.

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

Re: Coin acceptor with relay project

#22 Post by asuz » 27 Apr 2023, 17:53

As seen in the photo I attached, the coin acceptor is not connected to the esp. When I press the trigger of the soldering gun next to the esp, the esp is triggered. I am about to go crazy.
Attachments
20230427_184521.jpg
20230427_184521.jpg (4.52 MiB) Viewed 3425 times

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

Re: Coin acceptor with relay project

#23 Post by Ath » 27 Apr 2023, 18:52

Does that still happen if you unplug the white wire from the ESP? Because currently it acts as a nice antenna...
/Ton (PayPal.me)

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

Re: Coin acceptor with relay project

#24 Post by chromo23 » 27 Apr 2023, 19:02

asuz wrote: 27 Apr 2023, 17:53 the esp is triggered
Oh, so i misunderstood. I thought the coin acceptor is triggering....

But actually my answer could also fit to the esp... :)
Do you only have one esp to test? :shock:

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

Re: Coin acceptor with relay project

#25 Post by TD-er » 27 Apr 2023, 22:52

Very simple method is adding some small capacitor over the input pin and the GND (or 3V3)
It takes time and energy to charge (or discharge) this capacitor, so short spikes will not switch the logic level.

You may need some experimenting to find the right capacitance, but a very standard value is 100 nF.

If you need a higher capacitance, you may want to add a resistor in series to limit the current through this capacitor when charging/discharging.

Also if you need long wires, you may want to twist them with GND to make sure they don't act as an antenna.

It is good practice to always have them at a well defined state when a contact is "open".
For example pull the pin to "high" using some 10k resistor when there is a switch that will connect to GND.
Maybe also have some high resistance resistor over the switch itself to make sure there is always some minimal current flowing through the wires. This way external noise needs more energy to switch the logic state.

For example 4k7 pull up resistor and 47k over the switch.

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

Re: Coin acceptor with relay project

#26 Post by asuz » 28 Apr 2023, 21:10

I give up. many resistors, capacitors, short cables, twisted cables, etc... after trying, I could not prevent it from triggering on its own. I only had the idea of a metal box, I did not try it, but I decided to follow the path that someone more experienced than me in these matters tried and succeeded. I spent a lot of time but it didn't work. A friend here has an oscilloscope, I took the circuit to him and measured it and he said there was a lot of noise from esp. The supply circuits were clean, maybe there was noise in the smps supply circuit, I even connected a transformer supply, but it still didn't work.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 13 guests