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

by curly686 in Workshop > Cars

26950 Views, 87 Favorites, 0 Comments

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

temp_-979896313.jpg
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.

Take Out Your Center Console.

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

The Optional Step

0726151114[1].jpg
0726151114a[1].jpg

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.

Run Wires and Prep 'em

0726151144a[1].jpg
0726151113b[1].jpg
0726151154a[1].jpg
0726151114b[1].jpg
0726151114c[1].jpg
0726151114d[1].jpg
0726151114e[1].jpg
0726151135[1].jpg
0727151415[1].jpg
0727151415a[1].jpg

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

Wire Up the Arduino

0726151010a[1].jpg
0726151010[1].jpg
0726151113a[1].jpg
0726151135a[1].jpg
0726151113[1].jpg
0726151216[1].jpg

picture notes have all the information

Upload the Code to the Arduino

0726151330[1].jpg


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.

Put Everything Back Together and Clean Up

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