Notifications
Clear all

[Solved] Need a little hardware guidance on Servos

Page 1 / 2

Inq
 Inq
(@inq)
Prominent Member
Joined: 6 months ago
Posts: 891
Topic starter  

I needed to purchase some servos for our library group Ralf project - https://forum.dronebotworkshop.com/project-help/ralf/ .  Since it's just a toy, I was looking for the cheapest (SG90) plastic servos.  There seems to be a sweet spot at 10 pcs... usually around $20 US.  Anyway perusing Amazon, I ran across this options, that was even cheaper at $17 and it includes a bunch of other stuff.  I bought it because I can always use the pieces somewhere.

"https://www.amazon.com/dp/B089GPC9NK?smid=A2XLLJ8HYD6SMA&th=1"

https://www.amazon.com/dp/B089GPC9NK?smid=A2XLLJ8HYD6SMA&th=1

Can someone help me understand how this specific set of pieces might be used in what I would assume is a common project (to someone).  So far, the only pieces I need besides the servos are some potentiometers (that aren't in this set of pieces).

Ralf

The image above is all I have now and it seems to be working.  Should I be using some of this set's pieces on my project...

  1. Capacitors - different kinds
  2. Diodes - different kinds
  3. Transistors - different kinds
  4. Switches - why would someone be needing so many switches (that are not pots).  It seems to me this set couldn't drive the servos to any controlled positions. 

Thanks,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


Quote
Will
 Will
(@will)
Noble Member
Joined: 1 year ago
Posts: 2017
 

@Inq

I've used sg90 servos in a lot of projects and never seemed to need any of the accessories shown to support them directly.

I'd say they're just a "bonus" to make the package more attractive.

I was kidnapped by mimes.
They did unspeakable things to me.


Inq liked
ReplyQuote
Inq
 Inq
(@inq)
Prominent Member
Joined: 6 months ago
Posts: 891
Topic starter  
Posted by: @will

@Inq

I've used sg90 servos in a lot of projects and never seemed to need any of the accessories shown to support them directly.

I'd say they're just a "bonus" to make the package more attractive.

Bling... shiny object.  It worked.  Although the $3 cheaper probably would have done it for me.  

In the breadboard above, I have only two servos.  I'm using a little 5VDC, 300 mW AC adapter on the rail to power the servos.  I've noticed (sometimes) I can move the pot fast and the whole things stops working... not temporarily, but until I reset the WeMos.  The WeMos is being powered via the USB.  They are on a common ground.

I understand the servos might draw more than 300 mW, but I'd thought they might just stutter or be slow to respond.  Is there some way they can feedback to the WeMos and cause what looks like a lockup?  Should I be using a capacitor somewhere to act as a storage for surge current?

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 1 year ago
Posts: 2017
 
Posted by: @inq

Bling... shiny object.  It worked.  Although the $3 cheaper probably would have done it for me.  

The $3 absolutely would have worked for me !

In the breadboard above, I have only two servos.  I'm using a little 5VDC, 300 mW AC adapter on the rail to power the servos.  I've noticed (sometimes) I can move the pot fast and the whole things stops working... not temporarily, but until I reset the WeMos.  The WeMos is being powered via the USB.  They are on a common ground.

That's pretty unusual, I've never seen that happen. Maybe I didn't try to move it fast enough or maybe it's a difference between Arduino's (which is all I use) and the WeMos.

I understand the servos might draw more than 300 mW, but I'd thought they might just stutter or be slow to respond.  Is there some way they can feedback to the WeMos and cause what looks like a lockup?  Should I be using a capacitor somewhere to act as a storage for surge current?

I would also expect them to stutter or just stop instead of taking out the WeMos to that extent ! It seems a bit ... err ... extravagant.

Yes, you could try putting a cap across the supply for the servos (maybe one across the incoming voltage for each) and see if that helps.

If not, you may have to modify the code around your pots to limit movement to move in several smaller "chunks" than one very big one, or slow down the movement by adding a 1 millisecond delay between moves of 5 degrees (for instance).

Also, try swapping out for another uC or switch to a different type to see if that part is just defective.

I was kidnapped by mimes.
They did unspeakable things to me.


Inq liked
ReplyQuote
DaveE
(@davee)
Honorable Member
Joined: 1 year ago
Posts: 565
 

Hi @inq ,

Re: Is there some way they can feedback to the WeMos and cause what looks like a lockup?

In principle, yes ... identifying the exact point is more tricky.

I am assuming your observation that the WeMos processor needs to rebooted, indicates it is crashing or detecting a brownout. This is only a hypothesis for a start ... it might be something weird in the software that expects something to happen ... and it either doesn't happen or gets delayed when the power system is being stressed.

You also say:

They are on a common ground.

and the word 'common' suggests a mechanism. It is not unusual for there to be more than thing in 'common', and any of them may be capable of showing problems like yours, but lets start with 'common ground'.

Any piece of wire (ignoring superconducting types), will have a resistance and an inductance, jointly referred to as an impedance. And if there is a current passing through that wire, then this impedance will cause a voltage drop (Ohm's law, etc.). The voltage drop will determined by the total current.

If you have two circuit loops, in an '8' form, which share a piece of wire in the middle, then across that shared piece, they must also share the same voltage drop. Thus if there is a large current flow in 1 loop, even it is only momentary, then that means the voltage drop will also appear in the other circuit.

To make life worse, if you have very sharp current pulses, which implies high frequency, then the inductance of the shared part may exhibit a reactance (colloquially, the 'AC resistance') of much greater value than the DC resistance, so that the momentary voltage drop may be much larger than you might have expected knowing the DC resistance of the wire and the current peak in Amps.

Why is this a problem in a common earth situation ... because it can mean that the ground voltage can momentarily change by a volt or more, totally confusing any logic circuit using it as a reference.

How to get around it ...

The best approach is by not having any common ground wiring ... that does not mean two circuits always have to be totally isolated, although in some cases, such as where one circuit is a linear circuit sensing very small voltages or currents, this is the best approach.

Logic circuits are more 'robust', in that they have a 'large' voltage margin between the different states, so (relatively) small noise signals are automatically ignored. For such circuits, the physical  wire paths should be carefully considered. If you can identify two (or more) loops, e.g. one is powering the servo motors, the other is powering the microcontroller, then, so far as practicable, create independent loops, with no shared lengths of wire. If you wish them to have the same '0V' level, then join the two ground wires together at a single point. This is known as 'star' connection. That is, if there are several loops, then each loop will contribute just one wire, and the 'free' ends of all of the wires meet at single point to form a star shape.

In your case, the two loops may have common power source, e.g. a battery or small power brick.

Where the power source 'enters', have a pair of capacitors in parallel and connected at the same physical points across the power lines. The values are not usually critical, so maybe 220uF electrolytic and 0.1uF ceramic. Use the points these capacitors connect as 'star' points, one for 0V, the other for +x volts.

Then design your physical wiring into loops, so that any current heading out from the '+' , going to the servo motor (say) can only be returned to ground side of this capacitor pair, via the ground wire from the servo motor. Repeat the same process for the microcontroller power loop.

To further 'help' the process, if the wires to the servo (say) are more than a very few cm, add another pair of capacitors (same values) close to the servo. Likewise at the power input to the WeMos... and again at any other power loops you might have. The idea is the capacitors act like very short term power reservoirs, helping to maintain 'stable' power to the various power consumers, whilst also reducing the demand variations seen at the common power input.

...........

I don't know if all this makes sense ... and sadly I can't be 100% sure it will fix your problem, but I am confident the general approach is a good starting point.

Best wishes, Dave


ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 3 years ago
Posts: 1480
 

@inq 

Unfortunately I don't have Wemos to duplicate your circuit. I assume this is a web server based servo motor control. I assume the alligator clips are supplying the power for the stepper motors. They seem a bit close together risking a short? I can't really make out all the actual connections from the photo.

 


ReplyQuote
Inq
 Inq
(@inq)
Prominent Member
Joined: 6 months ago
Posts: 891
Topic starter  

I think I have found the problem and describe what I have found at the bottom, but I want to explore your post in detail...

Posted by: @davee

You also say:

They are on a common ground.

and the word 'common' suggests a mechanism. It is not unusual for there to be more than thing in 'common', and any of them may be capable of showing problems like yours, but lets start with 'common ground'.

I must be using the wrong terminology.  I learned somewhere along the way when you have multiple voltages - Stepper at 24V, logic at 5V or in this case the servo on 5V and 3.3V for logic, they have to be on the same ground plane or unexplained things happen.  I'm not sure if it's clear in the image, but the alligator clips are supplying the 5V rail at the lower right and the USB is supplying a separate 5V to the USB of the WeMos.  I thought having a wire from the 5V/ground rail to the WeMos ground that is off the USB ground is necessary and constitutes a "common ground".  I've re-wired it here for clarity.  All yellow wires are going to logic pins, orange is 5V+ and the red is 3.3V.  The far left black wire is connecting the ground plane of the USB/WeMos to that coming in on the upper rail from the AC adapter.

Glitch
Posted by: @davee

The best approach is by not having any common ground wiring ... that does not mean two circuits always have to be totally isolated, although in some cases, such as where one circuit is a linear circuit sensing very small voltages or currents, this is the best approach.

Hmmm... I thought having a common ground was a "You shalt have!" type of rule.  I've always followed this in the past and it has never let me down.  I will have to study this "star" or is my "common ground" more properly called a "star"?

Posted by: @davee

Where the power source 'enters', have a pair of capacitors in parallel and connected at the same physical points across the power lines. The values are not usually critical, so maybe 220uF electrolytic and 0.1uF ceramic. Use the points these capacitors connect as 'star' points, one for 0V, the other for +x volts.

I've seen this kind of thing used, but never seen it explained.  I don't want you to take your time to write something if you have a good link or can give me the term that will give me the links... but to me a capacitor is a capacitor is a capacitor.  I don't understand why some have polarity requirements while other don't.  I think I understand the big one is to act as a temporary reservoir to supply power during surges.  I don't really understand the small one's purpose.  Or... why you specified electrolytic on one and ceramic on the small one.  Also, I see something about "Tantalum" capacitors as a 3rd category to be concerned about.

I think this is the SOLVED solution

I've never seen this behavior before using these same servos and I've never seen the behavior on a WeMos.  It is not even watch dog resetting.  Took @will advice and hooked up my bench power supply and set to 5V and 2 amps max.  It never faltered, even though I saw spikes go nearly to 1 amp!  

What it was... I thought because this would go in the library I wanted to use a better AC adapter than the cheap $1 China adapters.  I have quite the bone collection of old (everything) as a hoarder and a tech adopter.  I found a nice (still made in China) AC adapter that is for a Palm Pilot.  Has all the UL listings and is built like... well... a brick $#!+ house.

Apparently, it has an overcurrent protection.  It was cutting out and the WeMos, still on the USB from the computer, was still happily bit-banging away as if nothing was wrong.  In the past, I've always recompiled and reloaded the Sketch which was long enough for it to reset.  This time, I was pondering... and I saw the servos glitch.  Sure enough it had reset.

Lesson - Use the cheapest AC adapters!  🤣 😋 

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


DaveE liked
ReplyQuote
Inq
 Inq
(@inq)
Prominent Member
Joined: 6 months ago
Posts: 891
Topic starter  
Posted by: @robotbuilder

@inq 

Unfortunately I don't have Wemos to duplicate your circuit. I assume this is a web server based servo motor control. I assume the alligator clips are supplying the power for the stepper motors. They seem a bit close together risking a short? I can't really make out all the actual connections from the photo.

 

Messy? - Yes... that picture was kind of messy and why I supplied a little better one above.  The gator clips were one above the other and had good spacing.

Web server? - This is for the Ralf project and it will have at least six servos on it and will be powered by only an AC adapter during use. I think you offered up on another thread some kind of I2C board that can drive up to 16 servos.  I need to find that again.  This Animatronics (although AI brain dead for your and my interests) is kind of cool for the kids.  It grabs their attention better than Inqling Jr.

Yes, although during this test, no InqPortal web server code was on it, but it will since I only have the one analog pin for one Pot.  I'll put a web client that takes mouse input x/y/wheel/buttons to drive the eyes, eyelids.  I was thinking I could do some kind of mixing like they do for sound mixing in studios... where I can record snippets like blinking, winking, and save them as individual files and then mix them together into a cohesive script.  Maybe I can do this all on the client browser side and upload the finished recording.

It might be cool down the road to put things like this on a great-great-grand child of Inqling that can be AI synced to look, blink and express emotion in conjunction with vision sensors and other calculations.

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 3 years ago
Posts: 1480
 

@inq

I have difficulty following verbal descriptions.  An actual circuit diagram would be sufficient as opposed to  trying to follow the wires in an image.

I don't want you to take your time to write something if you have a good link or can give me the term that will give me the links... but to me a capacitor is a capacitor is a capacitor. I don't understand why some have polarity requirements while other don't. I think I understand the big one is to act as a temporary reservoir to supply power during surges. I don't really understand the small one's purpose. Or... why you specified electrolytic on one and ceramic on the small one. Also, I see something about "Tantalum" capacitors as a 3rd category to be concerned about.

So I am guessing here electronics is not something you have a handle on yet?

Like learning to program it is better to take it in easy steps starting with the basic concepts.

I can explain what they are and how they work and how to use them in a circuit but not in a short post 🙂

 

 


ReplyQuote
Inq
 Inq
(@inq)
Prominent Member
Joined: 6 months ago
Posts: 891
Topic starter  
Posted by: @robotbuilder

So I am guessing here electronics is not something you have a handle on yet?

I'm still working on my Masters of the Universe degree.  I guess early in life I focused on backpacking, skiing, driving fast, chasing women, doing stupid $#!+, Aerospace Engineering, raising children, and Software Development, and making projects all throughout... I'm only just now getting to EE stuff late in life and don't think I'll ever get my MU degree. 🤣 

The absolute main reason I'm on this forum is to reduce my ignorance on EE stuff!  I try my best to offer help in fields I have some knowledge as payment for what I learn.  The comradery I enjoy here with you fine people is a perk.  

VBR,

Inq

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


DaveE liked
ReplyQuote
DaveE
(@davee)
Honorable Member
Joined: 1 year ago
Posts: 565
 

Hi @inq,

I fear I have unleashed a number of questions ... to be honest I have a feeling you are far from alone in being a little confused .. I suspect many fresh electronics degree graduates have problems with some of the issues mentioned. And a quick Google on one of them failed to turn up a good reference. Rather than make another long sermon, I am just going to pick the capacitor questions to get started.

Electrolytic capacitors

A capacitor is simply two conductive (metal usually) plates, separated by an insulator. Visualise a jam sandwich, with each slice of bread being a metal plate, and the jam being the insulator. (No butter!)

The insulator can be a vacuum or air ... but only for small capacitance values .. say up to 500 picoFarad (pF), and even that will be a physically large component.

For a simple 'parallel plate' capacitor (ie the jam is same thickness across the whole sandwich), then the capacitance is proportional to the area of the plate, and inversely proportional to the thickness of the insulator. It is also proportional to the 'permittivity' of the insulator.

Hence, to increase the capacitance and shrink the component size, there are two things to do:

  • decrease the thickness of the insulator, so that the plates are closer to each other
  • change the insulator to a material of higher permittivity

The small ubiquitous 'ceramic' capacitors use a ceramic material which is chosen to have a high permittivity, whilst also being a good insulator, even when the insulator thickness has been reduced to a minimum.

With capacitors, as well as the capacitance value in Farads (or fractions of Farad, like microFarad), they also have a maximum voltage rating ...exceeding that voltage risks the insulation breaking down, resulting in the capacitor going short circuit.

If the insulation is a material like a ceramic, or a plastic, then it doesn't matter which plate is positively charged compared to the other. Hence you do not see any '-' or '+' signs.

Electrolytic capacitors maintain the two plates and an insulator 'sandwich' form, but the insulator is more 'cunning'. Metals typically contact electricity, but metallic compounds such as oxides are often good insulators. If you have ever maintained on older car (at least in damper climate areas) you will be aware that films of corrosion and rust  on contacts are common reasons for lights not working, etc. With electrolytic capacitors, this process is used to advantage. The common aluminium capacitor consists of two aluminium plates with a conductive layer separating the plates.

Thus when the 'sandwich is first 'pressed' together, the component is not really a capacitor, since the two plates are not insulated from each other. Thus, there is another manufacturing step ... the component is connected to a DC power supply, and the resulting current causes one of the plates to be chemically changed, probably into aluminium oxide, which is a good insulator. Thus, the current soon reduces to (very near) zero and the component has become a capacitor.

Because the oxide film is very thin, the capacitance value can be relatively large for the physical size of the component.

However, the film depends upon the electrolytic plating process in all of its subsequent usage, so that any dc voltage applied to it, must be the same polarity as that used in the manufacturing process .. a reverse polarity will rapidly destroy the insulating film and the component will fail, typically going short circuit.

---------

Tantalum is sometimes used in place of aluminium, to produce components that have some improved electrical properties. However, they are even more sensitive to reverse polarity maltreatment, and even a brief momentary reversal can result in a damaged component A damaged tanatlum can cause a  fire, even when it is subsequently connected to the correct polarity.

---------

Whilst it is simplest to imagine a capacitor as a flat jam sandwich, that is rarely a convenient shape. Hence, aluminium capacitors often have the sandwich 'rolled up', like a Swiss roll, to produce a cylindrical shape. And ceramics may consist of a number small sandwiches stacked up, with the plates electrically connected, to make a cuboid shape.

Electrolytic and ceramic capaitor in parallel .. why?

For tasks such as decoupling, in which a capacitor is used to provide a local charge 'reservoir', it is common to see an electrolytic capacitor of (say) 100 microFarad (uF), connected in parallel with a ceramic capacitor of (say) 0.1 microFarad.

Given that capacitors connected in parallel, result in the sum of the capacitances, it is not obvious why a 100.1 uF would behave any differently from the 100 uF capacitor on its own.

The issue is, every real capacitor is not purely capacitance ... it also has some resistance and some inductance .. and for many applications, these 'extra' unwanted properties reduce the effectiveness of the desirable capacitance.

Electrolytic capacitors provide a large capacitance, and hence a large charge storage, for a given component volume. This is useful for handling low frequency demands which take a considerable (more than a microsecond say!) time. If they were competitive runners, these would specialise in marathons!

The ceramic capacitors are better adapted to high speed transitions, with better high frequency response, but the capacitance is too small for the longer time current demands. These are the sprinters!

Hence connecting the two capacitors in parallel, the aim is to provide a 'reservoir' for both fast transitions and the longer time demands.

-------

Hope that helps. Best wishes, Dave


Inq liked
ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 3 years ago
Posts: 1480
 

@inq 

This is for the Ralf project and it will have at least six servos on it and will be powered by only an AC adapter during use. I think you offered up on another thread some kind of I2C board that can drive up to 16 servos. I need to find that again

https://diyi0t.com/servo-motor-tutorial-for-arduino-and-esp8266/

https://nerdiy.de/en/howto-espeasy-pca9685-pwm-port-erweiterung-an-den-esp8266-anschliessen-und-ansteuern/

wemosAndPCA9685

 

This post was modified 1 month ago 2 times by robotBuilder

Inq liked
ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 3 years ago
Posts: 1480
 

@davee 

I was going to go into the functionality rather than the physical construction of a capacitor but for me I like visual explanations.  I don't know how much @inq knows to begin with.

 

 


DaveE liked
ReplyQuote
DaveE
(@davee)
Honorable Member
Joined: 1 year ago
Posts: 565
 

Hi @robotbuilder,

   Obviously we can only guess what other people know ... I tend to say more than necessary, on the basis that an excess of details is usually better than assuming the recipient knows something, whilst hoping it doesn't get too tedious for the recipient. Even then, I am concious there are more details to avoid it becoming even longer.

In the case of my electrolytic capacitor contribution, I tried to answer @Inq's questions/comments. If you feel you can clarify things I missed, didn't make clear or even muddled up, please add your own contribution.

Best wishes, Dave


ReplyQuote
robotBuilder
(@robotbuilder)
Noble Member
Joined: 3 years ago
Posts: 1480
 

@davee 

I tried to answer @Inq's questions/comments.

If you feel you can clarify things I missed, didn't make clear or even muddled up, please add your own contribution.

Your explanations made sense to me 🙂

 


DaveE liked
ReplyQuote
Page 1 / 2