Got some barcode scanner off ebay. It's the usb type 1d barcode scanner. Model type MJ-4209 . A picture of the MJ-4209 laser Barcode scanner

It came with a manual full of barcodes that allows for scanning it to set settings.

One of it was for version control. Which when scanned gave:

MJ_tech V3.00 2014/03/01

If you need a copy of the manual, here it is:

barcode manual as png

If you need the pinout, for the scanner, then here it is as well from the datasheet for MJ-4209

pinout for MJ-4209 as png

Interesting side note to observe:

  • In ps2 keyboard interface mode, there is PCCLK/PCDATA as well as KBCLK/KBDATA . You can infer from these keywords (and confirm with a google image search), that the scanner essentially acts as a pass-thorough for a ps2 keyboard ( KBCLK/KBDATA --> PCCLK/PCDATA ) . Incidentally, this is also a good spot to place a keylogger. Especially for paranoid organizations that likes to do weird things like "gunk up the usb slot" to prevent leakage of sensitive information. :D
  • Settings is only between KB/USB or UART. You can notice that the PCCLK/PCDATA pins is the same for usb mode. Recall that there is usb to ps2 adaptors for usb optical mouses. This is since ps2/usb mode is autodetected by the fact that usb is using balanced pair transmission and ps2 doesn't (it uses serial on one line plus a clock signal on the other. If you detect a steady pulse on one line only, then it's probbly a ps2 slot.)
CAT5 ETHERNET CABLE:
Pin Number  Strand color
1   orange stripe
2   orange
3   green stripe
4   blue*
5   blue stripe*
6   green
7   brown stripe*
8   brown*

Ethernet Pinout Front View: 
   ______________________  
  /                      \  
 /                        \ 
+--------------------------+
|  8  7  6  5  4  3  2  1  |
|                          |
+-----+              +-----+
      +--------------+      

SRC: 
* http://www.gnswireless.com/bulk_cat5e_ethernet_cable.htm
* http://www.cscape.net/modplugstandard.html

This two will allow you to interface with the device using a normal Ethernet cable modified to tap into those pins (remember to ensure the RX and TX lines are not twisted).

So we want to tap into UART mode using standard "RS-232/TTL" pin-out via an Ethernet cable

If an Ethernet cable has the correct configuration, we can save time by just using the colours. Recall the pinout for both the scanner and Ethernet. So when combined:

Ethernet cable pinout Vs scanner pinout:
(Ethernet uses 8pin, scanner port uses 10pin

 EthPin# | Eth Cable colour | ScanPin#  | scanner pin function
-----------------------------------------------------------
                            |   1       |    NC
    1    |  orange stripe   |   2       |    +5V
    2    |  orange          |   3       |    GND
    3    |  green stripe    |   4       |    RXD
    4    |  blue*           |   5       |    NC
    5    |  blue stripe*    |   6       |    NC
    6    |  green           |   7       |    NC
    7    |  brown stripe*   |   8       |    RTS
    8    |  brown*          |   9       |    TXD
                            |   10      |    CTS

So judging from the pinout. The standard Ethernet cable can connect pretty much everything, except for the CTS line. (Luckily) This will not matter for our purpose, as I plan to just use 5V,GND,RX & TX lines only, using software flow control.

What's the ethernet colour to use when wiring for scanner uart?

Thus using typical Ethernet cable would be wired as this:

StripedOrange == 5V | Orange == GND | GreenStripe == RXD | Brown = TXD

So! Let's wire it up!

I got a spare ethernet cable, I got an FTDI FT232RL SERIAL/USB dongle, and I got a scanner.

So, basically, I cut the ethernet cable in half (using the above cable colour direction as a guide), wired the RX to the TX of the dongle and the TX to the RX of the dongle. Hooked up the power supply rails. Plug the serial/usb dongle, and boot up a serial console.

|   ETHERNET CABLE      |       |   SERIAL TO USB       |
| Connected to MJ-4209  |       |   Converter           |
| 1D Barcode Scanner    |       |   FT232RL (By FTDI)   |
|=======================|       |=======================|
|                       |       |                       |
|   StripedOrange | +5V |:-----:| +5V | Power Rail Upper|
|   Orange        | GND |:-----:| GND | Power Ground    |
|                       |       |                       |
|   GreenStripe   | RXD |:-   -:| RXD | Serial Receive  |
|                       |  \ /  |                       |
|                       |   X <--crossover (not joined) |
|                       |  / \  |                       |
|   Brown         | TXD |:-   -:| TXD | Serial Transmit |

When done, it shall look like this:

A picture of the MJ-4209 laser Barcode scanner hooked to an FTDI Serial to USB dongle

Now, I set the scanner to "UART 9600, NO, 8, 1" ( Using the document manual called "Manual Guide" that you can find in this page).

After that, when I scan the MJ_tech demo barcode, it actually showed up! However, it didn't have newline inbetween, so hard to tell which is a new barcode. So in the "Data Edit Setting" I switch the scanner to use "CR+Skip" \r\n, but you could also use "skip" \n, or TAB \t. Depends on how you code the destination microprocessor's firmware (Or PC etc...).

This is what it looks like when you use CR \r only:

MJ_techMJ_techMJ_techMJ_tech

Thus in general, you would prefer to use either "skip" \n or "CR+Skip" \r\n

MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech
MJ_tech

So that's it! You got it interfacing over UART! (Oh and btw, I used the Arduino serial console to talk to the FT232RL. It was set to 9600 baud, set to "Both NL & CR" )

So what does this mean?

It means you could potentially hook this to a microcontroller, or an arduino project, since you now know the pinout of the serial uart cable for this scanner.

What can you do with this capability? Well how about this idea. Automated inventory management on the cheap etc...

Let me know if this is helpful to you on the comments below XD

Extra stuff from MJ-4209 datasheet

Here are the characteristics from the same datasheet:

Net weight : 115 g
Material : ABS+PC
Voltage : 5 V +/- 10%
Current:110mA , idle 10mA
Color: gray, black

Performance Characteristics::

Scanner type:        bi-directional
Light source:        650nm Visible laser diode
Scanning Rate:       100 scans per second
Scanning distance:   2.5mm-600mm
Scanning scope:      18CM
Print contrast:      25% minimum reflective difference
①Roll(tilt):       +/- 30degrees
②Pitch:                +/- 45 degrees
③Skew(yaw):            +/- 60 degrees
DecodeCapability:   UPC/EAN, UPC/EANwithsupplementalsCode128, UCC/EAN128, Code39Code39FullASCII, Code128FullASCII, Codabar, Interleaved2of5, Code93, MSI, Code11, ISBN, ISSN, china post code, etc
Bit error rate:      1/500million
Resolution:          4mil(0.1mm)
Tip :                buzzer and led
Scanning mode :      Press button, Automatic continuous scan Auto-induction,
Working times of button :    3 million times
Working hours of laser:      10000hours
Interfaces supported:        RS232,keyboard wedge, USB.
Cable length:                2M

User Environment::

Working temperature:     0oC-45oC
Storage temperature:     -400oC-60oC
Relative humidity:       5%-95%(Non-condensing)
Anti-shock design:       withstand 1.8M drops
Ambient light immunity:  immune to direct exposure of normal office and factory lighting conditions, As well as direct exposure to sunlight.

Regulatory::

Electrostatic discharge:     certified to ±15KV air discharge and ±8KV of contact discharge
EMI/RFI:                     FCC Part 15 Class B,European Union EMC Directive,Taiwan EMC,CE
Laser safety:                CDRH Class II,IEC Class 2
environmental protection:    certified to RoHS directive 2002/95/EEC

Related:

  • http://www.reddit.com/r/hardware/comments/1w6a2t/upccodescanner_question/
  • http://www.symcode.net/support/2013-10/05092551765176.pdf