Maker Pro
Maker Pro

Motor control and overcurrent protection

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
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.

4.jpg
 

Bluejets

Oct 5, 2014
6,926
Joined
Oct 5, 2014
Messages
6,926
Being in RC aircraft subjected to vibration, knocks and bumps etc. one would think the solid staye hbridge would be a better choice. For limits and simplicity, have ypu considered slot optos. I use them in both machines for cam and crankgrinder for miniature 4 stroke engines and there, they are consistent positioning within 1 thou inch. Apart from that, is your micro on a seperate supply with appropriate decoupling caps. Motor makes this a noisy system and more likely the source of any resets.
 

sumeryamaner

May 29, 2017
50
Joined
May 29, 2017
Messages
50
Being in RC aircraft subjected to vibration, knocks and bumps etc. one would think the solid staye hbridge would be a better choice. For limits and simplicity, have ypu considered slot optos. I use them in both machines for cam and crankgrinder for miniature 4 stroke engines and there, they are consistent positioning within 1 thou inch. Apart from that, is your micro on a seperate supply with appropriate decoupling caps. Motor makes this a noisy system and more likely the source of any resets.

During the initial phase of this project I used a L295 motor driver in an H-Bridge configuration. Due to the design of the IC (It has a separate input for motor power) I had to use a high side current sensing. I was not satisfied with it.
Using mechanical components like relays in RC aircraft seems non-logical at the first sight but this is a very simple task and not essential for a safe flight. The landing gear retracts or extends in approximately 10 seconds. During this period transient loss of contact in the relays won't be a big issue. This is why I am using this setup.
A discrete H-Bridge using MOSFETs would be another way but you know the high side switching problems with N and P channel MOSFETs. My design goal number 1 was "simplicity" and I really didn't want to use a charge pump to control the high side N channel MOSFET of an H-Bridge. :)
I am an amateur electronics fan and nothing more. :)
 

sumeryamaner

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

View attachment 128248

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.
 
Top