Good day folks. Some of you may know that a while back I was avidly trying to install an automatic roll-up system for the windows in my car and many of you were kind enough to provide lots of input on that, helping me learn a lot of stuff. I dropped it for a while due to various reasons, but now I'm back on it after I've been having more and more issues with the current install.
The car didn't come with such a feature, so a while back I bought an aftermarket box gizmo...thing which sort-of does the job, that is, when you lock the car this box rolls up the windows, but it's pretty "dumb" because it doesn't know whether or not the window has actually closed or is already closed. It just closes a relay for a set number of seconds and "hopes" the window makes it all the way up...which is fine for the most part, except for two instances: if the window is already up, there's no limit switch or current sensing to tell the box to stop cranking, putting quite some load on the battery and motor, since the motor is essentially seized at that point. Also, since it's based on a timer, if there's a smudge on the window or for some reason the rubbers become sticky and the window doesn't make it all the way up in time, the box doesn't know that either and it just stops, which is probably the biggest issue. Sometimes I forget or don't realize I have my window down, so I lock the car and walk away without looking back, only to come back to it later and discover the window is half-way down and rain or bird c*ap had got in....not to mention someone might get in and swipe the radio or something...you get the point.
So I decided to do something about it by implementing a feature that ensures the windows close properly each time and scrap that box I currently have on there entirely. At first I thought about using switches and installing those in the doors in such way that when the window is all the way up it would activate it and stop whatever device is cranking them. This idea stuck with me for quite some time until I thought about the probability of failure in mechanical switches and also about drilling holes in the chassis which would eventually lead to rust, so I dropped it.
The idea proposed in my original post involves current-sensing the motors and detecting the spike that should occur when the window has reached the top (and perhaps bottom as well if I REALLY want to be thorough). I struggled with discrete components, which although MAY save some money in the long run, they also introduce a lot of variables and things that can go wrong, so I thought about using a micro....after all, I assume modern cars do this by default and use some sort of micro there, so why not. I have an arduino mini lying around so let's put it to good use.
Now: current sensing with arduino...in a car. Can it be done ? I'm fully aware that everything must be stepped-down to 5v, since cars run at 12-14v, but admitting we get over that....The idea is to have the arduino "listen" for the lock signal on a pin and once it receives that, roll up the window until it detects a certain current level which would correspond to the motor being seized when the window has reached its end of travel. To overcome false-triggering caused by motor inrush, I'm thinking of a "debounce" feature that only stops the window when a current higher than X amps is maintained for 1s or so (to ensure the window has DEFINITELY reached the top-most position and also act as a safety feature to cut out if a foreign object or a person's limb is inserted in the door frame)...the real challenge here is the current sensing. Once I get that out of the way, the possibilities are virtually endless.
I came across this article which is fairly close to what I'm trying to achieve. Sounds simple enough: shunt on wire going to the motor, amplify its "output" and send that to the arduino. Then it's a matter of messing with the code to tell it when to start and when to stop. What do you guys think ? Cheers and thanks.
The car didn't come with such a feature, so a while back I bought an aftermarket box gizmo...thing which sort-of does the job, that is, when you lock the car this box rolls up the windows, but it's pretty "dumb" because it doesn't know whether or not the window has actually closed or is already closed. It just closes a relay for a set number of seconds and "hopes" the window makes it all the way up...which is fine for the most part, except for two instances: if the window is already up, there's no limit switch or current sensing to tell the box to stop cranking, putting quite some load on the battery and motor, since the motor is essentially seized at that point. Also, since it's based on a timer, if there's a smudge on the window or for some reason the rubbers become sticky and the window doesn't make it all the way up in time, the box doesn't know that either and it just stops, which is probably the biggest issue. Sometimes I forget or don't realize I have my window down, so I lock the car and walk away without looking back, only to come back to it later and discover the window is half-way down and rain or bird c*ap had got in....not to mention someone might get in and swipe the radio or something...you get the point.
So I decided to do something about it by implementing a feature that ensures the windows close properly each time and scrap that box I currently have on there entirely. At first I thought about using switches and installing those in the doors in such way that when the window is all the way up it would activate it and stop whatever device is cranking them. This idea stuck with me for quite some time until I thought about the probability of failure in mechanical switches and also about drilling holes in the chassis which would eventually lead to rust, so I dropped it.
The idea proposed in my original post involves current-sensing the motors and detecting the spike that should occur when the window has reached the top (and perhaps bottom as well if I REALLY want to be thorough). I struggled with discrete components, which although MAY save some money in the long run, they also introduce a lot of variables and things that can go wrong, so I thought about using a micro....after all, I assume modern cars do this by default and use some sort of micro there, so why not. I have an arduino mini lying around so let's put it to good use.
Now: current sensing with arduino...in a car. Can it be done ? I'm fully aware that everything must be stepped-down to 5v, since cars run at 12-14v, but admitting we get over that....The idea is to have the arduino "listen" for the lock signal on a pin and once it receives that, roll up the window until it detects a certain current level which would correspond to the motor being seized when the window has reached its end of travel. To overcome false-triggering caused by motor inrush, I'm thinking of a "debounce" feature that only stops the window when a current higher than X amps is maintained for 1s or so (to ensure the window has DEFINITELY reached the top-most position and also act as a safety feature to cut out if a foreign object or a person's limb is inserted in the door frame)...the real challenge here is the current sensing. Once I get that out of the way, the possibilities are virtually endless.
I came across this article which is fairly close to what I'm trying to achieve. Sounds simple enough: shunt on wire going to the motor, amplify its "output" and send that to the arduino. Then it's a matter of messing with the code to tell it when to start and when to stop. What do you guys think ? Cheers and thanks.
Comment