Introduction: Popup Headlight Wink With Arduino and Relay Board Featuring My Miata.

wiring up switches to make miata headlights wink is a pain, dont worry this is slightly less painful.

my goal of this project was to make the headlights wink or do other things using the factory switch. i thought it would be way cooler to make it look stock as possible but actually do more than stock. a sleeper build, if you will.

what this code does is one press of the headlight switch makes the drivers side headlight wink, a double click makes the headlights both go up or down, a short hold (1/2 second) puts one headlight up and the other down and a long hold (1 1/2 second) is for if some reason your motors get lost: it resets the variable to false and lowers the headlights.

i recommend the headlight switch modification in the second step but, it is not required.

this instructable can be used for almost any pop up headlight car, i have a miata so that will be the example i will use

everything will work with the headlights on or off.

[Play Video]

SHOPPING LIST

other than tools here is what i recommend to get


-arduino nano(~7$ebay)
-active high 5v 4 channel relay module(~6$ebay)
-at least 6 male/female pair shrouded connectors
-50 ft of 24 gauge wire of your choice
-a 12v in 5v out usb power supply
-2 butt connectors
-one of those breadboards that you have to solder or a solderless breadboard, soldered looks cleaner.
-2 ft of 28-30 gauge wire(if you chose a solder breadboard)
-a couple 6-32 screws with matching nuts
-ALL OF THE ZIP-TIES
-a car with popup headlights
-patience

-im probably forgetting something, feel free to tell me in the comments.

Step 1: Take Out Your Center Console.

i forgot to take pictures so here is a guy who does a pretty good explanation

Step 2: The Optional Step

okay you know how your switch latches at the bottom after you press it, like a clicky pen?

yea, this is to make it not do that because it makes it a quadrillion times easier to use the arduino

the way this is achieved is by taking out the spring and tiny metal wire squiggly doo-dad from the switch. if you decide to do this, do it in a bucket/ tote because the springs like to make the connector, clips, contacts and springs go flying all over.

i did it in the garage and conveniently lost the parts for the headlight latch. dont follow my example.

A) take a little flat head screwdriver and wedge it between the connector and the housing, pop out the four little clips that hold the connector to the housing and then be ready for it to try and shoot off.

B) take out the little spring, not the big one. take out the little metal wire squiggly

C)put it back together

i wish i took pictures but i did this weeks before any of these other steps and neglected to do so.

if enough people want to do this step i will take it back apart and take pictures.

Step 3: Run Wires and Prep 'em

running wires from the switch connector to under the dash and from under the dash to each headlight motor

the wires for the motors and their colors by year

http://www.dommelen.net/ephar/wirings.html

Step 4: Wire Up the Arduino

picture notes have all the information

Step 5: Upload the Code to the Arduino



if you dont know how to program the arduino, this is a good explanation.

https://www.instructables.com/id/How-to-Arduino-1-I...

if you know what you are doing with the code feel free to modify it and share it in the comment

EDIT: i modified the code a bit and made new double click the function the old short hold function and vice-versa. the miata headlight switch for some reason makes the double click un-reliable, also it makes it easier to get the headlights to flip back and forth this way.

Step 6: Put Everything Back Together and Clean Up

i am not responsible for any thing that happens to you or your car, positive or negative

Comments

author
adlmx5 (author)2017-07-17

Awesome! :D I'm about to do this wish me luck. Also I watched your youtube video and Im wondering how you mount the LED light bars into the stock position and retained the motor functionality? I've seen LED's mounted there before but most of them are hard mounted and don't retain the up/down functionality.

author
curly686 (author)adlmx52017-07-17

i had to make adjustable headlight linkages, stay tuned, ill have the designs up in a few weeks

author
adlmx5 (author)curly6862017-07-29

Awesome, looking forward to it!

author
dalton-randall (author)2017-02-10

Hey. I have made a controller as per the above. However once the arduino is powered and running all four relays activate simultaneously and stay active. The headlights continuously go up and down until power is removed from either the nano or relay board. I removed the headlight motor control wires and powered the board again. When pressing the headlight switch it deactivates particular relays briefly then re energizes. would you have any idea of where i may have gone wrong. very new to everything arduino so any help would be appreciated.

author
curly686 (author)dalton-randall2017-02-10

AH! you got an ACTIVE HIGH relay board, the code was designed for ACTIVE LOW relay boards. in the software change every use of the command LOW with HIGH and HIGH with LOW. when i get home i can send you an updated code for you that should work perfectly!

author
dalton-randall (author)curly6862017-02-17

I had a crack at altering the code as you suggested but the board is still playing up. They stopped constantly energizing after start up but are now randomly firing in odd sequences and I seem to have little to no control over the lights with the switch. Could the relay module potentially be a dud?

author
curly686 (author)dalton-randall2017-07-08

https://drive.google.com/file/d/0B5IiEaMipg4kWVhkQ...

thats the code that *should* work, sorry it took so long

author
curly686 (author)dalton-randall2017-07-08

check your connections and record the exact order of the relay firing if possible: it may help troubleshooting

author
NathanA81 (author)curly6862017-07-08

Hi Curly686,

Id' also like a copy of the updated code if you'd be so kind?

Thanks

Nathan.

author
curly686 (author)NathanA812017-07-08

https://drive.google.com/file/d/0B5IiEaMipg4kWVhkQ...

sorry that took so long ive been going between computers

author
oddzack (author)2016-02-23

do you have a video demostrating the wink ?

author
curly686 (author)oddzack2017-07-08

https://youtu.be/Iw2_0Dt-eI0 no idea why it didnt work in the instuctable

author
TheKitMurkit. (author)2017-07-06

Would be nice to see a video with headlights actually wink!

author
curly686 (author)TheKitMurkit.2017-07-08

https://youtu.be/Iw2_0Dt-eI0 i have no idea why the link wont work on the actual instructable

author
Hillermi10 (author)2016-12-06

hey looks awesome and exactly what im looking for, i have those same led bars ready to go in =, just wondering how you mounted them and also how you made them only come up to the half height? thanks!

author
curly686 (author)Hillermi102016-12-07

i used an adjustable headlight motor connector i made. ill be making an instructable coming up in the next couple months for how to make/ install them. ill also be selling them. contact me on instagram @corporalcabbage and i can keep you updated

author
D6equj5 (author)2016-05-10

Nice instructable - and very useful for my project to do a similar thing with my Terrano roof spots.

D6

author
GeoffW2 (author)2015-08-07

How easy would you say it would be to switch back to stock wiring?

author
curly686 (author)GeoffW22015-08-07

all you have to do is put matching connectors anywhere you cut wires. i would say 2/10 difficulty.

author
GeoffW2 (author)curly6862015-08-07

Ok, sounds good. Thanks!

author

gonna do this to my firebird haha, thanks for this awesome post!

author

no problem! i just wired this into a 240sx.

author
magnuswf (author)2015-07-29

No video of the final result?

author
curly686 (author)magnuswf2015-07-29

i am fairly certain there is a youtube link with the video in the introduction

author

Hi there!

I see the words [Play Video]. But its not linked to anything.

author

try that :) https://youtu.be/Iw2_0Dt-eI0

author

Yeah, that's actually pretty good.

About This Instructable

11,026views

71favorites

License:

More by curly686:Popup headlight wink with arduino and relay board featuring my miata.
Add instructable to: