decoupling capacitors

GeorgeC47

Senior Member
I started constructing the new circuit for my astronomy dome rotator. After the Picaxe and Darlington chip were on the veroboard I added a buzzer and tested the circuit.
Performance was erratic to say the least. I checked my soldering a dozen times but could find no fault.
Eventually I found a scrap of paper from a few years back, with the 'minimal' 18X circuitry. I had drawn on it a 100uF and a 0.1uF decoupling capacitor.
Of course! I had forgotten all about decoupling capacitors. When these were added, the circuit worked perfectly.

My point is this - in the three hours of going through the Picaxe manuals to try and see where I was going wrong, I did not see any reference to decoupling capacitors. Shouldn't the importance of these capacitors be stressed more forcefully?
 

premelec

Senior Member
We put up reminders on this forum often - it's something we can suggest with certainty that's likely to work... sorry you 'wasted' some time but next time you won't forget the bypasses! - Sure it should be emphasized elsewhere as well... glad you've fixed it!
 

MPep

Senior Member
Also, realistically the PICAXE forum is primarily for programming tips and associated 'things'.
Some electronics knowledge is 'assumed' by hobbyists.
As the system was primarily for educational purposes, teachers in the classroom help students with the electronic bit of the lesson.

However, we do try and help where we can.:)
 

erco

Senior Member
As you now remember, any buzzer or motor is likely to introduce electrical noise into the uC, almost guaranteed if they use the same battery supply. Fortunately your logical mind diagnosed the problem and found the right solution.

Good on ya, Mate!
 

John West

Senior Member
George, you made the mistake of not asking for help in the forum shortly after the problem first arose. I personally have identified the nature of the problem and the fix for at least two or three other posters in the past couple of months. Many of the regulars here seem to take turns solving just such problems nearly every day. Even posters who know very little about electronics, but read here regularly can answer that one for you as they've heard it so often.

As you note, this is a problem many inexperienced at electronics will run into as they expand on their PICAXE projects with accessory devices, but it is also a problem that is identified and solved for posters on a regular basis by both tech support and the regulars here in the forum.

I imagine a site search would identify many, many threads on precisely this subject of proper capacitive filtration around various loads and the symptoms associated with failure to install such filtration.

Moral of the story, if you have problems, make a couple of measurements, glance through the manuals, do a quick forum search, and if the answer's not forthcoming, then just ask. Don't pound your head against such problems. There are several folks here with decades and decades of electronics expertise, and they're usually pretty happy to help out.
 
Last edited:

GeorgeC47

Senior Member
Yes, perhaps I should have asked on the forum, but I thought at first that I had probably made a wiring error or a bit of solder was bridging somewhere. After these were ruled out I then worried about the input pins for the Picaxe left 'floating' because on the development board they have 10K resistors to ground. Then I thought about series resistors between the output pins and the Darlington chip. I have only made two Picaxe projects before so I inspected those and failed to notice the capacitors because the boards are deep in project boxes.
I kept checking the manuals thinking the answer had to be there. Perhaps also a bit of pride stopped me asking yet another 'Newbie' question.
As mentioned, it was only when I went through lots of old scraps of diagrams from one of my first projects that I spotted the handdrawn capacitors. I suspect that someone on the forum told me about those.
This forum has always been very friendly and helpful and has enabled my two previous projects to be completed successfully.
If this diagram in the manual had the capacitors added I am sure it would help other beginners.

 

Dippy

Moderator
I agree. At least some optional caps should be added and , hopefully, a brief sentence or two on size, types and placement.

I posted a drivelling post on this subject less than a month ago but, due to the nature of any Forum structure, it has already disappeared into the ether. I had titled it specifically hoping to make searching easier... but I can see it was unsuccessful.

Anyway, here it is, but well done for keeping notes and sussing it out.
http://www.picaxeforum.co.uk/showthread.php?19066-Transients-decoupling-bypassing-capactiors-on-PICs-and-other-things.&highlight=decouple
 

srnet

Senior Member
Well, that a minimum operating circuit. A lot of circuits will operate without decoupling capacitors.

I am sitting watching a 28X2 circuit on a breadboard, wires & jumpers everywhere, with no decoupling capacitors in sight, it works just fine ............

Quite what should be added for improved reliability in all circumstances is an issue for debate.

Although on any finished PCBs I do I would always add the decoupling capcitors ......
 

Dippy

Moderator
Yes, for sure, there are many occasions when they aren't required. But many occasions when they are required. If there is no indication of them as an option or suggestion then people (in particular novices) will just sit there scratching their bonces. We've all done that. I've gone bald when having problems with noisy circuits and ADCs.

These simple add-ins could be indicated by dotted lines which is the common way to imply an option (or 'something to look into') in a schematic - especially when that schematic is considered as a 'reference'..
30 minutes altering a 'reference' schematic could save 10minutes x 1000 for projecteers :)


Noise is a big subject on it's own but decoupling/bypassing techniques are a good start and a potential 2 minute solution. So many solutions. Once size doesn't fit all, but this simple 10 penny add-in can solve many simple problems.

99% people don't realise that micros are , in addition to being susceptible to noise, also noise generators themselves.
 

nick12ab

Senior Member
Also, realistically the PICAXE forum is primarily for programming tips and associated 'things'.
Some electronics knowledge is 'assumed' by hobbyists.
As the system was primarily for educational purposes, teachers in the classroom help students with the electronic bit of the lesson.
The issue is that newbies might look at that and think "The PICAXE is so brilliant that it doesn't need decoupling capacitors because Rev-Ed shows that so that must be right!" and for the teachers (in my experience) don't know anything about decoupling capacitors etc. probably since most GCSE projects work fine without them. Actually, a better example might be the starter projects (a PICAXE-controlled traffic light) that used a 6v battery pack and a 78L05 regulator.

Before late last year, I hadn't heard of decoupling capacitors so they should be firmly introduced to people at the earliest possible stage. Pages like Hippy's LCD Interfacing don't help since it says 'Decoupling caps not included' but if you don't know what they are, from the name you might assume that you connect one terminal to the power supply and the other to the voltage rail in the circuit.
 
Last edited:

Dippy

Moderator
Yes, I see what you are getting at George.
A good idea, though I'd prefer something like this (with the terminolgy as we all , well me at least, tend to interchange 'decoupling' and 'bypass' :) ).

Plus a paragraph somewhere about the basics of the purpose/reasoning and notes on optional values and physical positioning.

Anyone who wants more detailed/precise info and other tips can be pointed towards long drivelling Data Sheets and App Notes.

It seems to be considered as another 'Black Art' ... like driving MOSFETs .... aaargh! ;)
 

Attachments

Last edited:

srnet

Senior Member
Athough now of course you need to add a specific warning;

"Ensure Electrolytic Capacitors are connected with the correct polarity, that can explode if reversed"

or maybe another;

"We do not recommend the use of Tantalum capacitors, if reversed they can catch fire and/or eject a ball of red hot material"
 

nick12ab

Senior Member
Athough now of course you need to add a specific warning
That would probably be counter intuitive for school pupils as if they know this, they'll want to try it out "because it'll be funny if it does explode". In fact, I want to try it out now!
 

srnet

Senior Member
That would probably be counter intuitive for school pupils as if they know this, they'll want to try it out "because it'll be funny if it does explode". In fact, I want to try it out now!
A dilema is it not ?

In manufacturing it was standard practice to cover a circuit board with a perspex shield when it was powered up for the first time, just in case.
 

IronJungle

Senior Member
Why two caps? Why not just one cap that is bigger?

Yes, I see what you are getting at George.
A good idea, though I'd prefer something like this (with the terminolgy as we all , well me at least, tend to interchange 'decoupling' and 'bypass' :) ).

Plus a paragraph somewhere about the basics of the purpose/reasoning and notes on optional values and physical positioning.

Anyone who wants more detailed/precise info and other tips can be pointed towards long drivelling Data Sheets and App Notes.

It seems to be considered as another 'Black Art' ... like driving MOSFETs .... aaargh! ;)
 

Dippy

Moderator
Yes, I should have included a polarity marking.
And, yes a line or two on correct connection could be added somewhere.


Yes, Nick is correct.
Different capacitors have different characteristics, but all contain LCR. If you really want to know some nitty-gritty then you need to search the web. Manuafacturer's sites are a good starting point.
Sometimes you have to read App Notes as well as Data Sheets.
If you look on the links on my earlier-this-month thread I posted it'll give you some good link starting points and background. But there is oodles around if you can be bothered to search.

In some circuits you will see more paralleled capacitors. Or different value caps (sizes/types) on linked IC pins. You'll see this a lot on those RF chips used in the multitude of smart radio modules - or, should I say, you SHOULD see them...
But one thing is for sure; no capacitors are 'perfect' , no RC will be a perfect filter , they will not stop ALL nasties; sometimes you have to go to the source (not a transistor pun). Sometimes you have to cross your fingers :)
 

hippy

Ex-Staff (retired)
That would probably be counter intuitive for school pupils as if they know this, they'll want to try it out "because it'll be funny if it does explode". In fact, I want to try it out now!
A dilema is it not ?

In manufacturing it was standard practice to cover a circuit board with a perspex shield when it was powered up for the first time, just in case.
Remembering the perspex used must be capable of withstanding and containing an adverse event, rather than turning it into an even more dangerous 'fragmentation grenade' :)

As well as explosive risk there's also toxic chemical release to be aware of, as well as fire risk and the danger of fumes from smoke of those.

One problem is that any simple explanation of anything will never contain the full detail and complete picture, the more closely one considers something the more caveats and specifics emerge. The real dilemma is whose job it is to highlight related issues and how much detail to go into.

I don't recall any boiled egg recipe telling me not to stick my fingers in the boiling water ( but noting that's okay if I'm wearing heat resistant gloves, though only at normal atmospheric pressures ) or stating the cooking process given won't work at higher altitudes, and many don't detail the potential health hazards of eggs or through failure to cook them properly. Most recipe books don't mention not running in the kitchen whilst holding scissors or sharp knives.

Two quotes stick in my memory; from The Young Ones, paraphrased, "It doesn't say don't put washing up liquid in the video recorder", and from Viz, "Remember boys and girls; don't stick lighted fireworks up your backside".
 
Last edited:

Dippy

Moderator
Ah, but were the heat-resistant gloves made of a woven fabric like my oven-mits?
If so, the boiling water will be soaked in and therefore in prolonged contact with your skin...


But, seriously, you are absolutely right hippy. Where do we draw the line?

I think this Forum does a great job in giving cautionary advice when we get onto risky projects. e.g. Mains and vehicular stuff.
Sometimes it can appear a bit 'nanny' to some , but it is all done with the best intentions.
Sometimes it can appear over-pernickety and competitive (Please Teacher, Please Teacher) but many excellent points are made.

And, on another level, we can't respond to every question from ground up.
Most of us haven't got the time.
We have to assume certain things in any responses and it is up to the OP to say "Eh? Please explain."
We also have to assume that people have a little common-sense.

And, on yet another level, Old Hacks will often see the same thing over and over again.
- a bit like how I reckon this discussion will go :)
Anyway, I'll bring my eyeballs back down to horizontal and say just one word; Read! ;)
 

IronJungle

Senior Member
I know I'm approaching this from a mathematical angle and not a practical one, but two caps in || seem like one big cap (mathematically anyway). What is happening that changes that characteristic? Do spice models know the difference between two caps tied to the same nodes vs one cap of equal value?

Just trying to gather wisdom here. I see this design all the time, so I'm not questioning it's validity.

The smaller ones are better at filtering out high frequency noise than the larger ones - the larger ones are for low frequency noise.
 

nick12ab

Senior Member
@IronJungle, I'd say that the reasoning is to do with ESR and the aforementioned RCL (resistor-capacitor-inductor) being related to the capacitance. Someone else will come up with a more detailed explanation.

What I've just said isn't necessarily correct, but it makes sense to me.
 

Dippy

Moderator
Ironjungle, the size, value, dielectric and construction etc all affect how a capacitor works in real life.
Your mathematical approach I assume is using the simple combination of //d capacitors that we learnt at school?

That assumes perfect capacitors. No such animal. Capacitors as I said before are not perfect.

Different types (etc.etc.) have different performances.
If you look at the links I gave to my ancient thread of 3 weeks ago you'll see I posted some example PDFs.
http://www.picaxeforum.co.uk/showthread.php?19066-Transients-decoupling-bypassing-capactiors-on-PICs-and-other-things.&highlight=decouple
Post#3 for PDF links.

Have a look. See how performance changes with frequency. All component have LCR, again, nothing is perfect.

To optimise a design you need to KNOW your capacitors. Knowledge to the Atomic Physics level isn't needed (thank goodness). But read those PDFs that I posted and search for other mines of wisdom. Once you get the basics it'll help your understanding and therefore your design.
 

GeorgeC47

Senior Member
I know I'm approaching this from a mathematical angle and not a practical one, but two caps in || seem like one big cap (mathematically anyway). What is happening that changes that characteristic? Do spice models know the difference between two caps tied to the same nodes vs one cap of equal value?

Just trying to gather wisdom here. I see this design all the time, so I'm not questioning it's validity.
From what I remember of my Physics degree 45 years ago the impedance (resistance) of a capacitor is inversely proportional to its capacitance.
The magnitude of the current and the magnitude of the voltage are related: Vmax/Imax = 1/ (2*Pi*f*C)
where f is the frequency.
So if the frequency is very high then the capacitor will appear to have a very low impedance and any unwanted high frequency signal will be 'conducted away'.
This will be why the small value capacitor is there. The high value capacitor will act as a charge storage tank, almost like a backup battery, and so will maintain the voltage when there are slow changing events.
 

John West

Senior Member
You've got it. Also, the large capacitor is not as effective at bypassing the high frequencies away because of its mechanical size and design. A different cap for a different purpose.

A few other real-world capacitor characteristics are: leakage, value drift with temperature, and ESR (equivalent series resistance.)

The step from the theory to the practice is often a long one, but the theory is always a good starting point.
 

IronJungle

Senior Member
Of course. Different Cs would have different Rs, thus creating a unique RC. Makes perfect sense now. Thanks for the amazingly simple (but obviously needed) refresher.
 

inglewoodpete

Senior Member
My favorite PICAXEs for adding decoupling capacitors are the 28- and 40-pin versions. The + and - pins are alongside each other. The photo is of the underside of a DIL 28x1.
BypassCap1a.jpg
 
Top