Go Down

Topic: Need someone to write some code for mx5 headlight control (Read 275 times) previous topic - next topic

mx5

For a school electronics project i am making a circuit to control the pop up headlight function of my car. I want to have 4 different function a wink left headlight, wink right headlight, headlights half up and crazy headlights. For an example of what im talking about and a very similar project https://www.instructables.com/id/Popup-headlight-wink-with-arduino-and-relay-board-/ and https://youtu.be/Iw2_0Dt-eI0.
The problem with this is that it only really has 2 functions and imposes a bit on the standard headlight functions. I would like to have four separate buttons for each function.

So far i am using an arduino nano and an 8 channel relay board with buttons connected to pins D2,3,4,5 using input pullup with a common ground and the 8 relays connected to pins D6-13. I have worked out the wiring related to the car and the relay events that need to occur to make the functions work and i have made a few attempts to program the arduino but haven't gotten very far and im running out of time. Im looking for someone who can write a program for me im willing to pay.



The relay logic for each function is as follows

wink left headlight
both headlights already up
Right Relay 1 (RR1) - 2 x normally closed (NC) contacts open for 10 seconds
Left Relay 1 (LR1) - 2 x NC contacts open for 10 seconds
The four relays go open to disconnect the headlights from the car this happens for every event
Left relay 2 (LR2) - normally open (NO) contact closes sending 12v to the down pin of the headlights for 1 second.
Left relay 3 (LR3) - normally open (NO) contact closes sending 12v to the up pin of the headlights for 1 second.
These two events happen one after the other whilst the four relays are open making the left headlight go down then up.  

wink right headlight
both headlights already up
RR1 - 2 x NC contacts open for 10 seconds
LR1 - 2 x NC contacts open for 10 seconds
RR2 - NO contact closes sending 12v to the down pin of the headlights for 1 second.
RR3 - NO contact closes sending 12v to the up pin of the headlights for 1 second.

headlights half up
RR1 - 2 x NC contacts open for 10 seconds
LR1 - 2 x NC contacts open for 10 seconds
LR3 and RR3 - NO contact closes for 500 milliseconds
after the 10 seconds runs out the car will be back in control and the headlights should go down.

crazy lights
headlights go up and down out of sync
RR1 - 2 x NC contacts open for 10 seconds
LR1 - 2 x NC contacts open for 10 seconds
LR3 - NO contact closes for 1 second (left headlight goes up)
LR2 and RR3 operate for 1 second (left headlight does down right goes up)
LR3 and RR2 operate for 1 second ( right goes down left goes up)
repeat...
The attached picture is a car wiring diagram with the relay circuit drawn over the top which hopefully with the above relay logic will make sense as to how i want the functions to work 

This is my first time on this forum so I have tried to make it as clear as possible the coding that needs to be done to make this work

patduino

There are 10 types of people in the world, those who understand binary, and those that don't.

Go Up