DE2120 very occasionally reverts to USB Mode — scanner.begin() returns 0 intermittently

Hi,

I’m using the SparkFun DE2120 2D barcode scanner with an Arduino Uno via hardware serial (TTL/RS232 mode). The scanner is powered directly from the Arduino’s 5V pin — no USB cable is connected.

The problem:
In most cases, the scanner starts up correctly in TTL/RS232 mode. However, very rarely (not every time), scanner.begin(hardSerial) returns 0 and the scanner’s illumination light turns off almost immediately after startup, as if it has reverted to USB Mode.

When this happens, pressing the scanner’s button to force a scan restores normal operation. After that, scanner.begin() succeeds again.

Questions:

  1. Could a brief power instability (e.g., brownout on startup) cause the scanner to reset to factory defaults?
  2. Has anyone else experienced this kind of rare, intermittent reversion to USB Mode?
  3. Is there a reliable way to prevent this, or should I send the POR232. command programmatically at every startup as a workaround?

Any insight would be appreciated. Thank you!

  1. Yes it could, that is my main guess/suspicion
  2. I don’t think so…
  3. That seems like a decent idea, and/or adding delays might help

I’d try a mean-well supply and the 2 code changes (POR232, delays) and see how that goes…one at a time, though