Intro: Electronic Piggy Bank
So browsing the sparkfun website, I came across a three type coin acceptor. My first thought: "what project will I come up with to justify buying this?" And my answer was an electronic piggy bank. Thus I ordered the acceptor. And now I share my project. I have two versions of this; each of which are basically the same thing. So lets get started. iPod cameras aren't really that great.
Step 1: Things You'll Need
Some of these can be ordered from the sparkfun site also. Others, not so much.
Three coin type acceptor (they also have a six coin type for $45.00)
Various LED's and some 330 ohm resistors (I used LED assemblies from radio shack because of the internal resistors)
A circuit board (I couldn't find a link)
A five volt and a twelve volt regulator
A 16 pin DIP socket
A 4040 binary counter
A "NO" push button (like in VCR's and such)
A 10 K resistor
Solder, soldering iron, connection wire, wire cutters, wire strippers, safety glasses, any other soldering tools you want.
And some power source between 12 V and 30 V. One amp should be plenty.
Step 2: The Circuit Theory
The coin acceptor uses 12 V, thus the 12 V regulator. It outputs 5 V of power, thus the 5 V regulator. The acceptor outputs a pulse train on it's white data line. The number of pulses is determined when you program it; it's equal to the set coin value. This line will be connected to the counters clock pin. Whenever the clock pin goes low (set the acceptor to "NC" so that the pin goes low for each pulse), it increases it's count by one and outputs it in binary. The LED's are used to see these values. By using LED assemblies, you can mount them inside the box towards the front. However, they MUST be mounted BEFORE being soldered (a large miscalculation on my part).
In my first version, I used six LED's. This was a miscalculation due to it could only count to 63 cents. I have a version B now which uses all 12 pins for a total of $40.95. However, I had to use LED's mounted to the board and external resistors.
Step 3: Mount the Regulators and DIP Socket and Button
The socket is to prevent the 4040 from overheating during soldering. The button is to reset the 4040. This is necessary on initial boot because a random value will be output. We mount these items first because they are the largest. Well, minus the button. I put my button in the lower corner away from everything else to make it easier to access. Your plan may be different. Just keep the circuit the same. I started by connecting V<sub>in</sub>to the regulators and the regulators to their respectively powered device.
I also connected a 10 K resistor to the button and that connection to the reset pin on the 4040. I put the button to the 5 V line and the resistor to the 0 V line. I then went and connected all the ground lines to the 0 V line.
Step 4: Connect the LED's
Connect the LED's to their respective data pins. I used alternating color so it would be easier to distinguish the bits.
Step 5: Connect the Acceptor and Power Input; Mount the Board
By this stage, I had the acceptor mounted to the box. I had brought the four connection wires out the side, so that's where I mounted the circuit board. The red wire goes to the 12 V regulator. The black wire goes to the 0 V line. The white wire goes to the 4040 clock pin. The grey wire goes nowhere. The Vin line gets a red wire and the 0 V line gets a black wire. These wires go to wherever your power source is.
Not documented is the mounting of the PCB. It is recommended that you cut a hole just inside the parameter of the PCB so the copper/solder side does not press on the box.
Step 6: Finishing Touch and Testing
Now is the time to see if it works. Grab a 4040 and insert it in the socket. Now apply power. If some LED's light up, you're good. If no LED's light up, you may still be good. It's just the 4040 falling to some random value. If the coin acceptor beeps a few times, it's good to go. Reset the 4040 and insert a coin. If the LED's flash, it's all good. The 4040 will keep track of your money count, but only as long as it remains powered. I chose this rout as I didn't want to do any programming and I had some 4040's lying around.
Step 7: Possible Revisions
There are a few things that could be changed. Just today I replaced the assemblies for surface LED's and resistors. You can also add a power switch, which I am going to do soon. You can use a micro controller to keep track of money so that it does not reset on power off. You can also replace the LED's for 4-digit seven-segment displays so that you do not have to convert binary to decimal, unless you're into that. Image soon of my most current version.