A Thermal Printer library using ArduinoBLE and Adafruit GFX to control MPTII style printers.
Testing was done using a GOOJPRT PT-210. It runs the MPTII firmware.
ArduinoBLE allows multiple methods of scanning to find the proper printer (MAC, Name and UUID). If you need to find printer info like a scannable printer name or MAC address, you can run a test print and that info will be printed out (most printers will do this).
To run a test print:
- Make sure printer power is OFF.
- Hold down the form feed button.
- Press the power button to ON.
- Printer should automatically print a test page.
To find printer UUID, you can use a BLE scanner app like…
https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp&pcampaignid=web_share
You may be able to use these sketches with other Thermal Printers by changing the UUID settings to match your printer. That has not been tested.
*** The example below creates a simple data logger. It will print out data (every 5~6 seconds) to the printer as long as the printer BLE is connected. If the printer disconnects the data restart after reconnect (any data while disconnected will be lost). If the micro-controller restarts, the entire sketch restarts. ***
*** The example below draws Adafruit_GFX graphics to the printer. It uses the controllers memory as a buffer (canvas). Once the image is drawn to the canvas, the canvas is printed to the printer via BLE. ***
*** The example below prints out images and custom text ***
*** The example below prints the printer's built in barcode functions. ***
*** The example below prints many of the normal ESC/POS commands to the connected BLE printer. ***