Controlling unknown source with a PNP transistor switch

Thread Starter

ltorres

Joined Oct 17, 2024
25
Hello,

I have a controller box that sends signals to a motorized axis platform. This "platform" moves up and down until it hits a mechanical limit switch and then stops moving in that direction. It has a 9 pin Dsub and I mapped out where the limits are, ground, and motor controller. I know that when the limit switch is hit, it stops the motor from moving and that pin is driven high, 5V.

I want to use my own limit switches and piggy back off the same connector. The purpose of this is that my enclosure won't be as wide as the whole range of the axis platform.

My idea was to make a switch so that when the motor moves and hits the limit switch it drives the pin high and stops the motor.

The drawing below is what I have come up with so far. I used a 2N2907 transistor. When the switch is pressed the collector will output 5V and drive the motor controller pin high and stop the motor. My biggest concern/issue is that I don't exactly know how much current I am able to sink into the pin on the connector to drive it high.

I have gone up to 25mA and my voltage drops severely down to less than 1V. (I have been using different size resistors for Rb to control the current.)

If I measure the current output from the pin of the connector once the internal limit switch is high, I can measure 5V at 0.5mA. (I may not be accurately measuring the current is my guess)

Why am I sinking so much current and dropping my voltage into that controller? Would there be a better way to drive this controller? (The output of my DC power supply is 5V and can go up to 2A)

Thank you.

1755206631127.png
 

panic mode

Joined Oct 10, 2011
4,864
your circuit is basically correct. i would have added a diode to protect transistor since load is inductive.
you did not state how much current your motor controller requires. assuming some 150mA, base current would need to be about 1/10 of that so 15mA. (5V-0.7V)/0.015A=286 Ohm. common resistor value is 270 Ohm.
1755210557079.png
 

BobTPH

Joined Jun 5, 2013
11,463
I must be missing something. Why can you not simply replace the limit switch with another switch in a different position? Or even simply move the original switches?
 

Thread Starter

ltorres

Joined Oct 17, 2024
25
I must be missing something. Why can you not simply replace the limit switch with another switch in a different position? Or even simply move the original switches?
The limit switches in the controller are enclosed in something that was bought. I rather not mess directly with them in case they are needed eventually.

I agree this would be the simplest solution.
 

Ya’akov

Joined Jan 27, 2019
10,226
Welcome to AAC.

Have you tried using a bench supply to pull the pin high and see if that actually works?

Have you considered putting a "shim" (that is, a male-to-female DB9 extension that breaks out the wiring, then mechanically locking the original limit switches on (possibly with a skirt or something like it on your add-on enclosure, and placing your own limit switch(es) in series with the original?

The advantage is that the power supply for the limit circuit is untouched.
 

Thread Starter

ltorres

Joined Oct 17, 2024
25
your circuit is basically correct. i would have added a diode to protect transistor since load is inductive.
you did not state how much current your motor controller requires. assuming some 150mA, base current would need to be about 1/10 of that so 15mA. (5V-0.7V)/0.015A=286 Ohm. common resistor value is 270 Ohm.
View attachment 354234

thank you for your suggestion. I am not exactly sure what the current requirement is for the controller. When I measure the current from the motor controller to the motor itself, while in the limit stage, I measure around 0.25mA. I have been messing with the base resistor to get the amps to around 2mA but when I inject that current in between the 2 through my ribbon cable I can measure the 2mA but the voltage drops severely (less than 1V.)

I am going to try and up the current little by little see how it behaves, I am hesitant to add to much current too fast.
 

Thread Starter

ltorres

Joined Oct 17, 2024
25
Welcome to AAC.

Have you tried using a bench supply to pull the pin high and see if that actually works?

Have you considered putting a "shim" (that is, a male-to-female DB9 extension that breaks out the wiring, then mechanically locking the original limit switches on (possibly with a skirt or something like it on your add-on enclosure, and placing your own limit switch(es) in series with the original?

The advantage is that the power supply for the limit circuit is untouched.
I think I made a "shim"

Here is my hookup, I have the motor controller box hooked up to my ribbon cable. My ribbon cable has a female 9pin dsub in the middle so I can measure everything through there. The other end of the ribbon cable is hooked up to the cable that is directly connected to the motor/axis platform.

The motor controller comes with its own software where I can move the motor platform and lock it once it hits one of the limit switches and that is how I was able to measure 5V, 0.25mA on one of the pins, once its limit switch is engaged. Other than that I have no access to the original limit switches.

I am trying to piggy back from that ribbon cable so that when I add my own limit I can trigger it inside the box.

I have not tried the bench power supply, I know its easier to control the voltage but I am hesitant to start feeding it more current since I am not exactly sure how the motor controller works. However, this was my next step.

Thank you for your suggestion.
 

panic mode

Joined Oct 10, 2011
4,864
pretty sure your motor is not drawing 0.25mA. are you sure you are using DMM correctly? please post some photos of the devices, connections, DMM and the values displayed.
 

Thread Starter

ltorres

Joined Oct 17, 2024
25
pretty sure your motor is not drawing 0.25mA. are you sure you are using DMM correctly? please post some photos of the devices, connections, DMM and the values displayed.
Hello, its not the motor that that pin controls, but the motor control box. I assume its getting controlled by some IC.

You are correct, I figured why I am not measuring the current correctly. I need to modify my ribbon cable so I can measure directly.
 

Ya’akov

Joined Jan 27, 2019
10,226
I think I made a "shim"

Here is my hookup, I have the motor controller box hooked up to my ribbon cable. My ribbon cable has a female 9pin dsub in the middle so I can measure everything through there. The other end of the ribbon cable is hooked up to the cable that is directly connected to the motor/axis platform.

The motor controller comes with its own software where I can move the motor platform and lock it once it hits one of the limit switches and that is how I was able to measure 5V, 0.25mA on one of the pins, once its limit switch is engaged. Other than that I have no access to the original limit switches.

I am trying to piggy back from that ribbon cable so that when I add my own limit I can trigger it inside the box.

I have not tried the bench power supply, I know its easier to control the voltage but I am hesitant to start feeding it more current since I am not exactly sure how the motor controller works. However, this was my next step.

Thank you for your suggestion.
I don't think my suggestion clear. First, I am assuming the limit switch is connected to a GPIO pin on an MCU, and not to a motor. If that's incorrect, my suggestion is still potentially useful but I might change it somewhat.

Look at this:

OEM LIMIT SWITCH → OEM DB9 PIN → YOUR DEVICE → DB9 MATING CONNECTOR PIN → DEVICE MCU

If you mechanically bypass (activate) the OEM LIMIT SWITCH then the appropriate signal, whatever the parameters are, will be constantly available at the OEM DB9 PIN. Your device can then switch this signal rather than needing to provide anything.
 
Top