Good Hardware Design Practices

reywas

Member
I'm currently laying out my first real PCB (I've used perf-board for my projects up to this point) and I've been searching the forum (with little success) for information on good hardware design practices, specifically as it relates to PICAXE I/O pin protection. I'm sure this has been discussed "ad infinitum", but I guess I'm searching on the wrong keywords.

My project will connect:

PICAXE to PICAXE
PICAXE to parallel LCD module
PICAXE to membrane switch panel (common GND)

I know a current limiting resistor between the PICAXE chips is recommended but searching the web I find values from 100R to 100K. Typical value? Should I use the same for the LCD and membrane switch connections? Are they needed at all?

Thanks
 

Jeremy Harris

Senior Member
The rule-of-thumb I use is to connect directly to pins when there is no real risk of connecting anything that might harm the chip. So, I normally connect peripherals like LCDs and switches using PCB connectors that are keyed, and I have never had a problem with direct connections to ports with these.

If something is being connected to a port from outside the case of the project, say a serial connection that's running to another Picaxe in a different location, then I usually add a low value series current limiting resistor. For a 5V system, then I aim to limit the current in or out of the pin to 20mA, so 270 ohms is just about OK, and low enough to not have a significant impact on performance. That allows an external pin connection to be connected to either +5V or 0V and if the Picaxe pin is an output the current will be limited to a safe value.

If there was a risk of connection to a higher than supply voltage then I'd look at using a more comprehensive pin protection scheme, but, if I'm honest, I can only think of two projects where I've needed to do this, and the protection formed a part of the circuit, anyway (both were sensing higher than supply voltages).
 

PhilHornby

Senior Member
Microchip

I know a current limiting resistor between the PICAXE chips is recommended but searching the web I find values from 100R to 100K. Typical value? ... Are they needed at all?
For a 5V system, then I aim to limit the current in or out of the pin to 20mA, so 270 ohms is just about OK, and low enough to not have a significant impact on performance.
Microchip use 470R on their Curiosity Development board. Personally, I always forget to use any :eek:
 

hippy

Technical Support
Staff member
Many circuits are built without any current-limiting protection resistors. It is recommended to use them where there could be pick-up of electrical noise or when two potential outputs could be connected together .

That can be particularly important when two or more PICAXE are connected together so a 270R to 1K resistor on such a line is recommended. Not needed though if to a receive pin which is an input only pin and the two PICAXE chips share the same power rail.

Protection for the keypad would be recommended in case the PICAXE inputs become outputs and pushing a key would short those to 0V. One might choose to say the risk of that is negligible. If the keypad is on long wires it is probably best to include them.

PICAXE to a parallel LCD probably does not require any protection if the LCD is wired so WR is connected to 0V and the wires to the LCD are short.

For PICAXE to an AXE0133 serial LCD etc, there is a series resistor fitted to those anyway, so nothing additional needed if the wires are reasonable short.
 

Goeytex

Senior Member
Nearly every Pin on a Picaxe (PIC) Chip has a pair of internal ESD diodes. The exception is the Pin usually labeled "input only". This ie the PIC MCLR Pin. These diodes serve to clamp the voltage applied to the input pin to Vcc + .6v. But these diodes need to work in conjunction with a series resistance.

The Picaxe Download circuit is a good example. It uses a 22K series resistor to limit the current through the ESD diode to about 200 microamps while the ESD diode clamps a 12V RS232 Voltage to about 5V.

How much series resistance is used for protection can depends upon several things, of these are the output impedance of the device connected to the pin and the voltage applied. As a general practice I like to limit the input current to about 1 ma or less. That means with a 5V supply and a 5V input signal I use a 4K7 resistor.

But this is not a fixed rule. For example, if I know that the input is from a device with an open collector output with an internal 10K pullup. I might only use a 1K resistor and that is just in case I do something stupid like set the pin as a high output when the device connected to the input is LOW. So this 1K resistor is protection against moron induced smoke.
 

stan74

Senior Member
A 330R costs pence so a pin set as out can't short to ground if say you're a moron like me and drop a screw driver or drag a probe across the board you're safe not sorry. It does happen.
 

Flenser

Senior Member
+1 vote for a 330 ohm resistor per pin.

I have collected two references I like about input pin protection.

For simple protection, for example where you are connecting to other 5V chips, I like the advice that Bruce Land gives at time 46:20 in his Introductory lecture for the Cornell course ECE4670 https://www.youtube.com/watch?v=FYy6JN0vpg0
So the obsessive student, who wants a good grade, will put a 330 ohm resistor on every single IO pin before they hook it up to anything
For systems where more protection is needed, for example where you connect to components running at higher voltages like 24V relays, I like the approach used by Ruggedduino for their hardened Arduino boards https://www.rugged-circuits.com/ruggeduino/. Scroll down to the section "I/O Pin Protection".
 
Last edited:

nekomatic

Member
Those '220 ohm, 30 mA PTC resettable fuses' they use are nifty - I didn't know you could get the two functions (known resistor and fuse) in the same component.

However having said that I can't find them from a quick search on the usual suppliers' websites - does anyone know any more about these, part numbers etc?
 

hippy

Technical Support
Staff member
I would say PTC resettable fuses on every I/O pin would be overkill. I would even consider having resistors on every I/O overkill though it is recommended.

The amount of protection needed really depends on what the thing is and how it is used. If happy to build and use circuits on perf-board, strip-board and breadboard without them I don't see that it's really any different when it comes to a PCB.

If building a module which may have anything connected where accidents will happen it makes sense to make it as robust as possible. Where the circuit is well defined there is less risk to take into account.
 
Top