Read RS232 Barcode Scanner

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

Read RS232 Barcode Scanner

Postby dreamsteven » Fri Apr 12, 2019 12:18 am

From the tittle above i need some advice for my bar-code scanner .
I am using the RS232 barcode scanner
https://www.lazada.com.my/products/embedded-1d-2d-barcode-scanner-reader-module-ccd-bar-code-scanner-engine-module-with-rs232-interface-i140694063-s161534741.html?spm=a2o4k.searchlist.list.1.32ca3369etb0YU&search=1
A RS232 to TTL converter
https://www.lazada.com.my/products/pcb-3v-5v-serial-port-rs232-to-ttl-converter-module-for-diy-project-i480836553-s802816738.html?spm=a2o4k.searchlist.list.1.2d196978bIm5tg&search=1
Arduino board using the Mega
Connect RS232 barcode scanner with Rs232 to TTL converter using a null RS232 modem

CODE: SELECT_ALL_CODE
#include <SoftwareSerial.h>

SoftwareSerial mySerial(19, 18); // RX, TX

void setup() {
 
  Serial.begin(9600);
}

void loop() {
  if (mySerial.available()) {
    int val = mySerial.read();
    Serial.println(mySerial.read());
  }
  if (Serial.available()) {
    int val1 = Serial.read();
    mySerial.println(Serial.read());
  }
}


RS232 to TTL converter's TxD and RxD are connected to arduino pin 18 and 19.
After the scanning TxD and Rxd not blinking at all.
Serial monitor also didnt have any outcome.
Thanks.
dreamsteven
Fledgling
 
Posts: 1
Joined: Thu Apr 11, 2019 11:55 pm

Re: Read RS232 Barcode Scanner

Postby ober » Sat Apr 13, 2019 5:22 am

Not familiar with the devices as we do not carry it, but looking at what you like to do, you are using Arduino mega as a USB to Serial bridge right?

Why don you just connect the RX and TX of the RS232 to TTL Converter to D0 and D1 or Mega, and reset the mega while testing it? Just connect a jumper wire from Reset pin to Gnd on the female header (near to power jack). This will keep Atmega2560 in reset mode and will not interrupt the USB to Serial IC on Mega itself.

BTW, it seem you did not initialize the software serial in your code, you "begin" hardware serial, but did not do anything with the softserial.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 19 guests

cron