Motor drivers and arduino

Arduino projects on the go
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Motor drivers and arduino

Post by MaxZ »

Hi guys,

Anyone familiar with the L9110 motor driver circuit? This guy is warning for potential damage to the arduino when operated at 12V https://www.electroschematics.com/l9110 ... er-primer/

I am supporting a newcomer to arduino's in controlling his RC hoist on board a model tugboat, and I have shown the arduino connected directly to the driver board inputs. It would be a shame if the arduino would be damaged when the driver Vcc is somewhere between 5V and 12V.

Cheers,
Max.

Edit: I found the datasheet, it says "TTL / CMOS output level compatible, and can be directly connected to the CPU;", so I guess it's a false alarm. sorry.
Last edited by MaxZ on 13 May 2021, 09:40, edited 2 times in total.
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: L9110 motor driver damaging to arduino?

Post by Mike_K »

Hi Max

In practice, you'll probably be OK. 12V through10K pull up resistors would clamp to the 5V rail and the protection diodes 0.7V forward voltage drop would give 6.3V or 0.63mA and the data sheets says "Note that the maximum current through the AVR’s clamping diode should not be higher than 1mA". But you're approaching the maximum figure and it's probably not the best design practice.

Rather than using a L9110 with other protection circuitry, have you thought of using a TI DRV8838/DRV8835 or my favourite the Toshiba TB6612FNG? They have separate logic and motor supplies so no worry about the maximum motor voltage and they have the advantage of being able to brake the motor as well. I've used 20+ of each type without a single problem and they are what I, Phil, Tobe and Martin use for galloping ghost recoders and they have all proven to be 100% reliable (well the Pololu DRV8838, DRV8835 and TB6612FNG have).

Cheers

Mike
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: L9110 motor driver damaging to arduino?

Post by MaxZ »

Hi Mike,

Thanks for your explanation, but I am afraid I cannot follow it. Part of it may be that I cannot find a "proper" datasheet of the L9110, showing it's internal circuitry. On the board I can only see some R's and C's, what is the AVR clamping diode? Sorry, my knowledge of electronics only goes so far...( a bit past Ohm's law, but not much... :( ;) ). I would appreciate to be enlightened though :)

As for selecting an alternative driver, as I said the guy I am supporting (over the internet) is new to arduino and it's peripheries, and his original query on the Dutch modelling forum led to lots of advice from a number of people (including me), moving from DC motors to steppers and back, resulting eventually in the choice of this driver. He ordered a couple from china (still waiting for those), and I don't dare to tell him now that was a wrong choice :oops:
The intended use is nothing very critical, it will control two spindles inside an imitation of a hydraulic cilinder to operate the crane arm. The guy wanted to learn arduino just to achieve this, but looking at it I decided it would be a bit too daunting for a raw beginner, involving revolution counters and limit switches, and I decided to develop the sketch for him and start a PM-conversation to support him at a distance.

Cheers,
Max.
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: L9110 motor driver damaging to arduino?

Post by Mike_K »

Hi Max

There is nothing wrong with the L9110 and indeed they are cheaper than the DRV8835/TB6612FNG, so for simple applications, they're fine. But as we found to our cost, if you reverse a motor instantaneously, you can get a motor current high enough to temporarily operate the internal over-current protection and freeze the motor for a second or so. For a non-critical application like your friend's spindles, it won't be a problem, but it's not good for a galloping ghost actuator or a microcontroller-based servo. We found that braking the motor for a short period before reversing eliminated the over-current protection operating and solved our problem.

What are clamping diodes? All the inputs on an ATMega328P and many other microcontrollers have a pair of built-in diodes arranged as follows:

Image

If you connect a voltage above Vcc (5V in our case) or below 0V/GND, the current will flow through one of the clamping diodes and protect the input, but the diodes are only rated at 1mA. So if you applied 12V through a 10K pull up resistor your current would be (12V - 5V - 0.7V)/10K = 0.63mA which is below 1mA so OK. But I haven't seen a data sheet for the L9110 to see how its pull up resistors are configured so am basing it on what you've said. And you may be using 5V motors, in which case all of this is irrelevant.

Mike
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: L9110 motor driver damaging to arduino?

Post by MaxZ »

Ah, it's the diodes inside the ATmega chip, I did not get that.
Pull up resistors on the L9110: I don't know if there are some inside the chips, but the ones I was talking about are the 10k external resistors on the board.
See the first post in this forum thread: https://electronics.stackexchange.com/q ... wer-supply.

Thanks again, cheers,
Max.
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: L9110 motor driver damaging to arduino?

Post by MaxZ »

Hi guys,

Right, after a number of system iterations (revcounter with hall sensor via interrupt / hall sensor limit switch, 2x limit switch w. hall sensors, 1x with interrupt, 2x limit switch w. hall sensors / no interrupts) we finally seem to have something which works as intended. I did include some lines in the setup to block the system until both Rx signals were at neutral, but it still seems to act unexpectedly in case of a brown-out caused by overloaded servo's for other functions. Resolved by adding a separate power source for the arduino (it's a big boat.....).(Edit: this did not resolve matters, looking at what else could be causing this).

One thing that bothers us is that the L9110s drivers don't seem to last long, several cases of one half of the board dying have occurred. Could be a bad batch though. But Mike's mention of an over-current protection made me think. As I said earlier, I could not find information on the chip internals, so I don't know if there is an over-current protection present here.

The motors have been measured to draw 0.5A when stalled, and the chip is rated for 0.8A continuous, so unlikely to burn the chip out under normal service. But what about a sudden change of direction? Sudden is relative here, as the loop takes at least the time to read the Rx pulse, but it still is a quick change for the motor, especially when running at top speed. Mind you, it still takes time to pull the stick over, but there could be some spurious pulses.

I have been thinking about adding a pause when such a sudden change occurs, but if the L9110s has an over-current protection I won't bother. Anybody any information in this regard?

Cheers,
Max.
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: L9110 motor driver damaging to arduino?

Post by Mike_K »

Hi Max

When you reverse a running motor, the applied voltage is in effect double for a short time, as the supply voltage is added to the back emf across the motor. If the stalled motor current is 0.5A, then the motor current when reversed will be 1.0A for a fraction of a second (in the 10s of mS). The L9110 motor driver is of Chinese origin, they have a habit of giving the peak current rating, not the maximum continuous current. If the L9110 only has a peak current rated at 0.8A, every time you reverse the motor, you are exceeding the L9110 maximum current. I know your friend has already bought some L9110, but the Pololu TB6612FNG can drive two motors, can forward, reverse, brake and freewheel them, has a continuous current rating of 1.0A and a peak current ratings of 3.0A, so would be a lot more robust in your application.

We had a similar problem with the galloping ghost recoders where the DRV8838 over current protection kicked in and the actuator stopped for maybe a second which isn't ideal if flying. The latest recoder firmware brakes the motor for a few mS before reversing, so the motor is stopped/nearly stopped, so the current is around the stalled current. This completely cured the issue.

I don't think the L9110 can brake the motor, so if reversing why not having a delay to stop the motor before starting again?

Without seeing your code, I'm afraid none of us will be able to help you with your other issues.

Cheers

Mike
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: L9110 motor driver damaging to arduino?

Post by MaxZ »

Hi Mike,
Thanks for your reply. The datasheet for the L9110s states : "each channel through 750 ~ 800mA of continuous current, peak current capability up to 1.5 ~", so, theoretically, it should be able to stand a sudden reversal.
I will add the delay nevertheless, and post my current code here when I'm done.

Cheers,
Max.
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Re: L9110 motor driver and arduino

Post by MaxZ »

Hi Mike,

It took a while, the main problem being that I am servicing two motors from a single Nano, so I could not put delays in everywhere without an occurrence in one motor control affecting the other. Comments are in Dutch, to help my friend understand what is going on, sorry.

In the meantime another problem surfaced. One of the winch motors, not related directly to the Nano, seems to interfere with the inputs from the Rx. The result is that one or both of the Nano driven spindel motors is moving while it shouldn't. The effect is not noticeable when the Nano inputs are replaced by regular servo's. The culprit motor is run from a 12V battery, and the Rx and Nano both from separate bec's, powered by the same 12V source.

I did add a filter to skip any pulse outside the regular Tx range (950 - 2050 us), but that did not got rid of the problem. Is there a way to make the Rx inputs (pulseIn()) less sensible maybe?

Cheers,
Max.
Attachments
Spindels_slow_reverse.ino
(6.18 KiB) Downloaded 140 times
MaxZ
Posts: 330
Joined: 31 Jan 2019, 11:48
Location: Boskoop, Netherlands

Driver alternative

Post by MaxZ »

Mike_K wrote: 11 May 2021, 00:09 the Pololu TB6612FNG can drive two motors, can forward, reverse, brake and freewheel them, has a continuous current rating of 1.0A and a peak current ratings of 3.0A, so would be a lot more robust in your application.
Hi Mike,
Some further mishaps have occurred, not directly related to the Arduino, but I have been studying your suggested alternative, the Pololu TB6612FNG.
https://www.pololu.com/file/0J86/TB6612FNG.pdf

Clearly, it requires changes to the code, basically it is 2 inputs per motor setting the rotation direction or stop, and a PWM input to regulate the speed.
Looking at the datasheet, this is the truth table:
Schermafbeelding 2021-05-13 om 09.31.53.png
What puzzles me is that, every time the PWM goes low, the outputs go into "short brake" mode. But should that not be the freewheeling mode? But to get that you would have to manipulate the inputs together with the PWM, so is this necessary? Note that the PWM port is pulled low by an integrated 200 kOhm resistor.

Then there is a note "To prevent penetrating current, dead time t2 and t4 is provided in switching to each mode in the IC". I take it that is incorporated in the IC, right?

Then there is another note saying:
"If your design includes an inductive load such as a motor coil, incorporate a protection circuit into the design to prevent device malfunction or breakdown caused by the current resulting from the inrush current at power ON or the negative current resulting from the back electromotive force at power OFF. IC breakdown may cause injury, smoke or ignition.
Use a stable power supply with ICs with built-in protection functions. If the power supply is unstable, the protection function may not operate, causing IC breakdown. IC breakdown may cause injury, smoke or ignition."

If the stalling current of the motor is below the continuous rating, and I am preventing a sudden reversal (see my previous post), do you think any additional protection should be provided?

Cheers,
Max.
Post Reply