> For the complete documentation index, see [llms.txt](https://monasheng.gitbook.io/zerotohero/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://monasheng.gitbook.io/zerotohero/arduino-zero-to-hero/electrical-safety.md).

# Electrical Safety

{% embed url="<https://www.youtube.com/watch?v=h-UDNwiHkfA>" %}

Arduino devices are electrical components, and thus:

* Can pose a danger to you if handled inappropriately, and,
* Are reasonably sensitive, and can be easily damaged.

This page will focus on simple techniques you can follow to keep both you and your Arduino safe.

## Keeping you safe

Electricity is can be dangerous to humans - particularly where Alternating Current (AC) and/or high voltages (HV) are concerned.

In this module, we'll primarily be dealing with 'Extra-Low' Voltage (ELV), Direct Current (DC), devices - in the order of $$5;\text{V}$$ at most. While you should in-principle avoid handling live circuits with your bare hands, the voltages you'll work with in this module should be insufficient to cause you harm.

{% hint style="danger" %}
:zap: **Warning:** though the circuits you construct in this module might not be able to hurt you *electrically*, it is possible that *heat* generated by these electronics (especially if you accidentally wire a short circuit) could cause nasty burns.

\ <mark style="background-color:red;">**Always sanity-check your circuits before powering on, and avoid handling live circuits or electronics wherever possible.**</mark>
{% endhint %}

## Keeping your electronics safe

Electronics in general, and *particularly* microcontrollers, can be sensitive to voltages and currents outside of their design conditions. When subject to these inputs, microcontrollers might fail:

1. Suddenly and spectacularly, releasing a pungent cloud of burnt electronics, or,
2. In a more sinister fashion, where faults manifest intermittently or inconsistently in operation.

{% hint style="info" %}
:man\_mage: **Important:** Murdering electronics by application of unplanned voltages or currents is colloquially known as *'letting the magic smoke out'*. Once the magic smoke leaves, electronics tend not to work anymore.

**Letting the smoke out is bad and should be avoided!**
{% endhint %}

<figure><img src="/files/biSA2VWZZmyLzA41M1hH" alt=""><figcaption><p>Releasing the magic smoke and murdering a PCB by shorting across the input pins of the onboard MCU using an alligator clip. From: <a href="https://makeagif.com/i/cjtP9D">https://makeagif.com/i/cjtP9D</a></p></figcaption></figure>

Typically, electronic failures are caused by one of two conditions:

1. [#over-current](#over-current "mention"), or,
2. [#over-voltage](#over-voltage "mention").

### Over-Current

On printed circuit boards (PCBs) and within integrated circuit chips (ICs), current is carried by copper conductors (traces, pins, etc.). These conductors have some resistance, and thus generate heat from transmission and contact losses.&#x20;

<figure><img src="/files/krs4HRIMBB9A5RZTdi2Y" alt=""><figcaption><p>Cross section of a typical printed circuit board (PCB), showing copper traces on the top and bottom layers, as well as so-called <em>vias</em> connecting these through the insulative core. From: <a href="https://www.altium.com/documentation/altium-nexus/understanding-printed-circuit-board-makeup?version=4#top-and-bottom-solder-masks">https://www.altium.com/documentation/altium-nexus/understanding-printed-circuit-board-makeup?version=4#top-and-bottom-solder-masks</a></p></figcaption></figure>

While manufacturers size conductors to carry the current required for normal operation, application of larger currents (e.g. due to [#over-voltage](#over-voltage "mention"), connection of a current-hungry device, or a short-circuit) can lead to immense heat generation, causing burning and in-situ desoldering of components, as well as destruction of current-carrying traces.

<figure><img src="/files/rO24uOSNc74ddMP3aBPo" alt=""><figcaption><p>A split trace on a PCB, caused by enormous currents arising from a short-circuit. From: <a href="https://music-electronics-forum.com/forum/amplification/guitar-amps/maintenance-troubleshooting-repair/38480-what-is-considered-a-professional-pcb-trace-repair">https://music-electronics-forum.com/forum/amplification/guitar-amps/maintenance-troubleshooting-repair/38480-what-is-considered-a-professional-pcb-trace-repair</a></p></figcaption></figure>

The *datasheet* for your electronics (be they wires, IC chips, or MCUs) will typically specify maximum allowable I/O currents. Exceeding these, even for short periods, can lead to permanent damage.

<figure><img src="/files/wahNgP95iYBnHARBWxzj" alt=""><figcaption><p>A typical <em>recommended operating conditions block</em> from an LM7805 datasheet. The 7805 is an extremely common voltage regulator. Note the maximum output current specified (1.5 A). From: <a href="https://www.sparkfun.com/datasheets/Components/LM7805.pdf">https://www.sparkfun.com/datasheets/Components/LM7805.pdf</a></p></figcaption></figure>

{% hint style="danger" %}
:zap: **Warning:** MCUs are commonly destroyed by trying to drive large loads (e.g. motors, servos, solenoids, etc.) using their [Constant Power](/zerotohero/arduino-zero-to-hero/core-skills/constant-power.md) output or [Input/Output Pins](/zerotohero/arduino-zero-to-hero/core-skills/input-output-pins.md).&#x20;

<mark style="background-color:red;">**MCU traces and components are not rated to supply currents of this magnitude, and you will promptly**</mark><mark style="background-color:red;">**&#x20;**</mark>*<mark style="background-color:red;">**let the smoke out**</mark>*<mark style="background-color:red;">**&#x20;**</mark><mark style="background-color:red;">**if you try!**</mark>&#x20;
{% endhint %}

#### Mitigation Methods

You can help avoid [#over-current](#over-current "mention") situations by:

* Insulating connections in your circuit where possible, e.g. with heat shrink, or electrical tape,
* Using dedicated, current-capable supplies (e.g. batteries) for large loads,
* Handling circuits only when unpowered,
* Operating circuits on nonconductive surfaces, and,
* Avoiding connecting/disconnecting probes, alligator clips, jumper wires, etc. while a circuit is in operation.

### Over-Voltage

Application of voltage between two points is the driver/impetus for flow of electrons and thus function of electronic devices.

Where voltage input to an electronic device is too high, damage can occur in several ways, including:

1. Via[#over-current](#over-current "mention"), due to the extra potential available to drive electron flow ($$I = \frac{V}{R}$$) and subsequent increase in heat generation, and,
2. Electrical breakdown (e.g. arcing) within the circuit/between pins, driving current flow in unexpected/damaging ways.

Application of *reverse polarity* (where you e.g. you accidentally mix up `PWR` and `GND` inputs to a board) is one example of over-voltage. Most electronics are not designed to handle *any* voltage in the reverse direction. Consequently, any reverse polarity voltage typically exceeds the maximum tolerable for sensitive components in a circuit.

The *datasheet* for your electronics (be they wires, IC chips, or MCUs) will typically specify maximum allowable input voltages for power supply and otherwise. Exceeding these voltages, even for short periods, can lead to permanent damage.

#### Mitigation Methods

You can help avoid [#over-voltage](#over-voltage "mention") situations by:

* Using keyed connectors and labelling your circuits to prevent application of reverse polarity,
* Double-checking power supply settings before turning-on or connecting,
* Checking battery charge levels before connecting, and,
* When using a power supply, starting at $$0;\text{V}$$ input and ramping up to operating voltage (most circuits will not be damaged from being undervolted - though they may behave strangely though until a sufficiently large input voltage is applied).
