Detect Train and Close Window with Arduino and Webcam

Using a webcam, open-source motion detection software, and an arduino, I’ve created an automatic window closer for my bedroom windows. This is a demonstration of how it works.

Duration : 0:4:46





23 responses to “Detect Train and Close Window with Arduino and Webcam”

  1. mayhn Avatar

    Really great. In my …
    Really great. In my opinion? you should use high power laser beam to alert the train passing even a few hundred meters earlier.

  2. hingedelephant Avatar

    Nice.? A little …
    Nice.? A little slow, but a nice build.

  3. Houdinisworld Avatar

    Neat ideal! Most …
    Neat ideal! Most windows are verticle but this is great for sliding windows. My advice for improvement is to put a simple pressure switch on the track and add a wireless kit to your Arduino. You could also put an audio sensor which would kick in way before the? webcam sees the train… I have no doubts you can tweak the coding to respond only to the repetitive sound of a train. Really cool though!

  4. albertopasca Avatar


  5. crashtokio Avatar

    Thank you for …
    Thank you for sharing this! I am upset about people posting what’s wrong without building a better solution, documenting it and or posting a video response showing how to impove your very good idea. Your video is helpful. ?

  6. Auhydride Avatar

    not sure if it …
    not sure if it would be legal but, you can wire the railroads to give you heads up long time? before the train approaches.

  7. MrKaman25 Avatar

    When you hear the …
    When you hear the train coming, go and close the two windows. It would take less time and there would be no need for a special printer that makes plastic du-hickies and no need to put holes in your landlord’s walls. If you need something to do, invent a robot to close the windows and it could also get beer. Then I’d buy one! Thanks for the video and I’m sorry to the? person who is losing his company.

  8. toadrw1 Avatar

    Another solution… …
    Another solution…

    1. Stand.
    2. Walk to window.
    3. Close window.
    4. Walk to other window.
    5. Close other window.

    I understand the design is not as elegant, but you might get laid more and not need the tissues and lotion.? 02:41 Good luck to you!

  9. lightandbeautiful Avatar

    Please visit my …
    Please visit my channel for the unpopular truth about homosexuality.

    A person does not need hatred or any kind of phobia in order to acknowledge important differences between heterosexual attraction /? behavior / marriage / adoption and homosexual attraction / behavior / marriage / adoption. Even non-religious people know this.

    Homosexual activists, with support from the media, have succeeded at framing themselves as noble victims; it’s an effective way to push a social agenda.

  10. seere001 Avatar

    ??????????????????? …

  11. mhamsburg Avatar

    Hi People. I know …
    Hi People. I know this comment is not related to the video, but our company is going under (incl all my saving) and this is my desperate last resort to promote our iphone app. it’s called “FS Viewer” and “Analyst Rating Tracker”. u’d be saving two lives if u downloaded? either one of these apps..thanks a lot.

  12. ColoradoState76 Avatar

    “A” for creativity! …
    “A” for creativity! The actual usefulness…I dunno. This guy seems to have some good technological skillz as well as creativity. Sounds employable. What the is he doing living in some small apartment on the wrong side of the train tracks? We have a? ton of politicians who don’t know squat and they make millions.

  13. peetre Avatar

    very funny sw204me, …
    very funny sw204me, that was? my thought also. I expected a sound sensor that would automate this. If i had to push the button, by then i am wide awake. good idea though!

  14. 00skin00 Avatar

    Very cool. Have you …
    Very cool. Have you thought about tying this into a temperature monitor system so that if it is hot inside the windows automatically open based on the? time of day and temperature outside? I have been thinking about a project like this for some time.

  15. ddguydd1 Avatar

    neat project… …
    neat project… you’re lucky your trains are so slow… kidding?

  16. deadking13 Avatar

    Why not a Mic …
    Why not a Mic instead of? the web camera?

  17. redsynapse Avatar

    TLDW; “After the …
    TLDW; “After the train has already been roaring by my window for 20 seconds, my slow actuator kicks in an, at speeds rivaling that of the fastest glacier, and then 20 seconds after that the windows actually close.” Suggestion: use software like vitamindinc , where you can set up a rule (e.g. if the train moves past a boundary 200 meters away from your house) the? windows close.

  18. ivanblogs Avatar

    What h-bridge? are …
    What h-bridge? are you using?

  19. MrChannnnnnnnnnnnnnn Avatar

    Things you can …
    Things you can improve on:

    1. Have a recognition software hooked with a webcam,? to identify a train from FAR, so you would have the time to close it. (totally open source and simple google it.)

    2. Increase the speed of your actuator.

  20. SquirrelFromGradLife Avatar

    It’s quite clever, …
    It’s quite clever, but…yeah you knew there had to be a but in there somewhere…
    If noise is the problem, then why not hook some sort of microphone up and make an algorithm that monitors the sound level and detects a train coming before it’s actually parked in your bedroom.
    Also the linear actuators are fancy and they look somewhat powerful, but the force required? to close a window is quite small and the speed at which they close is paramount, so hook them up to some sort of gearing system.

  21. nadtulevad Avatar

    i bet the rent? i …
    i bet the rent? i cheap.

  22. boblebob Avatar

    yeah surely you …
    yeah surely you would want it to close quicker to block the noise quicker? seems like a lot of effort for? it not to be that effective

  23. mrmts Avatar

    @emomotorgeek LOL? …
    @emomotorgeek LOL? busted

Leave a Reply