car mirror in/out with locking the doors, but i'm stuck.

I’m very new to arduino, I started with simple project’s, of course, but now I took on a school project that I’m doing at work but I could use some help to point me back in the right direction.

The thing I want to do is when you lock your car door the mirrors go in, and when you put the ignition op the mirrors should go back in the drive position.
There is already a module that turns the mirrors in and out, it gets a pulse from a button. push the button and they go in. push it again and they go back out.

I will use the door locking signal that comes from the remote to turn the mirrors in.
But when you start driving the doors will lock so I can only use this signal when the ignition is off.

When you turn on the ignition the mirrors should go back in the driving position but only when you turn it on. because you should be able to use the normal, existing, button to move the mirrors. so if the mirrors always go in with the ignition on this will not work any more.

That is why I need a counter of some short to know the position of the mirror, also that counter needs to know if the button is pressed what the new position is, and remember this data until it changes to a new value.

I’m working on this project for some time now, I tried many different things, but non of them work. That is of course the reason I’m here. In the hope I could get some help.
I will attach the program that I have now and I hope you could take some time to help me out here.

spiegelnieuwsteversie.ino (1.74 KB)

That is why I need a counter of some short to know the position of the mirror, also that counter needs to know if the button is pressed what the new position is, and remember this data until it changes to a new value.

I'm not sure a counter is going to work. If the mirrors get out-of-sequence the counter is likely to be out-of sequence too.

There's probably a limit-sensor in the mirror to tell it when to stop the motor or when it's in the "home position". If you can tap-into that sensor so the Arduino knows if the mirrors are in or out, that should help.

The key to making this thing foolproof is knowing if the mirrors are in or out before you "do anything"... That's how they work now... You know if the mirrors are in the "wrong" position and if they are, you push the button.

I will use the door locking signal that comes from the remote to turn the mirrors in. But when you start driving the doors will lock so I can only use this signal when the ignition is off.

When you turn on the ignition the mirrors should go back in the driving position but only when you turn it on. because you should be able to use the normal, existing, button to move the mirrors. so if the mirrors always go in with the ignition on this will not work any more.

I'm not sure I've fully comprehended that... I'd have to make a chart... If you make a chart of all the conditions and the required result with each condition, you should be able to use logic (if, and, or) in your code to get the results you want.

There are 3 inputs, right? Lock state, mirror state, and ignition state. That means there are 7 static states. ...You might need to read and "remember" an active state (such as door-lock pulse and door-unlock pulse) to know if the doors are locked or unlocked.

It might be difficult to know the current state of the mirrors and the state of the locks (you can easily check the state if the ignition) but if the mirrors end-up in wrong state, pushing the manual button will reverse everything and that should get you back on track.

P.S. Do the door locks really matter? How about simply moving the mirrors out when the ignition is turned-on and back-in when it's switched-off? (And if you need to override that, you can push button.)

I think you need to find a trigger that's only active when the door lock activates from the remote, and not from the main lock/unlock circuit. Is this an aftermarket add-on remote locking thing, or all done through the factory BCM?

I'd be very wary of this project. If something went wrong, the mirrors could turn in whilst you're driving.

First of all thank all of you for your fast reply.

it's all factory original so it's as good as impossible to get to the remote signal with out breaking the door unit.

I think I will move the mirrors only with turning on or off the ignition. (thank you DVDdoug) But is there a rising and falling edge trigger of some sort ? so that the mirrors only move when the ignition go's from high to low and low to high. This is maybe more fail prove, seeing that henry's concerns are a valid one.

So could you help me find a way to move the mirrors on the rising and falling edge of the ignition signal.

Then I will go and look for the limit sensor signal.

Often there's power available on some circuits in the cabin (such as the radio) only when ignition is on - can you use that as your trigger?

wildbill: Often there's power available on some circuits in the cabin (such as the radio) only when ignition is on - can you use that as your trigger?

A car radio usually has two power supplies. The one you mentioned and one that's always on, to keep the tuning memory alive.

I have a ignition signal that is not the problem. The thing is when the ignition is switched from off to on it should only give it's signal ones. This is because when you give a second pulse the mirrors go back in.

I know from programming PLC's that you can use the rising edge, so when it was low and it becomes high, only then it will give a pulse. Or other wise I will need a reliable memory of some sort to store if it already gave a pulse when ignition was on.

So basicly what I want is this:

  • Ignition is off & mirror is in drive position then mirror go's IN (also only ones otherwise the mirror go's out again)
  • ignition go's from off to on & mirror is in in position then mirror go's out

I have: - constant power - ignition signal -(I will look if there is a limit edge signal from the mirror servo motor)

Take a look at the state change example in the IDE. That should let you manage edge detection in software. Add a small delay to debounce it once you detect the edge.