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.

57 thoughts on “Motion Detecting Window Closers Keep Train Noise At Bay

  1. 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.

    1. 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!

    2. 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.

      1. I that he would have known the tracks where there but moved there anyway, probably means that affordable alternate housing wasn’t/isn’t available. In general someone is going to have to put up with the annoyances from what benefits us all.

  2. @Hackerspacer:
    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.

  3. 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.

    1. 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.

      1. 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?

  4. 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.

    1. 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.

    2. 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.

  5. 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

  6. 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

  7. 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.

    1. 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.

      1. I’m just glad I sleep days and am up at night…the train never blows the whistle as it drives by the residential zone during the day; only in the middle of the night. I guess the driver figures, “If I have to be up at 2AM, so does everyone else!!!”

  8. 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.

  9. 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.

  10. 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.

Leave a Reply to n0lkk Cancel reply

