Pages: [1] 2 3   Go Down
Author Topic: Thermal printer isn't Printing Images  (Read 3599 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I am using a 2 inch thermal printer with arduino uno r3. I used adafruit library for thermal printer i.e. "Adafruit_Thermal.h". With this library the text (Strings)
are printing fine, but when there comes a bitmap image, the printer just prints some garbage dots. Guide me how to fix it.
Thanks 
Logged

NE PA
Offline Offline
Full Member
***
Karma: 5
Posts: 156
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You're probably going to need to post your code.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're probably going to need to post your code.

Code is as follows:
Code:
#include "SoftwareSerial.h"
// If you're using Arduino 23 or earlier, uncomment the next line:
//#include "NewSoftSerial.h"

#include "Adafruit_Thermal.h"
#include "adalogo.h"
#include "adaqrcode.h"
#include <avr/pgmspace.h>

int printer_RX_Pin = 5;  // This is the green wire
int printer_TX_Pin = 6;  // This is the yellow wire

Adafruit_Thermal printer(printer_RX_Pin, printer_TX_Pin);

void setup(){
  Serial.begin(115200);
  pinMode(7, OUTPUT); digitalWrite(7, LOW); // To also work w/IoTP printer
  printer.begin();

  // The following function calls are in setup(), but do not need to be.
  // Use them anywhere!  They're just here so they're run only one time
  // and not printed over and over.
  // Some functions will feed a line when called to 'solidify' setting.
  // This is normal.

  // Test inverse on & off
  printer.inverseOn();
  printer.println("Inverse ON");
  printer.inverseOff();

  // Test character double-height on & off
  printer.doubleHeightOn();
  printer.println("Double Height ON");
  printer.doubleHeightOff();

  // Set text justification (right, center, left) -- accepts 'L', 'C', 'R'
  printer.justify('R');
  printer.println("Right justified");
  printer.justify('C');
  printer.println("Center justified");
  printer.justify('L');
  printer.println("Left justified");

  // Test more styles
  printer.boldOn();
  printer.println("Bold text");
  printer.boldOff();

  printer.underlineOn();
  printer.println("Underlined text ");
  printer.underlineOff();

  printer.setSize('L');     // Set type size, accepts 'S', 'M', 'L'
  printer.println("Large"); // Print line
  printer.setSize('M');
  printer.println("Medium");
  printer.setSize('S');
  printer.println("Small");

  printer.justify('C');
  printer.println("normal\nline\nspacing");
  printer.setLineHeight(50);
  printer.println("Taller\nline\nspacing");
  printer.setLineHeight(); // Reset to default
  printer.justify('L');

  // Barcode examples
  printer.feed(1);
  // CODE39 is the most common alphanumeric barcode
  printer.printBarcode("ADAFRUT", CODE39);
  printer.setBarcodeHeight(100);
  // Print UPC line on product barcodes
  printer.printBarcode("123456789123", UPC_A);

  // Print the 75x75 pixel logo in adalogo.h
  printer.printBitmap(adalogo_width, adalogo_height, adalogo_data);

  // Print the 135x135 pixel QR code in adaqrcode.h
  printer.printBitmap(adaqrcode_width, adaqrcode_height, adaqrcode_data);
  printer.println("Adafruit!");
  printer.feed(1);

  printer.sleep();      // Tell printer to sleep
  printer.wake();       // MUST call wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

void loop() {
}

The output print iss attached...
Text is fine but image is returned as garbage dots... smiley-sad

Moderator edit "You're probably going to have to post your code with [code][/code] tags"


* test print.jpg (93.8 KB, 1146x288 - viewed 85 times.)
« Last Edit: February 07, 2013, 07:46:10 am by AWOL » Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What thermal printer are you using?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What thermal printer are you using?
Its chinese made printer. Model number is PT-48b.
Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a link to the datasheet?

What I am looking for is whether this printer supports graphic characters. You may be getting garbage because it doesn't.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have a link to the datasheet?


http://www.prttech.com/Printer-mechanism/PT48B/#4
Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. The PDF icon doesn't work, but it did lead me to another question. Are you driving the signal levels on that flat cable directly with your arduino or using an interface board in between? Your code doesn't look like it is driving everything directly.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you driving the signal levels on that flat cable directly with your arduino or using an interface board in between?
A interface board is available which is actually the logic level translator between printer and arduino. 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The PDF icon doesn't work.
Here the manual is attached.

* PT486FMB-enl.pdf (305.16 KB - downloaded 52 times.)
Logged

Offline Offline
Faraday Member
**
Karma: 58
Posts: 2778
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A thermal printer is readily capable of printing images,   but the software controlling it may not me.

In fact,  any printer can print images,  except the ones based on typewriter technology which have
actual metal printing elements representing the letters and numbers.
Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here the manual is attached.

Thank you. I see that it has a bit image mode, now just need to look at the adafruit library to make sure it is compatible and putting this into the correct mode.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thankyou so very much...
Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Looking at the datasheet and looking at the adafruit library, it doesn't look like the library is directly compatible with your board. To get into bitmap mode, you need to send a specific command. The reason it works with everything else is because the printer is set at defaults at power up and accepts your text.

Page 14 of the datasheet describes how to use the bitmap mode. You have to send ESC (27) then * (42) then a mode of 8 or 24 dots, and then your actual bitmap information. I don't see the library sending all those commands.

This was only a quick look, but I don't see it controlling the printer in the same way as the datasheet. However, some of the commands are the same, but those are for text stuff. The barcode and bitmap routines are not doing things the same way.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you tell me how to send the command???
I am sending the commands as:
printer.writeBytes(27,42,1);//ESC * m
printer.writeBytes(100,2);//n1 n2
for(int i==0;i<=200;i++)
printer.writeBytes(data);//d1 d2 .... dk
where the data is stored in program memory in the same format as in adafruit library example.
The code is successfully compiled and uploaded on arduino but the output is same as I have shown you above.(The data is also same)
I am stuck here... smiley-sad
Logged

Pages: [1] 2 3   Go Up
Jump to: