Rs232 Printer

0 views
Skip to first unread message

Lorin Cupples

unread,
Aug 4, 2024, 9:00:16 PM8/4/24
to jiripchosa
Ihave built a project for work that reads speaker lines and tests continuity. Once the test is complete I print the time, date, and part number on a thermal label that gets put on a wiring harness. I have tried using the common thermal printer for labels from Sparkfun. While it kind of works, the print starts dark on the left and the right side is completely light and unreadable. If I just print on thermal receipt paper it works fine. I'd like to be able to connect to our company's Zebra label printer. I have an RS232 shield and would like any help connect a MEGA to the Zebra via the RS232 shield.

9 pin Null Modem serial cable or standard 9 pin cable with a Null Modem Adaptor

Printer configurations matched to the host. ZM Serial Communication Information Read More>>

Note: The printer has a 9 pin female connector.


Honestly not a real issue as of yet. I'm waiting on the null cable. My plan is to send the string for baud/data/parity, and then send the ZPL codes as per the examples to the printer and see what the result is. We'll see what happens. Just not sure exactly HOW.


dbirky:

I have built a project for work that reads speaker lines and tests continuity. Once the test is complete I print the time, date, and part number on a thermal label that gets put on a wiring harness. I have tried using the common thermal printer for labels from Sparkfun. While it kind of works, the print starts dark on the left and the right side is completely light and unreadable. If I just print on thermal receipt paper it works fine. I'd like to be able to connect to our company's Zebra label printer. I have an RS232 shield and would like any help connect a MEGA to the Zebra via the RS232 shield.


The Arduino HardwareSerial does not handle Hardware Handshaking. You will have to implement it yourself. I have added an interrupt driven CTS/RTS handshaking feature to the HardwareSerial core. If you want it send me a private message.


dbirky:

Honestly not a real issue as of yet. I'm waiting on the null cable. My plan is to send the string for baud/data/parity, and then send the ZPL codes as per the examples to the printer and see what the result is. We'll see what happens. Just not sure exactly HOW.


Does it worked??

I'm trying similar thing here.

I'm using ZT230 printer which have serial port. When i send the zpl commands using "Direct Communication - ZDesigner" software from zebra, it prints the text properly. But same line of code when I send to printer, it does nothing.

I tried setting the printer in diagnostic mode and it printed exactly matching code for zdesigner's software and the ascii lines which i send thro' Arduino mega's serial1. But when diagnostic is OFF, printer does nothing.


rpatil5541:

Does it worked??

I'm trying similar thing here.

I'm using ZT230 printer which have serial port. When i send the zpl commands using "Direct Communication - ZDesigner" software from zebra, it prints the text properly. But same line of code when I send to printer, it does nothing.

I tried setting the printer in diagnostic mode and it printed exactly matching code for zdesigner's software and the ascii lines which i send thro' Arduino mega's serial1. But when diagnostic is OFF, printer does nothing.


Please, has anyone managed to communicate the arduino with the zebra printer? I'm trying to send data to the printer but I can not seem to print, on the serial monitor or the puty the string is received but the printer does not receive the command.


I already work with the zebra but with the use of CLP and I have no problems when I use a PLC, but I can not do anything using the Arduino, I believe it should be something with the serial and for this reason I ask you for help if you had any experience with communication arduino x zebra.


void loop ()



if (Serial.available ()> 0)



char c = Serial.read ();

if (c == 'a')

Serial.print ("^ XA");

Serial.print ("^ MMT");

Serial.print ("^ PW280");

Serial.print ("^ LL0120");

Serial.print ("^ LS0");

Serial.print ("FT189.454 A0I, 28.28; FH ^ FDTESTE ^ FS");

Serial.print ("PQ1,0,1, Y ^ XZ");

delay (1000);








It looks like are using pins 0 and 1 to communicate with the printer via the MAX232. As you are also using the Serial monitor to enter commands. This combination may cause problems because pins 0 and 1 on most Arduinos are used by the hardware Serial interface, ie the Serial monitor.


I currently have a source (i.e. a POS system) connected to a ESC/P2 thermal printer via an RS232 serial connection. I wanted to place an arduino uno between the source and the thermal printer. Its main objective is to monitor what is sent to the printer and based on a condition (i.e. a flag, a certain string in the data, etc), it determines whether a print is required. I have a MAX232/RS232 DB9 shield to adjust the voltages, but i'm not sure if my source will be able to see my arduino as a printer and thus even allow a print job to occur.


You can pass any data that comes in from the POS directly to the printer and any data that comes from the printer directly through to the POS using a very simple piece of code in the Arduino. That way neither the POS nor the printer will realise that they are not connected directly.


You can use e.g. an Uno with one hardware serial port and use a software serial port to connect to the two devices.

There are also Arduinos with 2 or more hardware serial ports which may be preferred if timing is critical.


The below code is basically the Software Serial Example and passes any data from POS to printer and from printer to POS; 9600 baud, 8N1. You can read the documentation (Software Serial and Hardware Serial) if you need to change it.


The Mega would probably be best because it could receive the data on (say) Serial1 and send it out again on Serial2 while leaving Serial available for communication with your PC while you develop the program.


The printer output is set up with 80 columns, 8 data bits, 1 stop, no flow, no parity. I am simply trying to echo Serial1 to Serial at the moment, however when I do that I get very strange output in the serial monitor.


@smn8600, 8N1 is the default so no need to set it for Serial1. The return from Serial1.read() is a byte (unsigned char) not an int. Serial.write() will put out the raw byte to the console so anything not ASCII will print weird or do odd things (eg. 0x0A is linefeed).


I am using LV 8.6.1. I am working on a project, which tests DUT and, at every end of the test, LV should tell printer to print date , below that , barcode and under this serial number . I have not used serial communication in labview much. Could you please help me how can i send the commands from labview to the printer ?


Here is a modified version of the example I suggested. It includes the option of using the parallel port for communication. I am in the process of getting some example ZPL for you for the label formats that you are using.This example should give you everything you need to communicate with the printer.


This chip inverts the signal, matches it to RS232 voltage levels, and limits the rate of voltage rise at the signal transitions - a TTL signal tends to go from one voltage extreme to the other in a couple of nanoseconds - it would be "fast" enough to implement a 10 megabit serial line easily. Unfortunately, a signal like that would need to be treated (cabling wise) like it was 10 megabit regardless of the baud rate, otherwise effects like horrible radio interference or phantom signal transistions due to reflections can and will happen.


-Modify the printer by disconnecting the serial level converter and hooking the TTL-level signals into the lines that interface between the rest of the printer and the converter. Mind that TTL level signals are not good for long wiring, if not using some termination scheme it is best to run them in shielded wires (or one half of a twist of a twisted pair cable, other wire connected to ground - not optimal but...) and keep cabling length to a feet or two. Or, build the FTDI (or other converter board) into the printer and run USB into it (Don't "mess" with USB wiring BTW, it is even more sensitive than TTL).


Looks like inverse polarity. The CR code is 015, 00001101 in binary.The codes for "=" and "y" are 075 and 171, 00111101 and 01111001 respectively. Note the sequence of four zeros in CR, and sequences of four ones in "=" and "y". With the inverse polarity, the character boundaries will depend on the speed with which they are sent because the start and the stop bits are messed up.


While Leo's answer seems possible, I find a reverse polarity problem relatively improbable when standard off-the-shelf equipment is used. I wouldn't want to rule out Leo's answer completely, though, just point out a possible alternative (even if I would assume that with reverse polarity at least the number of characters sent and apparently received should be equal).


you cannot connect RS232 to arduino you must use a RS232 to TTL converter whereby the rs232 goes to the printer and the ttl goes to arduino. Also you must swap the RX and TX lines at the arduino ,you can purchase the RS232 converter on ebay or amazon they are low cost .IF you connected the arduino directly to the RS232 printer well now you need a new arduino as it will not take RS232 voltage.


The S'PRINT thermal printers provide great capacity and performance with reduced size and weight.



Automatic paper loading with patented "sixload" system. Equipped with paper end sensor and black mark sensor. The printer supports an upgradable customer logo and can print the most used barcodes EAN 13, EAN 8, CODE 39, ITF, CODABAR. S'print-s is powered via an external power supply and comes equipped with serial RS232 interface. It is the ideal solution for applications such as instruments, receipt, coupon and report printing, also for banking operations.

3a8082e126
Reply all
Reply to author
Forward
0 new messages