Change-O-Matic

March 08, 2013

Change-O-Matic

Every year I throw an Oscar party with my friends, with lots of drinking, yelling at the TV, and low-stakes wagering. Everybody puts in a dollar as each category is announced, then that pot is split among everyone that made the right pick. After almost 20 years of doing it the same way, I finally got tired of counting out the change after each win. $1.65 times nine winners equals clinking coins for minutes.

So why not do what grocery stores and fast food restaurants figured out long ago and automate the change dispensing so any middle-school dropout can do it? I present to you the Change-O-Matic.

I picked up a used change dispensing machine on eBay, and after some trouble with the seller sending Australian coin canisters instead of US, I got it working. The model is a Telequip Transact 2+ CE. I can’t vouch for how well my system would work with other machines in their lineup, but I would assume some compatibility.

I found some basic documentation online about what connection settings it expected (9600 baud, 7 data, 1 stop bit, even parity), then with a serial monitoring program and a copy of the test & configuration software I was able to see what was being sent to and from the machine.

First to be sent are some control codes to reset the machine and tell it a change request is coming. Then the change amount is sent along with a checksum. I didn’t know how the checksum was calculated, but with only 99 options it was easy to record them all with the serial monitoring program and store them.

To drive it I used an Arduino, a serial shield, an LCD display, a numeric keypad, and some buttons and switches, and built it all into a Radio Shack project box that I milled some openings into. Paint and custom waterslide decals turned it into the Change-O-Matic. The outside looks a lot better than the mess I crammed inside. I plan on improving the design later with a custom PCB combining the microcontroller and serial driver, a serial port on the outside of the box instead of just a hole cut for the cord to pass through, and a rechargeable battery pack. I think I can get it down to about half the size.

I programmed two modes into Change-O-Matic: Oscar mode, where you enter the number of winners and the number of players and it calculates and dispenses the take for the winners, and Change mode, where you simply enter the amount of change and the number of times dispensed (0.35 x 3, for example). A two second delay between each batch of coins allows time to scoop out the change before the next comes.

At the party everything worked as planned, and change was dispensed quickly and accurately all night long. I wasn’t able to find a middle-school dropout to run it, but a friend’s elementary student took the job instead, freeing me for more drinking and yelling.

I’m not going to post the code for the entire project, but only the basics required for the interface with the change machine. I couldn’t find anyone else that had done this work with the change machine; everything else you can find better examples for online.

Interestingly, there doesn’t seem to be any kind of authentication between the change machine and whatever’s sending it commands. If you plugged this into the dispenser at the grocery store I think it would start spitting out the change you asked for. Standing there for 5 suspicious minutes while the machine dispenses $100 in loose change is not a risk/reward ratio that many people would find worthwhile, though.

Here’s a quick video of it in action, though I use the term “action” quite loosely. You’ll find the code immediately below that.

Change-O-Matic from HaHaBird on Vimeo.

#include "Wire.h"
//============================================
//            Inits
//============================================

// control codes used to communicate with the dispenser
byte STX=0x02;
byte ETX=0x03;
byte EOT=0x04;
byte ENQ=0x05;

// array of checksums, their position in the list 
// relating to the change amount requested
// so to get 45 cents you would also need to send checkSumArray[45].
int checkSumArray[]={ 
  0x00, 0x32, 0x31, 0x30, 0x37, 0x36, 0x35, 0x34, 0x3B, 0x3A, 
  0x02, 0x03, 0x00, 0x01, 0x06, 0x07, 0x04, 0x05, 0x0A, 0x0B, 
  0x01, 0x00, 0x03, 0x02, 0x05, 0x04, 0x07, 0x06, 0x09, 0x08, 
  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 
  0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 
  0x06, 0x07, 0x04, 0x05, 0x02, 0x03, 0x00, 0x01, 0x0E, 0x0F, 
  0x05, 0x04, 0x07, 0x06, 0x01, 0x00, 0x03, 0x02, 0x0D, 0x0C, 
  0x04, 0x05, 0x06, 0x07, 0x00, 0x01, 0x02, 0x03, 0x0C, 0x0D, 
  0x0B, 0x0A, 0x09, 0x08, 0x0F, 0x0E, 0x0D, 0x0C, 0x03, 0x02, 
  0x0A, 0x0B, 0x08, 0x09, 0x0E, 0x0F, 0x0C, 0x0D, 0x02, 0x03};

//============================================
//            Setup
//============================================

void setup() {  
  Serial.begin(9600,SERIAL_7E1); // serial settings required by the Transact
}

//============================================ 
//            Main Loop 
//============================================

void loop(){
   // dispense change from 1 - 99 cents with a 2 second delay
   for (int i=1; i<100; i++){
        dispenseChange(i);
        delay(2000);
    }
}

//============================================ 
//            Change Dispense 
//============================================

void dispenseChange(int cents){

    //send reset
    Serial.write(EOT);
    Serial.print("Cr");
    Serial.write(ENQ);

    //send the change command
    Serial.write(EOT);
    Serial.print("C");
    Serial.write(STX);

    //send the change amount
    Serial.print(cents);   
    Serial.write(ETX);

    //send the checksum
    Serial.write(checkSumArray[cents]);
}

Leave a comment

Comments will be approved before showing up.


Also in Projects

The Laboratory Lamp
The Laboratory Lamp

February 17, 2016

First created in 1860, the Erlenmeyer flask has come to symbolize chemistry, and by extension science as a whole. I wanted to use that symbol to create an item of functional decor, and what better for that than a lamp, with the relationship between the light bulb and the “aha!” of an idea?

 

View full article →

Garbage In, Garbage Out
Garbage In, Garbage Out

February 04, 2016

For over a decade I’ve had kicking around in my garage’s attic the cases from a couple of old original-style Macintoshes, waiting for just the right project.

One day, after staring at them stacked in my office, I realized that they had a similar form factor to the classic bullet-top garbage cans with the swinging lid. I could give one of these a new (slightly unceremonious) life as a garbage can!

View full article →

Moon Phase Purse
Moon Phase Purse

January 20, 2015

I’ve been going through a moon phase recently (pun absolutely intended), and thought it would be fun to make a wearable or totable that displayed the current state of the moon. There would be a bit of hardware involved, so a purse seemed like the perfect vehicle—you’re already carrying a load of other things, so there’s no harm in the addition of a small battery pack or a pile of LEDs.

 

View full article →