Detecting coins for payments
Most vending machines use coins as a payment method. Detecting coins is tricky. A potential problem is fraud. A coin may be actual money or a custom coin. Using custom coins, users can defraud the system.
A sample of coins used in European countries can be seen here:

In this section, we'll explore two methods to detect coins. The first method is to detect by weight. The second method is to detect coins using optical sensors such as cameras. We'll explore these methods in the next section.
Detecting coin weight
In some cases, each coin has a unique weight. From this scenario, we can detect the kind of coin that the user enters into a vending machine. There are many weight sensors with various specific precision features.
The digital weight sensor Gravity, from DFRobot, is one weight sensor that you can use for your vending machine. You can buy this product from https://www.dfrobot.com/product-1031.html. This sensor is a complete kit so you can use it directly with...