Background.
The aftermarket AutoLoc power window set up is a motor with a switch. Press the switch in the appropriate direction and the window goes up or down. But when the window reaches the end and can go no further, the 'dumb' motor will continue to try and drive it in that direction until you stop pressing the button. Pretty basic but it works.
The solution from AutoLoc is the Window Controller, which provides one touch up/down control and can also be connected to an alarm system to remotely make the window go up when you arm the remote. Nice and simple. But you need one per window and at $150 that adds up. Plus if you want to control the passenger side from the driver side, there is a a bunch of relays and wiring between the doors that need to be added.
I decided I could do better. I also don't have enough space in my door loom to take all the wiring. So I have come up with a wireless controller solution. This controls, with either input from the switch in the door or via WiFi from a central console switch, the up/down of the widow. It also controls the puddle light and tweeter background light that fade as the door opens and closes.
A little help from my……
Okay, if I'm honest, I'm a geek at heart. I built the electronics and programmed an Arduino micro controller to control the temperature and lighting of a marine fish tank in 2010 and it's still running today. So this isn't too far out of my wheel house. But with AI (mainly Gemini and a bit of ChatGPT), and asking it the right questions, I managed to build and program a working prototype with minimal electronics.
Yeah it's a mess. But it works.
Out of shot is the power window bolted to the wall.
Left is the window switch, bottom left is an Arduino which I am using to program the 2 small microcontrollers on the bread board. The one with a S (slave) will be in the doors, and the one marked with an upside-down M is the master which will be in the centre console.
Press either D on the window switch, or the Master and the window goes down until either you release the button or, if you press and release, it goes down and stops automatically when it reaches the bottom.
It does all this power control to the window with a motor controller module (just to the right of the voltage display at the top). This module (I think) is designed for robotics, and easily handles the power window motor. It also provides current feedback to the micro controller. So in the program, if the current goes up above a threshold, the motor is stopped.
The motor controller module uses PWM, so you can run the motor at any speed from 0 - 100%. I have programmed mine to ease in from 0-80% over a second, run at 80% then ease down to 20% until the current threshold is reached.
There is redundancy too. If either the micro controller or the motor controller module fail, then the power defaults back to 'normal' operation, getting 12V directly from the window switch via the 2 micro relays in a normally closed state. These relays only engage when you press a button and disengage after a minute of no activity.
The package
There is plenty of room in the door so no need to be too crazy trying to jam everything in. As the door is a relatively hostile environment for these electronics, I have designed this in such a way that each part is separate and can be replaced in situ if and when it fails.
The units are placed high up in the door, with the position dictated by the tweeter, and the point where the door loom is passing through. After modelling the case, I used it to make left and right templates to mark the mounting holes and cut the main access hole.
The case was 3D printed in PETG and made in two parts, with the idea that the two can be separately passed through the access hole in the door. Chose PETG over ABS, due to cost. Time will tell if this was a good choice as PETG has a lower melting point than ABS and, in theory, is more likely to deform in a door on a hot day.
Here are the two units ready for testing. Tweeter backlight and mount at the top, twin micro relays below to isolate the motor, blue module is the BTS7960 motor controller, green board is all the electronics inputs and outputs for the BTS7960 micro controller that is bolted down on top.
Testing and Wiring
Sticking to the redundancy concept, I have done all the wiring with plugs to each component. Power to the micro controller, which has a maximum input of 5V, is via a fused 12V-36V buck converter. At $30, this is one of the more expensive items, but the most critical to get right.
This is me attempting to neatly wire up the door. Wires that are passing through the black door jam wire loom are 2 speaker wires, +12V, ground, 4 wires for the central locking, door switch wire. All wires are 18AWG which is a little undersized but over the short run (hopefully) will be fine. 2 sensing wires from the central locking and the door switch sensor wires are 22AWG.
The schematic I made for the controller. There is a bit going on here, but a lot of it is to do with how the micro controller sends and receives information, which is capped at 3.3V. So to get the power window switch, which is sending a 12V (~14.8V) signal to the 3.3V device, you need a voltage divider circuit to protect the micro controller.. To activate the relays, the micro controller output, with a limited 40mA, needs a transistor to switch the ground side of the relay on/off. The fading LEDS are using MOSFETS to drive the power.
Programming and AI
So AI has pretty much selected the power module, power motor control module, the values for the components of the voltage divider, reminded me repeatedly what the pin outs for various components are etc, etc.. But it also gets it wrong - a lot. There have been a few wild goose chases.
I think my most asked question after a seemingly helpful response was "Are you sure?" Surprising how often it will backtrack on a solution. Or if in doubt ask the same question to ChatGPT.
Programming has been an area where it has made a mundane task extremely fast, but will often overwrite its suggested code with hallucinations.
The process, to put it nicely, has been frustrating. In five minutes of initial coding I had two mirco controllers talking to each other across the room. I think it took 3 weeks to actually get to the final code that I have running at the moment. I won't bore you with my frustrations and work arounds, but let's just say it has taken a lot of perseverance to get to this point.
Final Thoughts
Was it cheaper? Here is a rough breakdown per door.
ESP32 Micro controller $13.
BTS7960 motor controller $10.
2 Micro relays and holders $30.
36V-5V Power Buck $30.
Filament to print case $15.
Wiring $20
Electronics $20 (estimate as I already had all the components)
Total $138
Was it worth it? I enjoy this kind of trouble shooting so yeah for me it was. I also like the fact that this is a totally custom set up. I can make the windows open and close not only at the push of a button, but also programatically based on other information, from a central master controller. Don't know exactly what that control might be but closing windows when the doors are locked is an obvious one. Having the windows close if a rain sensor detects rain is another.
Honestly not sure if this is of interest to anyone, but if you are thinking of taking this type of thing on, or if you have questions, just ask me.
And I'll ask AI