This Automatic Window Closer Senses Loud Locomotives

Arduino Home Workshop
YouTube player

Ed Rogers lives next to active train tracks, which leads to a lot of noise in his bedroom when a train passes and the windows are open. Like any good maker, Ed solved his problem with a homebrew automatic window closer. He attached a pair of linear actuators to the windows with 3D printed brackets. These actuators are controlled by an Arduino with an H bridge and can be activated by a button on his nightstand. Not only that, but the project also integrates a motion detection system to close the windows automatically when a train is passing. At the end of the video, you can see the motion detection system spotting a train and closing the windows. It’s remarkable how much the noise is reduced when the windows are closed. I wonder, what’s the best way to get the windows to close right before the train comes? Any ideas, MAKE readers? [via Neatorama]

44 thoughts on “This Automatic Window Closer Senses Loud Locomotives

  1. Kasper Van de Laar says:

    The best way to close the window before the train comes, would be, imo, to have a camera installed outside the window, watching the track, and use the motion on a smaller piece of video to determine if the train is coming [which in this case would be a piece of track]
    It doesnt have to be an super camera, just one with decent quality.

    BTW: awesome project :D

    1. Guillaume Filion says:

      I agree with Kasper that a camera watching the track would be the best option. Actually, he would need two cameras, one in each direction.

      If the actuators were faster at closing the windows, a cheaper way to go would be to put a mic ouside and close the windows when the background noise level reaches a certain threshold. But the windows would need to close much faster for this to be effective.

  2. Vassilis Aggelakos says:

    Easy. 
    1. Let the software record the time at the the train pass.
    2. Leave it recording for a whole week.
    3. Next week close the windows 1 minute before the train!

    1. Anonymous says:

      That could work well for a passenger system, but freight is not nearly as predictable.  I tried to time my commute to what I thought was a regular train schedule, but it just didn’t work out.

    2. Anonymous says:

      That could work well for a passenger system, but freight is not nearly as predictable.  I tried to time my commute to what I thought was a regular train schedule, but it just didn’t work out.

  3. Pete Mills says:

    I don’t mean to be pedantic, but this isn’t sensing “loud locomotives”.  That is, it does not differentiate between a locomotive that makes noise and one that makes none.  After watching the video, it seems the window closing is based purely on motion, human, locomotive and presumably automobile too.

    As a way to detect incoming trains before they arrive and reject false alarms,  I would attempt to listen to train horns in the distance.  If I recall correctly the last modern train I saw had 3 separate horns on it.  Analyzing audio by scanning for these three frequencies concurrently could indicate a train blowing its whistle at an intersection further up or down the track.  You could also derive speed based on Doppler effect to determine how quickly you should shut the windows before the train gets to you.

    You could also try decoding the train whistle blasts in software.  It looks like it would be a pretty easy thing to do based on this http://en.wikipedia.org/wiki/Train_whistle#Whistle_code

    I like seeing multidisciplinary projects; keep up the good work Ed Rogers.

    1. Matt Richardson says:

      You’re right. I just liked the aliteration. I didn’t mean to imply that it makes a differentiation between loud and quiet locomotives, but rather state that loud locomotives are the ones that pass by the window and cause the problem that Ed is trying to solve.

      I like the idea of sensing audio. It could also just listen for any loud sound outside. That way, anything loud will close the windows, not just trains.

  4. Riley Porter says:

    Firstly, great project!  Next I have a suggestion.  There are lots of public webcam feeds (at least in my area DC).  If you poke around you might be able to find a public feed say at a stop light etc about a mile out or so?  Try to find 2 of them with your house in the middle.  Then tweak the code to use the public feed.  Just a thought.

    ril3y

  5. Riley Porter says:

    Firstly, great project!  Next I have a suggestion.  There are lots of public webcam feeds (at least in my area DC).  If you poke around you might be able to find a public feed say at a stop light etc about a mile out or so?  Try to find 2 of them with your house in the middle.  Then tweak the code to use the public feed.  Just a thought.

    ril3y

  6. Lynne Whitehorn says:

    One “best” way would be a cooperating network that communicates via a mesh (or other network).  This could also be used for other phenomena whose movement is semi-predictable (sirens, church bells, parades, cattle drives.)

  7. Jonathan Falkner says:

    I would recommend he switch from a webcam to a laser motion detector that is more directional, and point it at further up the track.  He’d need two (one pointed in each direction) because the train could come either direction on the track, but it would allow his system to start closing the windows much sooner, so they are closed by the time the train actually gets next to his house.

  8. Anonymous says:

    I would listen for the sound of the approaching loco so that the windows are already closing before the noise reaches its peak and use motion detection to know when to re-open the windows.  Our house is a block away from a crossing so we hear the horns as the train approaches.  There are also crossings north and south of us.  If my system senses the horns at the more remote crossings, then the windows can be already closed by the time it approaches the near crossing.
    As long as the windows are automated anyway, I would add precipitation and temp sensors so that it functions as a part of the home’s climate control.  As long as the outside temp is lower than the AC setting (or higher than the heat), windows open until it rains.  Set the locomotive sensing to only function during hours the home is occupied.

  9. Anonymous says:

    Really clever and well done! As for earlier detection… I couldn’t help but to think of the old trick of putting your ear on the track to listen for a train… which led me to think perhaps the vibrations might be detected easier/faster than the webcam (maybe?). I found a link on Makes site for a DIY seismic detector http://bit.ly/pCEiR1 or maybe something like this on youtube: http://bit.ly/nPnLtc – good luck and I hope we’ll see a follow-up post!

  10. Anonymous says:

    Why not close the window on sound level?  Then you’d close your window even if you can’t see the noise source.

    It may take some tweaking to find the level that doesn’t close window when its to quite and make sure it doesn’t open when it’s still noisy. 

    Set a shut threshold, start a delay to open timer, if threshold isn’t crossed again by the timer runs out reopen window.

  11. David C Dean says:

    $20 for long distance serial tx/rx pair from SparkFun, put prox sensor, transmitter, lipo+solar charge 250ft up the tracks in one of those trees (where it still gets sun).  Transmit on train approach.  It’s a kludge, but might work. :)

  12. Anonymous says:

    Very neat.

    I’d contemplate creating an acoustical model and train some Hidden Markov Models for the approaching train. Actually, the horn might be detectable with even simpler methods – maybe it would be enough to listen for a low-variance signal and verify with a FFT that it’s the right frequency.

    Or you could connect a sensor to the tracks (piezo pickup maybe?) 

  13. James Hollowell says:

    If the trains run on a schedule, you could try to find a web service with those times and have the Auduino ask it when the next train is, and then close the window before it comes by.

  14. Simon So says:

    hum… will it open the window again?  that seems to be just as important as well, otherwise, you could just leave the windows closed all the time! :P

    But otherwise, it’s an awesome project.  I agree with earlier comments regarding detecting the train earlier, either use a sound based detector (which makes sense since you want to close the window because something is making a racket outside, shouldn’t matter whether it’s moving or not), or a camera further out the window looking further down the tracks.

  15. Anonymous says:

    Love this idea even though it could use some tweaking. That’s how every great idea starts, with a thought and then build on that. What about using a timer http://www.truevalue.com/category/Electrical/Timers-Sensors-Photo-Controls/pc/4/62.uts? If you happen to have the train on a schedule then this would work great. Or if you wanted to leave the windows open when you left for work but knew it was going to rain so they would need to be shut later in the day.On the same page would be adding a electronic shade to lower when it gets darker outside.

  16. Anonymous says:

    Very nice setup. As for early detection – There is probably some kind of signaling system that controls where trains are and are not allowed to go. Presumably there must be a signal somewhere that changes state when a train approaches the section of track where you live. If you were able to somehow pick up this signal? There may even be an online monitoring system for these signals?

  17. David Sibrava says:

    Not that I understand all this arduino stuff, but using a directional microphone seems to me like a far better option (perhaps you could buy yourself a small satellite dish to amplify the sound and then just check whether it has gone over some limit?) Or you could point a laser beam at rails and watch for reflection changes (maybe) or use a sonar to detect incoming train. I don’t really have any experience, but… you know, maybe that could work.

  18. Howard says:

    I am looking for something like this for my windows and do not have the time to source/develop the components, i cant find anyone selling a kit like this, you should!

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

Matt Richardson is a San Francisco-based creative technologist and Contributing Editor at MAKE. He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.

View more articles by Matt Richardson

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK