Coin acceptor with relay project
Moderators: grovkillen, Stuntteam, TD-er
Coin acceptor with relay project
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 (115.64 KiB) Viewed 12159 times
-
- 1.jpg (326.8 KiB) Viewed 12159 times
Re: Coin acceptor with relay project
What voltage is there at the "coin" pin?
Or is it a mechanical switch and if so, will it connect to GND or +12V?
Or is it a mechanical switch and if so, will it connect to GND or +12V?
Re: Coin acceptor with relay project
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.
Re: Coin acceptor with relay project
OK, that's very simple indeed.

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.

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.
Re: Coin acceptor with relay project
Thank you very much.TD-er wrote: ↑17 Aug 2022, 23:25 OK, that's very simple indeed.
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.
- Attachments
-
- page2.png (48.74 KiB) Viewed 12116 times
-
- page1.jpg (85.95 KiB) Viewed 12116 times
Re: Coin acceptor with relay project
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 (83.62 KiB) Viewed 12113 times
Re: Coin acceptor with relay project
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)
Re: Coin acceptor with relay project
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 (52.07 KiB) Viewed 10035 times
-
- ask gif2.gif (4.25 MiB) Viewed 10035 times
-
- ask.jpg (3.37 MiB) Viewed 10035 times
Re: Coin acceptor with relay project
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.
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)
Re: Coin acceptor with relay project
incereasing debounce time not help to me, please sugget me the capacitor value to add ?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.
Re: Coin acceptor with relay project
That capacitor couls be around 100 nF, I think.
/Ton (PayPal.me)
Re: Coin acceptor with relay project
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.
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.
Re: Coin acceptor with relay project
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...
Re: Coin acceptor with relay project
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?
Re: Coin acceptor with relay project
What value pull-up resistor is installed on GPIO-35?
/Ton (PayPal.me)
Re: Coin acceptor with relay project
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.
Re: Coin acceptor with relay project
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?
Are the GND of the ESP and the GND of the coin mechanism connected to each other?
/Ton (PayPal.me)
Re: Coin acceptor with relay project
yes I use a dual output (12 volt and 5 volt) common ground power supply
Re: Coin acceptor with relay project
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.
Re: Coin acceptor with relay project
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 (4.52 MiB) Viewed 9646 times
Re: Coin acceptor with relay project
Does that still happen if you unplug the white wire from the ESP? Because currently it acts as a nice antenna...
/Ton (PayPal.me)
Re: Coin acceptor with relay project
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?

Re: Coin acceptor with relay project
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.
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.
Re: Coin acceptor with relay project
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.
Who is online
Users browsing this forum: No registered users and 22 guests