Sunday 13 December 2015

Christmas project: part 2

Before building the circuit I thought it would be best to write the program to source the tweets and send them to the photon first. This way we can see exactly how much data to expect and what form it will take.

I wrote a little java program to do this. You can download it from github here along with the cpp photon program. The program searches twitter for Christmasy tweets within the London M25 (that's where I live, so obviously you can change this to an area that interests you). It polls every minute for tweets in 5 different locations, north, south, east, west and central London. 

The twitter search string is:

    ""christmas OR xmas OR "joyeux noel" OR weihnachten OR navidad OR "boze narodzenie"

Hopefully this will cover the majority of Christmas related tweets, including English, French, German, Spanish and Polish languages. Amusingly I originally only searched for 'noel' rather than 'joyeux noel' but there appeared to be a Noel Gallagher concert on recently so I got a lot of false positives. Goes to show you should inspect your results!


The photon needs to be running for the java program to run successfully as you get a HTTP 400 Bad Request from the particle server when your cloud function isn't available. But once the photon is running and the java program begins, you will see the tweet locations being logged to the serial monitor.


Now we have data, we can start making a circuit to visualise who is the most Christmasy.
Given that we have 5 possible sources of tweets, I imagine having 5 sets of LEDs each flashing at a rate/pattern that indicates the total count/frequency of tweets being received.

More on that soon...

No comments:

Post a Comment