r/arduino • • 4d ago

Automatic windows

Ive always wanted automatic power windows in my MX5 (Miata). There was a japanese market option for auto down on drivers side only, but the vast majority were plain old buttons, and because the favtory switches carry the full current for the window motor, they need the contacts cleaned semi regularly.

So with 4 changeover relays, a couple of current sensors and a nano mega328 based board, i now have auto up/down on both sides. It all bolts in to the factory position and there are no permanent changes made to the car.

This is my 2nd finished project, and it would not have been possible without online pcb tools and cheap pcb mabufacturing!

108 Upvotes

20 comments sorted by

9

u/Wiggles69 4d ago

A not very good video of them working

https://imgur.com/a/V53rrEA

Is there a way to film a window going up and down and make it interesting? 😄

6

u/Aedifix 4d ago

Woah, cool! I’ve never used a current sensor before, how does this work? Do the sensors go inline with the motor relay and sense a decrease in current when the windows reach the limit?

10

u/Wiggles69 4d ago

Woah, cool! I’ve never used a current sensor before

Neither had I until a couple of months ago :p

how does this work

The current sensor is some tricky hall effect sensor on top of the current path, it spits out a 0-5v signal proportional to the current flow.

A DC motor current draw increases when it stalls, so the arduino just watches the current draw and cuts the motor when it crosses the threshold (i set the threshold after measuring normal usage).

The sensors are set up so they measure current no matter what direction the windows are going

7

u/Aedifix 4d ago

Clever, so it’s isolated from the current path but measures the magnetic field. I’d love to look at the schematic if you’d consider making the project open source.

I have a 1990 Miata with the power window package so now you’ve got me wanting to do this project haha. Unfortunately my driver side window is really slow right now, probably need to open up the door panel and fix that first!

Thanks for answering!

2

u/Wiggles69 4d ago

Yes. And even easier for me, they come as a little pre-made package, so I just shoved a couple of these In and plumbed them into the arduino

https://core-electronics.com.au/pololu-acs37042-hall-effect-isolated-current-sensor-micro-carrier-30a-5v.html

3

u/Aedifix 4d ago

That’s awesome!

2

u/AleksLevet 750K :750K:, 2 espduino + 2 uno + 1 mega + 1 uno blown up 3d ago

Oh that's clever!

4

u/CoffeeSalt2036 4d ago

Nice install. How are the current sensors handling end-of-travel - stall spike detection, or a timeout as fallback? Wet door harnesses love to nuisance-trip current sensing.

2

u/Wiggles69 3d ago

Its monitoring current for the stall spike. I realised the need for a timeout after I put it in the case and couldn't see the activity leds anymore. Do that will be added this wekend

2

u/CoffeeSalt2036 3d ago

that works - current sensing is the better call once the leds are hidden. when you add the timeout, size it from a measured full-travel time plus margin, not a guess, or a cold morning will leave windows half open.

3

u/Sleurhutje 4d ago

Looks good, nice design. But aren't you shifting the problem with the burning contacts from the switches to the relays? For a next project have a look at so called H-bridges to control motors. Then you have a solid state controller without physical contacts.

3

u/Wiggles69 3d ago

To be fair to the original switches, they only really need cleaning every 5 years or so :p

I did look at building a couple of H bridges with Mosfets, but it would have been the same if not more money, and harder to package the 8 though hole MOSFETS (i'm not set up for surface mount) compared to the changeover relays.

The relays are rated to 20A, the max stall current i'm seeing is around 13-15A, so they are in a fairly low stress environment, i'll see how they go, i don't use the car nearly enough to wear out the new original OEM switch i put in a few years ago, let alone the relays.

If i was doing it again, i'd design around a pair of ACTP212 or ACTP215 DPDT relays. Those are specifically made for power windows and would make the whole thing more compact (i found them after i was most of the way through designing this board ofc)

2

u/Sleurhutje 3d ago

Ah okay, so it's more about collecting dust and moisture than high current switching.

2

u/stlgen 3d ago

Nice build. One thing to watch with the stall detection is the inrush current when the motor starts, it spikes way higher than normal running current and can trip the threshold. I ignore the readings for the first 200 ms or so after start. Having a max run time as a backup cutoff is also a good idea in case a sensor ever reads wrong.

2

u/Wiggles69 3d ago

Hey, youve read my mind. 

I've got a 150ms delay on the current detection to ignore the inrush and the timeout is something I thought of after I put it in the case and couldn't see the activation leds.

0

u/stlgen 2d ago

Ha, good, then you're ahead of most. 150 ms is fine for a warm motor, but it might be worth checking the inrush on a cold day with stiff window seals, it can run a bit longer there.

1

u/Wiggles69 2d ago edited 1d ago

i had a bit of a head scratching moment when they wouldn't work at first 😄

Cheers, ill have a play with it.

11

u/DiggoryDug 4d ago

Nice work. Looks great. Thanks for sharing.

3

u/rlaptop7 geiger counter 4d ago

Wow! That's amazing work. Really clean install with the project box.

This is super cool. Such an amazingly good addition to a cool car.

1

u/DavidFromArduino Arduino Staff 13h ago

excellent! could you also program it to wind both windows down an inch or two while you put the top up? 💙