Linear Actuator PWM control for TV open/ close - Page 1
Forum section: electronics / projects

author: Joshsstuff
author_rank: Contributor
timestamp: June 01, 2017, 11:42:26 pm
content: Linear Actuator PWM control for TV open and closeHello,I have already completed a project that uses relays and a 120v circuit to open/close a set of TV monitors for my church. It's a very simple reversing circuit via the relays means a switch is turned "ON" to open the monitors and "OFF" closes them.(the 120v system was necessary because of the distance between the switch and the equipment)The problem, however 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's2) H- Bridge motor driverhttps://www.amazon.com/gp/product/B01GHKO5O8/ref=oh_aui_detailpage_o06_s02?ie=UTF8&psc=13) Infrared Diode LED IR Emission and Receiverhttps://www.amazon.com/gp/product/B00EFOQEUM/ref=oh_aui_detailpage_o08_s00?ie=UTF8&psc=14) 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 TVs3) 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 TVs1) Relay signal "open"2) IR signal "TV_ON"3) Actuator Powered "Forward"4) "full_Closed" Limit switch opens5) PWM function6) "full_Open" Limit reached7) Actuator Power StopsClose TVs1) Relay signal "close"2) IR signal "TV_OFF"3) Actuator Powered "Reverse"4) "full_Open" Limit switch opens5) PWM function6) "full_Closed" Limit reached7) Actuator Power Stops*Interrupt function = Pause before reversing circuit*Safety recovery after power blackoutI'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 jobThere 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.

author: Joshsstuff
author_rank: Contributor
timestamp: June 13, 2017, 07:28:54 am
content: 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.

author: BrianHG
author_rank: Super Contributor
timestamp: June 14, 2017, 10:03:37 pm
content: Quote from: Joshsstuff on June 01, 2017, 11:42:26 pmMake sure your TV remote frequency matches the 38Khz of the IR receivers you listed. Some TVs use 35Khz, or 40, or 45, but 38 is prety popular.Note that the output of these IR receivers will be an unmodulated regular data square wave, meaning the 38Khz will be gone. Though, having placed your IR transmitter right next to the TV IR receiver will most likely overload the TV's IR receiver and force it to work even though your IR transmitter will no longer have the all important 38KHz carrier, just a data low frequency square wave, but, be prepared that this may not work if the TV's IR receiver really filter's for that 38KHz carrier.

author: Joshsstuff
author_rank: Contributor
timestamp: June 16, 2017, 01:47:07 am
content: Quote from: BrianHG on June 14, 2017, 10:03:37 pmThank You Brian!I haven't even gotten that far yet for the IR blaster part of the circuit because of the complications with my driver board, but I will test it soon as you suggested. I'll report my results soon.I contacted the seller this was my message:Hello,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?

author: sarahMCML
author_rank: Regular Contributor
timestamp: June 16, 2017, 03:53:43 am
content: Hi,I think that your main problem with your test circuit is a misunderstanding of how this type of H-bridge works.Because it uses an N-channel mosfet in the UPPER output position, the driver IC has to produce a gate drive voltage which is more positive than the motor supply voltage. If it doesn't, the upper FET's of each channel won't fully turn on, will remain in their linear regions, and get hot.The driver IC generates this by using a "flying capacitor" connected to the source/drain connection of the output mosfets, together with a diode. BUT it can only do this if the PWM IS BEING PULSED WITH A SIGNAL. It CANNOT be allowed to drop too close to 0% or 100%, otherwise the capacitor won't have enough time to gather sufficient charge to fully drive the upper mosfet on the next cycle.So you cannot just connect the PWM inputs to +5V or 0V. You will have to use either your Arduino or maybe a simple 555 pwm circuit to drive it!By the way, the circuit diagram you have doesn't appear to agree with the PCB that you've purchased.U4 on the diagram is an 8 pin chip; U4 on your board is 14 pin!Hope this helps.Sarah.

author: Joshsstuff
author_rank: Contributor
timestamp: June 18, 2017, 04:56:00 am
content: Quote from: sarahMCML on June 16, 2017, 03:53:43 amgilty, I'm a noob, you'll get no argument hereQuote from: sarahMCML on June 16, 2017, 03:53:43 amThank you for this explanation Sarah!Others have hinted at this being the operation, but you nailed it down and explained it quite well!Quote from: sarahMCML on June 16, 2017, 03:53:43 amThis was my thoughts as well, this shows that the problem is not with the board but with the seller.(perhaps in copying someone else's design, he neglected to copy the proper documentation)The included test diagram for this board is so wrong that it's dangerous!Quote from: sarahMCML on June 16, 2017, 03:53:43 amYet another indication that the seller is clueless as to the operation of his product.(I'm clueless too, but I am not the one selling these things)Quote from: sarahMCML on June 16, 2017, 03:53:43 amYes you've been a huge help, thank you!I changed the upper and lower limits of PWM and it runs great!Now I'm going to scope the max values to insure i'm getting full power.Motor Driver Board #2I have managed to acquire other driver boards in the time it took me to solve this.The new boards do not require pwm to work and I was able to get them up and running in 30 minutes!Both could work well for my project.This larger board is actually way overkill in current and number of motor channels.The difference is the other board requires a driver circuit to operate and I must signal each mosfet individually (4 inputs).I built a driver circuit on a breadboard with 2222A BJTs and 2k and 1K resistors for the base and collector.I was surprised that the logic output was not sufficient to drive the boardThe board pictured below is much smaller, but has 4 led indicators (one for each mosfet when on)If I drive it directly from the Arduino output pins only the first Mosfet will turn on, but that's it.At first I thought I was sinking too much of my MCU current, so I tried different resistor values but no good.Then I tried connecting to mosfets 2-4 and none of them work, only #1Then I built the BJT drivers and it works fine I don't know why? (I've ruled out current)Is there some characteristic of the Arduino that limits it from what the driver can do?(other than current?)I'll post the board to see if any of you smart folks can clue me in as to why.It seems like direct MCU compatibility should be standard for a board like this . . ?otherwise I have had no problems with it.Here is the product page:https://www.amazon.com/gp/product/B06XDMJGT8/ref=oh_aui_detailpage_o09_s00?ie=UTF8&psc=1

author: sarahMCML
author_rank: Regular Contributor
timestamp: June 18, 2017, 09:26:09 pm
content: Hi Josh,Glad to hear that I could help.As far as the two new boards go, could you send circuit diags of what you did to try to get them going, especially the first one?Looking at the inputs of the second board, they each have a 470 ohm input resistor driving into an opto-isolator, which according to its datasheet will get about 7.5mA IF your Arduino I/O pins can supply that without too much voltage drop. Can the pins you're using do that?Did you check the logic table given in the Amazon listing for this board?You MUST drive two inputs at once to be able to drive the motor. The pair are (IN1 & IN4) and (IN2 & IN3). However you must be careful not to drive (IN1 & IN3) or (IN2 & IN4) at the same time, as the would turn on both mosfets on one side and short them both across the supply.The two positions marked STOP turn either both upper or both lower mosfets on. This tends to hold the motor in locked position, whereas keeping all four INputs at 0V turns them off, and the motor is free to turn more easily.Do let us know how it goes.Sarah.

author: Joshsstuff
author_rank: Contributor
timestamp: June 18, 2017, 11:25:11 pm
content: Quote from: sarahMCML on June 18, 2017, 09:26:09 pmSure, but just to be clear, I was able to get the new boards up and running in 30 minutes (even before you guys helped me with the original one)Like I mentioned in my post, I'm basically driving each "IN_" channel for the individual mosfets with a BJT (2222a)I started with the resistor values in the data sheet and they worked so I didn't try any other values. (2K to base/ 1K on collector)Four BJTs for the four channels, that's it, nothing fancy.I can draw up a diagram, but I think it's pretty strait forward.Quote from: sarahMCML on June 18, 2017, 09:26:09 pmFrom what I read, the UNO can source atleast 20 - 40mA on a given pin.Let me explain why i've ruled out current as the reason I had to build a driver to get things working:1) First I tried using resistance values on the pins (thinking that I was sourcing too much current on the first pin)I used a pot and tried every value, I could not get a 2nd pin to light when drivendirectlyfrom the UNO2) Next I tried to activate any other pin but "IN_1"Even with no other pins connected, the ONLY channel that can be activated (according to the handy indicator leds on the board) is "IN_1"Why is there 'enough current' to activate "IN_1" alone, but no other channel alone?This is why i've ruled out the current as the culprit.I can put a BJT driver (as described above) on any of the channels and they work fine, but the MCU pins can ONLY activate "IN_1"So I guess my question is:Besides the obvious: (current) what else is different with +5v coming through a BJT than +5 volts coming from the UNO?i.e. output capacitance, impedance, etc?Something 'magical' happens when you use a BJT that doesn't work if you try to use the UNO's output pins.Am I right about it not being the current?Quote from: sarahMCML on June 18, 2017, 09:26:09 pmThanks,I did have to figure this out to get the board working (although I'll admit, there was some smoke involved lol)Always supply a spare part or 2Quote from: sarahMCML on June 18, 2017, 09:26:09 pmI saw these values for "brake" and "coast" and I kind of figured that's how it worked, but thank you for the clarification, this makes sense.I feel myself leaning on the large original 2 channel board vs. the small single channel, mostly because I don't have to build a driver circuit to make it work, and it's so overkill, that I feel it's pretty safe for the long term relyability.(plus with the wrong code I can fry these small boards in an instant, which shouldn't happen, but I like that it's not possible with the large board)My inquiry into the reason for the driver circuit is mainly academic.I'm trying to learn something at each step, and I feel I've missed the reason for this behavior, even though I was able to get it to work.If anyone has any incite I'm open to your input, however I am going to go with the 'large' board for this project, because I'm running out of time and I still have to perfect my code and figure out the issue Brian brought up with the Infra-red part of the project.Thanks for all the help guys!Next, I'd like to show you the code I'm working on to get your thoughts.

author: rbm
author_rank: Regular Contributor
timestamp: June 19, 2017, 02:54:15 am
content: I'm working on an Arduino base driver for a linear actuator but for a different application. It is to deploy and retract a motorcycle stabilizer system. For this application, knowing the exact state that the actuator is in along with the conditions of the motorcycle (eg. its speed, state of inclination, selected gear, etc.) is paramount to maintaining safety. I decided to use a state machine to drive the linear actuator. The pseudo code would for my application will be structured similar to this:Definitions(S) A static state can be though of one where you are waiting for something to happen. The FSM lingers in that state until whatever it is waiting for has happened.(T) a transitional state is one which the FSM is only in very briefly while it actually does something. A transitional state immediately moves on to another state, typically a static state.Main FSM:0. If speed >1 and not tilted, goto step 6 # bike in motion so retractIf speed <1 and not tilted, goto 2 # bike halted so deploy# otherwise bike tilted or wrong gear so deploy when ready (T)1. Wait for right conditions to deploy (S)2. Deploy stabiliser and display “d” on display (T)3. Wait for deployed limit to be reached (S)4. Limit reached; Turn off display (T)5. Wait for right conditions to retract (S)6. Retract stabiliser and display “U” on display (T)7. Wait for retracted limit to be reached (S)8. Limit reached; Turn off display (T)9. then go back to 1

author: sarahMCML
author_rank: Regular Contributor
timestamp: June 19, 2017, 05:12:08 am
content: Hi once again,The board has its own built-in 470 ohm input resistors, so you don't need to add more.One thing to try which may give a clue as to where the problem might lay. Connect each INput in turn directly to +5V and see if the relevant LED lights. If you have a motor connected you could do the same with a "turning pair" (e.g. IN1 & IN4). If each LED lights or the motor rotates the problem has to be the Arduino.Are you 100% sure that the port pins you're using are all set as outputs? If they are it might be worth checking what voltage you get on the IN pin when connected to the Arduino. If much less than 5V it could mean they are not being set properly or are damaged.Hoping to see some values,Sarah.