# Garage Door Motor Direction to Modbus Data Input

#### kent@idma

Joined Dec 28, 2020
20
Hi All,

This is a refresh of a post I did a few years ago, but we've now moved house and new Garage Doors / Data Inputs.

Previous Posting if Interested: https://forum.allaboutcircuits.com/...relays-based-on-dc-current-flow.175324/page-4 (36V DC Motor circuit. 12V DC supply for other circuit, 3V DC for GIPO inputs)

Objective: Want to detect if the motor is off or powered in a clockwise / anti-clockwise direction.

So the setup is:
1) Circuit 1: Garage Door Motor = 24V DC.
2) Circuit 2: 24V DC power supply, Modbus input can handle 3-30V

I've attached the circuit diagram that we eventually came to at the end. The key differences to last time are:
1) 24V DC motor (instead of 36V DC). Voltage while running drops to 6V for final opening/closing stage in my testing.
2) No need to reduce the return voltage, can keep at 24V.

Given this, my questions are:
Q) Given the lower voltage range of the motor, should I reduce R7 - 2.7K 1W (say to 2.2K 1W) ?
Q) Modbus Data Inputs can handle the full voltage so do I need to keep any of R1-R6 at all ?

Notes:
• I've assumed I keep the capacitor so when the motor speed changes it doesn't cause a false trigger.
• The 4N25 is what I used last time (and I have a couple left over).

Thanks
Kent.

#### Dodgydave

Joined Jun 22, 2012
11,234
Does the modbus need a positive input or can it accept a low, if so you could just use the optocoupler to pull down with the collector and a 2.7K resistor 1/4W.

Last edited:

#### kent@idma

Joined Dec 28, 2020
20
Does the modbus need a positive input or can it accept a low, if so you could just use the optocoupler to pull down with the collector and a 27K resistor 1/4W.
As far as I can tell, yes. It has a 'COM' (which I've connected the -'ve to) and then the 16 inputs (which I've been connecting the +'ve to).

This is the guide I've been using for the software development: gecon-tcp-508n

This is the model I have: 12-channel Relay Output 16-channel Switch Input RJ45 Ethernet Modbus TCP Controller

Last edited:

#### Dodgydave

Joined Jun 22, 2012
11,234
Then just use a pull up resistor and an optocoupler collector on each input,.

#### nsaspook

Joined Aug 27, 2009
12,738
If it worked fine before, I wouldn't change much. The RC filter section will provide a stable on/off signal to be detected by the software.

R7: 2.2K is my normal value for the 4N25 on 24vdc signals but you're needing to drive the LED at 6 volts, so a lower value (think about the dissipation of that limiting resistor) will likely be needed to cover the entire motor drive range for reliable signalling.

One of my typical 4N25 circuits.

You're driving an opto on the Modbus device so think about the drive current you need to supply from the filter.

ON level 5-30VDC，6mA@24VDC
OFF level 0-3VDC

#### kent@idma

Joined Dec 28, 2020
20
Then just use a pull up resistor and an optocoupler collector on each input,.
Thanks - that's was I was thinking also. See my updated circuit diagram below.

If it worked fine before, I wouldn't change much. The RC filter section will provide a stable on/off signal to be detected by the software.
There were two key differences - the motor was 36VDC and the return was 3.6v maximum. Now I only have a 24VDC motor and the return requires at least 5VDC.

R7: 2.2K is my normal value for the 4N25 on 24vdc signals but you're needing to drive the LED at 6 volts, so a lower value (think about the dissipation of that limiting resistor) will likely be needed to cover the entire motor drive range for reliable signalling.
Okay - so I'll start with a 2.2K resistor and see how it goes. If I get a dropout too early when the motor is slowing down, then potentially drop this to a 2.0K resistor (bearing in mind if I drop too low I risk blowing the 6V LED in the OPTO when the motor is at full load).

You're driving an opto on the Modbus device so think about the drive current you need to supply from the filter.