CAUTION: I will not responsible for any damage that you faced. FYI, I not really an expert on calculating voltage value and electrical. So, please advise me for any parts that can be harmful.
In this tutorial, I just only show on electronically and programming parts. On the piggy bank’s designing, I leave it to you how to design it.
STEP 1: PARTS and TOOLS
Parts and Components:
- Coin Acceptor with programmable 4 coin from Adafruit – [Malaysia local store]
- Arduino UNO R3
- Jumper Wires
- 16×2 RGB LCD can get it from Adafruit – [Malaysia local store]
- 2.1mm Power Adapter 12v 1A
- Soldering Iron
STEP 2: Power up and Set Pulse for Coin Acceptor
Don’t forget, you need a 12v 1A to power up your coin acceptor. But, we need to cut the 2.1mm jack because we will use it later. So, loose some wire before cut it.
Make sure you know which +ve and –ve.
For how to set Pulse for the coin acceptor, you guys can follow this video;
My Pulse Setting;
Pulse 1 = 50 Cent [old coin]
Pulse 2 = 50 Cent [new coin]
Pulse 3 = 20 Cent [old coin]
Pulse 4 = 20 Cent [new coin]
STEP 3: Soldering
Well, I not really a pro on soldering part, but, what you guys need to do, is to solder the pins because we need to attach the LCD on the breadboard later.
STEP 4: Wiring the RGB LCD
To wiring up the RGB LCD, you guys can follow instruction from Adafruit Learn. I would like to rephrase the words in that instruction – “Do not proceed to next step unless you’ve got this figured out!”. So, make sure you get the correct result.
Don’t forget to test Hello World 🙂
STEP 5: Programming
Now we need to upload code for Arduino. I’m pretty sure you guys know how to compile it.
Generally, the code for Arduino is used to identify the value of Pulse from Coin Acceptor that will pass through. Then with the rules that we had made in the code, the Pulse will be converted to the value that we assign.
Thank you to craynerd for the video on youtube, because he wrote a code that allow Arduino detect the Pulse value from Coin Acceptor. [and of course to Ricky Fisher (rixter) because he re-wrote back the code on comment, make it easy for everybody to learn ].
I’ve use his code as basic to identify Pulse value and add some magic to make sure Arduino calculate the sum value of coins.
Download code Arduino by craynerd http://pastebin.com/ZYXNc5s7
From the craynerd’s code, I make some changes to localize it.
String OnePulse = “50 Sen”;
String TwoPulses = “50 Sen”;
String ThreePulses = “20 Sen”;
String FourPulses = “20 Sen”;
For the Five and Six Pulse, I not going to use it. So, let it be.
Let’s test the code. To wiring up Coin Acceptor and Arduino you may refer this diagram;
The white wire is pulse wire, attach it to pin number 3 on Arduino. Pin the Ground to the breadboard as well. Your Arduino is power up by USB cable, while Coin Acceptor is power adapter.
Use Serial Monitor to ensure Arduino detect Pulse value. At this moment, there are no text output displayed at LCD at the moment because we not set anything yet.
- Already set Pulse Value for the Coin Acceptor, powered and attached to Arduino.
- RGB LCD is attached and working, but no text output.
- Code uploaded, and able to identify coin value in serial monitor, LCD no text output yet.
If there is nothing wrong with your project, you may compile the code below on Arduino. I already add some magic to sum up total coin and will display it on the LCD.
Download New Code http://pastebin.com/XS4SwwbU
Now, we need to merge it and do some housekeeping on it. So, cut off all power source and refer diagram below;
Once it done, test it.
STEP 7: DESIGN
At this step, it’s depends on your creativity to design your own piggy bank.
Thank you, please assist me if there are any errors in this tutorial.