0

I am building an online POS and trying to establish low level communication with an Epson tm-t88iv thermal printer. there is no direct printing of files, only hexadecimals or ascii can be sent to the hardware in a specific format for it to print. all of this done in a linux enviroment (both ubuntu 13.10 and 12.04).

Now the problem is that I can't establish communication with the printer. I have tried using Jzebra and other java to javascript libraries but with no luck, so I changed to a more familiar environment and tried using the php serial class with a status check code but nothing happens.

include 'src/PhpSerial.php';

// Let's start the class
$serial = new PhpSerial;

$serial->deviceSet("/dev/ttyUSB0");
$serial->confBaudRate(38400);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");

$serial->deviceOpen();

$serial->sendMessage("\x02\x81\x1B\x02\x01\x03\x5C\x5C");

$read = $serial->readPort();

var_dump($read);

which returns an empty string. Also the printer is not receiving the hexadecimals (it is set on a hex-dump state, to print every hex it receives).

I am not sure even if its a coding or hardware problem. I tried installing cutecom to talk with serial port but I don't get any answers either. I also tried doing some stty commands directly from shell but got nothing either.

If someone can please shed a light on why this is happening or if he has any similar experience, it would be great.

thanks!

p.d: i am connecting using a prolific pl2303 serial to usb cable and its correctly installed as far as i am aware.

4
  • It sounds like your problem is not with javascript, java, or PHP (yet..). If you can't communicate with the printer using a serial terminal program (ie minicom or cutecom), then you won't be able to use higher-level tools either. Similar set up here might help: stackoverflow.com/questions/5347962/… Commented Mar 10, 2014 at 13:38
  • Did you try with 'echo DATA > /dev/ttyUSB0'? Did it reach the printer? Put debugging statements, check for errors, propagate them. Commented Mar 13, 2014 at 13:33
  • Thanks for the help, I solved it by changing the chmod on /dev/ttyUSB0 and also I had an issue with the hexadecimal code I was sending. In the end it was a bit of both programming and setting. Commented Mar 13, 2014 at 22:07
  • Possible duplicate of PHP serial port data return from Arduino, php read data from serial port on linux, php serial communication in linux, etc. Commented Jul 2, 2019 at 2:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.