Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Help with Proper Servo Driving


  • Please log in to reply
14 replies to this topic

#1 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 25 August 2011 - 05:37 PM

I’ve read many references on the forum to not driving a servo directly with the Netduino board. I’ve even regurgitated it once or twice to someone else. I realize that the servos “can” pull way too much current if they are “loaded up”. Unfortunately, the examples in the Wiki appear to me to still be pulling that current via the Netduino pins OR they are using some external break-out board dedicated for this purpose. All I want to do is drive a servo with a Netduino Mini expecting that the servo will see a load. Unfortunately, the servos must have less than 7 Volts and the Netduino must have more than 7.5 Volts.

  • I’m guessing I need a voltage regulator to step down the voltage for the servo.
  • I need to minimize weight, and it only needs to run for about five minutes with lots of servo action. So if you can recommend a lighter battery than the 9Volt, that also would be great.
  • Could someone point me to an article or something else that might help get me to the point where I could properly design such a circuit without multiple EE classes?
  • A working solution would also be great!
Here is where I got before bogging down in the details...

Thanks for your help.
Posted Image
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#2 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 25 August 2011 - 06:46 PM

It's not surely the best way, but at least is pretty simple. You may add an external regulator for +5V, such as the LM7805. This kind of regulator allows a current up to 1A, but there are models even bigger. On the input of the regulator you may connect your battery. I would you suggest a 6x1.5 pack, instead of a single 9V, because its life would be a lot shorter. The reg will stabilize the +5V on its output, and that voltage can be applied to the pin 21 of the Netduino Mini, that is the +5V pin. By the way, the Vin is not necessary, thus maybe left open, and the Netduino can be supplied directly via the +5V pin, bypassing the embedded regulator. I write that this is not the best way, because you will lose part of the battery energy. The lost energy will heat the LM7805, but it won't be a problem unless the current reach high levels. Hope it helps. Cheers
Biggest fault of Netduino? It runs by electricity.

#3 Mike P

Mike P

    Advanced Member

  • Members
  • PipPipPip
  • 41 posts
  • LocationAuckland, New Zealand

Posted 26 August 2011 - 09:09 AM

Another solution is to put 3 1N4007 diodes in series. The forward voltage drop is 0.7V each so the output would be 6.9V

#4 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 26 August 2011 - 02:24 PM

Thank you for offering suggestions…

Mario,
  • My first design goals is to minimize weight and the run time is less than 5 minutes. So I would probably want to go with something even smaller than the 9V battery.
  • Not inherently knowing all the EE hardware options available to me, I am looking for any “better” options for weight and/or energy efficiency. Cost would be third place on the list.
  • Again, not knowing the pro’s and con’s of EE circuitry, I was left with my simplistic logic… I thought it would be best to use Netduino’s on-board regulator to power the Netduino board, thus leaving the entire current capability of the voltage regulator to power the high current needs of servo(s). Also, I figured, that using the two regulators in this way might give me a little extra margin of noise isolation between the noisy servos and sensitive Netudino. But in my world that is called a WAG (Wild Ass Guess).

Mike,
I can handle basic Ohm’s Law type stuff, (that’s about my limit though :) ) so I understand what you’re suggesting. Two questions…
  • I assumed that dropping voltage this way was very wasteful of energy via heat… and thus I thought the preferred way was to use one of these voltage regulators. It’s all black magic to me. Which is better?
  • Couldn’t I do the same thing with just plain resistors? What do the diodes do differently in this case?

Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#5 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 26 August 2011 - 07:14 PM

The Mike's solution using diodes is working as well, it's also cheaper than other ways. However, it is the fartest from being energy-efficient.
From the Sir Ohm's perspective, using a LM7805 or some diodes is the same. Both generates a voltage drop of some Volts (Vbatt-Vreg). The drop, multiplied by the current flowing, gives a power. That power is totally wasted as heat.
The LM7805 way is economic, compact and very often used. The series of diodes is rarely used, because does not give a stable output. In other words, a regulator such a LM7805 is able to guarantee a stabilized output of 5 Volts, even the input (battery) is varying (within a certain limit). A diode creates a voltage drop across its leads, and that drop is pretty constant (is actually exponential). Thus, placing 1+ diodes in series, only guarantees a certain voltage drop, not the real output voltage.
The theme of the battery duration has been discussed several times in the forum. The *best* way (which is NOT the most economic) is using a switched-mode power supply. They are fairly complex (very complex without specific chips), but they able to reach very high efficiency. This kind of DC-DC converters may allow to take advantage of about all of your available battery energy. This means smaller batteries as well.

Finally, you cannot use simple resistors, because they have two disadvantages over the solution shown:
  • as the diode, a resistor creates a voltage drop, but no is involving the stability of the output voltage;
  • the voltage drop creates by a resistor is proportional to the current flowing. Under this aspect, the diode behaves better because the voltage drop is logarithmic respect the current flowing.
Hope this helps.
Cheers
  • Inquisitor likes this
Biggest fault of Netduino? It runs by electricity.

#6 Bill E.

Bill E.

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationSilicon Valley, California

Posted 27 August 2011 - 10:06 PM

This reply has its roots in my post earlier about the Hardware guy having problems with the software side. I hope I can help out a little here. Let's see if I understand what you are after: you want to power a servo (a typical analog type), control it with a mini and power the mini from the same battery? All in all this is not so difficult but has its issues, as Mario clearly pointed out. Heat, heat, heat. You can power the mini right off of the 9V battery - no problem. The MC3392 regulator used on the mini can tolerate an absolute maximum of 20V so you have lots of headroom there. It will have some heat loss but it will be very little since the mini draws next to nothing in power. Now the servo is another matter. Some folks say, key word "say", that some servos can tolerate a 9V source for a short while. I would NOT recommend that. An elegant solution is to use a DC-DC converter like the one available at Digikey here: http://search.digike...1709-nd&stock=1 This device is over 90% effecient, needs no heatsink (no, or VERY LITTLE loss to heat) has a minimum input of 6.5V and has an output capable of up to 500ma. It is a drop-in replacement for the LM7805 part. And it is less than $8. I use these parts in my professional work. I love them. When I monitor the current supplied by my bench power supply and I stall a servo (not too easy to do!) I still draw less than 1/2A of current so the converter should do fine for your app. Another, more pricier one, is to use polymer-lithium batteries. For your app there woould be three in series (1.7V x 3 = 5.1V) for powering the mini off of pin 21 and your servo directly. If you use 4 in series (6.8V) you have enough overhead to power your mini via pin 24 and the servo off the same power source. That allows a small margin of isolation between the servo (very noisy electrically) and the mini. This would require a charger also. Check out Sparkfun. BTW, I ampowering my entire robot (3 servos, a mini on a Parallax Super Carrier) with 4 nickel-metal hydride batteries with no problem. That's only 4.8V. Hope this helps some. Regards.
  • Inquisitor likes this

#7 Chris Seto

Chris Seto

    Advanced Member

  • Members
  • PipPipPip
  • 405 posts

Posted 28 August 2011 - 01:53 AM

I would definitely not recommend putting 3 diodes in series. I would, however, recommend using a voltage regular (linear) or if that isn't enough, a switch mode power supply meant for RC applications. these can be had from HobbyKing.com on the el cheapo by the name "BEC".

#8 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 28 August 2011 - 02:41 PM

I would definitely not recommend putting 3 diodes in series.

I would, however, recommend using a voltage regular (linear) or if that isn't enough, a switch mode power supply meant for RC applications. these can be had from HobbyKing.com on the el cheapo by the name "BEC".


I was looking to put an order together mainly to buy these cheap servos and I was hoping to add some other stuff to the order to get the free shipping at $50. Looks like between the BEC and Bill's polymer-lithium battery suggestions, I should have no trouble. :D

Thanks!
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#9 Inquisitor

Inquisitor

    Advanced Member

  • Members
  • PipPipPip
  • 91 posts
  • LocationAtlanta, Georgia, USA

Posted 28 August 2011 - 03:32 PM

This reply has its roots in my post earlier about the Hardware guy having problems with the software side. I hope I can help out a little here.

Let's see if I understand what you are after: you want to power a servo (a typical analog type), control it with a mini and power the mini from the same battery? All in all this is not so difficult but has its issues, as Mario clearly pointed out. Heat, heat, heat.
You can power the mini right off of the 9V battery - no problem. The MC3392 regulator used on the mini can tolerate an absolute maximum of 20V so you have lots of headroom there. It will have some heat loss but it will be very little since the mini draws next to nothing in power.
Now the servo is another matter. Some folks say, key word "say", that some servos can tolerate a 9V source for a short while. I would NOT recommend that.
An elegant solution is to use a DC-DC converter like the one available at Digikey here: http://search.digike...1709-nd&stock=1
This device is over 90% effecient, needs no heatsink (no, or VERY LITTLE loss to heat) has a minimum input of 6.5V and has an output capable of up to 500ma. It is a drop-in replacement for the LM7805 part. And it is less than $8. I use these parts in my professional work. I love them.
When I monitor the current supplied by my bench power supply and I stall a servo (not too easy to do!) I still draw less than 1/2A of current so the converter should do fine for your app.
Another, more pricier one, is to use polymer-lithium batteries. For your app there woould be three in series (1.7V x 3 = 5.1V) for powering the mini off of pin 21 and your servo directly. If you use 4 in series (6.8V) you have enough overhead to power your mini via pin 24 and the servo off the same power source. That allows a small margin of isolation between the servo (very noisy electrically) and the mini. This would require a charger also. Check out Sparkfun.
BTW, I ampowering my entire robot (3 servos, a mini on a Parallax Super Carrier) with 4 nickel-metal hydride batteries with no problem. That's only 4.8V.
Hope this helps some.

Regards.


Thank you for your detailed post. It was very informative and it was at the level I can digest… hence I gave you the + on the reputation. It has brought up some things that I wasn’t aware and some other avenues I should look into more heavily.

  • I’m not worried about heat in that I’m not going to have the device in a closed box, but I AM very critical about heat in that its wasted electricity. I will be electricity critical for my project
  • These voltage regulators waste some power. That I expected. I gather 90% is a very good number??? Also, is my assumption correct… that the closer you get to their minimum input voltage (6.5V in the case of this V7805-500) that the more efficient it is?
  • Would this be crude approximation of the efficiency of using resistors getting 9V down to the maximum that the servos can handle? (7.2V/9V = 80%)
  • Is my assumption correct that using pin 24 with a higher voltage source and letting the internal voltage regulator “clean” the power, give me better noise isolation than sharing 5 Volts on pin 21 and the servo(s)?
  • Your last BTW was very interesting… I gather my former notion that 5V regulated as input on pin 21 was written in granite was incorrect.
  • If I were sharing servos and NMini powering off these 4.8 Volts, and I had multiple digital and analog sensors going to various NMini ports, would I have to do some “re-calibration” in my software for the lower voltage? If the voltage varied (say 4 to 6 V) would calibrations go off?

Thanks!
Doing my best to keep the smoke in the little black boxes.
If my message helped you... how 'bout giving me a Posted Image
www.MessingWithReality.com

#10 Chris Seto

Chris Seto

    Advanced Member

  • Members
  • PipPipPip
  • 405 posts

Posted 28 August 2011 - 08:30 PM

I would also definitely not recommend using resistors to induce a Vdrop as a supply voltage for the servos. If waste power is a concern, I think you really want to get a switching BEC.

#11 Bill E.

Bill E.

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationSilicon Valley, California

Posted 28 August 2011 - 10:21 PM

Inquisitor, Good questions. For the V7805-500, you don't have to worry about going even to the maximum input voltage. The device is a very small "switch mode" power supply and by its nature wastes almost no energy when used within the specifications (the "effeciency"). Just like Chris Seto's reccomendation of the BEC. By the way, that was really a nice bit of advice, Chris! Way to go. I will remember that. Remember that the mini is a 3.3V device. The 5V is only for the 3.3V regulator and outside (external) circuitry. The mini cannot output a signal at 5V and any analog conversions will be done at the ADVref value, which is 3.3V. As long as you maintain the minimum input to the 3.3V regulator (it is a 1V "low dropout regulator" I know - details!) which will be 4.3V you will be fine. The 5V regulator won't care. So, no re-calibrating will be necessary. The more filtering between the mini "brain" and the servo motor the more likely you are to continue operating. A servo is not as noisy as a lowly brushed DC motor but the muscle of the servo IS a brushed DC motor! You say 5 minutes of operation is all you will require? If so, I would go with the linear regulator (LM7805) and not worry about effeciency. Power the mini and LM7805 with the 9V battery and the servo from the output of the LM7805. An alkaline 9V battery has about 500mAH (1/2 AMP capacity for 1 hour) so for 1/12 of an hour I would think you could use a cheap 9V sacrifical alkaline battery. Mario's explaination was a very good one. No-one can figure out how to escape the laws of Mr Georg Ohm! Not yet, anyway. It sounds like you are well on your way in this project. All the best. Let us know how it works out! Regards.

#12 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 29 August 2011 - 06:36 AM

No-one can figure out how to escape the laws of Mr Georg Ohm! Not yet, anyway.

Off-topic nitpicking: a p-n junction diode did (its relationship between current and voltage is non-linear) and certain parts exhibit negative resistance.

#13 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 29 August 2011 - 07:38 AM

Off-topic nitpicking: a p-n junction diode did (its relationship between current and voltage is non-linear) and certain parts exhibit negative resistance.

The physical effect behind the P-N junction is much more complex than the simple resistor, or even capacitors and inductors. I wouldn't compare the junction with the Ohm's law: at least for avoiding confusion for who has not enough practice.

Anyway, where do you find a negative-resistance characteristic on the PN junction? Do you mean the AC characteristic? That sounds new for me...
Cheers
Biggest fault of Netduino? It runs by electricity.

#14 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 29 August 2011 - 09:26 AM

Anyway, where do you find a negative-resistance characteristic on the PN junction?

Mario, by "certain parts" I meant different electronic parts (such as tunnel or Gunn diode, which have negative resistance region in their V/I curves), not p-n junction diode - sorry for the confusion. The Ohm's Law is indeed fundamental, but it is not very useful for analyzing behavior of components that have non-linear V/I relationship (i.e. semiconductors), or their resistance changes with temperature (i.e. light bulb) - but you already know that ;-)

#15 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 29 August 2011 - 12:22 PM

That's okay, no problem. I must confess that I did not study certain kind of semiconductors. I never used neither the tunnel, nor the gunn diodes. From my viewpoint, a hobbist such the guys here in the forum, may consider the ideal diode: the current flows only in one direction, and when it flows the diode has a voltage drop of 0.6V. For a transitor (or mosfet), most of the usages are in saturation and interdiction (OK in English?). So far, the hobbist people should only take care to guarantee the correct on/off, avoiding the linear zone. Who's asking more? That's a kind of "digital" usage for diode and transitors. Pretty easy, no troubles. When someone is asking something linear, I would suggest to use the OPAMPs: really simple to use. Cheers
Biggest fault of Netduino? It runs by electricity.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.