Barcode/qr code sanner with rs232 pins connecting to arduino uno

Hi everyone, can someone help me? I'm having a problem with my scanner. I connect my rs232 4pins directly to my arduino and everytime I scan a bar/qr code it gives me gibberish output.


1 Like

You might want to look at this How to get the best out of this forum before you proceed any further.

The Arduino Project section where you first posted means the Future of the Arduino and how it should develop. So it was the wrong section to select. I have moved it to a better place.

You can't do that, you have to translate both the the logic and voltage values before it will work.

You might have just fried you Arduino. Will it still load the blink sketch?

Sorry for the mistake. But how can I solve this problem? Since rs232 is not compatible to arduino uno.

You need to use an RS232 to UART converter.
They typically look like this:

It converts the RS232 signal (which can be from +3V/-3V to +15V/-15V) to the 0V/5V required by your Arduino.

You would also need to buy/make a lead to connect the scanner to the 9 way D connector.

1 Like

Alternatively use a MAX3232 chip (you can get them with conventional through hole 0.1" pitch mounting) and make one yourself on strip board. Then you only need to put on sockets / pins you need and you don't have to make any adapters.

Or you could simply get a RS232 to USB cable.

1 Like

Is this truly an rs232 interface, or is it actually a serial port that uses 5V logic levels? If it's just a serial port, you can connect it directly to the Arduino, but you need to get the baud rate right. And you also have to send the data through the Arduino correctly.

do I need to connect my rs232 to UART converter to scanner? or to arduino uno?

this is a qr/barcode scanner that uses rs232 port with 5pins 4wires. I saw on the documentation that you should not connect the 4 wires directly to arduino.

You connect it to both the scanner and your Arduino Uno, between the two.

The Arduino Uno connects to the 4 pins, labelled VCC, RXD, TXD and GND.
The MAX3232 IC in the converter generates the higher voltage required for RS232 from the Arduino 5V supply.
The scanner connects to the 9 way D connector.

As Mike pointed out in post #5, you won't need an adapter for the D connector, if you have a converter such as this one from Adafruit, that don't use D connectors.

1 Like

Thank you for the response but I think when you said that I got into trouble. I'm using this set up and can't connect my usb to serial adapter in my scanner.



I didn't realise that you already had an RS232 to UART converter - I thought you would need to buy one.

The adapter lead that you have got plugged into your converter is wrong for this application. That converts an RS232 signal to USB.

I would suggest that you get a 9 pin D connector (male), and fit it to the lead that you have coming out of the scanner, with the black, red, green and white wires.

There are D connectors available with screw terminals if you can't or don't want to solder to the wires.

1 Like

is it okay if I cut the usb to make it 4 wires and then connect it with my scanner?

No, I don't think you can do that.

There is circuitry moulded into the D connecter cover. You can see it through the blue plastic.

If you just cut off the USB plug, the signals on the wires will still be USB signals. The wires don't connect directly to the D connector.

1 Like

so the only way to do that is to connect my 4 wires in qr/barcode scanner to 9 pin D connector (male)?

One option would be to solder your wires directly to the D connector pins on the back of the converter PCB.

See photo below - your PCB might not look exactly like this one.


I would do it by:

  • Stripping an appropriate length of the wire.
  • Tinning the bare ends.
  • Form them into a loop which goes around the part of the pin that comes through the PCB.
  • Solder to the PCB/pins.

Another option (which I would not recommend) would be to simply poke the bare ends of the wires into the pins on the D connector.
This might work, but would be unreliable.

1 Like

hi sir, thanks for the response. but I have another question, where do I put my red wire in 9way d connector?

I don't know the answer to that question without any knowledge of the scanner itself.

Judging by the wire colour, it could be a power supply that might or might not be needed. But that is only a guess at the moment.

Can you tell us the make and model of the scanner, or post a link to the scanner's datasheet/instruction manual?

here's the link of the scanner.

https://shopee.ph/YOYO*-Embedded-1D-2D-Barcode-Scanner-QR-Bar-Code-Reader-Module-Scanner-USB-Connection-for-Gate-Machine-Tickets-Checking-i.64128805.14561537505?is_from_login=true

It looks to me as though it must be the 3.3V to 5V power supply going to the scanner.
Does the instruction manual confirm this?

If so it wants connecting to the +5V from the Arduino.

I found a similar product with mine and same problem. can you tell me how can I use the rs232 interface module in my scanner then how can I connect it with my arduino uno:

this is the same problem I am facing: