Arduino and CueCat barcode scanner
– unencrypt the barcode in software on the arduino
– i didn’t want to cut into the Cuecat in case I broke it, not hard to replace, but that’s not the point 😉
– get it to write only the bar code to the serial port, and I can use some terminal emulator (TeraTerm,Putty or SecureCRT) to write the data to a file as I furiously scan like a boss all items with a barcode in the house.
Step 1: Connecting the CueCat to Arduino
There is no continuous path between the 2 ports (Except Power and GND) as a multimeter and continuity test confirmed. So using the female port as a way to access the cuecat signal did not work.
The Cue cat cable has 6 wires, marked on the board as 1-6
1. Brown (+5V)
2. Red (DATA Female connector)
3. Black (Clock Female Connector)
4. Orange (DATA Male connector)
5. Yellow (Clock Male Connector)
6. Black – Cable is thicker than other black (Ground)
When cut, the female adapter, has the following which will map to the connector inside the Cuecat as follows
1. Brown (+5V)
2. Red (DATA Female connector) to Orange(pin4)
3. Black (Clock Female Connector) to Yellow (pin5)
4. Bare wire (GND)
I tinned the wires with flux and solder to make them a little more durable, and wired them to a terminal shield on the Arduino.
Step 2: Getting the first code
The only thing to watch out for is;
– The CLK is used as interrupt, and so ensure you connect to a pin that supports interrupts
e.g. on the Mega 2560 http://arduino.cc/en/Main/ArduinoBoardMega2560
External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2).
I used Pin 3… Which is a bit annoying as now all the pins are not on same side of the board 🙁 (first world problems)
And a few swipes, check all wires are connected right and …
TIP: Look at ASCII codes, NOT printable characters…
You can see I played with the code a little, as when looking at output there are always non printable characters, so I wrote the code to show the ASCII code.
OUTPUT ASCII value -> printed Character
International Keyboard Test:
[deleted for brevity…]
Note that there does not seem to be anything strange at the start, but the end is /13 which is a Carriage return, ie, end of the code
I did expect to see ALT-F10 being sent as on my linux box it kept minimising and expanding the window on each scan, and that is the keystroke that does that… if the Arduino doesn’t see it, then I am OK with that…
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
This Post / Project can also be found using search terms:
- arduino barcode scanner
- arduino barkod sorgulama
- barcode reading using esp8266
- ps2 barcode scanner arduino projects