Advise on project

Discussion in 'General Electronics Chat' started by goicox, Dec 12, 2012.

  1. goicox

    Thread Starter New Member

    Dec 12, 2012
    4
    0
    Dear All,

    I would like to receive your advise on how would you implement the following project.

    I would like to connect a coin acceptor device that has serial / usb connection to an embedded linux box with limited memory (flash and storage of about 32 MB and USB and Ethernet ports). The coin acceptor produces an analog output (0-12 V) when a coin in inserted. The output voltage depends on type of coin inserted. As you could imagine the final goal of the project is to know which coin was inserted in the linux and to do something with this information (e.g. print a ticket).

    My idea is to place a small micro-controller connected between the coin acceptor and the linux box. The micro-controller will be in charge of converting the analog signal to a digital one and if possible to generate the information about the type of coin inserted.

    Could you please advise on how would you implement this project? My initial though was to use an Arduino board (nano) or to create an special USB controller for linux. Note that I am good with programming, but I am not familiar with micro-controllers.

    Thank you in advance :), Goicox
     
  2. SPQR

    Member

    Nov 4, 2011
    379
    48
    Hello and welcome to the forum.

    So it seems you just need an analog to digital converter, and then to convert the digital to (I'll assume US coins) penny, nickle, dime, quarter, 50 cents, 1 dollar (6 coins).

    There are many chips that can do that - HERE are a few - and they are cheap.

    A voltage divider, the chip, a simple connector to your linux box, and you should be able to write a simple program that says "If 10010 then nickel if 11001 then dime..." etc.
     
  3. SolderFlux

    New Member

    Dec 6, 2012
    9
    1
    Agreed with your solution it is the most effective way.
     
    Last edited: Dec 12, 2012
  4. goicox

    Thread Starter New Member

    Dec 12, 2012
    4
    0
    Thank you for your answers (SPQR and SolderFlux) and link.

    This is exactly what I wanted to do, although with the arduino board for simplicity.

    * Now, if use the analog to digital converter as suggested, how do I program it (probably there are tons IDE to do this)? I am good in C/C++.

    * What about the "simple connector", it will be plug on an USB port. Can I buy the connector somewhere?

    * On the linux box, do I need to make a linux controller for this? Perhaps there are already available controllers for these chips!

    Thank you in advance, Goicox
     
  5. BReeves

    Member

    Nov 24, 2012
    412
    64
    Most coin and bill acceptors I have had expierence with will output a series of pulses depending on what bill or coin is inserted. On my last project I used a Teensy microcontroller to read the pulses and send a serial text string to the computer via the USB port. The Teensy web site has the serial to USB driver and am thinking they have one for Linux. The Teensy also supports the Adrino program with many examples making it fairly easy to program the microcontroller.
     
  6. SPQR

    Member

    Nov 4, 2011
    379
    48
    Ok, I think we're at a point where we need more info.

    I assumed the following:

    You have a box that collects coins and has three wires coming out of it.
    One wire is ground.
    One wire goes positive when there is a real coin to be counted.
    One wire gives a voltage "V", depending on the type of coin.

    You have a "linux system".
    A computer with memory, a drive (hard or SS)
    Linux is the OS
    The computer has some I/O ports.

    If you have that system, then you could do a simple A to D converter, put the "yes I have a coin" and "here is the type of coin" on one of the parallel ports, then write some C code to convert that information to "I have an X coin".

    If you don't have that, then you could use an Arduino, put the voltage on one of the analog pins, convert it to a "coin" pin (one of the digitial pins - easy coding) and your off!


    Perhaps you could explain your system a bit more.
     
  7. goicox

    Thread Starter New Member

    Dec 12, 2012
    4
    0
    SPQR, thank you for your reply !

    The linux box is actually an embedded system (Linux-based firmware - http://www.dd-wrt.com). This means that the processing power of the linux box and available memory is limited. There is no hard drive, the storage is made on a flash memory of 16 MB. There is only one USB port. On the other side, the coin acceptor is a standard one and works as you describe it.

    Regarding the Arduino part, as you mentioned is quite simple. There is a similar video in youtube:

    http://www.youtube.com/watch?v=wLgWcS-utIM

    ** Still, I got interested on the idea you mentioned of using an cheap analog to digital converter chip. Could it be possible to know how do you program these chips and how could you connected it to talk to the USB port?

    Thank you in advance, Goicox
     
  8. SPQR

    Member

    Nov 4, 2011
    379
    48
    An analog to digital chip doesn't need to be programmed - it just needs to have the voltages applied to it with the correct resistors.
    HERE is the datasheet of the 0801. Page three has a typical hookup. You would need to adjust the resistors so that all of the digital information comes out of 3-4 bits. But the problem is getting that digital information onto a USB connector.

    The problem is that USB is a serial only connector - so you're going to have to go from analog to serial digital. Then program you Linux system to accept the information as serial, then convert it to a "coin type".

    The only way I can think of doing it is to use an Arduino USB board, then connect the two systems.

    But there may be other ways, such as noted HERE.
     
  9. SPQR

    Member

    Nov 4, 2011
    379
    48
    Looking at the Youtube you posted, it uses the Adafruit coin counter.
    I've used Adafruit stuff before and it is very reliable.
    On their site they have all the code you'd need to get it up and running on an Arduino.
    HERE's a webpage for programming a serial port in VB.
    Looks pretty straight forward.
     
  10. goicox

    Thread Starter New Member

    Dec 12, 2012
    4
    0
    SPQR thank you for your great advise. To start the project I have ordered an Arduino nano.

    The link to the serial USB port is great!!! I will try to make it run in the embedded-linux box.
     
Loading...