[SOLVED] Apex Serials 5000 Bill Acceptor with Arduino Mega 2560 over Serial (600 baud, 1 start bit, 1 stop bit, no parity)



  • I'm trying to get a Apex Series 5000 Bill Acceptor to communicate with an Arduino Mega 2560. When I plug the Bill Acceptor's output Serial TTL line into the raw Serial input port (TX0->1) of the Arduino and run the Windows program RealTerm, the data can be seen in the Terminal.

    Screenshot: http://i.imgur.com/Nt0LyVs.png

    81 (hex) means 1 dollar was inserted in the bill acceptor.

    When I try to use the Arduino Mega's Serial1 input port, it doesn't recognize and display the input from the bill acceptor.

    Source code: http://codebender.cc/sketch:58090

    Is the config in the screenshot different from the config in the source code?


  • Hero Member

    Is the config in the screenshot different from the config in the source code?

    Yes it is, I see Realterm using 600 baud and with the Arduino source code you seem to use 115200 baud.



  • @daulagari 115200 is for the regular interface to read the serial output. Serial1 is at 600 baud and is connected to the bill acceptor.


  • Hero Member

    115200 is for the regular interface to read the serial output. Serial1 is at 600 baud and is connected to the bill acceptor.

    Right, reading too fast.
    But then I do not understand:

    When I plug the Bill Acceptor's output Serial TTL line into the raw Serial input port (TX0->1) of the Arduino and run the Windows program RealTerm, the data can be seen in the Terminal.

    So the Bill Acceptor's output Serial TTL line goed into the raw Serial input port (TX0->1) of the Arduino but how do you see then the output in RealTerm (which is set to 600 baud?)



  • @daulagari The Arduino can be used like it was a serial to USB adapter. Just plug the wire(s) in to RX0 (Pin 0) and TX0 (Pin 1) and load up a terminal host (ex: RealTerm). The output serial line is connected to the Arduino TX0, The data passes through without the Arduino being programmed to do anything.

    It works similar to one of these devices which can be used to program the Arduino Pro mini or as a general TTL serial port: http://www.ebay.com/itm/360916810060. An example use case is reading GPS data though a serial to USB adapter.


  • Hero Member

    The Arduino can be used like it was a serial to USB adapter. Just plug the wire(s) in to RX0 (Pin 0) and TX0 (Pin 1) and load up a terminal host (ex: RealTerm). The output serial line is connected to the Arduino TX0, The data passes through without the Arduino being programmed to do anything.

    Okay, did not know that, thanks!

    Yes, then the behavior you describe, the Arduino Mega not recognizing the data, is really weird.



  • I'm going to try using Software Serial on an Uno instead of Serial(1 to 3) on the Mega


  • Hero Member

    @jesse
    Thoughts:

    Did you get any "serialEvent1 called" debug output?

    Try moving lines 17-20 inside the loop function.

    I assume RealTerm is now configured for 115,200 baud (rather than 600) when you run the code.

    I assume that you've connected the bill accepter output to RX1 (vs Tx0 in the direct connection, since you want to go into the ATMega, not replace it's TX output).

    By the way, you might have some trouble with Software Serial at that low a baud rate, if it keeps interrupts disabled for too long while receiving a byte (16.7 msec per byte). Not sure if it does that for receive-only, you can check.



  • @Zeph I found the problem by connecting the Serial output line to analog pin 0. Low was about 320/1023, floating was about 330/1023, and high was about 340/1023. I used the internal pull-up on Serial1. Then it became possible to read the Serial data.

    The embedded code in the first post was updated automatically as work progressed.




 

320
Online

8.3k
Users

9.1k
Topics

96.7k
Posts