The moment that every hacker has been waiting for has arrived!!! Today HackADay launched the HackADay Prize, a contest where the best product that can change the world will be awarded A FRIGGIN’ TRIP TO SPACE!
Last year I “lost”, well I wouldn’t call it losing as I scored an awesome t-shirt and got the chance to meet a lot of awesome people at the big event in Munich, but this year I’m in for the grand prize! And for that I must always be up to date with all the news about the contest, so I started to get my hands dirty and built this thing to print tweets from the HaD Prize account:
This years contest is all about green technology, so what better way to offset all that good will than printing all @hackadayprize tweets on paper?
Just kidding, I saved that printer from the dumpster and the paper I’m using would have gone to waste anyway; also, I was already using the back of the “discarded” paper to take notes! :)
I tried the ESP8266 modules as soon as they became available and made a few projects, but nothing to write HackADay about… until I stumbled upon this nice portable printer, and decide to turn it into a TwitterPrinter! I first wanted to do everything within the module, but it soon became clear that it didn’t have enough horsepower/RAM to handle the whole Twitter website, and I didn’t want to use the APIs too because things. I decided to take another route: I created a PHP page on my server to parse the Twitter HaD Prize page and extract the tweets. And while I was there, why not making it preformat the page, so the module just have to get the page and forward it to the printer as-is? The PHP program could also keep track of the latest tweets and send only the latest ones!
So that’s how it works: the module loads the page http://www.mastrogippo.it/tweet.php?usr=ESP1 (note: I changed the path so you can’t crash my server) and the server keeps track of the latest tweet given to the device based on the name in the “usr” parameter. It does so by creating a file based on that parameter and storing the ID of the last tweet sent, so the program will parse only tweets after that one and not resend the whole page. In the video I deleted the index file, so the server sent me the latest seven tweets.
The program then splits the latest tweets in 24 characters rows, and sends back the result in plain text.
It’s then just a matter of writing a brief LUA script for the ESP8266 to request the page, forward the answer to the serial port, and go to sleep for a few minutes. Looks easy, but my module kept on resetting at random; I thought that I was running out of RAM, but it took me a while to find out that the LUA interpreter enables the watchdog by default! I just had to reset the watchdog for every line I sent to the printer, and I was good to go. For the electronic part, nothing fancy, I just had to use a 3.3V regulator to provide power to the module and two 2N7000 mosfets to turn on and off the printer.
And that’s all folks! Now I can get printed real time updates on any news about the contest, because who has a smartphone anyways?
As usual, here are the sources, released under the WTFPL: TwitterPrinter
4 thoughts on “The HackADay Prize 2015”
Very nice! An interesting direction for a project like this would be to replace the small ‘register’ printer with an actual teletype machine! Imagine the thrill of an actual teletype recording tweets on a roll of yellow paper! It would be like being transported back in time to an old newsroom…
Well, that serial printer was free… I’ll keep my eyes open for a teletype in the dumpster! :P
Awesome! Are you going to be attending CTJB #2 this year too? Maybe you could have a presentation! (and possibly Jeopardy again?)
Thanks! Just looked at CTJB’s website, this year it will be very early! I thought it was only every 2 years… I don’t think we’ll make it this year, but I hope to meet you all at the CCC! We may hold Jeopardys there, and I will hopefully have a talk ready – but on a more interesting topic! :)