loading
**** ENTERED IN THE HURRICANE LASERS CONTEST****
What would I do with a Laser Cutter? Build Simple Robotic Kits to teach people a Hobby that I Love.

Ever wanted to make some money from your projects?
This Instrutable will show you how to Simply interface a coin selector with your Adruino.
And also how to then connect that to your Visual C# Project.
Then it's all up to you and that great idea you have, if it's electronic or a program/game,
The Buck Starts Here.


You will need:
A Coin Selector: There are many different type's, the CH-926 accepts the most amount of coins so thats what I'll be using.
UK Stock, US Stock

Any 12v Power Supply, Batteries or Wall Wart.

An Arduino UNO

Microsoft Visual Express 2010 C#: Free Download, Scroll down until you see the correct option.
Note: Only needed for a coin operated Program, Not electronics Projects.

Let's get Started!

Step 1: Coin Sampling

For your Coin Selector to know what type of coins it accepts, you have to set it up and then feed it samples of those coins.
It is recommend to sample at least 15 coins of the same type, up to a maximum of 30. Don't feed the same coin through 30 times, it's make the selector to fussy about what it accepts.

A Coin Selector works by comparing the material, weight and size of coins past through it to the samples you provide. If a coin is not reconised it drops out the return slot, if it is reconised the Unit sends out pulse's on the "COIN" line.
So to make it easier for the programming side we use a "greatest common factor" rule.
eg. We'll use the following coins (UK) 5p, 10p, 20p, 50p,& £1, (US) 5c, 10c, 25c, 50c & $1.
All the the coins can be made up with multiple 5p or 5c coins, so we make 1 pulse equal to 5p or 5c.
5p/c = 1 pulse, 10p/c = 2 pulses, 20p = 4 pulses, 25c = 5 pulses, 50p/c = 10 pulses, £/$1 = 20 pulses.

Now, TheSetup:

First the switches...
select "NC" by sliding the top switch to the bottom position.
select "FAST" by sliding the bottom switch to the top position.

Power Up the unit with a 12v supply.

1. Hold the "ADD" and "MINUS" buttons down at the same time for about 3 seconds, release and then the letter "A" will appear on the LED display.
2. Press the "SETUP" button once, and the letter "E" will appear. Then use the "ADD" and "MINUS" buttons to choose how many kinds of coins your going to use. Press the "SETUP" button again to finish.
3. The letter "H" will appear. Use the "ADD" and "MINUS"buttons to choose how many sample coins your going to feed it later. Press the"SETUP" button again to finish.
4.  The letter "P" will appear. Again use the "ADD" and "MINUS" buttons to choose the amount of output pulses you want. Press the "SETUP" button to finish. Refer to the above example to determine number of pulses.
5.  The letter "F" will appear. Using the "ADD" and "MINUS" buttons, choose the accuracy. The value is from 1 to 30, with 1 being the most accurate. I use 10 and it works fine. Again "SETUP" to finish.

You have now setup the first coin, depending on how many coins you selected in step 2, you'll have to repeat Step's 3 to 5 for each one.
The letter "A" will appear when you've setup all the coins. Hold "SETUP" for 3 seconds to finish, the letter "E" will appear.
Finally, switch the unit off and then back on.

Sampling time:

1.  Hold the "SETUP" button down for about 3 seconds, release and then the letters "A1" will appear on the LED display. This is your first coin (5p/c)
2. Feed the Coin Selector your sample coins, the LED display will show the amount of coins you've entered. "A1" will appear again when finished.
3. Hold the "SETUP" button down again for about 3 seconds, release and then"A2" will appear, repeat these steps until all coins are sampled.

If your not using all of the coin types available (eg 5 coins of a 6 type coin selector) the unit will ask for samples of a coin type you haven't setup, just hold the "SETUP" button down for 3 secconds of each of the remaining coins.

The Coin Selector restarts itself and is now ready to connect to the Arduino.
<p>How to Earn money from Twitter <a href="http://mysite.pk/make-money/item/how-to-earn-money-from-twitter" rel="nofollow">Click Here<br></a></p>
<p>hey anyone know how to reset the coins value my project is supposed to start after fifty cents so I used that code and it works the first time after I upload the code but after that it breaks any help is great thanks!</p>
<p>A batter way is to make money online for free by just clicking ads 1$ per one click</p><p>you can change your life like me</p><p>make 50-100$ per day try now</p><p><a href="http://thebesttipsoffical.blogspot.com/" rel="nofollow">click here</a> to see how to earn money online on my website its very easy I guide you (:</p><p>start <em><a href="http://thebesttipsoffical.blogspot.com/" rel="nofollow">now</a></em></p>
<p>Hello, i'm in process to make project similar like vending machine. But, i dont know what to write in code if we press A button, then price should be like 5$ . Can you help me?</p>
<p>oLo</p>
<p>How can the arduino (your program) tells the difference if a 10p/c(dime) coin or 25p/c(quarter) coin is inserted from two 5p/c coins (nickel)? The way I understand is that this code: <br> void coinInserted() <br> //The function that is called every time it recieves a pulse<br> {<br> coinsValue = coinsValue + 0.05; <br> //As we set the Pulse to represent 5p or 5c we add this to the coinsValue<br> coinsChange = 1; <br> //Flag that there has been a coin inserted<br> }<br>will only add 0.05 to the value for each pulse. <br>How can I change the program so that It counts how many nickels (5p/c), dimes (10p/c), quarters (25p/c) etc... were inserted? I want just don't want to know the total value but also the number of coins type inserted.<br>Thanks</p>
<p>the first step would be to read about button state on the arduino website and learn how that works. Essentially this program has one but it is renamed with coinstate, coin counter, etc. You then create a button state for each type of coin you have, nickel , dime, quarter, etc. In order to tell which type have a statement like this.</p><p>pulseIn(13, High)</p><p>this isn't the exact code you would want to use or can use. the correct code would probably be a digital read pin 13... delay(100). to be sure check the arduino website references.</p><p>This will read the amount of pulses in a certain amount of time, then according to the amount of pulses, add a value to the appropiate button counter.</p><p>If you need help write me an email to ztpotoskie@gmail.com with a subject that reads instructables</p>
<p>How can I use this coin adapter with AVR Program(Atmega128)??</p><p>Can you help me?</p><p>I don't know how to make the AVR souce....</p><p>Please.. help me...</p><p>I need just simple souce..</p>
<p>if you want to use an LCD screen to display the money, then use the sparkfun 2 by 16 lcd screen, hook it up like they do in the SIK guide (circuit 13), replace the lcd connections from pins 2, 3, 4, and 5 to 3, 4, 5, 6. Then upload this code:</p><p>const int coinInt = 0; </p><p>//Attach coinInt to Interrupt Pin 0 (Digital Pin 2). Pin 3 = Interrpt Pin 1.</p><p>#include &lt;LiquidCrystal.h&gt;</p><p>LiquidCrystal lcd(12,11,6,5,4,3);</p><p>volatile float coinsValue = 0.00;</p><p>//Set the coinsValue to a Volatile float</p><p>//Volatile as this variable changes any time the Interrupt is triggered</p><p>int coinsChange = 0; </p><p>//A Coin has been inserted flag</p><p>void setup()</p><p>{</p><p> Serial.begin(9600); </p><p>//Start Serial Communication</p><p> attachInterrupt(coinInt, coinInserted, RISING); </p><p>//If coinInt goes HIGH (a Pulse), call the coinInserted function</p><p>//An attachInterrupt will always trigger, even if your using delays</p><p>lcd.clear();</p><p>}</p><p>void coinInserted() </p><p>//The function that is called every time it recieves a pulse</p><p>{</p><p> coinsValue = coinsValue + 0.05; </p><p>//As we set the Pulse to represent 5p or 5c we add this to the coinsValue</p><p> coinsChange = 1; </p><p>//Flag that there has been a coin inserted</p><p>}</p><p>void loop()</p><p>{</p><p> if(coinsChange == 1) </p><p>//Check if a coin has been Inserted</p><p> {</p><p> coinsChange = 0; </p><p> lcd.setCursor(0,1);</p><p> lcd.print(&quot;Credit: $&quot;);</p><p> lcd.print(coinsValue); </p><p>//Print the Value of coins inserted</p><p> }</p><p>}</p>
<p>How can the arduino (your program) tells the difference if a 10p/c(dime) coin or 25p/c(quarter) coin is inserted from two 5p/c coins (nickel)? The way I understand is that this code: <br> void coinInserted() <br> //The function that is called every time it recieves a pulse<br> {<br> coinsValue = coinsValue + 0.05; <br> //As we set the Pulse to represent 5p or 5c we add this to the coinsValue<br> coinsChange = 1; <br> //Flag that there has been a coin inserted<br> }<br>will only add 0.05 to the value for each pulse. <br>How can I change the program so that It counts how many nickels (5p/c), dimes (10p/c), quarters (25p/c) etc... were inserted? I want just don't want to know the total value but also the number of coins type inserted.<br>Thanks</p>
Inspired by this set of instructions I have embarked on a project using the CH-926. After successfully getting everything working - Today, when I turned it on, instead of the usual beeps it is displaying E2 and no combination of button pressing makes a difference. Can the units be reset? <br> <br>Thanks.
<p>@Sebuk Were you able to solve this E2 problem, by any chance? I encountered the same error today and I'm completely at a loss :(</p>
Looking online the only time you should see 'e' is during training...
<p>this project rocks </p>
<p>Hey, can I program this coin acceptor with an Arduino Leonardo?</p>
How can I store the credit to EEPROM???! in case of powering off and on? SO it starts the count from the memory? I am trying but failing.
Thanks! Worked well for me. In Australia out $0.50 coin can fit in the slot but can't fit through the eject slot! I will have to hack the casing...
Doesn't the COIN line have to be put through a voltage divider to prevent the ATMEGA pin for receiving more voltage than it can handle? I'm considering wiring one of these up with 6.8k and 5.1k resistors in a voltage divider arrangement to address this issue. <br> <br>With the available documentation, (and without an oscilloscope on hand), I'm finding it hard to identify what the peak output voltage is from the COIN line, but it's safest to assume it's 12V like the supply in the absence of any other information. Perhaps you have found a data sheet which says otherwise.
I measured it at 3.3V. I go though a 10K resistor between the coin pin an Arduino too and it works fine.
I measured it at 3.3V. I go though a 10K resistor between the coin pin an Arduino too and it works fine.
sir do you know how to program..L70 bill acceptor to arduino atmega328 ..? <br>
Hello guys, i've this coin acceptor and it recognize my coins (1,2 and 0,5 &euro;) and this is good! <br>But when i attach it to Arduino, it simply doesn't send any signal, any pulses. <br> <br>The ground of coin acceptor is connected with ground of supply and arduino ground. <br>The signal with voltimeter is 0.004 and when i insert a coin 0.016 V. <br>what's wrong with this little toy? Thanks, so sorry for my English.
Ok guys, that's my problem. <br> <br>I've purchased the ch-926 Coin Selector and i've programmed it with 1, 2 and 0.50 &euro;. <br>Next, i've programmed arduino with sample sketch and it didn't work. <br> <br>There is a pulse when i switch on the coin selector and another when i try to switch between NC and NO. <br> <br>Anyway it doesn't send pulses when i insert my coins. <br>So, i've tested it with &quot;Analog IN&quot; ports and it show me a value between 0.03 and 0.09 with this code: <br> <br>double sensorValue = analogRead(A0); <br>double voltage = sensorValue * (500 / 1023.0); <br> <br>I suspect that my Coin Selector is faulty and it doesn't send my pulses. <br> <br>How can i solve? Any ideas? <br> <br>Thanks for advices, Paki
This is the code for the Simon game I made with the kids. Each program work on their own but not together. I think it is down to a { or } somewhere in the program. I;m currently getting the following error at the line where I put the stars: a function-definition is not allowed here before '{' token. Any help would be much appreciated. <br> <br>const int coinInt = 0; <br>//Attach coinInt to Interrupt Pin 0 (Digital Pin 2). Pin 3 = Interrpt Pin 1. <br> <br>volatile float coinsValue = 0.00; <br>//Set the coinsValue to a Volatile float <br>//Volatile as this variable changes any time the Interrupt is triggered <br>int coinsChange = 0; <br>//A Coin has been inserted flag <br> <br>void setup() <br>{ <br> Serial.begin(9600); <br>//Start Serial Communication <br> attachInterrupt(coinInt, coinInserted, RISING); <br>//If coinInt goes HIGH (a Pulse), call the coinInserted function <br>//An attachInterrupt will always trigger, even if your using delays <br>} <br> <br>void coinInserted() <br>//The function that is called every time it recieves a pulse <br>{ <br> coinsValue = coinsValue + 0.05; <br>//As we set the Pulse to represent 5p or 5c we add this to the coinsValue <br> coinsChange = 1; <br>//Flag that there has been a coin inserted <br>} <br> <br>void loop() <br>{ <br> if(coinsChange == 1) <br>//Check if a coin has been Inserted <br> { <br> coinsChange = 0; <br>//unflag that a coin has been inserted <br> <br> if(coinsValue &gt;= 0.50) <br> { <br> const int led_red = 1; // Output pins for the LEDs <br> const int led_blue = 2; <br> const int led_yellow = 3; <br> const int led_green = 4; <br> const int buzzer = 5; // Output pin for the buzzer <br> const int red_button = 9; // Input pins for the buttons <br> const int blue_button = 10; <br> const int yellow_button = 11; <br> const int green_button = 12; // Pin 13 is special - didn't work as planned <br> long sequence[20]; // Array to hold sequence <br> int count = 0; // Sequence counter <br> long input = 5; // Button indicator <br> int wait = 500; // Variable delay as sequence gets longer <br> <br> /* <br> playtone function taken from Oomlout sample <br> takes a tone variable that is half the period of desired frequency <br> and a duration in milliseconds <br> */ <br> void playtone(int tone, int duration) { &lt;&lt;&lt;&lt;&lt;&lt;************************************************* <br> for (long i = 0; i &lt; duration * 1000L; i += tone *2) { <br> digitalWrite(buzzer, HIGH); <br> delayMicroseconds(tone); <br> digitalWrite(buzzer, LOW); <br> delayMicroseconds(tone); <br> } <br> } <br> <br> <br> /* <br> functions to flash LEDs and play corresponding tones <br> very simple - turn LED on, play tone for .5s, turn LED off <br> */ <br> void flash_red() { <br> digitalWrite(led_red, HIGH); <br> playtone(2273,wait); // low A <br> digitalWrite(led_red, LOW); <br> } <br> <br> void flash_blue() { <br> digitalWrite(led_blue, HIGH); <br> playtone(1700,wait); // D <br> digitalWrite(led_blue, LOW); <br> } <br> <br> void flash_yellow() { <br> digitalWrite(led_yellow, HIGH); <br> playtone(1275,wait); // G <br> digitalWrite(led_yellow, LOW); <br> } <br> <br> void flash_green() { <br> digitalWrite(led_green, HIGH); <br> playtone(1136,wait); // high A <br> digitalWrite(led_green, LOW); <br> } <br> <br> // a simple test function to flash all of the LEDs in turn <br> void runtest() { <br> flash_red(); <br> flash_green(); <br> flash_yellow(); <br> flash_blue(); <br> } <br> <br> /* a function to flash the LED corresponding to what is held <br> in the sequence <br> */ <br> void squark(long led) { <br> switch (led) { <br> case 0: <br> flash_red(); <br> break; <br> case 1: <br> flash_green(); <br> break; <br> case 2: <br> flash_yellow(); <br> break; <br> case 3: <br> flash_blue(); <br> break; <br> } <br> delay(50); <br> } <br> <br> // function to congratulate winning sequence <br> void congratulate() { <br> digitalWrite(led_red, HIGH); // turn all LEDs on <br> digitalWrite(led_green, HIGH); <br> digitalWrite(led_yellow, HIGH); <br> digitalWrite(led_blue, HIGH); <br> playtone(1014,250); // play a jingle <br> delay(25); <br> playtone(1014,250); <br> delay(25); <br> playtone(1014,250); <br> delay(25); <br> playtone(956,500); <br> delay(25); <br> playtone(1014,250); <br> delay(25); <br> playtone(956,500); <br> delay(2000); <br> digitalWrite(led_red, LOW); // turn all LEDs off <br> digitalWrite(led_green, LOW); <br> digitalWrite(led_yellow, LOW); <br> digitalWrite(led_blue, LOW); <br> resetCount(); // reset sequence <br> } <br> <br> // function to reset after winning or losing <br> void resetCount() { <br> count = 0; <br> wait = 500; <br> } <br> <br> // function to build and play the sequence <br> void playSequence() { <br> sequence[count] = random(4); // add a new value to sequence <br> for (int i = 0; i &lt; count; i++) { // loop for sequence length <br> squark(sequence[i]); // flash/beep <br> } <br> wait = 500 - (count * 15); // vary delay <br> count++; // increment sequence length <br> } <br> <br> // function to read sequence from player <br> void readSequence() { <br> for (int i=1; i &lt; count; i++) { // loop for sequence length <br> while (input==5){ // wait until button pressed <br> if (digitalRead(red_button) == LOW) { // Red button <br> input = 0; <br> } <br> if (digitalRead(green_button) == LOW) { // Green button <br> input = 1; <br> } <br> if (digitalRead(yellow_button) == LOW) { // Yellow button <br> input = 2; <br> } <br> if (digitalRead(blue_button) == LOW) { // Blue button <br> input = 3; <br> } <br> } <br> if (sequence[i-1] == input) { // was it the right button? <br> squark(input); // flash/buzz <br> if (i == 20) { // check for correct sequence of 20 <br> congratulate(); // congratulate the winner <br> } <br> } <br> else { <br> playtone(4545,1000); // low tone for fail <br> squark(sequence[i-1]); // double flash for the right colour <br> squark(sequence[i-1]); <br> resetCount(); // reset sequence <br> } <br> input = 5; // reset input <br> } <br> } <br> <br> // standard sketch setup function <br> void setup() { <br> pinMode(led_red, OUTPUT); // configure LEDs and buzzer on outputs <br> pinMode(led_green, OUTPUT); <br> pinMode(led_yellow, OUTPUT); <br> pinMode(led_blue, OUTPUT); <br> pinMode(buzzer, OUTPUT); <br> pinMode(red_button, INPUT); // configure buttons on inputs <br> digitalWrite(red_button, HIGH);// turn on pullup resistors <br> pinMode(green_button, INPUT); <br> digitalWrite(green_button, HIGH); <br> pinMode(yellow_button, INPUT); <br> digitalWrite(yellow_button, HIGH); <br> pinMode(blue_button, INPUT); <br> digitalWrite(blue_button, HIGH); <br> randomSeed(analogRead(5)); // random seed for sequence generation <br> //runtest(); <br> } <br> <br> // standard sketch loop function <br> void loop() { <br> playSequence(); // play the sequence <br> readSequence(); // read the sequence <br> delay(1000); // wait a sec <br> } <br>Serial.println(&quot;I'M MAKING MONEY!!!!&quot;); <br> } <br> <br> } <br>} <br> <br>Thanks
Hey bud, run a spell check ;)
this is so awesome! what projects have you incorporated this into so far?
So far, Just a few simple projects. Like Arduino based Simon Said, Tic tac toe on the PC, etc. Tho I am building a Cocktail Bartending Bot that I am planning on using it in.
The bartending 'bot, to be legal, probably needs a vision system to check ID and to work out when someone has had too much to drink, and an integrated phone to call a cab for those over the limit. Then to make it marketable,it needs to be a good listener and respond appropriately on occasion. ;^)
Inanimate object's are usually the best listeners ;-) Probably get away with it in a few european countries, I always use to love the beer vending machines in germany. The one I'm building is more for novelty and fun :-) Many conversations will be had tho!
Breathalizer, security cam, UV or rfid whater for the ID.
Sorry this may be a stupid question but, Just so I understand this right. This is used if you wanted to make your own coin opperated video game or any other project coin opperated device so others can use it without you having to be present to collect money directly from them?
Thats right, Just make sure it's secure if your not around.
Thank you for answering my question.
Does the mechanism have a refund option? What happens to the COIN pulses if you press the button on the front? I have one ordered, but won't be here for another couple of days.
Hey markvovo, There is no refund option. The button on the front mechanically opens the sensor section of the selector to release jams, these jammed coins drop back into the return slot. The pulses start when they have past this setcion so you'll only get Coin Pulses once actually receiving a coin. <br>Good luck with your project.
Excellent instructable!. <br> <br>A refund option could be mechanical. Coins that pass through the counter are collected in a small bin. The customer makes their selection and the coins are dropped into a bucket. If they don't make a selection and select a refund, the coins are dropped out to a refund cup on the outside of the machine... A small servo could activate the midpoint bin, one direction for keep, another for refund.
Very True, I'll have to try this. There is enough (All bar 1) spare pins on the Arduino to try use up ;-) Thats for your input.
Gone to my Blog Post, and voted, too. <br>http://faz-voce-mesmo.blogspot.pt/2012/09/um-makerbot-serio-um-robot-espanhol.html
Thanks very much Edgar, Glad you like it!
What does this do? Are you building a component of a vending machine?
Hey ak08820, you got it. It's the money making part of most vending machine's. So you can attach it to anything you feel like. Could just be used as a fun way to save spare change ;-) <br>
this is great! <br> <br>Keep in mind that if you want to use this in a public place, most places (at least in the US) you need a license from the city/county/state for a coin operated machine, and fines for not having one are seriously hefty. <br>
You need more than a license, you need specific permission from the local government that holds the deed to put one on their property, as you would anywhere else that isn't your own personal property, and then if it were on your own property you may at some point need business zoning, then there's the issue of establishing a business for taxation purposes. It is not so simple to make money with arduino after all!
of course. though by public, I meant publicly accessible, like in a store you own/work at.
this is perfect, I've been eyeing the CH 926 on adafruit for a while, and seeing as I just setup a mysql database to keep track of my money this is giving me the perfect excuse to buy it to automate keeping track of it (yes I know it's overkill for php/mysql but i don't care lol).
What, if anything, do you do with the counter meter gray wire?
You can hook it up to an <a href="http://www.ebay.co.uk/itm/6-digits-12V-mechanical-coin-meter-counter-/260635200110?pt=LH_DefaultDomain_0&hash=item3caf118a6e" rel="nofollow">electronic coin counter</a>. So you'll be able to tell at a clance how much money you've made. I've haven't used one, I just keep count in the program.
Oh ok thanks that makes sense. Also thank you for making this tutorial I had one of these coin slots and was having trouble with it this helps.

About This Instructable

116,497views

258favorites

License:

Bio: Curiosity is the key. The "How"'s & "Why"'s always lead me to pull stuff apart. The "Can I build that" lets me put stuff back together. I Love creating stuff from stratch, even if there are a million others out there, this one's different, It's Mine ;-) More »
More by Skipped:Make Money with Arduino
Add instructable to: