It’s been cold as an ice cube in an igloo lately, and the only thing that’s keeping my hands warm in the morning is my coffee. You know it won’t be a good day, though, when you’re getting a hot latte from a vending machine and the vending machine eats your coins. I end up with frozen hands and a caffeine headache by 10 am, or I end up having to reroute my whole morning just to run to another cafe.
I understand that vending machines fail sometimes—especially after learning about how to design a coin acceptor interface. In electronics design, a coin acceptor can be tricky with the failure to accept coins being only one of the lesser problems. Recently, I ran into a problem where payment machines I was designing were found to be accepting coins from neighboring countries with different monetary values, and it was provoking consistent losses to the operation. Much like most design problems, careful attention and a strong knowledge of the layout operation can get you through to a satisfactory and efficient solution.
Coin Acceptors: What Goes in and What Comes Out?
Despite the popularity of cashless transaction, coin acceptors are still commonly used in certain applications such as parking and vending machines, arcade games, and your uncle’s favorite party tricks. Oftentimes, coin acceptors are simple plug-and-play devices which are easy to use. There is some method behind the magic for how they can count the various kinds of coins, though.
Most coin acceptors are equipped with sensors to detect the differences in the size and metal composition. Some special coin acceptors use visual detection technology to identify notable characteristics on different coins and register them separately. Usually, these methods are sufficient in accurately identifying coins and sending out digital signals. Now, if only they could automatically tell if I wanted cream and sugar in my coffee or not.
While coin operators seem simple in concept, they have devastating effects if implemented incorrectly.
Every Coin Has Two Sides
There’s a whole process for when a coin acceptor validates a legitimate coin; it is up to the host controller to extract the coin value from the acceptor and ensure that the according value is assigned. By communicating with the coin acceptor via a proprietary protocol, or more simply put, detecting logic levels on a series of output pins, you can design for an easy-to-use and easy-to-understand coin acceptor. But with all solutions, there are limits to its usefulness.
Using proprietary protocol offers minimal signal connections and the ability to connect to more than one coin or note acceptor simultaneously. Another method, one that I prefer when compared to the proprietary protocol, is detecting the changes in logic levels from the coin acceptor’s output pins. The simplicity of logic level detections means a less complicated code and the ability to source for replacement coin acceptors between various manufacturers. The tradeoff is that this places a greater responsibility on the host controller to decode the coin value accurately based on the logic signal pulses.
Furthermore, additional processes may complicate your coin acceptor protocol. Most coin acceptors have an inhibit pin that disables the coin acceptor when it is inserted. In applications that use a coin acceptor, the microcontroller usually also manages other processes when it is not at the coin accepting stage. Inhibiting the coin acceptor is a prudent measure to prevent any coin insertion that goes undetected as the microcontroller is tending to other tasks.
Mess up the signal sampling and you’ll have a discrepancy in coin collection reports.
PCB Design to Avoid Signal Interference
If you are intrigued by my preference for decoding coin values through logic signal pulses, then you have to be careful to develop your firmware properly. If the firmware is not properly developed, it could result in missed detection or double detection. And since applications for coin acceptors directly involve monetary transactions, system bugs can lead to complicated issues with clients and customers alike.
The critical part of registering the correct value lies in knowing the exact start and end of the signal pulse. In coin acceptors, this means knowing the exact pulse duration and ensure that the sampling task is executed at an interval of at least half the pulse duration. In actual applications, electrical interference may affect the pulse signals and proper software sampling and filtering technique are needed to ensure the valid pulse is captured. And for additional reading, the Nyquist theorem states that the frequency of the sampling must be at least twice the frequency of the sampled waveform.
While it seems that the challenges of reading the right coin value reside in the arm of the firmware , protecting the coin pulse signals from electrical interference is also an important design factor. High speed or noisy signals should be routed away from the coin acceptor pulse signals. Setting up a keep out zone around the pulse signal traces with your PCB design software will eliminate electrical interference at PCB level.
Consider using CircuitStudio® for smart PCB layout that can detect your potential design problems in advance and show you where interference resides. If you have more questions about specific application layouts, talk to the experts at Altium today and find out more.