Go Down

Topic: My first standalone project - chceck correctness please (Read 10558 times) previous topic - next topic

Paul__B



As an honest question, is the discharge of a 0.1µF cap charged to 5v much of a concern to switch contacts?  (I imagine it would depend on the switch of course.)

Perhaps, perhaps not.  It most certainly depends on what sort of switch it is - in the case of more robust switches, some arcing is considered beneficial in keeping the contacts clean.  If you look at the specifications for these miniature switches, you will not that they are qualified for milliamps, not amps, so even a tiny spark, repeated, can be significant.  To say nothing of those consisting of metallised pads on flexible plastic - though their inherent resistance may (or may not) be protective.


Why trigger an ISR?  Simply, pin-change interrupts.  They're available, easy to use, and depending on the code, maybe preferable to polling.  Couple of examples:  Long loop() cycles, low clock speeds, sleep states, cases where it makes for more logical code paths.  Or maybe "just because".  The functional difference between reading pin states every loop() cycle, or setting marker variables in an ISR and checking for those in a loop is pretty much down to whims of the programmer in perhaps most cases.

My perception is to use interrupts for priority events.  Not entirely sure about "easy to use" as (and as you observe,) what you do in an interrupt routine - at least in this context - usually needs to be communicated by a semaphore to the non-interrupt routines in order to be acted upon which means code in both places.


If I'm understanding you correctly, you're talking about using something like a timer interrupt to perform UI polls every 1ms or so?

But accuracy is not important.  If you have a "heartbeat" loop, it makes sense to use it - noting that this is usually for low priority (or slow) events.  Generally if the debounce routine happens to run slow on occasion, it is not a catastrophe.

Commonly, you have a "main" loop - the thing called "void loop() { }" in the Arduino IDE.  This may or may not be isochronous, or to varying degrees (isochronous loops can be very effective), but it is not inappropriate to use this for the debounce if you can estimate the average loop time and consider it "near enough".

(I have chosen not to go into the considerations of a system which sleeps to conserve power.)


About half way down this page is an oscillogram of a 100 nF cap and a 10 K resistor where the open end of the resistor is grounded and it would appear that the combination does a great deal to debounce the signal.

I fail to see how a series capacitor "one shot" - which incidentally, has its own design problems to do with voltages exceeding the specified input range of the chip involved - has any relevance whatsoever to the matter of switch contact debouncing by the use of a parallel capacitor.  I don't think you have understood my points, particularly those relating to impulse generation within the current loop comprising the capacitor on the PCB, the ground connections on the PCB and the leads connecting it to a remote switch.

It is salutary to remember that a rotary mechanical switch (or spark gap) of substantially more robust construction and dimensions, is the most commonly used form of exciter for the Tesla coil enthusiasts.

pytel_zajicu

At first thanks for the critique. I read all comments and something is still not clear for me.

Quote
- First, add a diode at the power input.  This will protect your circuit in case the DC barrel connector's polarity is accidentally reversed.


I dont know, if should add diode to plus or minus pole of power supply. I added it at the minus because when reverse polarity, current will stopped immediately at beginning of circuit and will not come through  any component.
Quote
Ditch C1 and C7 in favor of a single large 100uF cap at the power supply input.

C1 and C7 replaced by single 100uF capacitor

Quote
C8 should probably be something like 47µF to 100µF, since fans tend to be current hogs at times.

Quote
Quote
C2 is OK at 10µF, given the likely current demands on the 5V circuit, but I would use something like a 47µF instead just because you can.
I would suggest the opposite.  10µF should be more than sufficient; it is the regulator's task to supply current on sudden demand; these capacitors are only present to stabilise the regulator at frequencies beyond its response.  More important is to ensure that the reference (ground) terminal has the lowest possible impedance to the ground and is as far as possible, a "star" point for supply and load.  Using ground "spill" or "fill" as far as possible is likely to enhance this.  Better to maximise - as you have said - the input capacitor.

Ok, I kept 10uF for Paul_B advice. But I dont understand what do u mean by ground "split" or "fill"

Quote
Quote
- In addition to bulk capacitance (the larger electrolytics) it's a good idea to use 0.1µF to 0.33µF ceramic caps on each side of the regulators.  This prevents over/under-shoot oscillations.

But they should go to the star point, not just to the regulator reference pin - so the circuit diagram as posted is still a trifle misleading in this respect.

Another sentences that is not quite clear for me. Can you explain it me more in details Paul?

Quote
You should put a 0.1µF ceramic cap between the high side (pin 1/2) of every switch and ground.  This prevents "switch bounce"..

I am preventing switch bounce in SW like Paul says...

Quote
Quote
Put a diode in reverse across the regulators (anode on pin 2, cathode on pin 1 -- or in schematic terms, like this:  1 --|<|-- 2).

That is in fact, one reason the output capacitors should be kept small.  If you can ensure the supply capacitor has sufficient reserve (and you have a series diode feeding it), it will be continuing to feed the circuit as the output voltage falls, and these diodes are unnecessary.

Paul says it is unnecessary and I belive him, so I didnt place them.

Quote
I would recommend reconsidering the 19V input entirely.  That means you're dropping 14V across the 7805, which will mean lots of heat.  You'll have to heatsink that IC, especially if anything draws more than a few mA of current.  Is it really necessary to provide regulated 12V DC?  If you're only powering fans on the 12V bus, just use a 12V power supply instead, and leave the 7812 out entirely.

19V input entirely is because of supplying led drivers and series of leds. I didnt want multiple power for LEDs and controller. Is it really bad idea 19 power suply for controller, when I add an heatsink? I should add 5V power supply, but it means one more wire.

Quote
- You're probably already doing this, but just to make sure, you are enabling the internal pull-ups on pins 13, 14, 18, and 19

Yes, I am using internal pullups.

Quote
Please understand that the process you follow may be OK for an Arduino device that you will build and use in your home BUT you should not be using these "procedures" in real products.

Yes, it is device, that I will use at home. It is good project to lear basics of designing own Atmega circuits...


I also replace buttons in scheme by holes, because buttons will not be at PCB, they will be lead out of box. Here is my actual scheme:












Paul__B

#32
Aug 19, 2013, 04:57 pm Last Edit: Aug 19, 2013, 04:59 pm by Paul__B Reason: 1
A "star" configuration refers to the arrangement where all ground connections, and in this case particularly those of the regulator reference pin, the bypass capacitors, the power source and the power feed on to subsequent sections, converge on one point.  You will find this description in the design notes to the regulators, perhaps particularly in older documentation.  This of course applies to the physical layout of the board, not merely the diagram.

The ground "spill" or "fill" refers to the practice of extending the ground connections to occupy as far as possible, all areas of the board not otherwise used, with as many interconnections between these areas as possible, including multiple "vias", thus "spilling" out and filling the board.  The intent is to create as low an impedance as possible between any two points and this assists in implementing the "star" topology.  There are at least two objectives, to ensure stability of the regulator(s), and to reduce radio-frequency interference (that FCC compliance thing) and potential impulse coupling between sections.  The placement of the bypass capacitors must also be arranged to minimise their lead and connection lengths.

As to the polarity protection diode, it does not go in the ground lead, as grounds (and notably casings, which should be grounded) of power supplies and peripheral devices are likely to (probably should) be connected, defeating a diode in such a position.  Also, it should be placed before the reservoir capacitor, so that it does not introduce impedance into the regulator input.

SirNickity

I dont know, if should add diode to plus or minus pole of power supply. I added it at the minus because when reverse polarity, current will stopped immediately at beginning of circuit and will not come through  any component.

It should be the first component after the positive pin on the power input.  You definitely want it before your 100uF cap, since reverse polarity to an electrolytic cap can end in oozing electrolyte and/or confetti.

Technically, with proper orientation, you can place the diode on either side of a power input and it will block reverse polarity.  It's a circuit, and both sides have to be connected for current to flow.  But, as Paul said, grounds can and often will interface at more than one physical place, so if you impede flow just at the ground terminal, you risk allowing reverse current through some other, unintended means.

Quote
Quote
Put a diode in reverse across the regulators (anode on pin 2, cathode on pin 1 -- or in schematic terms, like this:  1 --|<|-- 2).

That is in fact, one reason the output capacitors should be kept small.  If you can ensure the supply capacitor has sufficient reserve (and you have a series diode feeding it), it will be continuing to feed the circuit as the output voltage falls, and these diodes are unnecessary.

Paul says it is unnecessary and I belive him, so I didnt place them.

And Paul is right in this case, but....  If your circuit accepts input from any other externally-powered source, you could end up with power flowing back through your input pins.  This is probably not the case in this project, so you don't need to worry about it here, but it is something you should keep in mind when designing.

FWIW, I usually don't add a diode across the regulator in my own circuits.  But, I do consider the potential for power to appear from unintended sources.  If the chances are high that it could happen, a diode at the regulator is cheap insurance to keep things in order.  (Although, you may still fry pin protection diodes if you source too much current through an input, but that's another problem for another day.)

Another (admittedly rare, but possible) case where this diode could help -- if the input side cap is shorted, flows back to the supply (another reason for the input diode), powers other circuits (like yours does), or could otherwise conceivably drain before the inside cap does, you will end up with the regulator output higher than its input.

Again, you're probably fine here as-is.  Just something to keep under your hat for later.

Quote
I would recommend reconsidering the 19V input entirely.  That means you're dropping 14V across the 7805, which will mean lots of heat.  You'll have to heatsink that IC, especially if anything draws more than a few mA of current.  Is it really necessary to provide regulated 12V DC?  If you're only powering fans on the 12V bus, just use a 12V power supply instead, and leave the 7812 out entirely.

19V input entirely is because of supplying led drivers and series of leds. I didnt want multiple power for LEDs and controller. Is it really bad idea 19 power suply for controller, when I add an heatsink? I should add 5V power supply, but it means one more wire.

The regulators are usually rated for something like 35V input, so you're still technically within limits, but it will get really hot dropping 14V.  It's just not a great design practice.  If you engineer the heat sinking effectively, it can be done though.  Still, it might be easier to look into different series arrangements for the LEDs if that's a possibility.  Again, it's your task as the designer to balance the many compromises and pick the method that works best for you.  Know your options (and their consequences) and you'll be fine.

Go Up