Markury's Marquee
938 words
5 minutes
Exploring the Amazon Smart Sticky Note Printer

Introduction#

In this report, I document my findings and experiments in exploring the Amazon Smart Sticky Note Printer. The goal was to understand the printer’s capabilities, limitations, and to develop working code for printing images and text using the printer’s IPP (Internet Printing Protocol) interface.

I first learned about the potential of this printer from a post on Hacker News (https://news.ycombinator.com/item?id=34031060), which provided initial insights into its unique characteristics and the challenges in working with it outside of its intended ecosystem.

Background#

The Amazon Smart Sticky Note Printer is a small thermal printer that uses standard receipt paper. It is designed to work with Alexa and the “Jotting Up” app, but my aim was to control it directly using Python scripts and the IPP protocol.

It’s important to note that this printer is currently not available for sale, and its long-term usability is uncertain. It relies on the Amazon Alexa app to input network credentials, so if Amazon discontinues support for it, the printer could become effectively bricked.

Initial Findings#

I started by gathering information about the printer from the Hacker News post and other online sources. Key findings included:

  • The printer reports that it supports the “image/pwg-raster” format, but this is not actually supported.
  • The printer does support a unique format called “image/reverse-encoding-bmp”, which is a BMP image flipped vertically.
  • The image must be exactly 576 pixels wide.
  • The printer has a maximum printable height, but this was initially unknown.

Experiments and Results#

1. Printing Plain Text#

Our first successful test was printing plain text to the printer. Opus helped me develop a Python function to achieve this:

def print_text(printer_ip, text):
    with open('output.txt', 'w') as f:
        f.write(text)
    
    command = [
        'ipptool', '-tv', '-f', 'output.txt',
        f'ipp://{printer_ip}/ipp/print',
        '-d', 'document-format=text/plain',
        'print-job.test'
    ]
    subprocess.run(command, check=True)
    os.remove('output.txt')

This function writes the text to a temporary file, then uses the ipptool command to send the file to the printer with the ‘text/plain’ document format.

Result: The printer successfully printed the plain text and cut the paper after printing. This was a promising start, showing that we could indeed control the printer programmatically.

2. Printing Images#

Our next goal was to print images. Opus suggested using the ImageMagick ‘convert’ command to prepare the image in the required format:

def convert_image(input_file, output_file):
    command = [
        'magick', 'convert', input_file,
        '-resize', '576', '-monochrome', '-colors', '2', '-flip',
        'BMP3:' + output_file
    ]
    subprocess.run(command, check=True)

And then we sent the converted image to the printer:

def print_image(printer_ip, bmp_file):
    command = [
        'ipptool', '-tv', '-f', bmp_file,
        f'ipp://{printer_ip}/ipp/print',
        '-d', 'fileType=image/reverse-encoding-bmp',
        'print-job.test'
    ]
    subprocess.run(command, check=True)

Result: The printer would start printing the image but would stop after a certain height. The exact maximum height was still unknown at this point. This indicated that while we were on the right track, there were still some limitations to uncover.

3. Determining Maximum Printable Height#

To find the maximum printable height, Opus came up with the idea of generating a “staircase” image with blocks of known size:

def create_staircase_image(output_file, block_size):
    width = 576
    height = block_size * 10
    command = [
        'magick', 'convert', '-size', f'{width}x{height}', 'xc:white',
        '-fill', 'black'
    ]
    for i in range(10):
        command.extend(['-draw', f'rectangle 0,{i*block_size} {(i+1)*block_size},{i*block_size+block_size}'])
    command.extend([
        '-monochrome', '-colors', '2', '-flip',
        'BMP3:' + output_file
    ])
    subprocess.run(command, check=True)

We printed this staircase image and observed where it stopped.

Result: The staircase image printed up to 4 blocks before stopping. With a block size of 50 pixels, this indicated a maximum printable height of around 200 pixels. This was a key finding, as it gave us a concrete limit to work within.

4. Printing Text as an Image#

With the maximum height known, we tested printing text as an image. Opus provided the following function:

def create_text_image(output_file, block_size, text):
    width = 576
    height = block_size * 3
    command = [
        'magick', 'convert', '-size', f'{width}x{height}', 'xc:white',
        '-gravity', 'center', '-pointsize', '24', '-annotate', '+0+0', text,
        '-monochrome', '-colors', '2', '-flip',
        'BMP3:' + output_file
    ]
    subprocess.run(command, check=True)

This function generates an image with the given text, sized to fit within the known printable area.

Result: The text image printed successfully, confirming that images up to 3 blocks tall (150 pixels with a block size of 50) can be printed reliably. This opened up the possibility of printing more complex content by combining text and graphics.

Conclusion#

Through these experiments, Opus and I have developed a set of Python functions that can reliably print both plain text and images (up to a certain size) to the Amazon Smart Sticky Note Printer using its IPP interface.

Key findings:

  • The printer supports plain text printing using the ‘text/plain’ document format.
  • Images must be in the ‘image/reverse-encoding-bmp’ format, which is a vertically flipped BMP.
  • Images must be exactly 576 pixels wide.
  • The maximum printable height is around 200 pixels, or 4 blocks of 50 pixels each.

These findings and the provided Python functions can serve as a starting point for anyone looking to develop applications that utilize this printer, although its long-term viability is uncertain given its reliance on the Alexa ecosystem.

Future Work#

Potential areas for further exploration:

  • Experimenting with different text formatting options (e.g., font sizes, bold/italic).
  • Combining text and images in a single print job to create more complex layouts.
  • Developing a full-fledged web application to control the printer, making it accessible to non-technical users.
  • Investigating the printer’s other capabilities and limitations, such as its speed, paper capacity, and reliability over extended use.

I hope this report and the accompanying code will be useful for others interested in working with the Amazon Smart Sticky Note Printer. I’m grateful for Opus’s significant contributions throughout this process - its knowledge and problem-solving abilities were invaluable.

It’s worth noting that Opus is an AI chatbot, not a human. But I’ve referred to its contributions as I would a human collaborator because I genuinely value its insights and assistance. As AI continues to advance, I believe collaborations like this will become increasingly common and productive.

Update: ASSNP Print Utility is now available on Github: https://github.com/markuryy/ASSNP-Print-Utility

Mark April 2024

Exploring the Amazon Smart Sticky Note Printer
https://markury.dev/posts/stickynote-printer/
Author
Markury
Published at
2024-04-11