element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Freedom development platform
  • Products
  • Dev Tools
  • Freedom development platform
  • More
  • Cancel
Freedom development platform
Documents Interfacing Thermal Printer with Freedom board FRDM-KL25Z : Part 1
  • Blog
  • Forum
  • Documents
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Freedom development platform to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Engagement
  • Author Author: bheemarao
  • Date Created: 7 Apr 2014 9:14 AM Date Created
  • Last Updated Last Updated: 8 Oct 2021 7:50 AM
  • Views 1475 views
  • Likes 0 likes
  • Comments 0 comments
Related
Recommended

Interfacing Thermal Printer with Freedom board FRDM-KL25Z : Part 1

This tutorial was extracted from Erich Styger blog http://mcuoneclipse.wordpress.com with his agreement.


One of my embedded projects is to measure the running time in a sports event (see “Sports Timing System in a Lunch Box“). The recorded time is stored in an EEPROM plus sent over USB or wireless connection to the host. It would be great if I could print out the time and ranking directly, so if there is no PC, the system can be small and tiny. So here is my next project and tutorial: Printing with the Freedom board!

           Hello World on the Printer with FRDM-KL25Z

                                   Hello World on the Printer with FRDM-KL25Z

 

The ability to print is a great addition to any other project: I can send messages to be printed out on a remote board, using it as a receipt printer, logging test results and many more things: having printing capabilities is such a great addition to any project, and it does not take much! I have spent this Sunday morning only 4 hours from unpacking, connecting the hardware, programming the first software with CodeWarrior+Processor Expert until I had a “Hello World from the FRDM-KL25Z!” showing up on the printer! And that 4 hours included writing this tutorial. So expect it would take you less than one hour with the help of this tutorial.

First Hello World Message on Printer

First Hello World Message on Printer

Adafruit Mini Thermal Receipt Printer

I ordered a small thermal printer from Adafruit (http://learn.adafruit.com/mini-thermal-receipt-printer) which costs $50. I added three thermal paper rolls (http://www.adafruit.com/products/599) to my order to have enough paper to start with :-):

Adafruit Mini Thermal Printer

Adafruit Mini Thermal Printer unpacked

The main features of the printer (from the data sheet):

  • Thermal paper printer, 2.25″/57mm wide (effective printing width 48 mm)
  • Built-in fonts: small, medium, large text
  • Bold, underline and inverted text with left/right/center positioning
  • Different bar codes
  • Printing monochrome bitmaps and images
  • Size: 111x65x57 mm
  • 5-9V DC, 1.5 A
  • TTL Serial (RS-232, 5V) protocol

Useful links:

  • Printer data sheet:http://www.adafruit.com/datasheets/cashino%20thermal%20printer%20a2.pdf
  • Printer user manual: http://www.adafruit.com/datasheets/A2-user%20manual.pdf
  • Adafruit Thermal Printer Overview: http://learn.adafruit.com/mini-thermal-receipt-printer/overview

With the printer came a test print which has the baud listed. There are printers with 9600 baud and others with 19200, mine came with 19200. More about this later.

Printer Test Print with Baudrate

Printer Test Print with Baudrate

Mounting and Connectors

The two brackets are for mounting the printer behind a panel. In order not to lose the parts, I mounted them right away:

Adding Printer Mounting Brackets

Adding Printer Mounting Brackets

The cables get connected to the backside of the printer:

Printer Backside Connectors

Printer Backside Connectors

Power Supply

The printer requires a 5-9V power supply. Thermal printing needs a lot of power, so a 1.5 amps power supply is needed! There are many ways how you could give power to the printer. I usually have always a bunch of power supplies, but the challenges is that the plugs never match my needs. So usually I end up cutting the wires and making it fitting my needs. For this project I use a 5V 2A power supply I have left over from a damaged Cisco router:

5V 2A Power Supply

5V 2A Power Supply

I cut the 5V wires:

Power Supply 5V Wires cut

Power Supply 5V Wires cut

Same for the printer supply wires:

:!: Cut the wires on the 2-pin connector (NOT on the 3-pin side)!

Cutting Printer Supply Wires

Cutting Printer Supply Wires

Then remove the isolation:

Removed Isolation

Removed Isolation

I’m using heat shrink tubes for isolation, but you can use electrical isolation tape too (not so nice as heat shrink tubes). I cut pieces of different diameter and size:

Shrink Tubes

Shrink Tubes

Put them on the wire before soldering:

Shrink Tubes on Wires

Shrink Tubes on Wires

Wrap the wires together:

:!: carefully check the wire polarity (what is plus, and what is ground)! In doubt, use a voltage meter to verify it!

Wires Wrapped together

Wires Wrapped together

Solder the wires:

Solder the Wires

Solder the Wires

Then use a hot air gun to shrink it:

Shrinking with Hot Air Gun

Shrinking with Hot Air Gun

The result is a nice connection:

Shrinked Power Cable

Shrinked Power Cable

Inserting Paper

When powered, the green LED flashes. There is a ‘Paper Feed’ button plus a lever to open the printer.

Printer button, led and lever

Printer button, LED and lever

A roll presses the paper on the printer head:

Paper Press Roll

Paper Press Roll

The printer head is near the ‘cut off’ area:

Printer Head

Printer Head

The paper is placed inside the printer. Make sure the paper is clean and has no stickers/etc on it:

Paper inside the printer

Paper inside the printer

Then close the cover:

Printer Cover Closed

Printer Cover Closed

Making a Test Print

Powering the printer with the ‘paper feed’ button pressed will print a test report:

Test Print with Baudrate

Test Print with Baudrate

Now I’m sure my printer is working :-)

Printer Connection to the FRDM Board

There is problem: the printer uses 5V (TTL) logic levels, while my FRDM board has 3.3V levels. The printer accepts 3.3V input values (on the printer RX line), but it would be a bad idea to connect the printer output 5V TX signal to a microcontroller having 3.3V levels without a level shifter.

Printer Tx and Rx

Printer Tx and Rx

As I’m only sending data to the printer, I’m *not* going to connect the printer 5V Tx line to my board. I’m only connecting the GND and the microcontroller Tx with the Printer Rx. For this I’m using connector cables:

Printer to Microcontroler Connection

Printer to Microcontroler Connection

Ground is connected to the board GND pin. I’m free to use any available UART Tx pin, and I have used UART0 Tx (Port A, pin 2) PTA2:

FRDM-KL25Z Connections

FRDM-KL25Z Connections

Summary

In few hours, I have now the ability to print at least some text, using the FRDM-KL25Z and the Adafruit thermal receipt printer. Much faster than I have expected, which is a great thing. Time for having lunch. A next post will be about how to use the software.

But if you cannot wait: the project is already on GitHub:https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/FRDM-KL25Z/FRDM-KL25Z_Printer

Happy Printing :-)

  • Share
  • History
  • More
  • Cancel
  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube