0

MCR12 PS/2 Barcode Scanner Defective?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Tue Aug 20, 2019 6:46 pm

I recently purchased one of these, and have had no luck in getting it to scan anything.
https://www.adafruit.com/product/1202

I wired it up to an Arduino Uno using the PS/2 adaptor: https://www.adafruit.com/product/804 with the following connections:
- Green wire (PS/2 pin 4) to 5V
- Black wire (PS/2 pin 3) to GND
- Yellow wire (PS/2 pin 5) to digital pin 3
- Brown wire (PS/2 pin 1) to digital pin 2

I'm using a basic example based on the PS2Keyboard library to read from it. Nothing ever comes out of the port, no matter what barcodes I scan.

Based on the demo video and the forum posts I've read, it seems like it should make a beeping sound when it successfully scans something. Currently it beeps twice when it first powers up, and the red light turns on while I press the button. It never beeps again though, and I've tried scanning a ton of barcodes at varying distances.

Things I've tried so far:
- adding 10K pullup resistors to the data and clock wires
- switching out USB power to the Arduino for a dedicated power supply
- scanning the reset barcode and others from the supplier's config manual (they don't scan)
- disconnecting the data and clock wires and just powering it up via 5V/GND

Am I missing some obvious step here? Have I wired it up wrong after all? It seems really straightforward to use for someone who's worked with an Arduino before, so I'm starting to wonder if I just have a defective part here.

Any advice or assistance would be much appreciated!

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Wed Aug 21, 2019 2:56 pm

What's the simplest way I can confirm whether the scanner is working?

I'm assuming that the scanner will function if only the 5V and GND wires are connected, and that it will beep when it scans something. Is this true, or do I need to correctly set up a microcontroller and read the PS/2 output to confirm that it's working?

Thanks!

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by adafruit_support_carter on Fri Aug 23, 2019 3:22 pm

Just to be sure on this one:
- scanning the reset barcode and others from the supplier's config manual (they don't scan)

Did you try the one here?
https://cdn-shop.adafruit.com/product-f ... arcode.png

adafruit_support_carter
 
Posts: 13503
Joined: Tue Nov 29, 2016 2:45 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Fri Aug 23, 2019 4:01 pm

I tried that one, and there was no obvious response. Should it make a beeping noise when it scans one of the configuration codes like that?

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by adafruit2 on Sun Aug 25, 2019 2:08 pm

yeah if we recall correctly it should beep during a scan, also try pressing the button to perform a scan.
by chance do you have a usb to ps2 converter like https://www.adafruit.com/product/971 cause then you could test it with your computer - its been a while but it definitely was plug n play last time we used it.

adafruit2
Site Admin
 
Posts: 18783
Joined: Fri Mar 11, 2005 7:36 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Mon Sep 09, 2019 2:47 pm

Just tested with an active PS/2->USB adaptor, and it's the same behaviour. Beeps when it's powered on, but no output after that.
I tried scanning several regular barcodes and the "reset" one linked earlier.

It seems pretty likely to me at this point that the module is defective. What's your policy on this?

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by adafruit2 on Mon Sep 09, 2019 4:40 pm

we can refund or replace, your choice :)

adafruit2
Site Admin
 
Posts: 18783
Joined: Fri Mar 11, 2005 7:36 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Tue Sep 10, 2019 4:23 am

Replace would be perfect, as I still want to use this module. Thanks!

Do I need to send back the one that doesn't work?

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by adafruit2 on Tue Sep 10, 2019 1:26 pm

ok email support@adafruit for a new one!

adafruit2
Site Admin
 
Posts: 18783
Joined: Fri Mar 11, 2005 7:36 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Wed Sep 18, 2019 6:42 pm

Tried out the replacement module, and it looks like it scans barcodes now!

I'm still having trouble getting good data out of it though. I've tried scanning a variety of barcodes again, and they all seem to scan with a beeping noise but the data output is nonsense.

I tried first with my USB-PS2 adaptor, and only seemed to get single digit strings like "7" being typed. Then I've tried the recommended PS2Keyboard library with an Arduino, and seem to be having a very similar result to this other person:
viewtopic.php?f=19&t=135596&p=672449&hilit=mcr12#p672449

It outputs stuff like "OB(COX>~#" and "c3+nhn;xk-nd" for barcodes that should be all numbers. I've tried looking at the hex and decimal representations of what it sends back, but it makes no more sense. I used a barcode generator tool to make a few super-simple CODE-128 barcodes, and got the following:
expected: "a", received: "b"
expected: "aa", received: "B"
expected: "hello", received: "NHBO:I"

I've also tried playing around with the keyboard encodings available through the library, but it doesn't seem to make a difference. Am I doing something wrong here in how I'm reading the data? It does seem to respond to some of the configuration codes in the manual correctly, like turning off the beep and changing the scanning trigger behaviour.

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by oesterle on Wed Sep 18, 2019 6:57 pm

Hey, robodwyer!

A belated welcome to the Forums!

Can you post your source code? You can paste it into a reply, highlight it, and press the CODE button above the post editor to nicely format it. On these forums, we love looking at copious source code, serial monitor output, and verbose compilation messages, so don't worry about length!

Also, a couple sharp photos of your wiring might help. 800x600 works well. You can use File Upload, just below the post editor, to add to your post.

Cheers,

Eric

oesterle
 
Posts: 687
Joined: Tue Sep 17, 2013 11:32 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Thu Sep 19, 2019 2:08 pm

I've been testing with this example (and variations to output more info).

Code: Select all | TOGGLE FULL SIZE
#include <PS2Keyboard.h>

const int DataPin = 2;
const int IRQpin =  3;

PS2Keyboard keyboard;

void setup() {
  delay(1000);
  keyboard.begin(DataPin, IRQpin);
  Serial.begin(9600);
  Serial.println("Keyboard Test:");
}

void loop() {
  if (keyboard.available()) {
   
    // read the next key
    char c = keyboard.read();
   
    // check for some of the special keys
    if (c == PS2_ENTER) {
      Serial.println();
    } else if (c == PS2_TAB) {
      Serial.print("[Tab]");
    } else if (c == PS2_ESC) {
      Serial.print("[ESC]");
    } else if (c == PS2_PAGEDOWN) {
      Serial.print("[PgDn]");
    } else if (c == PS2_PAGEUP) {
      Serial.print("[PgUp]");
    } else if (c == PS2_LEFTARROW) {
      Serial.print("[Left]");
    } else if (c == PS2_RIGHTARROW) {
      Serial.print("[Right]");
    } else if (c == PS2_UPARROW) {
      Serial.print("[Up]");
    } else if (c == PS2_DOWNARROW) {
      Serial.print("[Down]");
    } else if (c == PS2_DELETE) {
      Serial.print("[Del]");
    } else {
     
      // otherwise, just print all normal characters
      Serial.print(c);
    }
  }
}



Can't post a circuit image right now, but it's super simple - I have a PS2 female connector from adafruit with the wires for 5V, GND, CLK, and DATA connected directly to 5V, GND, digital 3, digital 2 on the Arduino. I've tried swapping the clock and data pins just in case I got them backwards, and it just results in even more garbled data. I figure the other two connections must be correct since it powers up, scans, beeps as expected, etc instead of lighting on fire :)

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by oesterle on Thu Sep 19, 2019 7:26 pm

It looks like you're using Paul Stoffregen's PS2Keyboard library.

I looked at the source code for that; there's a bug filed on interrupt mapping, and a PR for a fix. I'd try the PR version.

I'd also check for a possible intermittent data or clock/interrupt wire connection, which can easily happen when moving something around like a scanner that's connected with breadboard wires.

oesterle
 
Posts: 687
Joined: Tue Sep 17, 2013 11:32 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Fri Sep 20, 2019 4:17 pm

I doubt that this bug is the cause, given that I'm not using an atmega1284. The interrupt handler appears to be firing since data does get read by the library into it's buffer. If the interrupt mapping was wrong, I wouldn't be receiving anything at all.

I'll double check the wiring and try to debug the clock and data signals without an interrupt so I can see what's happening.

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Re: MCR12 PS/2 Barcode Scanner Defective?

by robodwyer on Fri Sep 20, 2019 4:22 pm

What's strange to me is that I think I'm doing exactly what's described in the product page, and not getting the same results:
For Arduino users, we tried out PJRC's PS2_Keyboard library with great success - just check the 'simple text' example for which pins you can connect to on your 'duino (on an Uno we used digital pins 2 and 3). We suggest our PS/2 adapter cable to make the wiring easy.

I'm even using an Arduino Uno, so a software difference seems unlikely.

robodwyer
 
Posts: 9
Joined: Tue Aug 20, 2019 6:31 pm

Please be positive and constructive with your questions and comments.