Help - Thermal Printer Library for Spark

I have successfully used Ardafruit thermal printer with Arduino Uno and teensy projects.

Can anyone help getting the Ardafruit libraries working with Spark. I fear it is beyond me.

I suspect someone will have already got this working - but I can’t find anything on the forums.

I have made a “birthday card clock” - a GPS chip to get the day and time and showing time etc on lcd and using it to automatically print birthday cards - with different messages - for my children for the next 100 years on their birthdays - (i.e. messages after I am gone!)

It all works but…

… I am hoping to add wifi to it -(so want to use Spark instead of Teensy Arduino) so need help making these libraries work.
Really grateful for any assistance.
Andrew

1 Like

@andrew1, cool stuff! You said you used this printer with Teensy projects. Was it a 3.3V Teensy and did you use a level shifter (3.3 <-> 5V)?

The cool thing about the Spark is that it has a built-in RTC that synchronizes with the Spark Cloud so you will not need your GPS anymore. The interface to this printer is done via a serial port and the Spark has one you can use that precludes the need for the Arduino NewSerial library. So porting the printer driver will be very straight forward.

Let me know the info above so I can figure out how to go from there :smile:

That sounds like a really cool project. I hope you post the finished version (or mostly-working prototype)!

Hi Many thanks for your reply
It is a 3.1 Teensy that allows 5V - I am providing the thermal printer with a separate 5Volts.

I also use a 16 character by 2 line lcd display to show day of week/date/time/ name of child whose birthday it is.
The birthday card - with different messages for next 100 years (!) prints out at 8.00am - but i have a push button to allow reprint of birthday card.

Yes - great that I will be able to use the built in RCT.

I also hope to build a magic trick for my 15 year old son who loves magic - and this also will need a (dismantled) thermal printer! so any help with getting this library to work hugely appreciated.

ANdrew

I remember seeing the Choosatron using a thermal printer while we were at Maker Faire Bay Area.

Definitely be able to get it working :smiley:

Ok, just saw this on the Adafruit tutorial site for the printer:

you simply need a 3.3V to 5V TTL serial output from your microcontroller to print text, barcodes, bitmap graphics, even a QR code!

So the Core’s 3.3v output is fine! I will work on porting the library :smile:

@andrew1, I ported the code to use Serial1 which uses the hardware Tx & Rx pins on the Core. Make sure to connect the green wire to Rx and yellow to Tx.

You can find the repo here. Since I don’t have a printer, I have to rely on you to text it with the demo program included. Let me know how it goes :smile:

2 Likes

Paul - This is great
Really grateful - I am travelling at the moment - as soon as I am home I will test.
I’ll let you know how I I get on.

ANdrew

1 Like

Hi Paul,

I am not sure if I am doing everything correctly - I have used the test code -
printertest.ino
and added 4 more tabs:
Adafruit_Thermal.h
Adafruit_Thermal.cpp
adalogo.h
adaqrcode.h

The code compiles correctly and uploads to Spark -

But nothing printing - any ideas?

Could I lend you the thermal printer to test?
ANdrew

@andrew1, you may need to reverse the Rx and Tx wires on the Spark. If these two are crossed, nothing will happen. Also, is GND of the printer connected to the GND of the Spark? Are you powering the printer with a separate 5V supply?

• I’ve tried reversing Rx and Tx wires - no difference
• Yes GND of printer is connected to GND of Spark.
• Yes printer powered separatey - and it works (If I switch printer on with paper advance button pressed - it prints a text page as expected.)

So I not having too much luck -
Grateful for any thoughts - or could I post printer to you?

@andrew1, I’ll break out my arduino and do some tracing to figure out the problem. Stay tuned :smile:

1 Like

@andrew1 I found the problem… ME!! The printtest program I posted had test code that stopped it from working :open_mouth: Get the updated program from the repo and it should work. :blush:

1 Like

Fabulous - All works perfectly - I am very grateful for your help.
I am now building the project - Ill let you know how I get on!

May I ask one more question.
I hope it isn’t too basic a question.
If I have a one line .txt file at a url - and I want to pull that text file into the spark through wifi - and put that one line of text into a string. Can you point me in right direction?

Again - many thanks

2 Likes

@andrew1, glad it works! :ok_hand:

You can pull text off the URL using TCPCleint and print it from there. Or, you could create a Spark.function() and call it with the string you want to print. :smile:

2 Likes

I thought you would might to see the birthday clock with teensy -


I am working on this with Spark - but first I am making the magic trick for my 15 year old that needs spark!

@andrew1, nice work! Hopefully at 100, you are there to see the treasure map print :wink:

Anyone got any pointer on how i could get this to run on Spark?

I have got @peekay123 code to work and also the Spark SD library example to work.

Please excuse my ignorance, I’m pretty new to all this. Ideally i really want to get all this working - https://github.com/exciting-io/printer/wiki/Making-your-own-printer

Thanks in advance
Stuart