# BLE Thermal "Cat" Printer with CircuitPython

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/104/898/medium800thumb/circuitpython_ezgif.com-optimize%289%29.jpg?1632864504)

When I saw the "cat" printer in this [Hackaday article](https://hackaday.com/2021/09/21/mini-wireless-thermal-printers-get-arduino-library-and-macos-app/), I simply had to have one for myself. The original poster made a library for Arduino, but I wanted to make a version that worked on CircuitPython instead.

[**Big thanks go to GitHub user BitBank for the original Arduino code, which was studied to implement this project.**](https://github.com/bitbank2/Thermal_Printer)

Before trying this project, please check that your printer works by using the official "iPrint" application, since there's a lot of technology stacks involved

This project is designed for the Adafruit CLUE, but it should be possible to adapt it to other CircuitPython boards that support Bluetooth Low Energy (BLE).

I tried adapting the code to Adafruit Blinka, on a laptop and on a pi4, but the code wasn't as reliable. It tends to just stop printing part way through the image. So stick with nRF52840-based CircuitPython boards unless you want to debug it!

Info: 

## Parts
### Adafruit CLUE - nRF52840 Express with Bluetooth® LE

[Adafruit CLUE - nRF52840 Express with Bluetooth® LE](https://www.adafruit.com/product/4500)
Do you feel like you just don't have a CLUE? Well, we can help with that - get a CLUE here at Adafruit by picking up this sensor-packed development board. We wanted to build some projects that have a small screen and a lot of sensors. To make it compatible with existing projects, we made...

In Stock
[Buy Now](https://www.adafruit.com/product/4500)
[Related Guides to the Product](https://learn.adafruit.com/products/4500/guides)
![Animated GIF showing CLUE board  displaying data from the many on-board sensors.](https://cdn-shop.adafruit.com/product-videos/640x480/4500-04.jpg)

### USB A/Micro Cable - 2m

[USB A/Micro Cable - 2m](https://www.adafruit.com/product/2185)
This is your standard USB A-Plug&nbsp;to Micro-USB cable. It's 2 meters long so you'll have plenty of cord to work with for those longer extensions.

Out of Stock
[Buy Now](https://www.adafruit.com/product/2185)
[Related Guides to the Product](https://learn.adafruit.com/products/2185/guides)
![USB Cable with Type A and Micro B ends](https://cdn-shop.adafruit.com/640x480/2185-00.jpg)

### Part: Cat-Style BLE Thermal Printer
quantity: 1
 Pocket Mini Printer, Bluetooth Wireless Mini Thermal Printer with Android or iOS APP for Pictures, Retro-Style Photos, Receipts, Notes, Lists, Messages, QR Codes Print, Portable Smart Printer, Pink 
[Cat-Style BLE Thermal Printer](https://www.amazon.com/gp/product/B092Z4YQVN)

# BLE Thermal "Cat" Printer with CircuitPython

## CircuitPython on CLUE

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the **CIRCUITPY** &nbsp;flash drive to iterate.

The following instructions will show you how to install CircuitPython. If you've already installed CircuitPython but are looking to update it or reinstall it, the same steps work for that as well!

## Set up CircuitPython Quick Start!

Follow this quick step-by-step for super-fast Python power :)

[Download the latest version of CircuitPython for CLUE from circuitpython.org](https://circuitpython.org/board/clue_nrf52840_express/)
 **Click the link above to download the latest version of CircuitPython for the CLUE.**

Download and save it to your desktop (or wherever is handy).

![adafruit_products_CLUE_UF2_Downloaded.png](https://cdn-learn.adafruit.com/assets/assets/000/088/037/medium640/adafruit_products_CLUE_UF2_Downloaded.png?1580840077)

Plug your CLUE into your computer using a known-good USB cable.

**A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync.**

Double-click the **Reset** button on the top (magenta arrow) on your board, and you will see the NeoPixel RGB LED (green arrow) turn green. If it turns red, check the USB cable, try another USB port, etc. **Note:** The little red LED next to the USB connector will pulse red. That's ok!

If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

![adafruit_products_Clue_Reset_NeoPixel_bootloader.png](https://cdn-learn.adafruit.com/assets/assets/000/087/919/medium640/adafruit_products_Clue_Reset_NeoPixel_bootloader.png?1580496467)

You will see a new disk drive appear called **CLUEBOOT**.

Drag the **adafruit-circuitpython-clue-etc.uf2** file to **CLUE**** BOOT.**

![adafruit_products_CLUE_CLUEBOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/088/042/medium640/adafruit_products_CLUE_CLUEBOOT.png?1580841287)

![adafruit_products_CLUE_drag_UF2.png](https://cdn-learn.adafruit.com/assets/assets/000/088/043/medium640/adafruit_products_CLUE_drag_UF2.png?1580841295)

The LED will flash. Then, the **CLUEBOOT** drive will disappear and a new disk drive called **CIRCUITPY** will appear.

If this is the first time you're installing CircuitPython or you're doing a completely fresh install after erasing the filesystem, you will have two files - **boot\_out.txt** , and **code.py** , and one folder - **lib** on your **CIRCUITPY** drive.

If CircuitPython was already installed, the files present before reloading CircuitPython should still be present on your **CIRCUITPY** drive. Loading CircuitPython will not create new files if there was already a CircuitPython filesystem present.

That's it, you're done! :)

![adafruit_products_CLUE_CIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/088/044/medium640/adafruit_products_CLUE_CIRCUITPY.png?1580841453)

# BLE Thermal "Cat" Printer with CircuitPython

## Installing The Code

Once you've finished setting up your Adafruit CLUE with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.

To do this, click on the **&nbsp;Download Project Bundle** &nbsp;button in the window below. It will download as a zipped folder.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CircuitPython_BLEThermalPrinter/code.py

After downloading the Project Bundle, plug your Adafruit CLUE into the computer's USB port. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called&nbsp; **CIRCUITPY**. Unzip the folder and copy the following items to the CLUE's&nbsp; **CIRCUITPY** &nbsp;drive.

Several sample images are included, continue on to "[Using The Code](https://learn.adafruit.com/ble-thermal-cat-printer-with-circuitpython/using-the-code)" to print them. To prepare your own images, visit "[Creating Images](https://learn.adafruit.com/ble-thermal-cat-printer-with-circuitpython/creating-images)".

![File](https://adafruit.github.io/Adafruit_Learning_System_Guides/CircuitPython_BLEThermalPrinter.png)

# BLE Thermal "Cat" Printer with CircuitPython

## Using The Thermal Printer

![](https://cdn-learn.adafruit.com/assets/assets/000/104/884/medium800/circuitpython_PXL_20210928_191401453.jpg?1632856602)

Power on the printer (you can tell it's powered on when the blue LED blinks), then power on your CLUE.

The CLUE will wait until it can connect to the printer.

Then, the CLUE's built in display allow you to choose an image to print. (just the image name is shown, not the image itself)

Tap the "A" button to move to the next file in the list. When you reach the end of the list, you'll be sent back to the first file.

Tap the "B" button to send the selected file to the printer. While the print is in progress, button presses are ignored.

When the image is done printing, the CLUE will return to the screen where you can select an image to print.

# BLE Thermal "Cat" Printer with CircuitPython

## Creating Your Own Images

You need to prepare your images as black & white (also known as 1BPP) files in "bmp" or "pbm" format. The width must be exactly 384 pixels, while the height can be unlimited (as long as the file fits on the CLUE **CIRCUITPY** drive).

Different image and photo editing programs have different steps to prepare an image. Here you can see how to use the [free and open source GIMP photo editing software](https://www.gimp.org/) to prepare an image, but you should be able to use any software that can write compatible "bmp" files!

Open your original image.

![circuitpython_Screenshot_2021-09-28_14-23-28.png](https://cdn-learn.adafruit.com/assets/assets/000/104/886/medium640/circuitpython_Screenshot_2021-09-28_14-23-28.png?1632857272)

Resize the image to be 384 pixels wide. Let your image editor calculate the height automatically or the image will be distorted.

![circuitpython_Screenshot_2021-09-28_14-28-16.png](https://cdn-learn.adafruit.com/assets/assets/000/104/887/medium640/circuitpython_Screenshot_2021-09-28_14-28-16.png?1632857323)

Convert the image to 1 bit per pixel, using your choice of dithering methods

![circuitpython_Screenshot_2021-09-28_14-29-38.png](https://cdn-learn.adafruit.com/assets/assets/000/104/888/medium640/circuitpython_Screenshot_2021-09-28_14-29-38.png?1632857394)

Export the image as a "bmp" file on the **CIRCUITPY** drive. Your CLUE will automatically reset, and you can choose the newly uploaded file for printing!

![circuitpython_Screenshot_2021-09-28_14-30-13.png](https://cdn-learn.adafruit.com/assets/assets/000/104/889/medium640/circuitpython_Screenshot_2021-09-28_14-30-13.png?1632857432)


## Featured Products

### Adafruit CLUE - nRF52840 Express with Bluetooth® LE

[Adafruit CLUE - nRF52840 Express with Bluetooth® LE](https://www.adafruit.com/product/4500)
Do you feel like you just don't have a CLUE? Well, we can help with that - get a CLUE here at Adafruit by picking up this sensor-packed development board. We wanted to build some projects that have a small screen and a lot of sensors. To make it compatible with existing projects, we made...

In Stock
[Buy Now](https://www.adafruit.com/product/4500)
[Related Guides to the Product](https://learn.adafruit.com/products/4500/guides)
### USB A/Micro Cable - 2m

[USB A/Micro Cable - 2m](https://www.adafruit.com/product/2185)
This is your standard USB A-Plug&nbsp;to Micro-USB cable. It's 2 meters long so you'll have plenty of cord to work with for those longer extensions.

Out of Stock
[Buy Now](https://www.adafruit.com/product/2185)
[Related Guides to the Product](https://learn.adafruit.com/products/2185/guides)

## Related Guides

- [Introducing Adafruit CLUE](https://learn.adafruit.com/adafruit-clue.md)
- [Clue Coffee Scale](https://learn.adafruit.com/clue-coffee-scale.md)
- [Using the Bluefruit Dashboard with Web Bluetooth in Chrome](https://learn.adafruit.com/bluefruit-dashboard-web-bluetooth-chrome.md)
- [PyLeap BLE Controlled NeoPixels with CLUE](https://learn.adafruit.com/pyleap-ble-controlled-neopixels-with-clue.md)
- [Adafruit LSM6DS33 6-DoF IMU Breakout](https://learn.adafruit.com/lsm6ds33-6-dof-imu-accelerometer-gyro.md)
- [Digital Egg Drop Experiment with CLUE](https://learn.adafruit.com/egg-drop-clue.md)
- [¡Bienvenido a CircuitPython!](https://learn.adafruit.com/bienvenido-a-circuitpython-2.md)
- [CLUE Sensor Plotter in CircuitPython](https://learn.adafruit.com/clue-sensor-plotter-circuitpython.md)
- [Bluetooth Cycling Speed & Cadence Sensor Display with Clue](https://learn.adafruit.com/bluetooth-bicycle-speed-cadence-sensor-display-with-clue.md)
- [Bluetooth CLUE Robot Car using CircuitPython](https://learn.adafruit.com/bluetooth-clue-robot-car-using-circuitpython.md)
- [CircuitPython BLE Advertising Beacons](https://learn.adafruit.com/circuitpython-ble-advertising-beacons.md)
- [CircuitPython BLE Heart Rate Zone Trainer Display](https://learn.adafruit.com/circuitpython-ble-heart-rate-monitor-gizmo.md)
- [Chauncey the Flower Care Bot with CLUE and Bonsai Buckaroo](https://learn.adafruit.com/chauncey-flower-watering-bot-clue.md)
- [Metronome CLUE](https://learn.adafruit.com/metronome-clue.md)
- [Welcome to CircuitPython!](https://learn.adafruit.com/welcome-to-circuitpython.md)
- [CircuitPython CLUE I Ching Caster](https://learn.adafruit.com/clue-i-ching-caster.md)
