Motor control and overcurrent protection

Thread Starter

sumeryamaner

Joined May 29, 2017
114
4.jpg The landing gears of radio controlled aircraft can be retracted and extended in some models. There are many ways to do this. The most usual way is pneumatic control which is very unrealistic and unreliable.
Hydraulic control is a good alternative but it is expensive and requires complex systems.
The best way is using electric actuators to accomplish this task.
There are two main types of electric retract systems. One type uses endpoint switches which signal to the control logic that an endpoint has been reached so that the current to the motor can be switched off. More sophisticated systems omit those unreliable mechanical switches. They check the current of the motor. If the motor reaches an endpoint it stalls, increasing the current draw drastically. This increase in current is being sensed by the control circuitry.

I am using two relays for this purpose. You can see the schematic. The contacts of the relay form an H bridge. If I activate one relay the landing gear extends and if I activate the other relay the landing gear retracts. You can see the low side current sensing resistor (0.33 ohm). I am using an Attiny85 to control the relays and to monitor the voltage between the pins of this resistor.

Although the setup works fine most of the time, there are times when the gear stops moving midway. I think the inductive nature of the electirc motor makes the voltage reading unreliable.

A typical motor draws 300 - 400 mA during normal operation and when stalled it draws more than 1000 mA current. So it should not be too difficult to differentiate between the normal operation and stalled condition. At least theoretically.

Do you have any suggestions for the setup? (Any capacitors maybe across the shunt resistor etc...)

Thank you very much.
 

Thread Starter

sumeryamaner

Joined May 29, 2017
114
Limit switch to stop the motor instead of current limit? They sell very tiny ones. I have salvaged several from microwave doors.
Unfortunately this is not an easy solution from a mechanical standpoint.
Furthermore the strong vibration of our engines lead to frequent failures of mechanical switches.

How about a pulse input from a slot opto or small hall detector?
Sense zero rpm.
Max.
I think this solution is also not very easy in our situation.
 

dendad

Joined Feb 20, 2016
4,451
Try adding a 10K resistor in line to the analog in and at the processor, a 100nF or 1uF tant capacitor to ground for filtering.
Fiddle with the values to see how it goes. You are not after really fast response. It may be an idea to also put a Polyswitch in line with the motor to limit the current if it stalls.
In fact, a Polyswitch to ground and look at the volts across that could work well too but that would depend on it going into over current for a time to operate and on an RC plane you want to conserve power as much as you can.
 

drc_567

Joined Dec 29, 2008
1,156
Try adding a 10K resistor in line to the analog in and at the processor, a 100nF or 1uF tant capacitor to ground for filtering.
Fiddle with the values to see how it goes. You are not after really fast response. It may be an idea to also put a Polyswitch in line with the motor to limit the current if it stalls.
In fact, a Polyswitch to ground and look at the volts across that could work well too but that would depend on it going into over current for a time to operate and on an RC plane you want to conserve power as much as you can.
Note: tantalum capacitors are permanently damaged if a reverse voltage is applied at any time.
 

dendad

Joined Feb 20, 2016
4,451
Note: tantalum capacitors are permanently damaged if a reverse voltage is applied at any time.
Yes indeed! If you want to set fire to your plane, a reversed tant can do it!
The cap is not across the motor, but on the input to the Atmel analog in/p so will not be reversed.
 

strantor

Joined Oct 3, 2010
6,782
Unfortunately this is not an easy solution from a mechanical standpoint.
Furthermore the strong vibration of our engines lead to frequent failures of mechanical switches.

.
I'm then a reed switch with a tiny magnet?

I would try this type (something related/something similar) before a current limit because (i would assume) it is imperative that the landing gear be down when needed, motor current be damned. If something is bent or frozen up, if rather burn a motor than crash a plane.
 

dendad

Joined Feb 20, 2016
4,451
I think you have a good point there stantor.
Real position sensing is important. And the processor could have a time out so if the landing gear does not deploy in a set time it turns off the motors to save power.
Reed switches or Hall effect switches will work. In fact, small microswitches in line with the motor, with diodes across them to allow power to the motor in the other direction will be tough enough. Or just use the microswitches to trigger the processor, like the reeds or hall sensors.

What is the reason to not use a servo to do it? That will give you programmable movement profile for realistic performance too. I would think a servo will be smaller and lighter than relays and motor/gearbox.
 

strantor

Joined Oct 3, 2010
6,782
.

What is the reason to not use a servo to do it? That will give you programmable movement profile for realistic performance too. I would think a servo will be smaller and lighter than relays and motor/gearbox.
I never said not to use a servo. Servo should be just fine and probably the best fit since these RC systems are already set up for it.
 

Thread Starter

sumeryamaner

Joined May 29, 2017
114
Try adding a 10K resistor in line to the analog in and at the processor, a 100nF or 1uF tant capacitor to ground for filtering.
Fiddle with the values to see how it goes. You are not after really fast response. It may be an idea to also put a Polyswitch in line with the motor to limit the current if it stalls.
In fact, a Polyswitch to ground and look at the volts across that could work well too but that would depend on it going into over current for a time to operate and on an RC plane you want to conserve power as much as you can.
I have tried a similar approach (1 k resistor and 100n capacitor, but not tantalum) but the reslts were not as expected.
The polyswitch is a component I am not familiar to. Are there types for low currents like 1A?
 

Thread Starter

sumeryamaner

Joined May 29, 2017
114
I think you have a good point there stantor.
Real position sensing is important. And the processor could have a time out so if the landing gear does not deploy in a set time it turns off the motors to save power.
Reed switches or Hall effect switches will work. In fact, small microswitches in line with the motor, with diodes across them to allow power to the motor in the other direction will be tough enough. Or just use the microswitches to trigger the processor, like the reeds or hall sensors.

What is the reason to not use a servo to do it? That will give you programmable movement profile for realistic performance too. I would think a servo will be smaller and lighter than relays and motor/gearbox.
The software has a timeout. The retract system opens or closes in approximately 10 seconds and the timeout has been set to 11 seconds.
 

Thread Starter

sumeryamaner

Joined May 29, 2017
114
This is the circuit I am using for motor control.

Retract.jpg

There are two relays controlling the motor. It is an H Bridge configuration. The motor has it's own power source (A 2S LiPo battery). The logic part of the circuit is supplied with 3.3V (from a regulator LP2950). The LED is used to indicate that one of the relays is active.
Motor current flows through a low side shunt resistor (0.33 ohm) for current sensing.
The working current of the motor is about 250 mA and it rises to over 1A when stalled. Tests using an oscilloscope showed that during the normal operation (when the motor spins) there is a marked ripple (amplitude about 250 mV) on the shunt resistor. When the motor stalls there is almost no ripple (as expected).

The first versions of the software was measuring the voltage across the shunt resistor and if it is over a preset value ("voltlimit") it assumes that the motor has stalled. If I set the "voltlimit" too high, the circuit does not switch off the relay even if the motor has stalled. If I set it too low, sometimes the motor stops at the middle of the travel. So I modified the code.
Now I have two parameters: "Voltlimit" and "Count". That means in order to sense a stall there must be "Count" times consecutive overvoltage readings.
But I am not satisfied with this setup.
Apart from unreliability, sometimes the microcontroller hangs and I think this can be due to parasitic signals from the motor.

I think I must put a resistor and a capacitor between the shunt resistor and the analog input of the microcontroller but I am not sure about the values. For example I have tried it with 1K - 100n and the ripple was there. With 1k - 2.2u it was smooth.

I would appreciate any ideas and hints to reliably sense the motor current using Attiny85.
 

djsfantasi

Joined Apr 11, 2010
9,156
You say that the landing gear takes ~10 seconds to extend/retract. And in certain circumstances the motor stalls or binds for a short time mid-deployment. And it is more important to extend the landing gear than protecting the motor from burning up.

So I would consider a partial software solution. Do not check for a stall until after an ~8 second delay. Or some such value determined by experimentation.

That way, intermediate behavior is ignored and the check for full deployment only takes place at the end of it's expected time.
 
Top