Sjaak and I met up and hacked together a thermal printer with the web platform. It uses the @tweet_tree source to query twitter for the latest tweets to @dangerousproto and prints them.
The setup is really simple. A serial port is assigned to the IO header on the web platform. It outputs (only) serial data to the printer at 19200bps. See the intro article for more about assigning hardware peripherals with PPS.
Last night we got stuck. We could print the first batch of tweets, but each new query resulted in a 404 error. We did a bunch of stuff but couldn't get it.
We ran wire shark to capture the Ethernet packets. We compared a PC query to twitter to the web platforms request (aimed at a server running on a PC in the local network so we could see it). They were byte-for-byte identical.
Next we used modify headers add-on for Firefox to make firefox look exactly like the web platform. Firefox works, web platform doesn't.
We assigned the second UART to the USB->serial converter, and dumped the response from twitter for debugging. This made it easier to see the error without stopping the PIC under debug and reading it from the memory 50bytes at a time. The errors weren't really helpful. (Even if you don't have a thermal printer, you can program the firmware into your web platform and watch the twitter queries from the USB->serial port connection at 115200bps.)
Finally, in a stab in the dark, we increased the TCPIP buffer size and it worked right away. It's really confusing why it looked perfect when aimed at a local server, but caused bad request errors from twitter. Whatever, it works!
Anything you tweet @dangerousproto will print out here. I'll get a live cam up ASAP. This will have some sparse documentation for the Adafruit/Instructables make it tweet contest.
Tweetalicious! It was fun to meet and whip something up.
I think you should increase the rpp=1 when we get more popular? Or does it just returns one tweet a time without skipping?
I guess the pic does fragementation which most of the times would cause strange behaviour.
I upped the buffer to 2500bytes and increased the tweet pull to 12. That should be enough room for max sized tweets and control characters. It would probably be good to go higher because most are less than the max size and we do have buffer overflow protection.
So that's what you guys were cooking up! I was kinda following along on twitter. Good luck on the contest! :)
Ooops we get caught!!
/me runs away!
How it works? here's the dia and the png.
Thanks Jamz!
A low-res live stream is up, working on a readable one now:
http://www.ustream.tv/channel/thermal-tweeter (http://www.ustream.tv/channel/thermal-tweeter)
A short article will be on the blog today too
High-res feed it up now.
Hi Ian,
I'm new to all of this and I wonder if you could point me in the right direction, I've recreated this with my own Web Platform and Thermal Printer and loaded it up with your Thermal Tweeter Hex.
In the USB stream I can see the board checking for new tweets but when there's something to print the output I get from the printer is gobbledegook (see I'm learning the technical terms already) - possibly as though the Printer is expecting a different baud rate for the print data? Please see attached image.
Minor teething issues aside I have to say I'm loving the web platform thus far and the possibilities it opens up for personal projects. Thanks in advance.
A baud rate issue seems likely. Sjaak had messed with his printer before we used it. The code uses 19,200 BPS, but I think sparkfun lists 9600 as the default (?). Do you also have a Bus Pirate? That would be an easy way to make the change.
Thanks for the reply, thought that might be the case.
Unfortunately I don't have a Bus Pirate, but I'm going to have to start getting my head around the code sooner or later anyway so could you point out where the baud rate is set in the code at:
http://code.google.com/p/dangerous-prot ... t_treev1.c (http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/trunk/Web_Platform/firmware/Thermal_Tweet/tweet_treev1.c)
then in theory I should be able to edit to 9600 and recompile?
Thanks again, much appreciated.
It is just one value that needs to be changed. Unfortunately you will also need to get the TCPIP stack installed and working with these files. I'm afraid that might be a pain with the latest version.
The value is here, there are online calcs to help with it:
http://code.google.com/p/dangerous-prot ... main.c#196 (http://code.google.com/p/dangerous-prototypes-open-hardware/source/browse/trunk/Web_Platform/firmware/Thermal_Tweet/main.c#196)
I would LOVE to port this project to one of the FreeRTOS ports for the web platform.
Fantastic, just again another note of appreciation and some info for anyone else trying the same thing.
The magic number for my printer was:
U1BRG = 515
Also I heeded your warning about attempting this with the latest TCPIP Stack version and found Microchip have an archive of older versions here:
http://www.microchip.com/stellent/idcpl ... odeId=2896 (http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2896)
The version I plumped for was Microchip Application Libraries v2010-10-19 and that's working fine.
Another image attached, this time not in gibberish
Glad you got it, and thanks for the tip on the old TCPIP versions, I didn't know about them.
Congrats on building the second Thermal Tweeter!
Cool project!
I'm wondering if this can be modified to print Facebook status updates instead of tweets, and if so, how hard would the required modifications be?
It depends if Facebook serves Json feeds without authentication. If so, it could be done. If not you might as well do a total rewrite.
I guess you need to replace the twitter get url and code to that of the the rss of your facebook status. Well I have no practical idea on what I'm talking about but it maybe one possible way.
Really cool proyect! Some questions... Where i can buy? And i can print pictures or lines like a form? Thannks!
[quote author="R3tikus"]Really cool proyect! Some questions... Where i can buy? And i can print pictures or lines like a form? Thannks![/quote]
The printer is kinda intelligent and can print text and graphics. Check the datasheet here: http://www.sparkfun.com/products/10438 (http://www.sparkfun.com/products/10438)
[quote author="R3tikus"]Really cool proyect! Some questions... Where i can buy? And i can print pictures or lines like a form? Thannks![/quote]
Take a look at LadyAda'a guide at http://www.ladyada.net/products/thermalprinter/ (http://www.ladyada.net/products/thermalprinter/)