NewsAlarm – wiring in to the NYT NewsWire API

NewsAlarm: Process

Holding a smoke alarm, battery installed, is somewhat like holding an unwound jack-in-the-box. While you know that it shouldn’t go off, there’s still a nagging suspicion that it might. I get a similar feeling when I check news websites in the morning – somewhere in the back of my mind, I suspect that the world might have caught on fire while I was asleep. So, it made at least some degree of sense to me to build a News Alarm – a device that sounds an alarm when specific new stories are detected ‘off the wire’.

Last week, I wrote a simple set of Classes in Processing which connect to the New York Times NewsWire API. The NewsWire has been described by the NYT R&D guys as a ‘firehose’ – it send out a live stream of articles as (or before) they are posted or published by the Times. The Processing Classes allow you to hook up to the feed, and to set up alerts that are triggered when stories with specific keywords or descriptors are published. By attaching filters, you can in effect adjust the tolerance of the alerts, so that you can be notified when a key word, person, or location appears at all, or when it appears repeatedly over a period of time. For example, I might want to be alerted when any story about Canadian Prime Minister Stephen Harper comes across the NewsWire. I can set this up like so:

NYTNewsWire wire = new NYTNewsWire();
wire.addFilter(“person”, “HARPER, STEPHEN”, 0);

I’ve asked the NYTNewsWire object to listen for stories tagged with Mr. Harper. I’ve set a tolerance of 0, which means that I’ll be alerted if stories come up at any frequency. If I wanted the alert to only be published if a LOT of stories about Harper came across the wire (if he were, say, to resign, or be impeached, or disappear, or other such good news), I can adjust this frequency number. Here, I’ll only be alerted if more than 25% of the wire stories are about him:

NYTNewsWire wire = new NYTNewsWire();
wire.addFilter(“person”, “HARPER, STEPHEN”, 0.25);

Obviously, we can set up any number of filters and get our alerts to be specific as possible. Which is useful if you are going to, say, be hooking up the alert to a 85 dB smoke alarm.

NewsAlarm: Process

Smoke detectors work by detecting small particles of smoke as they pass through the sensor inside the device itself. There is a good parallel here to what our software ‘news detector’ does (detecting small particles of news as they pass through the feed), so I thought it would be an interesting proof-of-concept to wire up a smoke alarm to the NewsWire and bring the virtual news stream into the physical world. As it turned out, this was fairly simple. All smoke detectors have a text button which sounds the alarm – you can see the bracket-shaped metal contact for the test button on our alarm above. What we ended up doing was wiring into the test contacts, then running these wires through a breadboard to a programmed Arduino, and from the Arduino via USB to my MacBook.

NewsAlarm: Process

I am not particularly skilled with electronics, so I asked my friend and colleague Dennis Rosenfeld to do most of the dirty work. Dennis has a wealth of electronics and software knowledge, as well as being a talented artist in various media. ‘Hacking’ the smoke detector took about 30 minutes all told, and in short order we had a device that was ready to be connected to my simple Processing App.

NewsAlarm: Process

In the photo above, you see a list of news items that have been broadcast over the NewsWire while the application has been running. As each of these news stories appears, they are checked against a filter. If the filter is matched, a signal is sent through the Arduino to the NewsAlarm, which sounds for about 1 second (this duration can be controlled in the Processing app, to produce a short chirp or a long alarm). A successful ‘hit’ also lights a small LED on the breadboard.

NewsAlarm - LEDs
Trapper John & The NewsAlarm

As you can see, it works! Our next step will be to put the components onto a small circuit board, and to implement a wireless relay so that the alarm doesn’t need to be connected to the computer via a cable.

Ultimately, I’d like to produce an array of these devices that can be installed as a sort of ‘News Alarm Centre’.

In the meantime, I have the news alarm running – queued up to sound if more than 50% of the NYTimes headlines contain the word ‘aliens’. You never know… right?

22 thoughts on “NewsAlarm – wiring in to the NYT NewsWire API”

  1. While I applaud your ingenuity, I must raise the question as to whether it’s wise to use a smoke alarm as the alert signal.
    Smoke alarms have a distinctive, fairly-unique alarm sound that has so far been reserved for the event of smoke or fire. It is a well-recognized sound that requires little or no explanation in a home or office setting. Using this sound for another purpose diminishes its capacity to do its intended purpose effectively.
    Undoubtedly the number of news alerts that come in will be greater in frequency than the number of smoke or fire events. If you or your family get too accustomed to this sound signifying a non-life-threatening event, they will likely not recognize it when it is, in fact, trying to save their life. Even if it caused them to hesitate to respond for a very few minutes, that could be the difference between living and dying.
    Please, please reconsider using this sort of alert for your project.

    1. Jim,

      This is an art project. It was never intended to be a device that is functional, or would be used in the real world. Quite frankly, you’d have to be insane to want an 85 dB alarm telling you when news has arrived.

      News agencies work very hard to foster anxiety surrounding the news – it’s a way for them to increase readership and advertising revenue. I wanted to embody this in a device which is quite literally alarming; an object that is associated with emergency and threat to one’s safety.

      Networks like FOX News would have us believe that news ‘alerts’ are just as important as a house on fire, but of course in real life they never are.

  2. Hi Jer, just thought that I would take a look at your blog. This is quite ingenius. I understand the process but for me to instigate this would be way beyond me. I like the concept of making the news literally alarming!

    I love your studio! So clean and relaxing. A great space.

  3. Pingback: mtascon (mtascon)
  4. Pingback: bgerst (Ben Gerst)
  5. I loved your innovation about creating a new alarm and I must admit that it is really good. The problem lies in the use of the device, I am not sure, as where is it going to be used on a daily basis?
    Thank you for enlightening us on this very innovative device.

  6. This is a great project, really inspiring. You should convince the Drudge Report to sell these, since they're so fond of gif sirens with their breaking news. Also, the fire alarm has a lot of interesting connotations to dangerously shocking (or i guess "alarming" news), maybe a fire extinguisher should be rigged up to go off whenever there is breaking news with a positive tilt, like "health reform" and "passed."

  7. Jer, very creative! Love it. Where did you come up with the idea of using a smoke alarm for a news wire? Can you get it to alarm with specific wording? Anyway, very cool. Thanks for posting this article.

  8. Hahahahaha…I'm sorry, but the whole dog thing with "As you can see, it works!" is too hilarious.
    Anyway, congrats on the ingenius idea. I've always admired creativity though I must say I don't really possess such a skill. For example, I wouldn't have known what to use it for if you hadn't given the alien example. That and "epidemic" or "solar flare" maybe.

  9. I would love to see the classes that you developed to do this. I am new to Processing so am looking for examples. If you can share them I would be very thankful.

  10. I think many of us have the same feeling about holding a smoke alarm! I love your ingenuity but wonder whether you would really want to hear the noise of a smoke alarm as your alarm… I know I certainly wouldn't!

Leave a Reply

Your email address will not be published. Required fields are marked *