Circuit to control car windows - Page 1
Forum section: electronics / beginners

author: cs2000
author_rank: Contributor
timestamp: May 28, 2018, 10:53:34 am
content: Hi guys.Im looking at building a custom PCB (more of a "can I do it" than anything else) which will take a input from the car, through an Arduino to control my electric windows.Essentially, the system will take the door lock pulse, then activate a relay for X seconds to close the windows when the car is locked with the lock button on the key fob.As I want to maintain power to the system after the car is off for a moment or two, im adding in a LiPo charger PCB from Adafruit and a 18650 (which yes is probably overkill).I have a very rough schematic which is the below. Would appreciate any advice on 1. will it work, and 2. anything else like resistors or capacitors to smooth out the voltages needed/a good idea. I will of course add in a fuse on the inputs, but il use a standard automotive blade fuse in line for that.Also here is my parts list on digikey if you need to see more detail on any of the partshttp://www.digikey.co.uk/short/jh84bh.Appreciate any assistance on this before I pull the trigger and do a breadboard design. I later then to try and get a PCB from JLCPCB or something and try and make it that way!

author: Paul Price
author_rank: Super Contributor
timestamp: May 28, 2018, 12:49:50 pm
content: Looks like a wee bit of of overkill in your scheme to charge the li-ion battery, you could just float charge it (charging always on when the ignition is on) with a constant 4.1 voltage source (a single NPN pass transistor(some T0-220, i.e. TIP31) on a small heatsink) with a zener diode to set the output to 4.1V) and then current limit the float charging current with a small wattage resistor in series with the collector of the NPN pass transistor. This 4.1 V charging voltage will never damage the LI-ion cell. Alternatively, you can use a LM317 to do the same float-charge job as the NPN transistor suggested and it would be much easier to set accurately the 4.1V float charge V.To keep things simple, you could just use a very low-standby power CMOS 555 timer to actuate the relay for the required number of seconds to close the windows and so do the same job as the overkill Arduino, but actuating the 555 at key turn off might require another 555 to keep the first 555 powered. I would probably use a 8-pin MCU like the 12F683 or func. equiv. to do the same job in one IC package since I know how easy it is for me to write the program to do this job, even with the necessity to add a resistor-zener voltage regulator to power the MCU, which would give very good protection from 12V car battery circuit surges. The same MCU could easily measure battery voltage and manage float charging the li-ion battery.

author: sokoloff
author_rank: Super Contributor
timestamp: May 28, 2018, 12:59:17 pm
content: One thing to consider is whether your car is new enough to use CAN for communications and, if it is, whether you can accomplish this task more easily over CAN.I'd put a CAN sniffer on the body CAN bus, activate the dock lock, key fob, and power windows. If all of those are present, I'd then try to emit a "window-close" or "window-auto close" CAN message and see if that worked to close the window. If it did, you have an all-CAN solution available, which will [somewhat counter-intuitively] be a lot easier than what you're proposing above.

author: Paul Price
author_rank: Super Contributor
timestamp: May 28, 2018, 01:03:01 pm
content: Complexity! Just because you can CAN, doesn't mean you should!

author: bob225
author_rank: Frequent Contributor
timestamp: May 28, 2018, 01:30:18 pm
content: On GM cars its known as total closure other marks its known as soft or comfort closingThis is way over kill, you can do this on older cars with a 555 timer a few transistors and relays be aware that newer cars windows and locking are controlled via the bcm over can linesMost CAN based cars have this sort of closing built in and it just needs enabling15-20 years ago it was common to fit closing kitsa cheap Chinese close kit is under £10, a decent on is more like £35 - All they are is a cut down car alarmEdit. What car and year ?

author: BillyD
author_rank: Regular Contributor
timestamp: May 28, 2018, 03:10:06 pm
content: Personally I'd have concerns about simply powering the window for a fixed period of time.In fact supposing the window is already closed, do you still want to power the motor for 5 to 10 seconds?Or if, say, someone gets caught up in the glass, etc.Typically the factory fitted system will detect this, presumably by measuring current draw of the motor and stop and even reverse the motor if it gets obstructed or reaches the end of its travel.It's an interesting project alright but do be mindful of the systems you are thinking of bypassing.

author: bob225
author_rank: Frequent Contributor
timestamp: May 28, 2018, 03:17:51 pm
content: cars of the last 20 years have the limit switch built into the motor in the door but there's always the exception that the current limitation is controlled by a moduleIts all dependent on the car and year, to the system it uses and how its wired

author: cs2000
author_rank: Contributor
timestamp: May 29, 2018, 12:30:44 pm
content: Thanks for all of the replied guys.I know the solution is a little overkill. an Arduino is used in so many projects where a "simpler" often single chip solution would suffice. Its just easier for me to understand this way due to the availability of online resources.I know for example that even an 18650 is too much, i need the circuit to last for literally 15 seconds at most after power off of the vehicle, but again its just familiarity and availability of the components@Paul Price - Hmm OK, i was trying to be careful not to overcharge (or do anything else weird with) the 18650, hence just going for a standard LiPo charge PCB. But if that would work it would save on components, the Adafruit module is reasonably pricey for what it is. What would a diagram of that look like?@sokoloff - The car is a CAN based vehicle yes, however the year of my vehicle doesnt have the "total closure" stuff implimented, neither did the later cars to be honest. The later vehicles can roll up and down the windows by holding the lock/unlock button on the fob, but again, mine doesnt have this. Its not something that can just be switched on or off in my model year, its a physical difference in the body control module (much more space available in the later years flash memory so more features were added).@bob225 - Its a 2004 Nissan 350z@BillyD - I too have thought about that. The motors themselves dont care if you hold the window switch Up when the windows are already raised. The particular car has frameless windows and as such the end of travel is defined by a limit switch, so there will be no ill effects there.I do need to investigate what happens with regards to if something is trapped in the window as the OEM system reverses the glass if current draw is too high (assume something stuck in the window). This MAY still be functional as you can power the windows still for 20-30 seconds after switching the engine off, so id assume that from factory that the safety feature has to be available at all times and as such should still work as my circuit will essentially be replacing the in-cabin window switchesSo in conclusion, although what i have proposed is way overkill, there are no fundamental issues with is. Its not required to have any capacitors to smooth outputs anywhere etc? and should work if i connect everything up right? I could breadboard this one up, and it it works then try to pair components down to simplify the circuit.I know its all kinda silly, but i just like doing these things rather then just resorting to eBay if possible. I find it fun and i think this is simple enough to be within my realm of possibility!

author: sokoloff
author_rank: Super Contributor
timestamp: May 29, 2018, 03:14:52 pm
content: It's not silly at all to wonder, brainstorm, and prototype a solution like you propose.I do think that if you want to go to "production" (even for one), you might want to do it "your way" and then re-do it with a CAN command and use the CAN bus for the permanent version. (Most CAN buses remain energized for 15-30 seconds after car shutdown.)

author: cs2000
author_rank: Contributor
timestamp: May 29, 2018, 03:28:50 pm
content: Quote from: sokoloff on May 29, 2018, 03:14:52 pmThats kinda my plan, just to keep my mind busy! Id like to just build this, if there are no glaring issues, test it on a breadboard and then review the board again, see if i simplify things one im more familiar with it.Would just like a sanity check on my current plans before i bother to build something that has an obvious flawI know the components will physically work together, but im not an EE, so things like requiring capacitance on in/outputs and what not is foreign to me, but im here to learnIf i CAN find a way to use the CAN system, then thats of course even easier, but thats stage 2

author: bob225
author_rank: Frequent Contributor
timestamp: May 29, 2018, 03:46:30 pm
content: 04 350z, every thing is done at the drivers door switch, including the encoding for the limit and it is controlled by the bcmthere are 2-3 designs of switches early ones are a open contact design, later ones use a sealed slide switch (boards are all alps)I know Nissan's well as I use to run a forum QQ, note, juke and micra are all the same electrically - if your interested you can do the fully illuminated door switches I have done a few sets for all sorts of nissansI take it you have the 350z esm already

author: cs2000
author_rank: Contributor
timestamp: May 29, 2018, 04:13:12 pm
content: Quote from: bob225 on May 29, 2018, 03:46:30 pmYeah i have the full ESM manual, been investigating that already which had led me to believe this (rather than the CANBUS) is the way to go. its not a CAN controlled system from what i understand. Mine is an earlier model, so i should be fine.The arm rest section is east to remove (ive had the door card off plenty of times) so i can access the wires to double check when the weather is nice and all. Unless you have any other sage knowledgeIlluminated door switches would be cool, how was that done?

author: CatalinaWOW
author_rank: Super Contributor
timestamp: May 29, 2018, 04:27:59 pm
content: Rather than having the whole lipo system just power this from an unswitched tap on the car battery. Many cars even have a tap that stays on for a short time after ignition off just for purposes like this. If your car has this you can further simplify.You would still want this circuit to disconnect after function to minimize passive drain on the battery. Not a problem if you drive the car every day, but it is really annoying to come back from a trip and find that a phantom load has drained your battery. Simple enough to do with a relay. Wire it such that power can come from a switched source so that it can turn on. Don't forget to isolate your power from the rest of the car so that you aren't feeding everything in the car through your bypass. All it takes is a diode.

author: bob225
author_rank: Frequent Contributor
timestamp: May 29, 2018, 06:19:46 pm
content: no need for any batteries just pull a perm live off the internal fuse boxNo can bus - motors are fed directly and the controls are on the low power side - the limit and one touch is done by the chip in the drivers door switchilluminated switches are fairly straight forward add the resistors and leds, passenger side has a extra diode, swap the switch caps with the onesones with the lens (again there are 2 types of cap)on the passenger side you need to add a extra ground and earth it to the body - Nissans of this age tend to lose there ground on the door when the door is closed