≡ Menu

Arduino Protection: How to Make Sure Your Project Won’t Kill Your Arduino

An Arduino Breadboard ProjectOK, so you’ve bought one of the Arduino boards, downloaded some development software, and figured out how to talk to the Arduino to do simple tasks. Now you want to introduce Arduino to the outside world, so you’ll have to learn something about electronics in order to keep that “magic smoke” (more like the odoriferous black cloud of doom!) from escaping from your new little workhorse.

The easiest way to get the Arduino practicing safe outside world contact is to use one of the many “shields” that are available. These are circuit boards which are especially created to interface the Arduino and plug right on to the Arduino board.

With the aptly named shield in place (a staggering multitude of shields are available!), you can freely experiment with interfacing without fear of turning your Arduino to toast. You might cook the shield, but the Arduino will probably survive. So if you’re working solely with shields, you can breathe your sigh of relief now, bookmark this page for future reference, and get back to your tinkering project.

* Photo Credit: g.p.macklin, distributed under a Creative Commons license.

But I Want to Build my Own Homebrew Shields!

The Ohm’s Law is your friend

If you are a courageous soul, you may want to homebrew your own physical interfaces to the Arduino. When you do, there is one very strict rule that you need to follow:

Obey the Law!

“Always use a current limiting resistor so you never exceed the maximum source or sink current that the Arduino can handle”

Current Limiting Resistors* Photo Credit: oskay distributed under a Creative Commons license.

An Assorted Resistor Kit is a Great Starting Point

E-Projects 16 Value Resistor Kit, (Pack of 400)

I recently bought this kit for myself, and I am happy with it. The resistors come nicely packed and well-organized.

There is a label on top of the box, as well as separate labels that you can stick to each individual bag.

This nifty kit contains 25 each of the 16 most common resistor values, ranging from 10 Ohm to 10M Ohm.

Law? What Law?

Ohm’s Law: a snapshotOhm's Law Triangle Diagram

In the diagram to the right you can see a simple circuit illustrating the three variables whose relationship is defined by the Ohm’s Law: Voltage (V), Resistance (R) and Current (I).

The law states that “the current (i) between two points of a conductor is directly proportional to the potential difference (V) across these two points” and is described by the following mathematical expression:

V = IR, where V is the voltage (in volts) across the points marked “+” and “-” in the circuit, R is the resistance (in ohms) of the conductor (the zig-zagged portion in the circuit) and I is the current (in amperes) that flows through the conductor.

For a complete explanation of the Ohm’s Law, read this Wikipedia article.

* Image credit: the two images that were merged together here were kindly released into the public domain by its creators.

Array of LEDs

An Example of Ohm’s Law Applied to a Circuit

A simple Arduino experiment to flash LEDs

OK, so here’s a simple example:

One of the experiments you can perform with the Arduino is a device that can flash Light Emitting Diodes. An LED exhibits a very low resistance in the forward bias direction, so if you apply voltage in that direction from one of the Arduino IO pins without protection, a very large current will flow. This is likely to destroy the LED AND the Arduino in one nifty little “pop.”

Some LEDs have an internal current limiting resistor which prevent this, but it’s best to not take that chance unless you are absolutely sure (redundancy intended). You should put a resistor between the IO pin and the LED anode to keep the current under control.

The value of the resistor is determined by the current rating of the LED and a little math, using, you guessed it, Ohm’s Law!

Let’s say that the LED draws about 10 milliamps of current when fully lit. The Arduino IO pin will usually supply 5 volts in an active high state, so with Ohm’s Law, the voltage divided by the current will equal the amount of resistance required (we’ll ignore the internal voltage drop on the diode here for simplicity).

Doing the math (5 volts divided by .010 amps) yields a resistance value of about 500 ohms. Resistors aren’t available in exactly 500 ohm values, but we can find one at 510 ohms.

There! Now your Arduino is safe from harm!

* Image credit: generously shared under a Creative Commons license by cibomahto, on Flickr.

Want to Get Your Hands “Dirty”?

Here’s a great hands-on volume to keep you mildly challenged and highly entertained!

arduino workshop project book

John Boxall of tronixstuff fame does a great job writing tutorials on his blog, and he now has made it even easier for us to play with the Arduino by bundling 65 awesome projects in his book “Arduino Workshop: A Hands-On Introduction with 65 Projects“.

The 65 DIY projects in this book go from basic to intermediate to sophisticated, as your knowledge of and comfort with the Arduino grow. (I guarantee it will. The learning journey this volume takes you on is painless and fun!)

With fun projects such as digital thermometers and dice, secretly coded lock, GPS logger, binary quiz game and several more, the “Arduino Workshop” will take you from apprentice to sorcerer!

Hint: modifying projects to do things differently or to extend functionality highly encouraged!

But wait!

There’s more!

There is one more thing to say about the Arduino.

Although the single IO pins have individual values, when you view the IO pins as a port and use several simultaneously, there is also a maximum amount of current that can be drawn or dissipated by the combined group.

If you decide to manipulate the port registers,

you must calculate the TOTAL current for all pins in a B, C, or D port configuration by adding the individual values and making sure the sum doesn’t exceed the total allowed for the group.

There are several Arduino web sites that can provide exact values of current and pin configurations for all the different Arduino boards.

A good starting point is the official Arduino website, at arduino.cc. More specifically, this reference article on port manipulation.

And, of course, last, but not least, HAVE FUN tinkering with your new Arduino board!

{ 0 comments… add one }

Leave a Comment