Git Product home page Git Product logo

adafruit-thermal-printer-library's Introduction

!!! NOTE !!!

THIS REPOSITORY IS ARCHIVED AND IS NO LONGER SUPPORTED OR MAINTAINED

Adafruit Thermal Printer Library Build StatusDocumentation

This is an Arduino library for the Adafruit Thermal Printer. Pick one up at --> https://www.adafruit.com/product/597 These printers use TTL serial to communicate, 2 pins are required.

Full tutorial with wiring diagrams, images, etc. is available at: https://learn.adafruit.com/mini-thermal-receipt-printer

Before loading the example code, or even opening the Arduino software, place the Adafruit_Thermal folder in your Arduino library.

////ARDUINO LIBRARY LOCATION//// On your Mac:: In (home directory)/Documents/Arduino/Libraries On your PC:: My Documents\Arduino\libraries On your Linux box: (home directory)/sketchbook/libraries

Adafruit invests time and resources providing this open source code. Please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries, with contributions from the open source community. Originally based on Thermal library from bildr.org MIT license, all text above must be included in any redistribution.

adafruit-thermal-printer-library's People

Contributors

caternuson avatar dmalec avatar driverblock avatar ennui2342 avatar evaherrada avatar hoffmannjan avatar ladyada avatar lazyatom avatar paintyourdragon avatar retsifp avatar rotzbua avatar siddacious avatar tdicola avatar xseignard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit-thermal-printer-library's Issues

Stuttering when printing images or test print

Hi,

I'm having an issue but I am not sur it's not due to the printer itself. Indeed I followed the tutorial to setup the printer with a raspberry pi and installed the zj58 drivers. However when I do the test print or print a PNG file through LP the printer stutters. That is every 5mm it stops for a second. This leads to slow prints and also to artefacts in the result.
I saw some videos on YouTube where the images are printed continuously without any issues.

Any idea?

SoftwareSerial, NewSoftwareSerial is required

This library doesn't use HardwareSerial, and SoftwareSerial, and NewSoftSerial is required by the libraries. I've tested the library with HardwareSerial and it can work, but there appears to be timing issues.

It would be handy to be able to pass a serial object into the class.

Can't change codepage on firmware 2.69

I'm try to use another codepage by setCodePage().
No matter what codepage I setup, I still get chinese symbols in upper ASCII.
But changing charset by setCharset() working correctly.

Here the test page I get when press button during power on:
image

Adafruit Thermal Library Error

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: Particle PHOTON

  • Arduino IDE version (found in Arduino -> About Arduino menu): Particle IDE - build.particle.io

  • Attempting to flash the adafruit_thermal code to the particle photon, which has the library included, returns errors which I've included an image of.

screen shot 2017-03-09 at 11 29 43 am

All examples are still using SoftwareSerial Library

Arduino: 1.6.7 (Mac OS X), Board: "Intel® Edison"

/Users/.../Documents/Arduino/libraries/Adafruit_Thermal_Printer/examples/A_printertest/A_printertest.ino:21:28: fatal error: SoftwareSerial.h: No such file or directory
#include "SoftwareSerial.h"
^
compilation terminated.
exit status 1
Error compiling.

setSize() has no effect

Thanks for this awesome library 😄

The print demo is working well except for the setSize() functions. They always print default/small. I can workaround this by using some different functions, like this:

  //printer.setSize('L');        // Not working.

  printer.doubleHeightOn();
  printer.doubleWidthOn();

  printer.println(F("Large workaround"));

  printer.doubleHeightOff();
  printer.doubleWidthOff();

  printer.println(F("Back to default size"));

In case this information is useful, my printer is labelled CSN-A2-T, and reports itself as Version 3.8 2011-09-21.

the example documents can print Chinese characters but we can't do it the other documents out of the librarys

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Adafruit_Thermal has no destructor method

  • Arduino board: Arduino Nano 33 BLE Sense

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

I am using Adafruit Thermal Printer as a dependency on a project, where in a class I have an instance of Adafruit_Thermal, and when I delete this instance on my destructor method, I get the warning "warning: deleting object of polymorphic class type 'Adafruit_Thermal' which has non-virtual destructor might cause undefined behavior".

as far as i know this warning could be fixed with a destructor of Adafruit_Thermal

timeout micros

Hi,

I've found issue with micros overflow [ back to zero ] which as I see is solved but the way that it only works if one is using sleep() wake() code - even then not always - it can happen that micros overflows in the middle of waittimeout.

I'd like to see universal solution like:

timeoutSet - store timestamp and delay in micros

void Adafruit_Thermal::timeoutSet(unsigned long x) {
// resumeTime = micros() + x;
lastOperationTS = micros(); //last operation timestamp
waitTime = x; // how many micros to wait for another operation
}

Then wait until waitTime passed or miscros overflow

void Adafruit_Thermal::timeoutWait() {
// while((long)(micros() - resumeTime) < 0); // Rollover-proof
while( (micros() >= lastOperationTS ) && ( (long)(micros() - lastOperationTS - waitTime) < 0 ) ); // Rollover-proof
}

Possible to use FPGA instead of arduino?

Hi, I am a university student studying electrical engineering. I would like to modify the thermal printer to take in data from an FPGA instead of an arduino. Is this feasible/doable? I don't understand the firmware behind the printer too much - being an EE student.

leftover debug code in ::write

size_t Adafruit_Thermal::write(uint8_t c) {

contains non-optioned debug code which echoes the printer output to Serial:

Serial.print(" 0x");
Serial.print(c, HEX);
Serial.print(" (");

if ARDUINO >= 100

Serial.write(c);

else

Serial.print(" (");

endif

Serial.println(")");

Error when compiling for ESP32

When trying to upload the printer test sketch to an ESP32 I get the errors:

Arduino: 1.8.10 (Windows 10), Board: "Node32s, 80MHz, 921600"

In file included from C:\Users\Mike\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library\examples\A_printertest\A_printertest.ino:21:0:

C:\Users\Mike\Documents\Arduino\libraries\EspSoftwareSerial\src/SoftwareSerial.h:162:12: error: 'size_t SoftwareSerial::readBytes(uint8_t*, size_t)' marked 'override', but does not override

     size_t readBytes(uint8_t* buffer, size_t size) override;

            ^

C:\Users\Mike\Documents\Arduino\libraries\EspSoftwareSerial\src/SoftwareSerial.h:165:12: error: 'size_t SoftwareSerial::readBytes(char*, size_t)' marked 'override', but does not override

     size_t readBytes(char* buffer, size_t size) override {

            ^

Multiple libraries were found for "Adafruit_Thermal.h"
 Used: C:\Users\Mike
Multiple libraries were found for "SoftwareSerial.h"
 Used: C:\Users\Mike
exit status 1
Error compiling for board Node32s.

Carriage return 0x13 ?

Hi

While I'm enhancing the performance of this library by making it non-blocking, I've noticed this line :

if(c != 0x13) { // Strip carriage returns

Shouldn't It be 13 Decimal, Not HEX ?
if(c != 13) { // Strip carriage returns

Or someone waits Ariana 6 to happen here ? xD

Thanks

printBitmap function restricted to 255px width

the function to print images needs a fix.

does not allow images larger than 255px in width to be printed.

it is possible though, as other projects, using the same printer, show.
by example: http://electronicfields.wordpress.com/2011/10/09/sharing-links-physically/
code of this project available at github.
look for PrintImage function here: https://github.com/yukimizake/ThermalDotNet/blob/master/ThermalDotNet/ThermalPrinter.cs

should be easy to implement in adafruits Thermal Printer Lib, will have a look when i find time, but would appreciate pros to look at it!

cheers,
k

Code Pages not working

Hi
Hope you have a nice day

I run the example for printing non english characters, but for all cases the printer just prints chinese .

what should I do?

NodeJS support

Hello,

I'm wondering if there is any NodeJs alternative to this library ?

Thank you,
Vincent

timeoutWait function doesn't work with ESP8266

The timeoutWait function uses:
while((long)(micros() - resumeTime) < 0L); // (syntax is rollover-proof)

This won't work with ESP8266 because it leaves the processor no time to do other things.
For ESP8266 it should be changed to a delay() call.
I use delay(10) and that works fine.

Bitmap print on other thermal printers

Hello

i have a samsung srp-350 POS thermal printer and i cant get the bitmap image function to work, it just prints random charaters instead of the image

2015-08-22 23 05 00

setHeatConfig has no effect on printer's behavior

Hi,
I'm currently trying to use the printer in a more industrial environment, where speed is key. As I was trying to speed up the printing process, I've noticed that printer.setHeatConfig has no impact on the printer's behavior. I'm using an Arduino MKR Zero as a microcontroller and a 5V 10A power supply. Has anyone had this issue before?

printing bitmap doesn't work in example

Got the Adafruit thermal printer. The example supplied works perfectly except for the 2 printBitmap parts.

In both cases (the adafruit logo and the QRCode) starts ok (as in the first top section of the bitmaps are printed fine), but then follows with garbled content.

I suspected a buffer overrun, so I added a setTimes statement to the example with 2X, and 3X the default values. There's speed difference in the printing, but no change in what is being printed.

Printer Firmware version: 2.68

  • Arduino board: tried with Feather M0 and MKR1010

  • Arduino IDE version: 1.8.19

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

Used example sketch A_printertest.

printer.feedRows(1) prints 'J' in stead of a row feed, unknown firmware version

printer.feedRows(1); prints a J in stead of a row feed.
I suspected my firmware version is older, however I don't know the firmware version. Setting PRINTER_FIRMWARE in Adafruit_Thermal.h to 0 didn't change the behavior! That is strange, because it should print new-lines in case of older versions that don't support the row-feed command.
I changed the header files in both these locations:

  • /home/USER/.arduino15/staging/libraries/Adafruit_Thermal_Printer_Library-1.2.0.zip
  • /home/USER/Arduino/libraries/Adafruit_Thermal_Printer_Library

I added the following lines in my code as a sanity check:

#if PRINTER_FIRMWARE >=268
#error "PRINTER_FIRMWARE>=268"
#endif

It gives the error when I don't edit the header file and doesn't when I set it to 0. So that means it should be compiled using that define. I deleted the cache folder and restarted arduino ide several times. But it still prints J

I use printer #597.
This is what the sticker says:

Model: CSN-A2
S/N Z1912110420

The test page printed by the printer doesn't have a firmware version number. This is what I see:

Selftest
System: A2
Version: GV.16.08 20190822_R
[...]
MAX dots:80
Heat time:774
[...]
Selftest Finished

I have ubuntu 20.
I use esp32 DOIT devkit.
Printing text works well.
Printing bitmaps works well too, but I do see thin horizontal white lines through the image even after setting heating time to 255.

Upside down printing is not working.

I'm trying to use this upside down feature and it doesn't change how text is printed at all.

  printer.upsideDownOn();
  printer.println(F("Test"));
  printer.upsideDownOff();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.