Connect thermal printer reciept to arduino through module rs232

Hi... I Connect thermal printer reciept model xp-v320m to arduino UNO through module rs232....
Connect RX from module to TX arduino
And TX module to RX arduino
And VCC module to 5 V
And GND module to GND

I need a code to print (Hello)

Thanks in advance :slight_smile:

Serial.println(“hello”);

WattsThat:
Serial.println(“hello”);

Fail.Serial.print(“(Hello)”);

I tride it.. But without respons

Do you suppose he connected the adapter to pins 0 and 1?

Paul

You have got your Tx to Rx interconnections made wrongly.
The Transmit signal from your Arduino needs to pass through your TTL to RS232 converter (where it is level shifted/inverted) and on to the Receive pin of the printer.

You need to connect the Tx pin of the RS232 adapter module to the Tx pin on your Arduino, and Rx to Rx.

It is at the 9 pin D connector side where you need to make the cross connection between Tx and Rx.

Connect:

  • pin 2 of one D connector to pin 3 of the other
  • pin 3 of one D connector to pin 2 of the other
  • pin 5 to pin 5 (Gnd)

Are you using SoftwareSerial?

Hi ,,my rs232 module convert to TTL , it have 4 pin only TX,RX,GND,VCC

sorry but i don't understand this

Connect:
pin 2 of one D connector to pin 3 of the other
pin 3 of one D connector to pin 2 of the other
pin 5 to pin 5 (Gnd)

i connect VCC to 5 volt from arduino
and GND to GND from arduino
and TX to pin 5 from arduino
and RX to pin 6 from arduino

and thermal recipte printer model XP-v320m

and this is a code

#include "Adafruit_Thermal.h"
#include "SoftwareSerial.h"


#define TX_PIN 6 // Arduino transmit  YELLOW WIRE  labeled RX on module rs232
#define RX_PIN 5 // Arduino receive   GREEN WIRE   labeled TX on module rs232

SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial);     // Pass addr to printer constructor
void setup() {
  mySerial.begin(19200);  // Initialize SoftwareSerial
  printer.begin();        // Init printer (same regardless of serial type)
  printer.justify('L');
  printer.println("***  MY ENGINEERING STUFFS  ***\n");
  printer.justify('C');
  printer.setSize('L');        // Set type size, accepts 'S', 'M', 'L'
  mySerial.println("TOKEN NUMBER");
  printer.boldOn();
  printer.setSize('L');
  printer.println("001\n");
  printer.boldOff();
  printer.justify('C');
  printer.setSize('S');
  mySerial.println("***  HAVE A NICE DAY  ***");
  printer.justify('C');
  printer.print("DATE:24/01/2018\t");
  printer.println("TIME: 00:07");
  printer.println("TODAY: WEDNESDAY");   
  printer.write(10);
  printer.write(10);
  printer.write(10);
}

void loop() {
}

Does anything get printed with that setup?

This looks wrong to me

#define TX_PIN 6 // Arduino transmit  YELLOW WIRE  labeled RX on module rs232
#define RX_PIN 5 // Arduino receive   GREEN WIRE   labeled TX on module rs232

The Arduino Transmit signal needs to go to the pin on the RS232 module labelled TX
and
The Arduino Receive signal needs to go to the pin on the RS232 module labelled RX.

farg:
Hi ,,my rs232 module convert to TTL , it have 4 pin only TX,RX,GND,VCC

sorry but i don't understand this

Connect:
pin 2 of one D connector to pin 3 of the other
pin 3 of one D connector to pin 2 of the other
pin 5 to pin 5 (Gnd)

Sorry, that might have been a red herring.
I had assumed that you were connecting the printer to the RS232 interface module using a lead with 9 pin D-connectors on each end.

Now that I have seen a picture of the printer, I can see that it doesn't have a 9 pin D connecter on it, unless it doesn't show up in the photographs.

How do you connect the printer to the RS232 interface module?
Do you use a ready made lead, or did you make one of your own?

It is in this lead that the crossover from Arduino TX to Printer RX needs to be made, not as you have it between the Arduino and the RS232 interface module.

Connect look like this photo