Connect with us

Adding PWM speed control to Linear Actuators for TV control

Discussion in 'Sensors and Actuators' started by joshzstuff, Aug 25, 2016.

Scroll to continue with content
  1. joshzstuff


    Jul 4, 2010
    The project I'm working on is to open and close a set of TVs mounted on a hinge.

    They are installed in a church stage, they fold against the wall when not in use and the actuators push them to face the audience when needed. (then pull back to the wall)

    I didn't realize that I needed speed control, so I simply installed them controlled by a double pole relay with a reversing circuit. A single pole switch loop controls the actuators remotely.

    The relays work fine, however the TVs, moving at full speed come to an abrupt stop, so I'd like to add a PWM circuit to slow them at the end of their extension.

    Here is what my plan is:

    I want to place a mosfet or some other driving circuit between the power supply and the relay. And control it with a micro controller (Pic/ Arduino)

    I can program the speed control based on simply timing, or I can use a Potentiometer connected to the moving parts as a feedback.

    I know that I could also replace the relays with H-bridge motor drivers, however if I can source the parts to augment the current setup it would seem simpler.

    Specs and distances:

    The actuator runs at 5 amps but peeks @ 8amps at startup.

    I have 12 guage -2 conductor wire between the tv locations to send the switch positions simultaneously from the switch which is connected to the first TV location relay.

    Can anyone recommend either discreet components for the motor driver, or else a board I can purchase to handle the load from the actuators?

    I'm feel I should have something rated for 8-10 Amps.

    Please let me know if I forgot to add any important details.

    Thank You!
    Last edited: Aug 25, 2016
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    Pwm speed control is pretty simple but you need to consider how you are going to do the control.

    One simple means is to operate the motor at low speed the entire time until a limit stop is reached.

    A second way is to operate the motor at full speed until a sensor says you're almost there, then use pwm to slow the motor gradually to a low speed, stopping the motor when an end stop is detected.

    Another way is to use timing to control the profile of speed until the end stop is reached.

    It is a good idea to have limit switches to remove per from the motor when you hit the end. However, it is also sensible to monitor the motor current, so you can stop the motor under software control of the mechanism gets jammed or the limit switch fails. Finally, limiting the time the motor is on will ensure the motor stops if a linkage breaks.

    All of this can be done with hardware (and limit switches are best done in hardware) but the rest is most easily done with a microcontroller.

    Do you have experience with microcontrollers?
  3. joshzstuff


    Jul 4, 2010
    The actuators are geared for speed and not power so I will need full starting current.

    Yes, I can use the pot to track the progress or limit switches, this is what I vaguely described above. I'll need to do it this way since the motor needs it's starting current

    Thank you for these safety suggestions, I will be sure to implement them in my design.
    (The actuator of course has built in limit switches which stop the motor at each end of it's stroke)
    What do you suggest to 'monitor the current" ?

    Yes, I have experience with PicAxe chips, It seems my PicAxe 08 M2 should work.
    I wish to 'tune' the speed control to achieve the desired result, I have no idea what values will produce real world results so I will experiment with the program after I have the hardware assembled.
    I'm somewhat sure about the type of programming I will need to do, but I can inquire more about it once I have the hardware to work with.

    What I need to get started with my project is suggestions as to the hardware or circuitry to accomplish what you have suggested.
    Could you be so kind as to offer suggestions as to specific hardware?

  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    Firstly, PWM will give high torque at low speeds, so you should be able to do a slow or soft start.

    There are many ways to detect the motor current. There are simple hall effect current sensors, or you can use a current sense resistor. With a sense resistor you can use an op-amp to amplify the voltage, put the voltage direct into an ADC, or use it to switch a logic level at some current level.

    The simplest is to have a resistor which drops about 1V at the stall current for the motor. A transistor can be switched on when the voltage exceeds about 0.6V. This can pull against a resistor to change a logic level.

    You need to be a bit careful because the stall current will flow briefly as the motor starts, so you need to look for it remaining asserted for longer than the time the motor takes to start up under load.

    I'm on my phone, so I'll read your questions again, but feel free to ask again if I've forgotten anything.
  5. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    I'll try to draw up some circuits for you later today.
  6. joshzstuff


    Jul 4, 2010
    Thanks Steve! I'll look into this technique so I'm more familiar TV Project.jpg with it.
    Here is a diagram to make things a bit clearer for the thread:
  7. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    Here is one way to wire the limit switches:


    if the left is positive an the right is negative, then the limit switch S2 should open at the end of travel.

    This circuit allows the motor to be driven no further than the limit in either direction, but allows it to be driven out of it in the reverse direction.

    The diodes should be rated for the full motor stall current, because if they fail (they will fail short circuit) the limit switch will no longer be effective.
  8. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    Jan 21, 2010
    To detect stalling, you could use something like this:


    power input is on the left, the right goes to the PWM transistor and the H bridge.

    R1 has the value 1/s Ω where s is the stall current of the motor in amps.

    R2 should be about 1k, and R3, 10k.

    While the current through R1 is significantly less than the stall current the transistor Q1 remains off. This means the signal to your microcontroller (the terminal in the middle on the left) remains high.

    When the current to the motor nears the stall current, Q1 turns on and the signal goes low.

    This circuit requires that your motor power and the microcontroller power have their grounds linked (preferably near the emitter of Q1) and will also require some further signal conditioning if the voltage to the motor is greater than the voltage to the microcontroller (as is a distinct likelihood).

    It's also probably a good idea to protect the microcontroller from voltage spikes which may appear on thew motor power rail.
    joshzstuff likes this.
  9. joshzstuff


    Jul 4, 2010
    Thank you Steve!
    Something I learned when I got into linear actuators is that this exact setup is already installed in side the unit.
    Actuator limit switches will come 1 of ways: adjustable or fixed.
    The adjustable type will allow you to set the stroke length by moving the limit switches, the fixed cannot be adjusted.
    The actuator I am using has fixed limit switches internally, I imagine that they are arranged exactly how you have shown ;)
    How Internal Limit Switches in Our Linear Actuators Work - Progressive Automations - YouTube
  10. joshzstuff


    Jul 4, 2010
    Hello again
    I've decided to re-visit this project and go at it from a different angle.
    I'm using an Arduino with a purchased set of motor controllers, but I will need to write the arduino code to make it work.

    The problem of the abrupt start and stop of the monitors needs to be fixed.
    My Arduino project will use a PWM sequence that I will fine tune to provide a more gradual opening and closing.
    (I would also like to add an infrared transmitter mounted to the TV sensors so that I can have them turn on/off as they open/close)
    Here is an illustration of how the system currently works:


    I have sourced the following items for this build:
    1) 2x Arduino Uno's
    2) H- Bridge motor driver
    3) Infrared Diode LED IR Emission and Receiver
    4) Limit switches at each end of the Actuators desired stroke.

    Features to include:

    1) Interrupt code, if the switch needs to be reversed when the actuator is in motion, there is a brief pause before heading back. (this is really bad for the actuators, but I must leave some safety option)
    2) IR transmission to turn ON/OFF TVs
    3) Recovery protocol if power is cut to the system
    (if a fuse blows mid-path or while the TVs are open, there must be a way for the program to recover)

    There challenge in #1 & #3 is that the only input is signals sent to the Arduino based on 2 positions of the switch.
    I plan on using the dry contacts of the relays to send 2 signals to the Arduino:
    "Open" and "Close".

    Unfortunately these actuators do not include position feedback, so I will use limit switches at each end of the desired stroke to feedback to the Arduino.
    I plan on using the opening of the limit switches as a signal to start the timing of my PWM function to properly time the stroke speed.
    Here is the order of the Arduino program:

    Open TVs

    1) Relay signal "open"
    2) IR signal "TV_ON"
    3) Actuator Powered "Forward"
    4) "full_Closed" Limit switch opens
    5) PWM function
    6) "full_Open" Limit reached
    7) Actuator Power Stops

    Close TVs

    1) Relay signal "close"
    2) IR signal "TV_OFF"
    3) Actuator Powered "Reverse"
    4) "full_Open" Limit switch opens
    5) PWM function
    6) "full_Closed" Limit reached
    7) Actuator Power Stops

    *Interrupt function = Pause before reversing circuit
    *Safety recovery after power blackout

    I'm used to programing on PicAxe microcontrollers.
    I have ideas about how I would use the interrupts and multitasking to accomplish this type of program, on my old platform, but I'm still learning how to do this on Arduinos, so perhaps you could recommend better procedures than how I propose to accomplish these objectives.

    Here is the motor controller I purchased for the job
    There is no real documentation with this controller, it appears that a +5v to the "PWM" pin and a ground to the "DIR" pin will allow it to operate at full speed in a particular direction.
    (The controllers are coming in the mail tonight and I will test them)

    I am grateful for any insight you can offer that will point me in the right direction!
    Thank you!
    In advance.
    Last edited by a moderator: Jun 2, 2017
  11. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    May 8, 2012
    Josh, just curious why you abandoned a PIC for an Arduino?

  12. joshzstuff


    Jul 4, 2010
    Hello Chris,
    PicAxe was the first micro I learned to code on, I had a hard time deciding but I finally went with picAxe because of the educational tools that came with it. After a lot of research and trial and error I was able to get by pretty good on the platform.
    I haven't coded for a long time, and my documentation on my old projects was too poor for me to pick up where I left off (noob's curse lol)
    I realized that I would have to re-learn much of what I knew to get back up and running. Since then, I've noticed the amazing support for Arduino, both in hardware and community.
    I decided before I started this project that if I was going back into working with micro's I'd start up learning Arduino.
    I think I made the right choice. However having worked with both I see strengths/ weaknesses.
    One thing I really miss is the simulated multi-tasking on the PicAxe.
    However, Arduino code forces me to code closer to 'real code' without the crutch of PicAxe.
    The PicAxe system is completely closed source and proprietary, quite the opposite from Arduino.
    (kind of like Apple vs. Android ;))
    You cannot flash the bootloader yourself, and you must buy the chips directly from them. They do offer a lot of nice tools and features, but compared to Arduino, it feels limited and arcane and all you can get is what THEY offer.
    The popularity of Arduino means that there is a much better chance that someone else has the same hardware/project/or issue as you and the help is easier to get most times.
    I see loads more tutorials of Arduino projects than I do PicAxe, and it has kept moving that direction over the years.
    I saw the picaxe platform as 'painting me into a corner', even though it wasn't that bad of a corner ;)

    One of the challenges of this project is I must code the simulated multi-tasking to ensure the switch reversal is responsive in an emergency. There is a much higher learning curve doing this on the Arduino, but I'm slowly learning the technique. I'll post the code when I get further along.
  13. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    May 8, 2012
    I think you misread my post. I asked why not a PIC,.... not a Picaxe. :)

  14. joshzstuff


    Jul 4, 2010
    Ah, I see.
    Well I never used a pic without the bootloader, so I never really 'abandoned' it just PicAxe. ( Being a noob)
    I assumed that by 'Pic' you were referring to the brand. ( I'm aware Microchip now own both)

    But my answer is basically the same. I chose to move ahead with Arduino because of the community support and popularity, not for any technical reasons.
  15. joshzstuff


    Jul 4, 2010
    I've received my Motor Controllers and I ran into a problem.
    Other buyers have reported this driver gets extremely hot.
    Before I write my Arduino program, I tested the driver circuit with the included example test circuit.

    When connected to "Motor2" (as per the diagram) the circuit works, however when you supply +5Votls to the "Dir2" pin Mosfet "Q1" (shown by the red arrow) gets SUPER HOT. However, when you put "DIR2" pin low the circuit works and all of the components are cool to the touch.

    I tried the same circuit on "Motor1" and this time +5Volts was fine, however -5Volts on "Dir1" pin caused Mosfet "Q7" to overheat.
    I've tired to limit the current to the direction pin by putting a 10K resistor in series, this makes no difference.

    I've noticed that when the 12volt motor line voltage is switched "OFF" there is no overheating on the mosfets. This leads me to guess that the design of this board is causing some misoperation with the Gate and Drain of the Mosfets, and the effect is mirrored on each motor path.
    Unfortunately I'm not smart enough to come up with the specific location of the fault.
    This board has been sold many times and has positive feedback, so I'm not sure how others are using it without this problem . . . (could that be an hint as to a work around?)

    Another thought I had was that perhaps somehow the diodes built into the limit switches of the Linear actuator could only cause the problem with these actuators and not regular motors. I don't have any other motors I could test it with, but I kind of doubt this is the problem.

    You can tell by the traces how the "H" bridge is arranged, but if you wish I can also include a picture of the under side of the board.
    I'm sure this would be a simple problem to solve for someone familiar with advanced "H" bridge design. Any insight would be greatly appreciated.
    Is there a way I can work around this problem?
    I purchased other motor drivers, but these were much more expensive and higher current rated, it's a shame that they are the ones to cause an issue.
  16. joshzstuff


    Jul 4, 2010
    I contacted the seller this was my message:
    For your Motor controller I set up your test circuit. Other buys reported "Motor controller gets extremely hot", they are right. I found one source of the problem.
    I used an Arduino for the 5Volts and a 12V supply to control a motor in a 5 Amp max Linear Actuator.
    I used 3Amp fuses, so the power was never too much for the driver.
    The Dir2 pin controls the direction. The circuit works in both directions with the test circuit, however, when Dir2 (or Dir1) is set "high" with 5 volts then "Q1" Mosfet gets SUPER HOT (I can smell it!)
    I have tried putting a 10K resistor on the +5 volts to limit current, but the same results.
    Next I tried using the "Motor 1" side.
    This time when "Dir1" = LOW then Q7 Mosfet gets SUPER HOT.
    Please tell me, Is there a way to correct the Motor Driver by adding components, or is there no way to fix this bad design?

    His reply:
    "Add a heat sink"

    Lol, NO!!
    I told him 4 reasons why strapping a heat sink will not make this problem go away and requested a schematic.
    Here it is:
    I'm not sure how useful this schematic is in troubleshooting, because this only shows 1 channel, so I'm sure a lot of other things are missing.
    Also, why doesn't this say: " +36 volts" since that is what the board is advertised as?
    Anyone smarter than me see any smoking guns from this though?
    Or is this how the board 'should' have been designed?
    Did this guy just throw me a generic diagram?

    Attached Files:

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day