Lawrence T. Mazza has an interesting article on the same subject, but I had a few different design goals in mind. First, I didn't want to have to manufacture any components. Instead I chose to use an Infineon Smart High-side power switch (PROFET). This device features a current mirror output that drives a current proportional to the current at the power output without any current drop penalty caused by a shunt resistor. Using a PROFET in addition to a relay has another advantage: The current can be switched off before the relay opens, preventing sparks inside the relay and significantly prolonging the relay's lifetime. Further, the PROFET is protected against pretty much anything that can happen in a harsh automotive environment. Plus, the device has a diagnostic output that can be used by the controlling CPU to determine many causes of failure, like short circuits, overvoltage, etc.
The CPU's analog comparator (the CPU is an Atmel AT89C2051) is used to sense the preset current threshold. A variable resistor is used to set this threshold. For each volt at the comparator there must be a current of approx. 5 Amps through the load. I checked various power window motors with both the engine running (or more importantly the alternator running) and the engine off (Voltage less than 12V, or voltage 13.8V). The current is normally between 4-6 Amps, and rises to 12.5-15 Amps when the window hits the stop. So I decided to set the threshold to 9-10 Amps (1.8-2V). When the threshold is exceeded while closing the window, the motor continues to run for 500ms to ensure the window is closed tightly. When the window is opened, it stops immediately when the window is fully open. Also, the time to open or close a window is between 3-4 seconds. So a built-in timeout of 8 seconds shuts the motor off in automatic mode. This is to prevent the motor from running indefinitely if something is wrong with the system that prevents it from tripping the threshold.
Here are a few characteristic time constants that the current software implements:
Time constant | value |
---|---|
Key debounce time | 50ms |
Threshold for automatic mode detection | 500ms |
Motor off delay in auto down mode | 0ms |
Motor off delay in auto up mode | 500ms |
Max. motor on time for automatic mode | 8s |
Max. motor current limit threshold exceeded time in manual mode | 3s |
Manual mode current limit threshold recovery time | 10s |
Here is the parts list:
Qty | Description | Conrad Part Number |
1 | AT89C2051 with program "Power Window Controller" | N/A |
1 | BTS 640 S2 | N/A |
1 | TA78L05 | 14 47 11 |
1 | 3mm low current LED, red | 14 59 98 |
2 | LL4148 | 14 09 02 |
1 | BC 847 | 14 00 58 |
2 | BC 817 | 14 00 23 |
1 | LM 393 (SO8) | 14 25 14 |
1 | 1.5k Ohm 1206 | 40 25 67 |
1 | 1k Ohm 1206 | 40 25 40 |
3 | 100k Ohm 1206 | 40 27 88 |
1 | 47k Ohm 1206 | 40 27 45 |
2 | 4k7 Ohm 0805 | 40 63 33 |
1 | 0 Ohm 1206 | 40 22 22 |
2 | 150k Ohm 1206 | 40 28 00 |
2 | 220k Ohm 1206 | 40 28 26 |
1 | 150 Ohm 1% | 41 81 53 |
1 | 100k Ohm Variable Res. | 42 52 81 |
3 | 100nF 1206 | 45 24 40 |
2 | 100nF 0805 | 45 25 05 |
1 | 1uF/16V SMD | 48 15 13 |
1 | 22uF/16V Tantal | 48 17 50 |
1 | 220uF/16V (Mini) | 46 07 29 |
1 | 20 pin socket | 18 98 39 |
1 | 12V Varistor | 46 76 50 |
1 | 8MHz Oscillator | 50 39 67 |
1 | Motor Relais | 50 50 13 |
1 | Connector | 84 51 75 |
1 | Connector | 84 51 40 |
5 | Pins | 84 52 99 |
5 | Pins | 84 52 64 |