I am currently attempting a project which involves one of my companies existing thermal printers (Star Micronics SM-T300i) and a raspberry pi board. I am attempting to communicate with it via Bluetooth. I have successfully paired the devices and found a test program and tutorial which shows how to communicate to the thermal printer and produce a test print.

Tutorial: http://natemcbean.com/2012/11/rpi-thermal-printer/

The code is found here: https://github.com/luopio/py-thermal-printer/blob/master/printer.py

I provided a link because I couldn't get it to fit in the code block correctly.

The only thing I changed was the serial port: SERIALPORT = '/dev/ttyAMA0' which I changed to SERIALPORT = '/dev/rfcomm0' to work with the bluetooth serial connection and I changed the Baudrate to 115200 because it is the rate we use in other applications with this printer. Originally I left the Baudrate set to the default in the code and it worked the same only it was slower.

The test prints fine in the text based parts but does not print the png file, instead it prints a bunch of unreadable text where the image should be. I originally thought that maybe the image was too large for my printer but the tutorial shows a 2.25 inch width and mine is 3 so I think it should be able to fit properly.

I did also import ImageTk after I installed it with sudo apt-get install python-imaging-tk.

I want to know if this is possible to print the image and what steps I might need in order to solve this. I have had no issue printing text or even the barcodes in the example but a .png file or other image has not been successful. I am new to python as we generally use C++ but I have not been able to find any useful source for how to print this. Perhaps I am searching for the wrong terms.

1 Answer 1


(Star Micronics SM-T300i)

Why would you expect a userspace driver for "the 'micro panel thermal printer' sold in shops like Adafruit and Sparkfun" to work with this device? They don't look the same. This is not to say they aren't using the same essential hardware under the hood, but unless you have reason to believe they do, most likely they don't.

Printers are not standardized. Different models use different drivers, even from the same manufacturer. I doubt bluetooth makes any difference to this, as printing over wifi is not standardized either.

Perhaps I am searching for the wrong terms.

Possibly, if you are searching for "Raspberry Pi" related solutions. The exact brand of computer doesn't make any difference here, you might as well be using an Acme laptop, etc. You are looking for a solution with the following elements:

  • Driver for your specific printer.
  • GNU/Linux based; it will not be distro-specific ("Debian", "Ubuntu", whatever) although there might be minor differences in terms of configuration file paths, etc. So something which is labelled as a solution on Ubuntu can be applied on Raspbian, Arch, vice-versa, and so on.
  • Works via bluetooth.

Note that the linux user base is several orders of magnitude larger than the rpi user base, and has been around a lot longer. I believe a more normative approach here would be to look for a way to do this with CUPS (questions about which belong our sibling site Unix & Linux).

The hard part is probably the driver. However, I notice that Star Micronics at least has a linux based C++ SDK for their POS printers. That plus some bluez and you should be able to bang something together in userspace in, you know, a bunch of hours/days...hopefully not weeks/months...

  • I appreciate the input. I will admit hardware is definitely not my forte. I only used the printer I did because we already use them for something else and the quality is good enough for me. I had assumed that because the drivers for linux were x86 it wouldn't work so I tried modifying the Adafruit tutorial to match my port. I had just assumed that Serial code would be the same for each. I have also tried to use CUPS but I was unable to locate the thermal printer, only our other networked printers. I'll look into the other suggested searches you mentioned.
    – Jeff S
    Commented Aug 14, 2015 at 17:47
  • That's what makes the driver the hard part -- if there's an open source one in the kernel tree, it's easy (actually it looks like specific printer drivers are mostly userspace entities on linux). If not, and the manufacturer only distributes an x86 binary, then D: I know nothing about CUPS usage, but it does appear to require a plugin for bluetooth support (the bluez-cups package on Raspbian).
    – goldilocks
    Commented Aug 14, 2015 at 18:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.