January 25, 2010

Coinco 9300-CL Reverse Engineering Part 1

A while back I was able to get several parts to a vending system off of school surplus. Which I was quite excited about, because it was something I had always wanted to be able to play with. However I quickly ran into problems in trying to use it as there was nothing online to help. But, finally with the arduino that I now have, I believe I can make it all work. So I started out by seeing if I can get just the coin changer to interface with my computer via the arduino.

The coin changer is a coinco 9300-CL which from what I can tell is the same as the 9300-L model, but with it requiring 117 instead of a lower voltage. Both seem to have the option of a 15 pin or 12 pin plus, the CL has a 12 pin plug. Using the service manual found here. It explains the pinout and basic operation of the coin changer. However the image for any details of the communication is rather blurry and almost impossible to understand, so I had to do some poking to figure out what was what. To start out the 12 pin plug has 6 vertical pins and then 6 more pins that alternate vertical and horizontal. Pin 1 is the first vertical pin of the all vertical group, starting on the left and then 2 in the middle and finally pin 3 on the right. The rest of the pins follow suit in numbering from left to right on each row. Luckily I had a connector that came from the vending device, so I simple had to use my multimeter to find the connected point on the female connector for the main board. Which was nice as it had the two 117 volt pins removed so I could not accidentally destroy anything!

Using the service manual I have compiled a much easier to read version for the pinout as it was on the female header end of the plug.  You will notice pin 10 and 12 are missing as there is no need for them because another pair of separate wires run to my power supply for those pins.  For basic use it looks like you simple need pin 1 and 2 hooked up to +5 and ground on the arduino and then 3 to a digital output pin and 4 and 5 to digital input pins.  Pin 3 is your TX pin for the serial communication where pin 5 is the RX.  However pin 4 is used as an interrupt that signals when data is going to be sent.  Sadly the service manual only covers a single example of when a coin is used.  This states that when a coin is entered it will send an interrupt to the controller via pin 4 and then wait for a signal on pin 3, which after receiving it will finally send a message with information on the coin and other states.  This is nice, but what I needed is how to connect to it at startup as well. It looks like when the coin changer is first turned on it sends a status request to the controller and will not fully activate until the request is answered.  This is preventing me from actually using it in any way.

So to get around this I hooked everything up to the controller board I already have, that came with the parts, and started intercepting the communication between the coin changer and the controller, using my simple oscilloscope and the arduino to read the serial communication.  For the most part the serial communication is simple enough, however I have yet to figure out the actual protocol used.  From what I have seen online I believe the 9300-CL uses some form of the MDB protocol however I have not been able to quite narrow it down to the 9 bits it should be using if that is the case.  I have tried many different timing setups in order to catch the correct bits, 2400 and 3300 microsecond delays between bits seem to get the best results so far, which I would happily use, if not for the fact that I also need to talk to the coin changer, not just read what it spits out.  So I am now waiting for a reply from coinco tech support to see if they can shed some light on the matter, otherwise it will be a slow process of trial and error till I get the right timing and figure out the correct protocol.

No comments: