Motion detecting window closers keep train noise at bay


[Ed Rogers] has the unfortunate privilege of living right next to a set of train tracks, and as a man who holds his sleep in high regard, he needed to find a way to keep the noise in his bedroom to a minimum. To combat the sound of passing trains, he built himself a system that automatically closes his windows when a train passes by his apartment.

The setup relies on a web cam, which uses motion-sensing software to detect a passing train. The video is analyzed by a computer in his room which passes a message to an Arduino when a train is near. The Arduino then sends a pair of window mounted linear actuators into action, slowly (and quietly) shutting his windows.

The linear actuators move pretty slowly as you can see in the video below, but we doubt that matters. Since it looks like [Ed] lives in a slow zone, it likely takes quite a bit of time for a freight train to pass, making the 40-second closing period more than reasonable.


  1. Hackerspacer says:

    Pneumatic cylinders with dampers would be much faster but I still question how a window being closed truly blocks low frequency sounds such as a freight train would generate. My guess is not too much.

    • drake says:

      Haha I can only imagine! Psssssst SLAM smash *cry*

      I can see it being faster but in this application I don’t think it would be safer. Not to mention you’d need a compressed air source.

      Another improvement would be an automatic loading of walnuts/peanuts/etc into the jamb for a dual purpose closing and nut cracking!

      All in all this is a good build. I cant see why to dedicate a whole computer to image processing though. You could probably pick up a cmu-cam2 cheap … check with FIRST teams. This would allow the removal of the computer and usb and allow for a single serial line for communication with the camera!

    • Will says:

      The really low frequency sounds from the locomotives would be hard to muffle, but the video shows that it does a good job of quieting the squeaks and rattles from the cars. I suspect that those sounds are more frequent and distracting than the engine noise.

  2. Jeppo says:

    What’s up with the lotion and the tissues on the nightstand!?

  3. Technicality says:

    It doesn’t really matter, because the higher frequence sounds are more annoying. Otherwise I agree with you, it shouldnt be hard to make this work a bit faster – a bit of gearing could do the trick.

    But it works right now, so no need to pull apart the fancy linear actuators.

  4. giacomo says:

    Love these practical hacks – nice build! If only the trains ran on a tight schedule, you could just use an RTC… Personally, I’d dispense with the webcam + computer and just use an accelerometer or resistive vibration sensor attached to some structural member of the house (or maybe water pipes). Get the magnitude of the vibrations, and if the magnitude exceeds some preset for more than a few seconds, close the windows. You could get fancy and use an FFT to only respond to the train’s vibration signature, but that’s probably not necessary.

    • cmholm says:

      Since Ed is already using an Arduino, and given availability of accelerometer shields w/ (what I hope is) acceptable sensitivity, I think @giacomo has the right idea for rev 2.

      I’ve got barking dogs to deal with, so I was going in hoping Ed had some active noise canceling solution. Trying to get at the root of my problem, short of calling the cops on my otherwise good neighbor, I’ve been using the Dog Silencer Pro. It’s mounted on my house only 30 feet from the canines.

      It has helped a bit, but I think it needs a bit more amplification to motivate them to shut the @#!#$ up.

    • Whatnot says:

      To me that sounds like a much worse solution that is sensitive to error and reacts too slow.

      • giacomo says:

        Why? Many cheap accel’s are sensitive enough to detect footsteps. I think it could work, especially if you go with an FFT. I guess the only way to know would be to try it. Too bad/fortunately I don’t live near any train tracks. Anyone want to take their accel shield on a field trip to test?

  5. Tanky321 says:

    This is a really cool idea, I think the webcam and PC image processing is way overkill though. I bet you could use an electret microphone feeding into a comparator to trigger the actuator. Granted you might have to mount the mic outside, id have to think about that.

  6. Tuckie says:

    And that brings us to the question of: why not process the sound of the train? The high pitch sounds are probably pretty distinctive.

    • milo says:

      This is a great idea, and you could use a parabolic microphone off ebay to pick up the train at a great distance. Dial the action to a volume of the test sample and you could have the windows closed before you could ever hear the train. Additionally the parabolic is very good at canceling noise from anywhere that the dish is not pointed and it keeps you from having to mount anything far from the house (like a vibration sensor on a track tie.

    • Cheap laser pointers and some reflectors mounted on trees or posts in the background. He’s 2nd story, so he might even be able to get some range.

      I use to live near a rolling stock/hot axle detector. when the train passed by the sensor, the radio kicked on and transmitted the total number of cars. Since this was a mile or so down the road, it would have made a perfect heads-up, at least for traffic coming one way.

  7. anon says:

    it should check train times instead!

  8. torwag says:

    if you are already into recording the train… hack one of this noise cancellation headsets and create a noise cancellation bedroom.
    I remember once I saw a project (guess was commercial) who created noise cancellation windows by using the window glass (as a membrane) itself to cancel out the noise.

    Anyhow I would definitely go with an easier solution as mentioned above… noise, vibration
    the webcam solution is kind of not very green. How much power does your system burn just to wait for a train event?
    The sound of the fans in the PC should not make you happy either.

    You could combine several principles noise, vibration and time tables to make the system rather fault proof. A simple rule set…

    is there noise?
    is there vibration?
    does it lay within a time table slot for a train?

    close the window

  9. jordan says:

    I like this concept! And he definitely couldn’t use a clock to manage the opening and closing. I deal with CN rail and their shipping trains follow anything but a regular schedule.

    My criticism: i think it’s overkill to use a webcam and computer. Sound is the problem so I’d use a microphone. There are quite a few great electret mic drivers for microcontrollers online.
    Make a directional enclosure and point it at the farthest away a train can be.
    With a bit of calibration, he’ll have it activate when it gets loud.

    Heck, it’s even possible that he could stick the mic to the ground/windowsill and use the FFT library to look for super loud low frequencies if the response time of a mic in air isn’t good enough.

    I think a microphone would respond in about the same time as a webcam would so I figure he’d get the same results at a fraction of the energy requirement. Plus no noisy computer fans :P

  10. David S says:

    His sleep? Do cameras work in the dark? Or is he a nightwalker?

  11. Fogger says:

    Sound activation makes more sense than motion activation for the problem he’s solving. But for motion detection, there are lots of cheap IP cameras available now that have nc/no alarm outputs that are triggered by motion.

    For those of you that don’t live within earshot of a railway line. Your brain does start to tune out a lot of the noise after a while. I’m not as close to the railway line as he is, and I can definitely hear the trains pass by. But the sound doesn’t grab my attention or wake me up at all. I find passing light aircraft & helicopters of similar volume much more distracting, probably because they don’t pass by that often.

    • Keith says:

      I would go with sound level / frequency detection. However, like Fogger said, you will eventually get used to it. I know, since I lived very close to a firehouse once and thought I would never sleep again … a few weeks later and my brain filtered it out and I didn’t hear it much anymore.

  12. Frollard says:

    Yeah, only trouble is by the time you see the train, the loud part is gone.

  13. Frollard says:

    *to add, how tricky would it be to screw a reflector to a tree way in the distance and use a very low power laser to have a trip BEFORE the train gets there…

  14. Cryous says:

    Not too hard, aligning the laser would be hard. also the circut board would have to be a tad more complex. i like the mic idea that would work great

  15. KillerBug says:

    So…what about the air horn that they hold down as they go by at 2MPH at 2AM?

  16. Eric says:

    If you could see the train, isn’t it a little bit late?

  17. Wil says:

    I love the build, but the most important thing I’ve drawn from this is that I have /got/ to get myself a makerbot.
    So… useful…

  18. Sinamox says:

    Cool WSOR’s anniversary SD40-2. Why are the windows closing instead of opening? More train videos please.

  19. doragasu says:

    I think an Active Noise Control device is a lot more suitable for this kind of tasks, but good hack anyway.

  20. If possible, microphone could be attached to the track. (or accelerometer). That way train can be detected early enough.

  21. Chris says:

    Just reposition the camera to see the train a bit earlier, and the window might be closed before the train is that close, even if it’s slow and silent. I guess silent is the key word here. ;-)

    As mentioned, there are now cheap cameras available with built in detection (I had one that let me set up zones/boxes for detection, ignoring the rest of the image) and no/nc outputs.

  22. T says:

    Nice idea! I love to have this for rain detection.
    Are there any methods to detect rain?

  23. rasty says:

    The way I would have done it would be to build a small AM transmitter triggered by a wire on the rail or a piezo and a reciever. That way the windows would close before the train arrives. With enough piezos and a capacitor the system could be made to work without batteries.

  24. vegard says:

    How about if you just angle the camera or put it outside or something so that it spots the moving train earlier, and thus start to close the window earlier?

    Cool build anyhow! :)

  25. melt says:

    Neat! How about listening for the radio transmissions from the FRED? This could mean you’d close the windows before the train arrived. Apparently they can be detected up to two miles away?

  26. aztraph says:

    nice build, he could even sell it if he built in a few safeties like an obstruction switch/bar, to prevent it from closing on little fingers or critters.

  27. DOT850 says:

    Very cool build! Makes me want a Makerbot, also makes me want to live near a train, maybe not that close though.

  28. exuvo says:

    Why not keep the windows closed all the time? Seems like a much easier solution. Also by the time those windows are closed I would already be awake.

  29. henry99 says:

    imo it would have been easier to hack a disto (laser measurer) and aim it onto the track. That way you could stop false alarms from birds etc.

    Also, as previously mentioned, the train will have passed by the time the windows close.

  30. Psiu! Puxa! says:

    Much easier to implement in my home automation with my Jalacy windows and a window actuator motor out of a car.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,532 other followers