Hard Limit Switch with Signal to Arduino

I'm trying to hook up 2 limit switches to a linear actuator so that

  1. When one of the limits is reached, the motor is cut off in that direction, but still allows current to flow in the other direction.
  2. A signal can be read by the Arduino to detect when either limit switch is pressed

The power source is a 12V battery (LiFePO4), the motor stalls at 9A, and the motor driver is a VNH5019. I have included a schematic with what I think will work. Does anyone see any issues with it or offer any feedback? Thank you!!

How do your switches get set back to their original positions?
Paul

The controller would need to send a signal to the VNH5019 to start moving in the other direction. I didn't show the controller pins to the motor driver. Right now, I'm just trying to set up the hard limit switch with signals to the Arduino.

I think your Opto's need to be across the switches, hopefully not requiring enough current to move your motor.

You didn't show any protection across the motor.

And what tells the controller that the switches have been activated? Look again at your schematic. There is NO connection between the switches and anything other than the motor power.
Paul

Thank you so much for the feedback.

Could you elaborate on that bit? I thought the diodes across the switches and the VNH5019 (and passives hooked up to it) took care of any backfeed.

And what tells the controller that the switches have been activated?

Got it. I updated the schematic. The OUT_SW1 and OUT_SW2 would connect to I/O pins on the uC. Does this look better?

Is there some SPECIAL reason you are not using limit switches like the rest of the world uses them?
Paul

How does the rest of the world use them? Conceptually, I'm trying to shut the motor off on the 12V side without a microcontroller doing the work. But then I need a signal to the uC. Doesn't seem like a bad use case to me, but I'm not an expert.

Basically... something like this How Linear Actuator Circuits Work - YouTube

The rest of the world uses the micro controller to control the motor and uses a limit switch to signal the micro controller to stop the motor and possibly reverse the motion.
The limit switch is adjusted so the motor stops/reverses at the proper location. Stopping a motor does take time, as will you scheme, which also does not allow for bouncing switch contacts.
Paul

Thanks for the feedback. I would still stop the motor from the uC. I am trying to add redundancy to the system. If the software gets hung, at least I am absolutely certain the motor won't move beyond the fail safe points. I guess I thought linear actuators work the same way with internal limit switches. Is this not a sound approach for accomplishing that task?

I have also discovered high amp limit switches aren’t cheap. Arduino controlled it is, but I’ll try and add hardware logic to ensure the motor gets turned off.

No!

The optocouplers are connected the wrong way round with two consequences. The diode across the switch will conduct at a lower voltage than the optocoupler LED, so the LED will never work, but will be subjected in reverse to the full motor voltage (for which it is probably not rated) when the limit switch opens to stop the motor.

And in fact he is using them in the recommended fashion. It is always advised that if possible, the limit switch actually directly cuts power to the motor and does not rely on the microcontroller code (and the motor driver) to stop the motor.

That may be true. You generally use "microswitches" for the purpose, and there are small and large ones though the former are more common.

Another approach is to use the limit switches to operate directly on the motor controller.

Hi,
Most internal limit switches are for max and min travel of the actuator and are fixed.
If your system needs different travel max and min then external limits are essential.

Have you got the basic setup built and testing with the actuator removed from its final operating position?
That way you can safely test your code and circuit.

With one control to the driver IC, how do you STOP and CHANGE DIRECTION?

Tom... :smiley: :+1: :coffee: :australia:

Do you have any suggestions on how to accomplish the same behavior directly to the motor driver? With 1 input for speed and another for direction, I'm not sure how you could set the speed to 0 when one of the switches is toggled but still be able to move in the other direction.

I read that you could drive the switches on the 12V side with a high current relay, but I think the relay would always be energized which would be a bit problematic since the motor is battery powered. For most of the time, one of the limit switches will be engaged (actuator at rest).

I was using internal switches on an actuator as an analogy. The motor I am using will be moving a platform left and right up to a specific limit. Once the limit is hit, I want to cut power to the motor in that direction. I was assuming internal switches in an actuator work the same way, and I was wondering how they were wired.

How far will the platform continue to move as the motor slows to a stop?
Paul

It shouldn't move too far. The motor is 40RPM rotating a lead screw which moves the platform. I understand what you're saying... setting the speed to 0 will stop the motor on a dime instead of cutting the power.

Do you have a suggestion on how to accomplish the same task at the motor controller without depending on code?

Depends on the options on the motor controller.
Paul

I am using the VNH5019.
Here's the pololu carrier board.