Greenbacks and an Arduino
One of the additions that I want to make to Exuro is the ability to accept money and then interact in different ways with the person who shelled out some of their hard earned dollars. In order to do that, I first need to figure out how to accept a money and process the amount given via an Arduino.
I’m working with a Pyramid Technologies Apex 5000 bill acceptor and an Arduino Uno. The folks at Pyramid Technologies seem to be completely open to helping people work with their products. I purchased a used Apex 5000 on ebay and their support folks were quite willing to answer configuration questions and help me with the project. That’s pretty cool.
It turns out that the Apex 5000 is pretty simple to interface with an Arduino. There’s a configuration setup whereby the bill acceptor will send N 50 milli-second pulses per $1 value of the bill that was read. The configuration that I’m currently working with sends 1 pulse per dollar. So a $1 will send 1 pulse, a $5 will send 5 pulses and so on.
The output line on the Apex 5000 is an open collector which makes things pretty simple. The output line of the bill acceptor is connected to a pin on the Arduino that’s used to count pulses. On the Arduino Uno, I’m using pin 2 since that is one of the two that can support interrupts. There’s a 2K resistor that connects the bill reader output / Arduino pin 2 connection to the +5 V pin on the Arduino. And the ground for the bill collector and the Arduino are also connected.
With this hardware configuration, I’m able to read the pulses from the bill collector. My first attempt actually had the configuration so that there were 10 pulses per $1. But this resulted in completely bogus readings because the whole sequence of pulses could take up to 20,000 milli-seconds for a $20 bill. To start, that’s way too long to wait before making the determination as to the bill domination. And the code was slipping sideways when trying to count the pulses. So I reset the configuration to 1 pulse per dollar which results in a maximum of 2,000 milli-seconds for the largest bill allowed.
Right now, the code is still a little wonky. There’s still a problem with determining the actual dollar value. I suspect that it has to do with the relationship between the interrupt and the simplistic logic in the loop to determine the value. Some more debugging is needed.
There’s a code repository to share whatever way I manage to make this work. Feel free to poke at it with a sharp stick.