Controlling power windows with Arduino

So, I'm building a "remote car" system with my Arduino. I have a keychain transmitter (with A-B-C-D buttons), and a matching receiver that outputs clear "signal received"-A-B-C-D signals, and runs on 5V. Totally perfect for the Arduino platform. Now, it's just up to me to design the interfaces and the software. I even intend for it to interface with my existing MPGuino device via serial I/O, and display information on its screen as need be. I even hope to use a motor control shield to drive an old alarm siren with PWM audio using another project I cooked up. You know, hit the "disarm" button and the car burps out the AOL "Welcome" sound. Arm with "Goodbye!" ;D

But I'm hung up on the first part I decided to tackle in the project. The power window controller. How can I drive these power windows? Seems like such a simple task, but there's practically NOTHING I can find online about it. Nobody seems to have an interest in driving power windows with a microcontroller. ;D

I already ruled out relays... too damn prohibitively expensive, at $40 a pop for a 4DPT relay... and that would only drive both windows in one direction... or maybe one window in both directions. I'd looked into using two H-bridges, but as was the problem I had when I first looked into H-bridges, I can't find ANY documentation about building an H-bridge. Those would work rather nicely. I have a little baggie of 3x 100v/40a power MOSFETs that I could finally put to some use...

But I have next to no idea how I'd go about building it. Is there any way I could optimize the design? I really don't even need the windows to be individually controlled, just to go down or go up. Problem is, they need to be electrically isolated so I can still roll each down using the switches... so I can't just mash the two motors together on one H-bridge.

The circuit breaker for the car's window circuit is 30 amps for both windows (combined). The motors also have their own breakers. So I'm guessing something like 10-15 amps maximum per channel. I'm looking at a budget of under $40 for the parts in this thing, and these MOSFETs I've got now were pretty cheap, something like under $1 each I think (it was some 4 years ago). The heat sink is my only concern for price, I think...

Any ideas?

(also on the drawing board: remote locks (just actuating the car's relay in either direction), remote trunk (also a relay on the car), brake light flasher, loudspeaker/siren circuit)

I can't find ANY documentation about building an H-bridge.

Come off it!

Put h-bridge into google image search and you get lots and lots of schematics.

"Problem is, they need to be electrically isolated so I can still roll each down using the switches... "

Why not just wire to the existing switch contacts and control from there? A small relay to make the same contact the switch does would seem to do the trick, no?

Why not put simple SPST relays in parallel with the switches that already control the windows; one each needed for each button, control them with a transistor, diode, base resistor of course...

Building an h-bridge of the size needed won't be easy; you could throw something together that would work, but it would take a bit of effort to make it efficient. It would be far better to just spend the money for such a bridge, unless learning how to design and build a transistor/mosfet h-bridge was your goal.

I think using relays inline with the existing switches might be the best option; if the switches are "direct connect" (that is, they form the h-bridge for the motors), then you'll need relays with contacts rated for the motor current draw (standard Bosch-type automotive SPST/SPDT relays are fine). If the switches actually send a signal to the car's computer which then actuates the motors, then you might be able to use a smaller relay, or even possibly a transistor/mosfet switch.

That's how I'd approach it. No use making it the solution more difficult than it needs to be...


Yeah, I'm playing around with the idea of relays again after re-thinking it.

I should clarify some parts of the car's design, though. Yeah, the switches in the car directly form an H-bridge for the motors already. So the full current of the window motors go through the switches. It's an old '87 Fiero. Amazingly, the power windows still work great. ;D

The switch works basically about as simple as it sounds... 4 wires to each switch: +, -, motor "A", and motor "B". So I'd need to find some way to use relays to signal each direction... even then... switching directions seems to be a huge task. Relays stay "idle" in a fixed position which is a serious problem here. In an H-bridge I'd need either 4 SPST relays for each window (a total of EIGHT relays!), or by some grand miracle of product availability, only FOUR SPDT relays (two per channel - motor A to +/-, and motor B) that take two inputs and stay in a "neutral" position. But as far as I can tell there is no such thing! :(

As for the readily available schematics... yeah, it's easy to find a "functional diagram" of an H-bridge, but I wasn't able to find an actual working schematic of a system that would fit this application... either that or I just wasn't looking in the right places :/

If the switches actually send a signal to the car's computer which then actuates the motors, then you might be able to use a smaller relay, or even possibly a transistor/mosfet switch.

The switches will be hard wired to 12v when the key is on. The computer is entirely separate.

The Fiero only has 2 windows, right?

First thing that will have to be done is run a 12v+ always hot line from fusebox to near each window switch. Car Window motors draw a huge amount of current. You are looking at as much as 15a at 12v per window.

Well, thanks to lorenzop on freenode #arduino, I now understand the concept of a reversing relay, so I can actually make this work with 5 relays - one DPDT and four SPST relays, for both channels!

The four relays are used to disconnect this “remote override” system from the physical window switches when not in use. Otherwise it’ll run the windows all the time! Also using this method, I can “address” each window by simply enabling one or the other. Or both, even, now that I think about it! Only thing I can’t do is simultaneously roll one up while the other goes down. Who needs that anyway. :smiley:

So, very cool. Looks like I get to load up a Mouser basket full of SPST relays (I also need 2 more to activate the lock/unlock relays in the car!) ;D

So we’re up to 6 I/O pins so far:
1: Window direction
2: Enable window control L
3: Enable window control R
4: Unlock relay
5: Lock relay
6: Trunk-relay relay

Not bad, considering. :sunglasses:

Can you post a schematic of what you have? Sounds like you have a momentary switch that goes in 2 directions. One direction connects + to motorA and - to motorB. The other direction connects - to MotorA and + to motorB. Where does the H-bridge come in? Would seem pretty straight forward to wire up 2 normally open relays DPDT relays to the 4 terminals to do the same thing. 2 of these would do it.

^ That works too, heck, wouldn't even need DPDT switches, just DPST, since the other pole (normally closed) is NC on each point. Interesting.

That would still end up being a total of 4 DPST relays, and would require 4 I/O pins (L-Win down, L-Win up, R-Win down, R-Win up). Not bad, but there are tradeoffs :)

I've pretty much got it figured out now, but I'm just having trouble finding an appropriate relay model, something I can solder or screw to. A socket+relay set, maybe, but that could get rats-nest'ey - maybe I should just PCB-mount it all. Mouser doesn't exactly have the most useful sorting/filtering options ;)

edit: almost forgot. Here's the link to the wiring info. Page 5 has the window wiring/schematic: And it'll likely be on the order of 10A per channel, higher (up to 15A max, since the breaker that controls both windows is 30A and both can run, stalled, simultaneously) if the engine is running, which it'll never be when I'm using the remote (relay) functionality.

It will cost a little more, but I'd just go to radioshack and go through the drawers of components. I found every part you need for a very similar wiring project (not using arduino) there a couple months ago. It was worth the extra $10 rather than messing with mouser or digikey websites. Rather than try to solder it to a floating relay, pick up 2 radioshack part # 276-150s. They are pcbs that were 1.99each at my shack, and are laid out like a bread board, except instead of 5 terminals inline on each side, it has 3, and then 2 dots are not connected. I did this for relays for a headlight conversion so they are sitting in my engine compartment and I've never had any problems.

Dont forget you will need a +12v always hot to each window if you want this to work without the key in the run or start. Most car fuse blocks have 1-3 spade terminal hookups for accessories on the interior fusebox, but the fiero is a weird car.