Internet Troll Rebirth

So a couple of weeks ago I blogged about the Internet Troll I had hacked together. I was really disappointed with the performance of the twitter integration as I was relying on IFTTT to send a signal to my Troll to get him moving his hair.

The problem with this approach is that IFTTT was not giving me instant feedback, so it took a bit to find out that a tweet actually went through. This made it incredibly challenging to test and debug when I was working with this in the beginning.

We talked a little about it on an internal call that we have for makers. Jeremy Foster ( offered to join up and pair program on a solution since this was similar to what he had done with his TweetMonkey. Also on the call, Kenny Spade asked to join in because he was working on something similar for a project he was doing. In the end, after sharing a screen for an hour or so, we were able to get a Node.JS application reading the twitter stream for specific hashtags and calling a API for the Internet Troll.

The code for the Particle.Core device is relatively simple. I exposed three functions to control the motor speed…tweetme, stopme and slowme. Then the node application would call the appropriate function to start and stop the motor running in the Troll:

The code for the NodeJS application was fairy simple as well. There are really three main pieces…set up the twitter client, set a stream watch on the filter and respond to the tweet. In this case, we would do a ‘tweetme’ to speed the motor up, wait for two seconds and then slow back down with the ‘slowme’ command. The more active the twitter stream…the more active the troll will get.

If I run this node application with the command ‘node app.js NetTroll’ any time someone sends a tweet with ‘#NetTroll’ my little guy starts doing his thing. The best part about this is, with this setup, I get almost instant feedback to tweets that interest me. I’ll be carrying this around with me in my bag, so ask to see it if I am around.

If you want some generic code for your own twitter project, you might want to check out our node-twitter project over on githgub. Jeremy did a pretty good job setting up a project to get you 95% of the way from doing something with Twitter on Node. Have fun!