Complete Guide to Building a Coin Sensor Circuit Step-by-Step

Begin with a voltage divider for signal conditioning. Use a 10kΩ resistor paired with a 4.7µF capacitor to filter noise before the comparator stage. This setup stabilizes the baseline voltage and minimizes false triggers caused by electromagnetic interference, common in industrial environments. Ensure the capacitor is rated for at least 16V to handle transient spikes without degradation.
Select a dual-threshold comparator like the LM393 to differentiate between metallic disc thicknesses. Configure the non-inverting input with a 2.5V reference via a precision voltage regulator such as the LM4040. Adjust the inverting input’s sensitivity by adding a 100kΩ potentiometer in series with a 1kΩ resistor. This allows fine-tuning for alloys with varying conductivity–critical for distinguishing copper from zinc-plated blanks.
Power the assembly with a regulated 5V supply from a linear voltage source (e.g., LM7805) to prevent thermal drift. Add a Schottky diode (1N5817) on the input line to clamp reverse voltage from inductive loads. Ground planes should extend under the sensing coil to reduce parasitic capacitance, which can distort the transient response. Test coil dimensions at 30mm diameter with 50 turns of 0.2mm enameled wire for optimal eddy-current penetration.
For calibration, pass reference discs through the detection zone at 1.2 m/s and measure the comparator’s output pulse width using an oscilloscope. A 200µs pulse indicates a standard thickness, while variations beyond ±50µs suggest counterfeit or non-standard material. Log these values in an EEPROM (e.g., AT24C02) to maintain consistency across power cycles. Avoid PWM noise by keeping the microcontroller’s switching frequency above 50kHz.
Building a Reliable Token Detection Setup
Start with an infrared LED and phototransistor pair for accurate metal piece recognition. Position the emitter and receiver 12–15 mm apart at a 45° angle to minimize false triggers. For 5V systems, add a 220Ω resistor on the emitter side and a 10kΩ pull-up on the receiver to stabilize signal voltage swings between 0.8V (blocked) and 4.2V (unblocked).
Use a Schmitt trigger inverter (e.g., 74HC14) to condition raw pulses. A single-stage inverter with 10nF feedback capacitor sharpens edges, eliminating noise from worn inserts. If jams occur, lower the capacitor value to 4.7nF–reducing hysteresis but increasing responsiveness.
Validate pulses with a microcontroller interrupt pin. Configure rising-edge detection on a 1 kHz scan rate to reject debris; metal slugs must breach the beam for >2 ms. Store timing thresholds in EEPROM if field calibration is required, adjusting for ambient light shifts.
Guard against electrostatic discharge with a bidirectional TVS diode (P6KE6.8CA) across sensor terminals. Avoid placing traces near motors–route analog lines perpendicular to PWM outputs, keeping >3 mm clearance to prevent coupling.
Select a Darlington array (ULN2003) if driving solenoids from the same board. Each channel handles 500 mA, sufficient for most coin-directing actuators. Isolate high-current paths with a separate regulator; LM2576-5V handles input swings from 7–40V without resets.
Calibration and Testing

Verify alignment by inserting shim stock (0.1 mm stainless) at expected token thickness. The gap should block ≤85% of IR energy–measure current through the phototransistor: ideal range 0.5–3 mA. For multi-denomination setups, add separate detectors tuned to distinct diameters (adjust spacing ±2 mm for each size).
Optimize pulse stretching by matching the inverter capacitor to the slowest token (typically copper alloys). Test drop speeds from 1 m height–fast tokens may need 1 µF capacitors for consistent triggering. Record false triggers over 24 hours in varying humidity; aim for
Choosing Optimal Parts for a Metal Disc Recognition System

Begin with a phototransistor and infrared LED pairing for gap-based detection. The Osram SFH 420 or Vishay TEMT6000 provide precise response curves in the 850–950 nm range, minimizing ambient light interference. Pair them with a 1 kΩ resistor for the LED and a 10 kΩ pull-up on the phototransistor output to ensure sharp edge transitions when a disc passes.
For inductive methods, select a LC tank tuned to 10–50 kHz. A 100 µH coil with a 10 nF capacitor yields a 160 kHz resonant frequency–adjust capacitance to match target disc alloys. Ferrite cores increase sensitivity but require air gaps to avoid saturation; experiment with core material (e.g., 3C90 ferrite vs. powdered iron) based on disc thickness and composition.
| Disc Material | Optimal Coil Inductance (µH) | Capacitor Value (nF) | Resonance (kHz) |
|---|---|---|---|
| Copper | 80–120 | 6.8–10 | 140–200 |
| Nickel | 60–100 | 10–15 | 100–160 |
| Aluminum | 40–80 | 15–22 | 80–140 |
Operational amplifiers must handle high slew rates for inductive spikes. The LM311 comparator excels with rail-to-rail output, while the TLC272 offers low noise for weak signals. Use a 10–47 pF compensation capacitor to filter high-frequency noise without distorting pulse width. For multi-disc sorting, add a second stage with a TL081 to isolate noise from adjacent channels.
Power supply decoupling is critical. Place a 0.1 µF ceramic capacitor and a 47 µF electrolytic within 2 cm of each active component. For inductive loads, add a flyback diode (1N4007) across the coil to clamp voltage spikes exceeding 50 V. Linear regulators (LM7805) suit small setups, but switch-mode (LM2596) reduces heat in battery-powered systems–thermals dictate choice.
Signal processing demands a microcontroller with hardware timers. The ATmega328P captures pulse widths with 62.5 ns resolution via Timer1, while the STM32F103 delivers 72 MHz speed for real-time FFT analysis. For basic setups, dedicate one interrupt per edge transition; for advanced discrimination, sample the ADC at 4× the resonance frequency.
Discrimination algorithms vary by method. Inductive approaches require bandpass filtering centered on the disc’s eddy-current frequency–use a Goertzel filter on the microcontroller to reduce computation. Optical setups compare shadow profiles via lookup tables or neural networks trained on 128-sample datasets. Ensure ADC resolution exceeds 10 bits for reliable diameter measurements.
Environmental stability hinges on component placement. Mount photodetectors in a baffled enclosure to block stray light, using matte black spray paint to reduce reflections. Inductive coils require shielding–wrap them in grounded copper tape to mitigate EMI from motors or nearby electronics. Temperature shifts alter resonance; compensate with a thermistor (10 kΩ NTC) paired to a calibration lookup table.
Final validation uses reference discs of known dimensions and alloys. Adjust threshold values iteratively, logging results at 0°C, 25°C, and 50°C to ensure repeatability. For mass production, store component tolerances (e.g., ±5% for inductors, ±2% for capacitors) in firmware to auto-calibrate on startup. Debug tools should include an oscilloscope with FFT mode and a logic analyzer to verify pulse timing consistency.
Building an Inductive Detection Module for Metal Discrimination
Start by winding a 200-turn coil using 0.2mm enameled copper wire around a non-conductive ferrite core with a 10mm diameter. Maintain consistent spacing between turns to prevent short circuits–wrap the wire tightly but avoid overlapping. Connect the coil ends to a capacitor bank (combination of 10nF, 47nF, and 100nF ceramics) to form a resonant LC tank with a target frequency between 100kHz and 200kHz. Adjust the capacitor values during testing: smaller capacitances increase sensitivity but may introduce noise.
- Use a NE555 timer (astable configuration) to generate a stable square wave at the chosen frequency–set R1=10kΩ, R2=47kΩ, and C=1nF for ~150kHz.
- Feed the output into a CD4069 hex inverter as a buffer; this isolates the oscillator from load fluctuations.
- Connect the LC tank to one gate of a dual NMOS transistor (e.g., IRLML6402) via a 1kΩ resistor–this stage amplifies impedance changes when metallic objects pass within 5mm of the coil.
- Add a 1N4148 diode across the transistor’s gate-source to clamp inductive spikes; omit this step only if thermal stability is non-critical.
For signal conditioning, route the amplified output through a precision rectifier built with an OP07 operational amplifier. Configure it as a half-wave rectifier with a 100kΩ feedback resistor and a 10nF smoothing capacitor. This stage converts the high-frequency oscillations into a DC voltage proportional to the object’s conductivity and proximity–expect 0–3.3V output for typical copper-nickel alloys.
Mount the entire assembly on a perforated prototype board with ground planes beneath all analog traces to reduce EMI. Power the module from a regulated 5V supply; decouple each IC with 10µF tantalum and 0.1µF ceramic capacitors directly at their VCC pins. Test with calibrated samples–adjust the coil’s position relative to the detection path by ≤0.5mm increments until false triggers drop below 1%. For long-term stability, pot the coil and LC components in epoxy resin to prevent mechanical drift.
Fine-Tuning Detection Precision for Various Currency Variants
Begin by setting the comparator’s reference voltage to 60-70% of the expected signal amplitude for the most commonly handled metal disc. For example, a 5-cent Euro piece typically generates a 3.2V peak on a 5V supply–adjust the potentiometer until the output toggles at approximately 2.1V. Record this baseline value; it serves as the starting point for all subsequent adjustments.
Use a non-ferrous alloy sample (e.g., brass or cupronickel) to establish a second reference point. Measure the time-to-peak for the induced eddy-current decay–brass should settle within 8-12 microseconds, while nickel-plated steel may linger up to 20 microseconds. Modify the RC time constant of the front-end stage by swapping the feedback capacitor: 10nF for brass, 22nF for steel variants. Verify edge sharpness with a dual-channel oscilloscope; rise/fall times must stay under 1.5 microseconds to prevent false triggers on small denominations.
Create a lookup matrix correlating diameter, thickness, and alloy composition to signal amplitude:
- 1-cent US: 2.0 ±0.2V (copper-clad zinc)
- 20-pence UK: 2.8 ±0.3V (cupro-nickel)
- 1-yen Japan: 1.7 ±0.15V (aluminium)
Store these values in firmware as hysteresis thresholds; activate the appropriate profile via dip-switch or serial command during deployment. Ensure the bandwidth of the amplification chain excludes frequencies above 120 kHz, as higher harmonics disproportionately affect thinner discs like the Swiss 5-rappen.
Test edge cases by placing two discs in near-contact–staggered alignment–or introduce contaminants like finger oils or beverage residue directly on the validation path. The detection window should still resolve within 2.5 mm clearance. If marginal cases persist, reduce the comparator’s hysteresis gap to ≤120 mV and add a 47 µH choke in series with the excitation coil to suppress ambient noise from adjacent machines.
Final calibration requires a sample size of at least 200 pieces per currency variant, processed in groups of 10. Log false positives/negatives; if the rate exceeds 0.5%, incrementally shift the comparator threshold by 30-50 mV and repeat until stability reaches 99.8% accuracy. Document the optimal settings on a label affixed inside the device housing, noting ambient temperature and humidity, as these parameters directly affect coil Q-factor.