PCB design: analog signals and PWM and copper pour

I've been reading up on PCB design. Three things I have read are: route analog signals separate from higher-frequency digital signals; don't run higher-frequency digital signals parallel to each other; and don't put copper pour underneath higher-frequency sub-circuits or components. My question is, does the Arduino's PWM output, running at say 1 kHz up to maybe 32 kHz, count as "high frequency" in this respect? What about the three control lines for my 4051 mux, which are cycling binary 0-7 every loop()? In the latter case, a single loop() may take several ms to complete, so the average frequency of the lines is probably only a few hundred Hz, but the polling of the mux occurs in seven sequential analogReads(), so when the code runs, the burst frequency may be as high as 10 kHz (100 us per analogRead()) for a time of 800 us (8 analogReads).

I have one more question, while I’m at it: in my schematic, I put bypass capacitors on all my Vcc pins. When I got to the PCB layout, I clustered the ICs together to make routing ground/Vcc easier, and I realized that, within the length of a 300-mil or 400-mil trace, there were three Vcc pins and three bypass caps, all routing to ground. It seemed kind of wasteful. I know that the bypass cap needs to go as close to the Vcc pin as possible, but is there a point at which several ICs’ Vcc pins are close enough together that they can all “share” the same bypass cap?

Attached is an example showing the layout.

pcb.jpg

joshuabardwell: I've been reading up on PCB design. Three things I have read are: route analog signals separate from higher-frequency digital signals; don't run higher-frequency digital signals parallel to each other; and don't put copper pour underneath higher-frequency sub-circuits or components. My question is, does the Arduino's PWM output, running at say 1 kHz up to maybe 32 kHz, count as "high frequency" in this respect? What about the three control lines for my 4051 mux, which are cycling binary 0-7 every loop()? In the latter case, a single loop() may take several ms to complete, so the average frequency of the lines is probably only a few hundred Hz, but the polling of the mux occurs in seven sequential analogReads(), so when the code runs, the burst frequency may be as high as 10 kHz (100 us per analogRead()) for a time of 800 us (8 analogReads).

High frequency is 10's MHz and above really. From there up transmission-line theory starts to dominate all signal routing, below that then short traces are probably fine for logic signals. 10kHz is orders of magnitude below "high frequency"!

At the higher frequency end, say from 1MHz and up then groundplanes start to become de-rigeur in order to prevent unwanted signal coupling. Stray capacitances are say of the order of 5pF and have significantly low impedance only above 1MHz (30k ohms at 1MHz, 3k at 10MHz, 300 ohms at 100MHz...) A groundplane short-circuits capacitively coupled currents to ground in preference to flowing into other signals.

joshuabardwell:
I’ve been reading up on PCB design. Three things I have read are: route analog signals separate from higher-frequency digital signals; don’t run higher-frequency digital signals parallel to each other; and don’t put copper pour underneath higher-frequency sub-circuits or components.

Someone correct me if I’m wrong, but I have been led to understand that copper fills underneath high-speed digital circuits are a very good thing, as it reduces the inductance of traces.

Also, regarding your Vcc decoupling… If you have two ICs that are so close that a decoupling cap between them is equidistant and sufficiently close to both (sufficient being as close as possible), then yes go ahead and share it. If the ICs draw appreciable current (a shift register with 8 LED outputs doing PWM is a good example), it would probably be happier with its own, and maybe even a small bulk cap (1-10uF) nearby as well.

Mind, these rules aren’t black and white. You’re trying to minimize current loops as much as possible. Think about how the device in question consumes power, and what you can do to meet those demands – understanding that no component or PCB trace is perfect, and will impede current flow to some extent. Compare cost and complexity to diminishing returns and go from there. Of course, experience is the only way to really get this right, and will probably involve some failures along the way. Such is the course of skill building.

Analog and logic signals are rather different - a high-impedance analog circuit might very well want a hole in the groundplane to reduce stray capacitance to ground locally. A high gain high frequency analog amplifier would definitely want a groundplane to tame unintended positive feedback and prevent oscillations.

Logic signals at high speed are universally single-ended or differential pair transmission lines, stripline, microstrip, LVDS etc. Most Arduino applications are not high speed.

SirNickity: Someone correct me if I'm wrong, but I have been led to understand that copper fills underneath high-speed digital circuits are a very good thing, as it reduces the inductance of traces.

I am way out of my depth, but if memory serves, the author was saying that the capacitance of the ground plane would slow the circuit down.

Sure, but so could inductive traces. Maybe the capacitance from the nearby ground plane counter-acts the inductive traces and (if properly balanced -- which is not trivial) would nullify some of the effects? Frankly, I'm out of my depth too. Maybe some day I'll graduate to >100MHz. :roll_eyes:

Ardunio PWM is 490Hz, not kilo or 10s of kilo-hertz. Far from high frequency.

Ground planes are always a good thing.

Here is a video on to make ground planes in EAGLE: http://youtu.be/eAbpZfqE8r4

[quote author=James C4S link=topic=191114.msg1413463#msg1413463 date=1380680799] Ardunio PWM is 490Hz, not kilo or 10s of kilo-hertz. Far from high frequency. \ [/quote]

Arduino Uno PWM can be up to 62.5 kHz (pins 5/6), using in-built clock dividers. Pins 3/9/10/11 go up to 31.25 kHz

http://playground.arduino.cc/Code/PwmFrequency http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM

Yes, "can be." But if you use the built-in analogWrite() functions, they aren't nearly that fast.

Here’s a video of me welding with my Arduino project controlling the welder’s output. The relevant part is that the welder is being directly driven by the Arduino’s PWM output at 4 kHz. You can hear the PWM signal when I strike the arc, and if you look up a 4 kHz test tone, you can hear they’re identical. Save yourself the pain of hearing me pontificate and jump to about 2:00 in the video.

[quote author=James C4S link=topic=191114.msg1413501#msg1413501 date=1380685206] Yes, "can be." But if you use the built-in analogWrite() functions, they aren't nearly that fast. [/quote]

But I'm not. Because I want to implement output pulsing at up to 30 Hz, I need to increase the PWM frequency to ensure adequate sampling resolution. All I'm saying is, it's not correct to say that the Arduino's PWM frequency is 495 Hz. The default PWM frequency is 495 Hz, true.

joshuabardwell: . All I'm saying is, it's not correct to say that the Arduino's PWM frequency is 495 Hz.

No, it is perfectly correct to say so. The Arduino libraries are ~490Hz. If you do direct register manipulation then, no, the [u]AVR[/u]'s PWM isn't.

AVR != Arduino

[quote author=James C4S link=topic=191114.msg1413507#msg1413507 date=1380685486] No, it is perfectly correct to say so. The Arduino libraries are ~490Hz. If you do direct register manipulation then, no, the [u]AVR[/u]'s PWM isn't. AVR != Arduino [/quote]

I see the distinction you're making, but I think you're splitting a mighty fine hair. If I call digitalWrite, ultimately some piece of code manipulates registers in the AVR. Just because the digitalWrite function has been baked into a standard library by the Arduino developers and the pwmFrequency function hasn't doesn't mean that I suddenly stop developing on an Arduino when I use the pwmFrequency function.

For that matter... does it depend on clock speed? E.g., if I use an older Arduino NG (or make my own), is the default PWM still ~500Hz? I haven't checked... it's just something to keep in mind when making unqualified assertions. Not that every statement needs to be exhaustively disclaimer'd, but it's worth understanding how those statements come across to members of more or less technical skill and experience.