central doorlock motor


I have a central doorlock motor that works on 24V and I want to connect it to an arduino. The type of arduino doesn’t matter in this case and the coding doesn’t matter aswell. It is mainly connecting it all together that is a problem. The central doorlock motor works on 24V and to use it I have a few “transistor mosfet DC switch relays” laying arround to switch the 24V. Here is how the central doorlock motor works. When 24V goes in the motor through the red wire and out through the yellow wire. It makes the motor goes to “pos 2”. Then it disconnects the yellow wire internaly. When using the white wire as - it moves the moror to “pos 1” and disconnects it internally and connect the yellow wire. so either the white or yellow wire would move the motor to the 2 different possitions. Now comes the tricky part. It has a black wire that will tell the possition of the motor. But it also uses the white and the yellow wires to tell it. so basicly to move the motor I need to use the red and white/yellow wire, and to tell the possition i need the black and white/yellow wires. So I thought connecting the arduino to black and white/yellow to tell it the possition of the motor would work untill I noticed that when moving the motor with 24V, there goes a high voltage through the white/yellow aswell and maybe blow up the arduino.
Here is a scematic (not connected to each other) of the different components:

Best regards,


To read the position I suggest an opto copler. Use 10 kOhm to limut the current from the 24 volt going through the diode.
Use INPUT_PULLUP for the sensing controller output. Connect thr ooto output between GND and controller. Watch + and - on the opto.

But if I use an opto coupler, would it also send out a signal when there is no power through the higher voltage wires?
Cause I think it is visa versa >> when let's say black and yellow sends out a signal that the motor is in possition 1. Then red and white will make the motor turn to possition 2. And then black and white tells the motor is in possition 2.
Maybe if I write it as this. If the relay switch sends 24V through the red wire and goes back through the yellow wire the motor moves to possition 2. At that same time black and white has a connection but once the motor is half way to possition 2 the black wire losses it's connection with the white wire and gains a connection with the yellow wire. By gaining this connection there would also flow 24V to the arduino untill the motor is in possition 2. With an opto coupler I won't allow the 24V to go to the arduino but that wire should still tell the arduino that the black wire and the yellow wire are connected to send out 24V through the red wire and the white wire to move the motor back again.

Write some code and show us. Your literal description is hard to grab as I have no pen and paper at hand.

If the entire 24 vikt is down the controller will read a none active dignal. During that condition no action is going on in the motor either.

I have no code at all. I have tried to connect it to an arduino but it broke my arduino cause of the 24V. I'll ask the manufacture if they are kindly enough to send me the electrical schematic.

Okey. If You can get a drawing of the motor assembly it's good.
Else, if You can either run the motor manually, or affect the end stops, You can check what the status signals look like.

I figured it out how I could do this but i need to know that if I place an opto coupler, I can still read if a circuit it closed. So basicly if there is no power going through the opto coupler can I still read if let's say circuit black and yellow are closed? since the wires from the arduino wo't make physical contact with the yellow wire. I also need a some kind of one way valve for the 24V but i have no idea how those are called. I know they excist just I don't know how they are called.
Here is a schematic of how I want it to be like (if this is possible by using a opto coupler).

And where does the wire go where the question mark is? Back to ground from the arduino?
Also I didn't drew the yellow wire else the drawing would get unclear.

That black cable connection can be removed but connect the question mark to Arduino GND. Add a 10 kOhm serie resistor to the white cable, just before the opto. Else the opto will be burned.

Hmm I've been thinking and I don't think I should remove the black wire cause internally it is used to tell the possition. And I don't think an opto is the right component to use. Cause if the door lock motor is in possition 1 (locked the door state) and I manually open the door with the mechanical lock, the possition changes from 1 to 2 and using an opto won't tell the possition change since the relay switch cuts the power to the door lock motor.

I might found a solution. I disassabled and thought if I could add 2 wires to the DC motor so it wouldn't interupt with the possition sensor it could work. So the 24v would be a completly closed circuit and would never get near any arduino wiring. But if that fails I have to maybe buy a new motor and report back to the forum cause that is my only possible idea

The end switches stops the motor and that is very valuable! Keep that!
You should not have any commom ground to the Arduino!
The 24 volt world current should only pass the led in the opto copler. Connect the ? to GND as I wrote.
When the 24 volt comes, the opto copler acts like a relay and conducts on the Arduino side of the opto.
Your reply in #9 makes me worried. You need to search and find out how an opto copler works.

Here is the internal possition thingy. When the yellow plastic parts moves from one side to another the metal part on it connects the black arrow (black wire) with either the yellow or white arrow (yellow or white wire). How can an arduino detect this if on the yellow/white wire there is an optocopler. the opto copler send out a signal when the 24v passes through it (as i read it) and doesn't work when there isn't 24V. I also can't leave out the black wire cause it is actually crucial in derterminating the possition of the lock.

Thanks for the picture. Sorry but I can't see what You see.
Consider the black wire as a common for the position indication, and feed it to both opto diodes. Mind the polarity of the opto diode/LED.
Then feed the yellow to one opto LED and white to the other opto.
As I understand there is 24 volt when the movement is between the 2 positions. Right?
That shoukd be interpreted by the controller as:
Conducting makes a low level on the controller input meaning "Not in any position". High level indicates position is reached.

I managed to get it working without using an opto coupler (they were out of stock anyway). I did this bu adding 2 wires to the negative side of the DC motor inside the door lock motor. Also removing the connection between the yellow and white wire so the possition sensor and the dc motor are on 2 different circuits. Thank you very much for your time and knowlage .

Nice that it works. I can guess what You did. Literal wirings are always uncertain, easy to misunderstand or not understand.