one-shot power windows (car)

Hello,

I am thinking about a new project where I want to build a standalone circuit that adds one-shot functionality to a car's power windows.

So far, that car only has "basic" electrically powered side windows, meaning that you have to keep the window switch pressed to roll the windows all the way up or down. Most newer cars have "one-shot" windows, which means you just have to push the switch briefly for the windows to roll all the way up or down on their own.

In my imagination, the simplest idea for a circuit would just be to rewire the power window switch through an Attiny MC, one Attiny for each window, and then let the Attiny count up the milliseconds for which a switch is kept pressed. If it's pressed for more than half a second, the Attiny will switch 12V through to the window motor for three or four seconds using a MOSFET, so the window will roll down or up on its own.

So far, so good. This setup wouldn't take long to buiild. But I want to build the circuit so that the power windows will still work if there's a fault with my standalone circuit. To do that, the Attiny circuit would probably have to run parallel to the window switches, but in that case, the Attiny wouldn't know if there's power going through the switch because the switch is pressed, or because the Attiny itself has put 12V on that wire.

In factory configuration, each switch has its own 15A fuse in the fuse panel under the steering wheel. Each switch directly switches power from the fuse panel through to the window motor. Pushing the switch up or down changes the motor's polarity and so the motor basically turns in one direction or the other.

Any thoughts?

First I thought that having arduino control relay switches in parallel with button switches would allow it to both measure how long a contact is pressed and have the relay closed for longer than the switch.

But it may fry a fuse if the passenger changes mind and decides to close the window while arduino is opening it.

Better make sure the arduino program doesn't go wrong and have it control the motors according to button presses.

blimpyway:
Better make sure the arduino program doesn't go wrong and have it control the motors according to button presses.

Yeah, that's one of my problems. How to cut the power to the motor when the switch is pressed in the opposite direction.

There will be at least one brief moment where the motor will have +12V power from both wires. It could also damage the motor itself.

Because the factory window switches are rocker switches, the way it is now, it's practically impossible that the motor will get 12V on both wires at the same time.

For me, a motor has two wires (I know there are other ones); direction depends which wire is positive. What does the window motor have? 3 Wires, one to ground and two to determine direction and the switch powers one of them?

ok here's a circuit diagram to that section of the car's wiring. The window switches are in the lower right corner of it (it's a two-door car):

carguy:
But I want to build the circuit so that the power windows will still work if there's a fault with my standalone circuit.

Like I explained before, there is absolutely no guarantee your circuit will fail in a non-interact state. Yes, if the power fails or the ATtiny is blown but if you build it nice those changes are small. I would say as small as a spontaneous short circuit which blows the fuse and you can still not use the windows...

I think the biggest change of failing is because of a bug in your code. And there is no guarantee it's a bug that only makes it unresponsive. It might as well be stuck in on or ping ponging the windows up and down.

And besides that, it's hard to parallel a polarity changing circuit without the risk of short circuit.

So just drop the parallel idea, use a motor driver to drive the window and post your code and schematic here so everybody can check for bugs.

And the time limit may work but it's not the best. If the windows is already up and you press it up it will keep power to a stalled motor. Also, for safety. What if there is a finger stuck?

Yes, you could implement some feature like a minute time out after the last full up/down cycle and a cancel by pressing the other direction. But it would be nicer to add current sensing. The current will go up when the window is blocked (is it by accident or it reached the end) and when you sens that you can switch it off. And it's not hard at all to make :wink:

[edit] Now you posted a circuit you can see both windows are NOT the same. The passenger side is driven directly but the driver side goes through the MCU. Both are possible but you need different circuits. The driver side can probably be connected to the ATtiny directly (measure the current, probably very very low, and voltage when the switch isn't pressed, expect 5V). But for the passenger side you need a driver of some sort. H-bridge motor driver is the easiest.

Can you use the existing window switches to control your Arduino so that all the control of the window is by the Arduino. That way there could not be conflicting signals.

Having both motor wires at 12v or at 0v can't do any harm. A problem only arises when 12v is connected to 0v without a load in between.

I assume the window motors are designed so that they are comfortable with the stalled current for an appreciable amount of time - for example if the person closing or opening the window fails to take their finger off the button, or mistakenly presses close instead of open.

...R

Since the driver-side switch has a double switch that goes through the ECU, it should already do that - the second switch is activated when you push/pull more, and the ECU takes that input to know when to fully open/close the window. The passenger's window motor however is directly connected to battery via fuse box.
That's exactly how my old almera works.

Hm... I wasn't going to fiddle with the window ECU because so far I am not sure I fully understand how it works.

So I thought I was just going to let the Attinies in my circuit mimic the behavior of the window switches. As I understand it, this could be done simply by using MOSFETs or relays... but I may be wrong?

Yeay, you can do that. But then you are on the driver side already "fiddling" with the MCU... The MCU is probably there because the is already some sort of one shot build in. You have to keep that in mind when you make code so you don't end up with your own one shot controlling the one shot of the MCU. The switches to the MCU are nothing more then two lines that are switched to ground. It's just like you're used to connect switches to an Arduino. And you can, if the current is low and the voltage when not pressed, connect them straight to the ATtiny. If the line is pulled to 12V I would add a optocoupler. Relay is also possible but chucky, power hungry and loud...

And because both windows have a different layout you need two different circuits.

For the passenger side you could use relays as the two switches but then you have to watch not to activate them at the same time (or, when parallel to the switch now, together with the switch because that will blow the fuse. So I would go the easy route, connect the switches to my ATtiny and let the ATtiny drive a H-bridge. Put a sens resistor in line to detect a stop. Doesn't get any more easier.

Robin2:
I assume the window motors are designed so that they are comfortable with the stalled current for an appreciable amount of time - for example if the person closing or opening the window fails to take their finger off the button, or mistakenly presses close instead of open.

Yeah, they probably are. I think most cars have a thermal fuse for that, which cuts the power before it could start to damage the motors. That's how they did it on older Volkswagens anyway.

I was just going to let the Attiny put through 12V for five seconds everytime it senses that somebody briefly flicks the switch. I've timed it, it takes about four seconds for the window to completely roll down or up. "Up" takes a tiny bit longer, probably due to the weight of the window being lifted.

And just keeping the button pressed for four seconds when the window is already all the way up or down seems to have no harmful effect on the motor or the car's circuits.

And then if during those four seconds the switch is pressed in the opposite direction, I will just let the window stop and exit the four-second timer.

carguy:
And then if during those four seconds the switch is pressed in the opposite direction, I will just let the window stop and exit the four-second timer.

But you can't do that if the switch is parallel to your driver :wink: On the passenger side you have a dead short and on the driver side it depends on how the MCU handles it.

Speaking about the MCU, doesn't it already have a one shot function on the driver side?

And yeah, they will have some protection so you'll probably don't damage the motors. Like I said, you can do it time driven. But current sensing isn't that hard and you could make it stop when a finger is stuck :wink: But yeah, it's a bit more complicated.

septillion:
Speaking about the MCU, doesn't it already have a one shot function on the driver side?

That's the weird thing. Going by the wiring diagram, it probably should, but I've tried a few times, and in practice, it really does not.

Later model years did have one-shot functionality on both windows. But I can't just put the window control unit from one of them in this car, because they changed more than just the ECU. I'd have to see if I can get the wiring diagrams, but from what people have told me, you can't just swap it.

Oh, the car is a 1998 MG F. It's a British made two door convertible.

Weird, because I see no other reason to wire it through the MCU (on one side of the car) other then one shot... Have you checked the wiring in the door itself? Does it indeed go to the MCU? Or is the schematic wrong (newer model) and is the driver side the same as the passenger side?

Other option would be to drop the whole MCU connection on the driver side and use a H-bridge there as well. But then you'll need the 12V to drive the window (from the 15A fuse) at the window itself. And that's probably not there on the driver side....