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
@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
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.
@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
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 found the problem… ME!! The printtest program I posted had test code that stopped it from working Get the updated program from the repo and it should work.
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?
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.