I am using the L298N motor driver for a robotics project to control 4 motors. 2 in each input and output terminal. I have this connected to an arduino uno which is powered by about 7-8v from nimh batteries. This battery source also powers a servo with a 470uF capacitor and the L298 board. Finally i also a have a hc sr04 running of the 5v rail.

I have a program that makes the servo sweep left and right. When the servo is moving however ,very little current is going into the L298 and only one or two motors are moving when all 4 should. When the program is only controlling the motors and not servo the servo keeps twitching and turns to face the left (0 degrees) and slows the motors down. Why is the servo conflicting with the dc motors?

  • \$\begingroup\$ What type of NiMh battery are you using? Most servos like to be powered with 4.5V to 6V, so the NiMh may be powering the servo to a point where it is not badly damaged, but working beyond spec. Further, the servo may be drawing a lot of current, dropping the battery voltage, and effecting the motors. Post a link for the servo and its spec. Also, please post a schematic of the system. \$\endgroup\$ – gbulmer Oct 1 '16 at 17:01
  • \$\begingroup\$ The servo is a hs422. \$\endgroup\$ – Don Grey Oct 1 '16 at 17:10
  • \$\begingroup\$ Please update your question with the part number, I found this datasheet cdn.sparkfun.com/datasheets/Robotics/hs422-31422S.pdf \$\endgroup\$ – gbulmer Oct 1 '16 at 17:18
  • \$\begingroup\$ @gbulmer Realistically there's not going to be a difference between various micro and standard size hobby servos, they are designed to be interchangeable, and a setup that properly supports one will support another. \$\endgroup\$ – Chris Stratton Oct 1 '16 at 17:19
  • \$\begingroup\$ Should I replace the nimh batteries as they drop to less than 7v pretty fast to a 12v lipo battery and run the servo off the 5v rail with a capacitor instead? \$\endgroup\$ – Don Grey Oct 1 '16 at 17:20

Most model servos should be powered with 4.8V to 6V. so the '7-8V' NiMh may be powering the servo to a point where it is not destroyed, but working beyond specification. That may account for its wrong behaviour.

This is a datasheet for the Hitec HS-422 servo (it isn't ideal as it is from Sparkfun, and not the manufacturer, but better than nothing). It states the operating voltage range is 4.8-6V.

It states a no-load current of 180mA. So as the motors are effected by the servo running, either the battery isn't capable of supplying enough current (maybe a NiMh PP3?), or it has quite a significant stall current, or the servo is damaged.

It may be that the voltage drop of the LM298 (which drops quite a lot of voltage) and a lowered voltage caused by the servo is so low that motors stop working.

You need to get a multimeter to try to understand what is happening. Try to measure the voltage across the motor drivers when the servo is disconnected.

Turn on 1, 2, 3, then 4 motors, and measure the voltage each time. If the voltage is dropping by more than, say, a volt, then the battery supply may not be sufficient for the motors.

Try the same test with the servo included. Again, of the battery is dropping more than a volt, then the supply may be inadequate.

If you have access to a good bench power supply, capable of supplying all 4 motors + 1A, then try that and observe the results.

The easiest short term fix may be to try powering the servo only directly from its own 4xAA battery supply. If things start working a bit better, then the problem is servo power. If the servo is still not sweeping, you may have broken it.

In either case, the servo should not be powered directly from the '7-8V' battery. It should be powered from a 4.8-6V supply. If you have enough space and load capacity, use 4xAA. Otherwise use a linear or DC-DC voltage regulator.

If you plan on using a higher voltage LiPo then use a DC-DC switch mode power supply to generate the servos 6V.

If you stick with NiMh '7-8V' then either will be okay, and the wasted energy using a linear regulator (where the excess power dropping down to 6V is turned into heat) is acceptable. If you choose a 6V linear regulator with a voltage drop of 0.7V or less, then it should keep within 4.8-6V for most of the NiMh supplies discharge.

|improve this answer|||||

It is likely that your power supply isn't capable of supplying the amount of current that you require. I would suggest testing with an external power supply connected to test whether this is the case.

If it is you need to spend some time determining how to create a supply that can deliver the current you require. I would suggest using more batteries and a voltage regulator.

|improve this answer|||||
  • \$\begingroup\$ A higher voltage might help the L298, but for the servo it is really not the best idea - they are designed to run directly on 4 AA's without the losses of a regulator in their intended application. Likely the issue is either overvoltage, an undersized regulator, battery cells due for recharging, or simply bad ones. The power supply for the DC motors and arduino is where more thought may be needed. \$\endgroup\$ – Chris Stratton Oct 1 '16 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.