Giter Site home page Giter Site logo

ch-926-arduino's Introduction

CH-926 Arduino

I recently had to use a CH-926 coin acceptor (made by Sintron) in an Arduino project that accepted coins for instant donations to charity using JustGiving.

I had many problems with programming the device in the first place to accept coins and then spent hours trying to find a way to process the signal from the coin acceptor.

So here is a little guide on how to get the coin acceptor setup and some sample code you can use in your projects.

I'm hoping to eventually turn this into a Arduino Library.

Note: The code included in this project was designed to work with my specific unit of the CH-926. Other sample code online didn't work for me so I can't guarantee this will work for you as I may have a faulty unit that works differently.

If you have any questions or suggestions you can contact me on Twitter @DavidMaitland.

Device configuration

Wiring

  • DC12V (Red) Goes to your 12v supply.
  • COIN (White) Goes to pin A1 on your Arduino (this outputs 5v).
  • GND (Black) Goes to your common ground, yes it needs to ground on both your Arduino and the 12v power supply.
  • COUNTER (Grey) Leave it alone, ain't got a clue what it's for.

Switches

  • Set the top switch to NC (this should be the down position).
  • Set the speed switch to slow (this can be changed, but it's what I used).

Setup

I may include a device programming guide in the future, but I did follow the terrible instructions and got it working (after 7 attempts). The reset function will be your friend.

Pay attention to the pulse setting when progarmming your coins. In this code the signalCostFactor is 5 (you can change this). Which means each pulse is worth 5p, so when progarmming the 5p you would have it send 1 pulse, 10p would send 2, 20p would send 4 and so on..

Usage

If you have programmed the coin acceptor and completed the device configuration above you should be ready to go.

Open and upload the script (CH-926-Arduino.ino) to your Arduino (I used a Arduino Uno). Open the serial monitor (9600 baud) and you should see the following when you insert coins...

Ready..
Coin Value: 10
Balance: 10
Coin Value: 20
Balance: 30
Coin Value: 20
Balance: 50
Coin Value: 5
Balance: 55

There is an issue with the coin value, if coins are inserted within the debounce delay of each other they will become one. This doesn't affect the balance but you may get some 30p coin values if say a 10p & 20p were inserted at quick succession. If this is a problem for you try changing the debounce delay to be shorter and the speed switch on the coin acceptor to be faster. I never got around to trying this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.