Part

Coin acceptor, CH-926

On 12 V, a burst of pulses on COIN for each coin it knows, pulling the line low for each.

See every part
  • 4 pins
  • 2 settings
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
Coin acceptor, CH-926 as drawn in the Mokxi simulator
At a glance

The Coin acceptor, CH-926 in brief

What it is, and every setting the properties panel gives it.

The CH-926 is a programmable coin acceptor with a chrome face, a coin slot and a return lever, and a four-wire harness. It is taught up to six kinds of coin by sample and told how many pulses each is worth; a coin it knows drops through and COIN sends that many pulses, while anything else falls out of the return. The board never learns which coin it was, only a count. The model wires DC12V to a 12 V supply, COIN to an input with a pull-up, and GND to ground. Its pulse property sets each pulse's length in milliseconds, 50 by default, with a gap of the same length, and nc flips the output as the NO/NC switch does. The model does not include teaching the coins, which happens on the unit's own buttons, the inhibit input some versions have, or the time a real one takes to look at a coin. Click a coin under the face to drop it in. Coins are worth 1, 2, 5 and 10 pulses.

Family
Inputs
Pins
4
pulse
50
nc
false
Pins

4 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
DC12V
The 12 V supply, the red wire.
COIN
The pulse output, the white wire. Open collector: it pulls to GND for each pulse.
GND
Ground, shared with the board.
COUNTER
Drives an external counter on a real one. Not connected here.
How to use it

How to use the CH-926 coin acceptor with an Arduino Uno

The example project is Piggy bank. A CH-926 coin acceptor counts each coin's pulses and a TM1637 display adds up the savings in dollars and cents. DC12V goes to the 12 V supply, COIN goes to Uno pin 2, and GND goes to the Uno's GND, shared with the 12 V supply. The display's CLK and DIO go to pins 13 and 12. The acceptor is taught that a nickel sends 1 pulse, a dime 2, a quarter 5 and a dollar coin 10.

The sketch enables the Uno's pull-up on pin 2 and attaches an interrupt that counts falling edges. A burst is over once the line has been quiet longer than any gap inside one, so it waits 200 ms. It then adds up the burst's count, looks up its value in cents, prints it to the serial monitor and shows the total on the display. An unknown count prints "not a coin I know". While it runs, click a coin under the acceptor's face to drop it in.

With default settings, the serial monitor printed: "Mokxi Arduino Uno: piggy bank", "saved $0.00". The first line is the sketch starting and the second is the empty total at power on, before any coin is dropped.

After a coin worth 5 pulses was dropped in, the serial monitor printed: "5 pulses: 25 cents, saved $0.25". The sketch counted five pulses, looked up 25 cents, and added it to the total. Coins are worth 1, 2, 5 and 10 pulses here. Drop them a moment apart, or two read as one long burst.

Part pin
Goes to
DC12V
12 V
COIN
Arduino Uno R3 pin 2
GND
Arduino Uno R3 pin GND
Piggy banklive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
sketch.ino · Arduino Uno R3 · the first 45 lines
// Piggy bank: a CH-926 coin acceptor and a TM1637 display.
//
//   pin 2    the acceptor's COIN (white), with the Uno's pull-up
//   GND      the acceptor's GND, shared with its 12 V supply
//   pins 13, 12  the display's CLK and DIO
//
// The acceptor is taught each coin and the pulses it is worth; here a nickel
// sends 1, a dime 2, a quarter 5 and a dollar coin 10. COIN pulls low for
// each pulse, so an interrupt counts falling edges, and a burst is over once
// the line has been quiet for longer than any gap inside one (the acceptor's
// gaps are as long as its 50 ms pulses here, so 200 ms is plenty).

#include <TM1637Display.h>

const int COIN = 2;
const int CLK = 13;
const int DIO = 12;
const unsigned long QUIET_MS = 200;

TM1637Display display(CLK, DIO);

volatile int pulses = 0;
volatile unsigned long lastPulse = 0;
long cents = 0;

void onPulse() {
  pulses++;
  lastPulse = millis();
}

int centsFor(int count) {
  switch (count) {
    case 1: return 5;
    case 2: return 10;
    case 5: return 25;
    case 10: return 100;
    default: return 0;
  }
}

void show() {
  display.showNumberDecEx((int)(cents % 10000), 0b01000000, true);
}

void setup() {
Common errors

Common Coin acceptor, CH-926 errors and fixes

What goes wrong
The fix
Powering the acceptor from the board's 5 V pin.
It needs 12 V, with the grounds joined. Under 10.8 V it is not running and the coin falls back out.
Leaving COIN without a pull-up.
The output is an open collector, so use INPUT_PULLUP on the board or a resistor to 5 V. Never to 12 V.
Counting a coin per pulse.
Count the pulses in a burst, then decide what the burst was worth once the line has been quiet for longer than a gap.
Dropping two coins at the same time.
Drop them a moment apart. Two clicked at once follow each other by a single gap and read as one long burst.
Questions

Questions and answers

how many coins can a ch-926 be taught

Up to six kinds of coin, taught by sample on the unit's own buttons. The board never learns which coin it was, only a count.

what voltage does the ch-926 coin acceptor need

A 12 V supply on DC12V. Under 10.8 V it is not running and a coin falls back out.

does the ch-926 coin output need a pull-up

Yes. COIN is an open collector that pulls to GND for each pulse, so it needs INPUT_PULLUP on the board or a resistor to 5 V, never to 12 V.

what does the pulse setting do on the coin acceptor

It is the length of each pulse in milliseconds, 50 by default, with a gap of the same length after it. The speed switch on a real one sets it; match the two.

How it is modeled

What is true about the Coin acceptor, CH-926, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

The supply. Under 10.8 V (12 V less 10%) it is not running, and a coin falls back out.

The output. An open collector, so COIN needs a pull-up: INPUT_PULLUP on the board, or a resistor to 5 V. Never to 12 V.

Coins in a queue. A coin dropped while another is still sending waits for it to finish. Drop them a moment apart: two clicked at once follow each other by a single gap and read as one long burst.

Not modeled

Teaching the coins, which happens on the unit's own buttons; the inhibit input some versions have; and the time a real one takes to look at a coin.

From Coin acceptor, CH-926, in full.

Projects

See the Coin acceptor, CH-926 in a project

One built-in project uses it. It opens in the editor, already wired.

Boards

The boards it is shown on

This board has a built-in project with the Coin acceptor, CH-926 in it.

Wire up the Coin acceptor, CH-926

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.