|
DIY Headlight Controller module using Arduino NANO microcontroller (Page 1/3) |
|
WalkerTexan
|
MAR 19, 09:47 AM
|
|
For those that are interested: I designed a replacement headlight controller module because mine was dead. Many people have tried to use GM modules from other cars with mixed results because the current sensing is different based on the car; the Fiero has a heavier load than most other headligt systems on GM cars from what I have been able to determine.
By making my own using an Arduino NANO I was able to tweak the current sensing to match my Fiero's loading. I installed the new module in the front compartment rather than trying to fit it behind the fender. Plenty of room for it next to the brake master cylinder. I made a circuit board for it but point to point wiring would work as well if you are careful.
The Arduino program is very simple and I included a LOT of notes so that it is easy for someone familiar with Arduino programming to understand and tweak if necessary. There are references to an earlier design that you can ignore; my original prototype was point to point and I later updated the design to be more robust and used a circuit board.
All of the parts are easily available from electronic supply companies or AMAZON. Most of the parts I had on hand and some I ordered from Amazon because, well, I'm an electrical engineer and somewhat of a geek
Note that this is a replacement for the 87-88 module since the 84-86 do not use a module. HOWEVER, it would be very simple to adapt this to the earlier design because you could bypass all of the limit switches/relays and use this circuit directly connected to the headlight motors. This could be done with new wires and wouldn't require sourcing an original harness from an 87-88. I haven't tried this but I have looked at the earlier wiring (having previously been the original owner of an 85 2m4 that had problematic headlights) and believe it would be stupid simple to do. Well, for me anyway and probably for anyone with sufficient electronic experience.
The original module used a current sensing circuit to remove power if the current was too high thus preventing burnout of the motor(s) if stalled. The circuit used an approximately 3 second timer to allow the headlights to open/close; if the motor stalled mid-way then the current sensing circuit removed the power. The circuit used FET devices to accomplish this task which in itself is a good design. Unfortunately, the FETs are what typically died, usually with much burning of the module internals because I believe the original designers attempted to shunt the current quickly if the motor stalled and didn't adequately protect the FETs in that case. Probably an unfair observation on my part since GM didn't intend the module to last this long but nonetheless. GM used two circuits, one for each motor which was the right thing to do. Mine died because a previous owner had one circuit of the module die and he then connected BOTH motors to the same circuit! FYI, don't do that To paraphrase Bill Murray in Ghostbusters: "This module is TOAST!" And it was
My circuit uses this same approach. For safety of the motors I made the current sensing measurement occur every 100ms which is more often than the original. I spent a lot of time slowly raising the current limit value until I determined a safe value without too much overshoot. This is detailed in the Arduino code notes and shows you how to calculate the current value. It is easy to tailor to your car if you choose (or it is become necessary). Basically, if the motor stops before reaching the end in either direction it is probably because the current limit is too low and needs to be raised slightly; easy to do in the Arduino program if you need. To avoid some of the failure issues I used relays instead of FETs. These should be more reliable in the long run and certainly more easily replaced in the event of failure since FETs are a little harder to source and easier to damage due to their ESD sensitivity. Old school, I know, but I didn't want to have to fix this often. My module has worked well for months now so I consider it mature enough to share.
Link to design zip file
I mounted the circuit in a "leftover food" container I found at a dollar store. I painted it black to hide the inner workings. As luck would have it, this container had a band around it that didn't get painted so it glows due to the LEDs in the circuit. Kind of looks cool and spooky at the same time when I open the front hood
The circuit draws approximately 40ma continuously when the key is off. The original module draws approximately 80mA so there is no risk of running the battery down faster with this circuit.
USE THIS AT YOUR OWN RISK! If you aren't "fluent" in electronics then find a friend who is. Very low risk in my opinion but your mileage may vary based on your own expertise.
|
|
|
theogre
|
MAR 19, 02:33 PM
|
|
Module in other cars is often The Same part as Fiero. GM only used a very few part numbers for all Hidden HL. Others are about same but wired different w/ "reverse" motor wires or up/down wires are feed different to Fiero. See my Cave, Gen 2 HL Motor
You likely have other problems that killed the GM module(s). Have crap solder joints etc in the module can fry the module and the motors. Using Used Module often have same problems. Car's wiring have problems doing same. Example: See my Cave, Electric Motors Motors and/or Lift Assem have problems causing high current from the motors. Doors and lifts can bind in several spots but most people have No Clue and never bother to look for that. Hell, Most have No Clue the Lift Mounting Holes are Slotted For Reason to allow moving entire assem up/down and left/right. And that's assuming no damage to the hood etc making more headaches.
If doors, lifts, etc are working right... The motors only draw about 2-3 amps running. Stall Current is higher and Module is looking for this. Relay last decades because Relay doesn't switch loads only changes direction before MOSFET turn on. OE MOSFET are 10 to 20a and have a Heatsink. Also has a "fuse" but doesn't "blow" unless has a direct short. Follow "repair" threads in Gen2 page.
Also Many of us no longer use Used or DIY "Rebuild" motors because of many problems but most think is just "weak dowels/pins" that killed them. Cardone AZ and few others have New Motors w/ Lifetime Warranty. Could get cheaper on Eflay but except little or no warranty even if you find the vendor next week or next month.
OS Fiero Module have 5 sec Time Out on top of Stall Current killing power. Motor needs ~ 1.5 to 2 sec to open/close the doors if everything is good. If binding even a little 2.5 sec isn't enough. (DOT 108 spec allows 3 sec to "open" a Hidden HL.) Why? If motor power is On but Motors have Sheared the pins or is unplugged, the power will still shut off but 5 sec won't cause "fake" problems.
OE Fiero module allows Doors to Stay Open if parking lights stays On and HL turn Off. I and others do this all the time when getting gas at night etc.
Your programing have Major Problems and Does Not use Sleep Modes. The 5V Nano w/ 16mhz clock constantly Polling the HL switch will "kill" the Car's battery in a few days. Car Battery under 12 to 11.8 V is "Dead" even if does start the car. Every time you drain the battery "Dead," you shorten the life and likely need a new battery soon. The CS-130 Alt may not turn On if battery is under ~ 11.5v. Low battery Starting can cause Battery Cables and Starter getting hotter then normal hurting them too for same Low Volt problems. Worse, If you have cold weather, low or "dead" battery can Freeze easy and Freezing will destroy it. See my Cave, Battery and CS Alternator
The relay in your "module" has nothing protecting the contacts from the power surge from motors. These Motors can generate Hundreds of Volts when shut off. GM used simple resistors across the wires to motors but other better protection options could be used.
ATmega328, even if you reprogram and rewire for Sleep Modes, may have more problems because you have a Nano w/ FTDI that never sleeps and worse using the serial port in Serial.println etc.------------------ Dr. Ian Malcolm: Yeah, but your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should. (Jurassic Park)
The Ogre's Fiero Cave
|
|
|
dremu
|
MAR 19, 06:11 PM
|
|
Now we can add Arduinos to the list of illegal things, including LED's, fire extinguishers, and brake upgrades.
To the OP, thanks for posting this. I suspect that the Venn cross-section of Fiero people and Arduino people is small, but there are a few of us, and so it's useful or at least interesting regardless. Plus, it's your car, you can modify it how you want.
Ogre, you need to add a section to the cave about constructive criticism, as opposed to your usual sweeping (and cryptic) Negative Nelly nonsense.
I see he's got the diodes reverse across the relay coils to avoid inductive discharge, which is SOP; what DO you suggest across the motors? MOV's maybe? (Do they come in low enough voltage? I've only ever used them in higher-voltage AC applications.)
And, this being open source software, if you don't like the code, don't talk smack on it. Rewrite it to be better and post it, even just snippets or an example.
Finally, yeah, I've got an Arduino in my car, and it drives LED lights, so I'm doubly illegal =))
-- A[This message has been edited by dremu (edited 03-19-2021).]
|
|
|
RCR
|
MAR 19, 08:08 PM
|
|
Walkertexan, Cool little project. Thanx for posting. I hope it works well.
Ogre, you're pretty much spot on, but a little tact would go a long way.
For a DIY project, it fixes a problem Walker has. Is it the only solution. No. Does it work? Seems to.
I've been doing automotive electronics for a little while. I couldn't put it in an OE vehicle, but for a hobby vehicle why not (and it's not illegal).
my two cents...
Bob
|
|
|
skywurz
|
MAR 19, 08:31 PM
|
|
Walker congratulations you have met theogre. He means well really.
I like arduino projects. I would rework this to power on and off with the switch. Probably using some sort of delay relay. ¯\_(ツ)_/¯ then add a voltage sensor to tell if parking lights are still on before lowering the lights.
|
|
|
Neils88
|
MAR 19, 08:51 PM
|
|
I love projects like this. To me this is one of the reasons to have a Fiero. There are unlimited opportunities to test your creativity.
Great job and keep posting for those of us who enjoy this type of thing.
I'm glad Ogre doesn't read my Aventador build project... he'd grind his fingers to the bone telling me all the ways I'm doing it wrong! lol
|
|
|
bmyers
|
MAR 19, 10:47 PM
|
|
I never heard of Arduino before reading this post. Looks neat. Just bought a starter kit to get acquainted. Thanks! ------------------ Brian
|
|
|
pmbrunelle
|
MAR 20, 12:36 AM
|
|
IIRC the AVR has a user-settable clock prescaler register.
You're not doing much in your program, so I think you could afford to slow down the clock speed and reduce the current draw.
The current sensors are also sucking a bunch of current, so if you could just power them only when the lights are moving up/down, that would also save... but at the cost of complexity.
Once the module does what you want, you can ditch the FTDI.
I see that you put freewheel diodes on your relay coils; not worried about the inductive spike from switching the motors?
MOVs degrade every time they conduct. I would instead suggest bidirectional TVS diodes; they need to be sized to absorb the energy from the motor's inductance. We use TVS at my work on electric power steering motors. Above a certain motor size, you'll have too much energy for off-the-shelf TVS and need to find another solution, but the headlight motors are small enough.
FETs don't handle inductive spikes well (though you can get avalanche rated ones), but the relay contacts might be OK with the arcing from an unsuppressed transient.
Also note that the lower the clamping voltage, the longer the current continues to circulate in the motor, and the longer it takes for the motor to "turn off" after switching it off. But since you're polling at 100 ms and you haven't broken anything yet, I guess speed isn't so critical...
Something like a fuel injector cannot have a normal freewheel diode on it; it would take too long to close. Instead, the switching system must be built robust enough to handle some higher voltages.[This message has been edited by pmbrunelle (edited 03-20-2021).]
|
|
|
pmbrunelle
|
MAR 20, 12:53 AM
|
|
quote | Originally posted by Neils88: I'm glad Ogre doesn't read my Aventador build project... he'd grind his fingers to the bone telling me all the ways I'm doing it wrong! lol |
|
I think that Ogre recognizes those who have gone off the deep end into the world of auto modification... and does not attempt to save those lost souls.
I don't think he has commented in my project thread either.
|
|
|
tomsablon
|
MAR 20, 01:48 AM
|
|
I wonder what is the exact torque in in/lbs.at the linkage required. seems like a small braided /shiethed cable ( bicycle or power equipment type) connected to a spring to prevent damage in the case of a linkage binding situation would prevent / eliminate all of this hullabaloo.
This would eliminate all of the wires / relays / modules / safety issues / battery drainage / myriad of gears-pins-motors etc.
You simply switch the lever in the car from left to right and it locks in place, and the headlights pop-up and the bulbs come on via an end switch . The spring in the linkage simply stretches in the case of a linkage issue. An indicator light and chime come on if you shut off the ignition with the lever in lights up position. I know,, no more glorious button, but still...
Done.[This message has been edited by tomsablon (edited 03-20-2021).]
|
|
|
|