# Electricity Primer

## Introduction

Design of reliable systems is really, really hard. The main challenge is the design of reliable building blocks - i.e. circuit and board layouts - from which to create your system. Phidgets does the majority of this work for you. And, once you have reliable building blocks, designing a reliable system from them is much easier.

However, you can still make an unreliable system out of Phidgets. In fact, if you are building a more complex system than the common examples we show through our documentation, and you have limited experience in complex electrical design, you will probably - and unintentionally - introduce design flaws that will make your system unreliable.

There are two reasons why you should read this primer:

1. You want to build a complex system, more complex than we illustrate in our documentation. To succeed, you need to understand concepts.
2. You understand how to make your system work, and you want to ensure it is well designed for maximum reliability and/or precision.

## The Basics

To understand our discussion of potential problems and their solutions below, you'll need to be familiar with the basics. For this page, 'being familiar' means more than simply having heard of voltage, amperage, and power. You will need to have a working, conceptual model in your head, so that you can apply that model to your own system and examine it for problems. This section is all about giving the tools to build that mental model.

First, some terminology. We introduce it by analogy. If a circuit is a water system,

• The voltage is the pressure in the system
• The power supply is the pump creating the pressure
• The amperage, also known as current, is the amount of flow
• The resistance is an attribute of the load - how tight or loose the faucet is
• The ground is the return path from load to pump.

The basic concepts for all of these terms are presented below.

In simple, USB-only Phidget systems, the load is the Phidget itself. The USB port is ready to provide power, but it does not (and cannot) until a load is applied (i.e. the Phidget is attached) and the circuit is completed.

Without a load that connects in a loop, it is like attaching a closed pipe to your pump. Initially, water will fill the pipe, and pressurize it, but once the pipe fills the system as a whole will do nothing more. To allow the pump to drive the load, and the flow to supply the load, we need to have a completed circuit, like this:

The load and the pump must match. If the load lets too much flow through, the pump will work too hard and burn itself out. This is what happens when you short circuit a power supply. The load is then simply a wire, which basically opens the flood gates and drains your power supply pump. The load must not let too much flow through, which it does by resistance. Likewise, the pump cannot push too hard on the load, or the load will break. This is discussed in-depth as part of Voltage and Amperage below.

### Voltage and Amperage

Within the flow concept above, voltage is pressure. Specifically, it is the difference in pressure between the flow and the return. Voltage is measured in volts, and is denoted by V.

Amperage - also known as current - is the flow, or the amount of water that moves. At the pump, the amount of current out and the amount of current in are equal. The pressure might vary widely (highly pressurized pipes out, low pressure pipes back) but the amount of current is always the same. Amperage is measured in Amps, and is denoted by A.

To match a pump to a load, the voltage and amperage of the power (supply) and load (sink) must line up. We discuss picking a power supply - whether wall mains, or batteries - in the Power Needs section farther along in the document, but we need a few more concepts before we get there.

Power supplies - whether wall power or batteries - are usually rated based on voltage and amperage. Voltage is the specification to be the most careful with for circuits. Too much voltage is the same as overpressurizing your pipes - they will burst. In the case of electronics, you device will break.

This can be counterintuitive - in reference to safety (for humans) around electronics, you may have heard "It is not the voltage that will kill you, it is the amperage". Because of this, it may be tempting to think that too high of an amperage will harm your device, but this is not true. Our hearts are very susceptible to amperage but not voltage, hence amperage is considered dangerous for us whereas voltage is not. But a circuit is not like a human body - in a circuit trying to handle a power supply it is the voltage that matters most.

#### Set Voltage (No Control)

Most loads do no power regulation of their own. They simply take the voltage given to them and do useful things with it. You can tell that a pre-designed load (like a Phidget) falls into this category because it gives its voltage need as an exact value. For example, most Phdigets use exactly 5 V of USB power. These loads will also tell you their amperage, which is a flow need that must be met or exceeded. A load will only use as much amperage as it needs.

#### Controlled Power

Some loads change the voltage or current they receive. This can be with the intent to either (a) keep a constant amount of power flowing from a draining power source like batteries, or (b) to modify a common power source (i.e. 12 V at 1 A) into an uncommon power source (i.e. 1 V at 12 A). This process is called regulation.

You can tell that a pre-designed load (like a Phidget) falls into this "power-regulated device" category because it gives its voltage need as a range. For example, the Phidget Single Board Computer (SBC) can take 6 V to 15 V.

To understand how this works, take the example of a flywheel. Flywheels are designed to be heavy and to take work in order to get them spinning at speed. But once you have them spinning, you can extract that work later at a more consistent rate:

Flywheels can either make amperage or voltage be the more consistent blue line over time. The most common one in Phidgets is for stable amperage. Regulated amperage is also how LED lights can stay consistently bright for any length of time when using batteries. Stable voltage design is usually applied when the voltage is too low to begin with (such as any device that runs on a single AA battery), and the flywheel must amplify and stabilize it over time.

For those readers trying to envision how this works electrically, in practice the flywheel is an inductor (or, a transformer utilizing its inductor properties). For both voltage and amperage regulation, one way relief valves (diodes) must be added. And, in amperage regulation a reservoir (capacitor) must be added to offset the current drop by pulling more amperage as a battery drains. Then, a controller is needed to measure and then correspondingly enable and disable the flywheel system as the voltage or amperage drops from the supply.

But with those details in place, the inductor (and capacitor, in the case of amperage regulation) can effectively take the variety of voltages from, say, a draining battery, and still allow the board to run. Some devices even do this naturally. For example, motors often can take a variety of voltages because their construction (i.e. wire wrapping) naturally creates inductance.

These regulated systems often list the power they need directly, using a type of power rating called watts. Watts are voltage and amperage together (i.e. power):

${\displaystyle {\text{Amperage}}={\frac {\text{Watts}}{\text{Voltage}}}}$

Watts can be a handy way to describe flow and pressure together for these regulated devices. Rather than separating voltage and amperage like the unregulated devices do (i.e. this load needs exactly 12 V, or this load will draw exactly 2 A), the unit of watts will allow different value combinations of volts and amps as long as the wattage remains the same. For example, a 12 watt device with a voltage range of 5 to 12 volts can run on 6 V at 2 A, or 12 V at 1 A. Either will work. Amperage for all values in the device's range of 5 to 12 V can be found with the equation above. Because of this, watts are often preferred when trying to match a power supply to a regulated load.

### Ground

All circuits have a ground. This is simply the return pipe to the pump. In a circuit, it is denoted by an upside-down triangle:

When drawing a circuit diagram, the symbol is placed on the wires that return to the pump:

This electric ground provides a voltage reference throughout the circuit. Ground is always 0 volts as far as the circuit is concerned. (Remember, voltage is the difference between the flow and return pipes at the pump.) Ground is important because it provides a reference from which all the parts of the circuit can speak the same "voltage language" to each other, which matters a lot when a certain voltage means "1" and a certain voltage means "0".

There is only one absolute ground, and that is the Earth, which is taken to be 0 volts as an absolute value. Circuits not well-grounded to the Earth (of which there are many - your cell phone, car, etc) operate at a relative voltage. The upside-down triangle above denotes a relative ground.

With relative voltage, only the difference between local ground and the local high voltage matters. For example, a cell phone might operate as a 3 volt device, which means relative to its ground it always operates between 0 and 3 volts. But if that cell phone were compared carefully to Earth ground, its absolute voltage could be, say, between 10 and 13 volts. Until comparison, the device doesn't "feel" charged. This is the same as how you don't "feel" charged after skidding your feet in socks across a carpeted floor. But, when you "compare" yourself to Earth ground by touching some well-grounded metal, you receive a static electricity shock.

The same thing can happen when you combine two different power supplies, as we discuss below.

### Power

There can be different types of pumps, and at this point we should supplant our heart symbol with some actual power supply pump symbols. For example, this is the symbol for a direct current (DC) battery:

The + end is on the out flow, and the - end is on the return (ground). Batteries are usually listed with their voltages. This is because the resistance of the load will determine how much amperage is drawn, but too much voltage and you will harm your load.

This is the symbol for alternating current (AC) that you would get directly from the wall:

Again, this is listed using voltage for the same reasons as DC. A relative ground symbol is still used on the return line here. AC devices can still operate on relative voltage if they do not use Earth ground (the third prong on a wall plug in North America). This is how some loads have AC cords with only two prongs - they operate on a relative voltage and relative ground. And relative AC voltage, having significantly more voltage (pressure) behind it, can really hit a device hard when two power supplies meet across it.

This connecting of multiple power supplies is quite a complex subject, and is described further in both picking different power supplies and connecting different power supplies later on in this Primer.

### Emissions and Wires

To talk about emissions, it is worth speaking more precisely about what a load is. The typical, simple Phidget setup is receiving 5 V direct current (DC) from the computer over the USB port. Let's model this as coming from a battery so that we can examine all parts of the system. From the point of view of the battery, the Phidget load is not just the green board with the circuitry on it. The load also includes the power cable (i.e. two wires in the USB cable), and anything else on the path out or back from the circuitry to the battery itself:

This is important because the wires play a role in the voltage that eventually makes it to the Phidget. This is true all the time, even when the Phidget is attached to a computer instead of a battery. All wires have some resistance, and so they are, in a way, in and of themselves circuits. Therefore, because of their resistance, the wires 'use' some of the 5 V heading out to the Phidget circuit board. This is discussed more below, but essentially longer cables have more resistance and at some point the voltage will drop so much over the length that the Phidget will not turn on.

To conceptually separate the wires from the Phidget in terms of the load, we can now start drawing the wires themselves in our circuit diagram, instead of the curved concept arrows indicating flow and return:

When talking about the 5V relative ground in this system, we are in fact talking about the ground right at the battery so we move the ground symbol to the battery itself.

Then, the resistance on these wires creates a possible problem - the emission of electromagnetic radiation as the wires naturally drop the voltage:

These emissions are at a set frequency determined by the length of the wire:

• Long wires create low frequencies (harmful interference)
• Short wires create high frequencies (less harmful interference)

This can be minimized by having the flow and return wires be the same length and sit right next to each other. This way, the emissions somewhat cancel each other out from the flow and return going in opposite directions. This is partially how USB cables minimize emissions.

So, the way you design your connections (i.e. the resistance and placement of your wire) will have a direct affect on:

1. The voltage that reaches the Phidget
2. The emissions that your system produces

With all this talk of emissions, you might be tempted to try to shield parts or all of your system from emissions that either your system or external systems create.

Keep in mind that shielding is actually really hard to do correctly. Especially when grounding your shielding, with ad-hoc design you have a high chance of having an interfering signal (that has traveled out to the shield and traveled back via ground) creating a larger problem than not having a shield at all. Rather than shielding, it is easier to simply keep your cables short and with as low a resistance as possible throughout your system to minimize your emissions in the first place.

Identification of and solutions to these (and other more complex) problems are discussed in detail in the section on choosing cables and the section on connecting the pieces below.

The easiest way to hook up multiple Phidgets is in parallel, where the voltage stays the same but they share the amperage. Here the DC supply is two USB ports, each at 5 V and 0.5 A:

However, the length of your wires comes into play again, because the voltage that actually reaches the Phidgets above is somewhat less than 5 V. So if your wires are long, or mismatched, the voltage may not match and will give you strange results. The voltage is both affected on the way out, and on the way back. Assuming the wires are the same length:

In this way, you can create difficult-to-debug problems within a complex system, where one Phidget works but others mysteriously fail.

## Power Needs

Now that you've understood the basics, it is time to actually talk about decisions and design. This section will help you choose a power supply for your Phidget. Let's say you want to run the Phidget Single Board Computer off of a battery. Or you want to run a motor controller with a power supply you bought from the hobby store. What do you need to buy? Will one you already have work? It is worth it to spend a moment with pencil and paper to work through this section and identify your power needs.

As described earlier, voltage is pressure. Too much pressure behind your faucet, and the water mains or faucet will break. Likewise, if you have too much voltage from a power supply, your circuit will break. You should choose a supply with voltage that matches the range the Phidget can accept. The voltage cannot be over the maximum (otherwise, like pressure in a pipe, the pipe will burst), and the voltage cannot be under the minimum (otherwise, like pressure in a pipe, no flow will occur). Also, generally, a device (like a motor controller) will perform better at its maximum rated voltage if a range is available.

But the faucet doesn't care whether there is a big reservoir or small reservoir feeding the system, as long as the pressure is managed. Likewise, you can choose a power supply with more amperage than you need (a big reservoir to draw from) as long as the voltage matches. In the same way that a faucet restricts water by design, loads draw and allow only the amperage that they need. However, the amperage cannot be less than the Phidget needs. In that case, you will either overextend (and break) your power supply, or the circuit simply will not turn on at all.

The specification for your specific device will list its power needs. For most devices, the external power supply needs will simply be listed in voltage and amperage. USB power is 5V at up to 500 mA (0.5 Amps). Most Phidgets will draw less than this - if you need precision, you can check the specification for your particular Phidget. And, if it is an Interface Kit, you can add the draw of each analog sensor and digital in/out from their specifications.

However, some Phidgets (e.g. motors, and the Phidget Single Board Computer) do not have a straight amperage and voltage specification. Instead, their power draw will be listed in watts, for which you saw a relation earlier to convert to the values you need.

### Wall Power

Wall power sources usually take the alternating current (AC) from the wall and convert it into a direct current (DC). These power supplies often take your familiar two-or-three prong wall connector and put power out via a barrel plug-type connector. AC power (typically 110 or 240 volts, depending where you live in the world) goes in the typical wall plug, and DC power (typically 5 to 24 volts) comes out the barrel plug. Most power supplies of this type list the conversion explicitly, such as: 110-240 Volts to 12 Volts at 2 Amps. You'll want to match your Phidget's needs against the 12 Volts at 2 Amps.

• The voltage must match exactly
• If the Phidget takes a range of voltages, the supply must fall within the range
• The amperage can be equal to or greater than the Phidget needs

A wall power supply is essentially an inexhaustible supply of current, so you don't need to worry about it running out like you would with batteries.

### Battery Power

If you intend to use a battery bank (even of only one battery) to power your Phidget, you probably want to know what type of battery to purchase.

#### Battery Chemistries

The first thing that sets batteries apart is the type of materials used in their construction. The following table shows several of the more common battery chemistries as well as the voltage per cell they produce and the specific energy of the chemistry.

 Chemistry Nominal Cell Voltage Specific Energy (MJ/kg) Description Primary Batteries Alkaline 1.5 0.4 These are the most common form of battery. Many commercially available AA and AAA batteries are alkaline. Lithium (LiMnO2) 3 0.83-1.01 These are used in high drain devices or devices with a long shelf life as they have a very low self discharge rate. Silver-oxide 1.55 0.47 Only used in small button cells as these are quite expensive. Secondary Batteries NiCd 1.2 0.14 Older technology, suffers from memory effect. Capable of very high discharge rates with no ill effects. Moderate self discharge rate. Lead-acid 2.1 0.14 Not particularly good with high discharge rate. Moderate rate of self discharge. NiMH 1.2 0.36 Very heavy. Good performance in high drain devices. Very high energy density naturally, at the cost of a high self discharge rate. Newer versions are able to get rid of some of the self discharge though they suffer ~25% lower energy densities as a result. Lithium Ion 3.6 0.46 Expensive to produce but very high energy density. Very low self discharge rate. Safety hazard as short circuiting can yield explosive or fiery results.

#### Choosing a Battery

Batteries are chosen first by their voltage (V). Match the voltage exactly to the voltage the Phidget needs. Over or under this value, you could harm the board or have it simply fail to turn on.

Next, choose a battery that has adequate amperage to feed your device for the time you need. The lifespan of the battery will usually be listed in Amp-Hours (or Ah). For example, a double wide 12 V lantern battery will have usually around 7-8 amp hours. This means if you drew one amp from it for seven to eight hours, the battery would be totally drained. Or you could draw two amps from it and drain it in 3.5-4 hours. This does not mean however, that you can draw 36A for 15 minutes. It is important to understand that there is a limit at which more power simply cannot be drawn from the battery. Effectively, high drain devices will decrease the rated Ah. The amount differs from battery to battery so to be sure it is recommended to check the data sheets for the battery you are using. If the battery did not come with a data sheet they can usually be found on the manufacturers website. The data sheets should have a graph that shows the relationship between current draw (usually in mA) and capacity (Ah or mAh). Another useful thing that can be gathered from the datasheets is the batteries response to temperature. Batteries tend to not work as well in cold environments, most manufacturers will provide graphs of how the batteries lifespans will shorten at different temperatures. This is often very significant, causing the battery to last a fraction of its normal lifespan at temperatures below -10°C.

Finding the amperage or voltage sometimes needs to be done indirectly by using a specification of watts. The relationship between amperage, voltage, and watts is given above in the voltage and amperage section.

For an example, let us say you want to use battery power to run the Phidget Single Board Computer. The specifications say that it uses 1.2 watts as a base value. The specifications also say that it can take 12 V DC power. If we choose to use a 12 V battery, at 1.2 watts it will use 0.1 amps according to the equation shown earlier. Going by amp-hours alone, if our battery is a double-wide lantern type 12 V battery, with 7 amp hours, with 0.1 amp draw it will last 70 hours, or almost three days.

${\displaystyle {\text{Maximum Running Days}}={\frac {\text{Battery Amp Hours}}{{\text{Device Amps}}*{\text{24}}}}}$

However, to estimate average running time (rather than maximum running time possible), amp-hours cannot be used so directly. Over time, batteries decrease in voltage as their power is used up. Practically speaking, this means one of two things for your load. For loads that do not regulate voltage or current, the amperage will also decrease over time. The classic example is an LED light source that grows dimmer and dimmer as the batteries are used up.

You should usually only count on about 60% of the stated amp hour rating to apply before expecting to run into problems from escalated drain due to battery voltage drop. This is especially true for deep cycle rechargeable batteries left in an installation, where draining more than 60% could also harm the battery.

Then, for lead-acid batteries, a typical battery is tested from full to complete drain over 20 hours by the manufacturer to obtain the advertised amp-hour rating. Draining a battery at a faster rate than this will result in even more reduction in capacity, by 10% or even more. This due to Peukert's Law.

There are plenty of battery calculators around the Internet which take most or all of these additional factors into account when recommending an amp-hour rating. For longer-term installations, the solar power online community has some excellent resources.

#### Setting up Multiple Batteries

You can hook up multiple batteries in series to get more voltage at the same amperage. The amperage is additive. For example, you can hook up two single-wide 6 V lantern batteries in series to produce 12 V. Or two 12 V batteries in series to produce 24 volts. This system would still only have the amp hours of one of the lantern batteries, because you will be essentially using them both at once:

The upside down triangle (ground) is explained above in a section of its own.

Or, you can hook up multiple batteries in parallel to get more amperage at the same voltage. For example, you could hook up two 12 V deep cycle batteries in parallel to provide more amperage at 12 V, which is like having a deeper reservoir of power for your device to use:

#### Heat

• all batteries have some sort of internal resistance
• can be found on the battery's data sheet
• the more power you pull from the battery the more heat is going to build up as a consequence of the internal resistance.
• larger internal resistances will cause heat to build up faster.
• when charging a battery you are not just limited to the power in the battery. nothing stops you from dumping energy into the battery past the point where it is fully charged
• this is why charging batteries is a bit of a tricky business.
• many batteries come with custom chargers that have control systems to prevent this type of overcharging.

#### Weight

Finally, weight matters - a car battery is much heavier than a lantern battery. Batteries vary widely by weight per amperage. Lithium batteries are usually very light for their power, followed by alkaline, followed by lead acid. This may not seem important at first, but if you are building a mobile robot it is worth calculating in the work of carting around a battery. You may find that, for the length of time you want it to run, your battery requires some system redesign.

## Selecting Cables

### USB Cables

In general, use the shortest cables possible. There are many reasons for this described above, but as a summary:

Long cables reduce the voltage that reaches the Phidget.
This happens in both directions. So, for every unit cable length added, the voltage decreases by twice the electrical resistance of that length of cable. With especially long cables the Phidget may drop below its 4.6 volt threshold and simply never turn on.
Long cables increase the width of your circuit.
All circuits act as emitting antennas for the resonance frequency of the circuit structure. The longer the wires in the circuit, the lower the frequency, and the higher chance that it will be emissions that will interfere with your data and system.
Longer cables have more length exposed to external interfering emissions.

Also, use thick cables that are built to specification. Some USB cables with thinner wiring have higher electrical resistance. This can be equal to what a much longer wire would have, and thus create a similar voltage drop where the Phidget will not turn on.

#### Options for longer cables

The maximum length for a USB cable is 5m. This is laid out in the USB specifications. Often times however a system requires more reach. In this case there are a few options available to you. You can use what is known as an active extension cable or USB extender. These cables act like extension cables and add power to the line so that the signal can travel further. A second option is to use a Cat5 extender. These extenders are 2 USB dongles that connect on either end of your system. You join them up with Cat5 cable. This allows you to run over much longer distances than USB traditionally allows. Please note however that many of our customers have reported stability issues or errors using various types of USB extenders with Phidgets. This can probably be attributed to the maximum round-trip time of 1.5 microseconds for commands issued over USB, after which the command is assumed lost. This limitation is part of the USB specification.

### Power Cables

There are "DC Wire Table" references on the Internet which describe how to pick a wire appropriate for your voltage and amperage. When selecting AC wires, you will probably be using pre-made extension cords. Cords add interference resonance length to your circuit, just like USB cables do as described above. A long extension cord can create huge electromagnetic interference for your circuit and other systems in the area when first plugged in.

Also as with the USB cables above, cut the cables to the shortest length possible. This is again both for voltage drop reasons and frequency emission reasons.

### Hubs

Avoid hubs where possible. Unpowered hubs are good for reading data from memory keys, but not for powering many external devices. If you must use a hub, buy a powered one.

### Sensor and Motor Wiring

All Phidgets sensor class devices (products whose part numbers start with 11 such as the 1129) use a 3 channel ribbon cable for power and data transmission. Similarly, all our motors and load cells use multichannel wire interfaces. As mentioned previously, USB spec limits cables to 5m, this is not the case for these wires. The biggest concerns are electromagnetic interference (EMI) and voltage drop. In general you should be able to run these wires over significant distances (30m or more) with the load cells in particular having very long range. If EMI starts causing issues you can always use ferrite beads on the cable near the sensor or motor and the controller to reduce noise.

### Cable Gauges for Terminal Blocks

Many Phidgets products feature green terminal blocks that use screws to hold wires in place, making it easy to take apart and rebuild connections in your project. The size of the terminal block determines the gauge of wire you should use.

Terminal Block Width (mm/port) Recommended Wire Gauge (AWG)
3.81 14 to 26
5.0 12 to 26
9.5 10 to 26

The gauge of cables and wires is measured in AWG, which is the American Wire Gauge standard. The following table lists the properties of wire gauges commonly used with Phidgets:

American Wire Gauge Sizes
AWG Size Diameter (mm) Area (mm²) Max Current (A)
10 2.588 5.26 15
11 2.305 4.17 12
12 2.053 3.31 9.3
13 1.828 2.62 7.4
14 1.628 2.08 5.9
15 1.450 1.65 4.7
16 1.291 1.31 3.7
17 1.150 1.04 2.9
18 1.024 0.832 2.3
19 0.912 0.653 1.8
20 0.812 0.518 1.5
21 0.723 0.410 1.2
22 0.644 0.326 0.92
23 0.573 0.258 0.729
24 0.511 0.205 0.577
25 0.455 0.162 0.457
26 0.405 0.129 0.361

## Hooking Up The Pieces

Here, things can be tricky. You might think: just plug everything in and go! But often it is not that simple. Many Phidgets require special care when hooking up. We encourage a process where you apply the concepts in this Primer, through analysis, to your system. So, we don't explicitly list the boards most commonly affected until the end of this Primer.

The categories of the boards which require special attention within a complex system are:

1. Phidgets with more than one power source, and
2. Phidgets needing precise measuring or control of an external power source

If you are already thinking about your boards in your head and trying to figure out whether they fit into one category or another, you're on the right track! The list of commonly affected boards are only the common ones... with a sufficiently complex system, you could conceivably create problems with any boards.

Both types of projects require a full understanding of electrical basics. Using those concepts, below we first describe problems that arise when hooking up different power sources, and extend that into using the solution to give more precise measurement and control.

### Shared Grounds

Shared grounds can occur in Phidgets that handle two different power sources. Recognizing the sharing of a ground is not always easy. We show what it is, how it can be possible, and why it creates problems by starting with the most basic Phidget system. The simplest setup for a Phidget is to use the ground of the computer it gets data and power from over a USB port:

In this case, there is only one relative ground, and it is the PC ground, which is ground #1 in the image. The PC ground determines what is considered 0 volts for all signals on the Phidget. When you add different power sources or sinks in the system, you are pulling the system relative to the PC ground.

##### One Powered Phidget

The next most complicated system is one Phidget that handles two power sources. Let us say you have a motor controller, which takes power from USB, and which also takes power from a second power source. Although the second power source is usually just a wall plug, the simpler case for thinking about ground is actually a battery. A battery creates a second relative ground. Through the Phidget, relative ground #1 (from the PC) and #2 (from the battery) actually become the same ground:

This is the first reason why systems with powered Phidgets have to carefully manage ground. If ground #1 and ground #2 are different with respect to each other (see the static shock analogy in the ground section above), then whatever circuitry along the red dashed arrow must deal with the initial static shock. In this case it would be the circuitry of the Phidget. In the case of a battery, after the initial equalizing shock the battery will be whatever relative voltage the PC ground needs it to be. Hence a battery relative ground can 'float'.

If ground #2 comes from the wall, on the other hand, the ground does not 'float' and instead is always absolute 0 volts Earth ground. With the PC giving the power, this is not a problem in practice because the PC can also float (as with a laptop), or it uses Earth ground. But if you were using a different and more powerful USB power supply instead of a PC, and then connected it to the absolute Earth ground through the Phidget, the Phidget would bear the brunt of any ground equalization that would occur. If neither the new ground nor the old ground float, and the power supplies were powerful enough, this would eventually destroy the Phidget. In this case, you would want to use isolation, as described in How To Fix This below.

##### Multiple Powered Phidgets

A worse case comes in when you are using two powered Phidgets and one external power source. Again, say you are using a battery as the external power source. It would be tempting to simply wire both grounds from the Phidgets to the ground on the battery:

Although this looks benign, you have actually created a new circuit. The circuit is a second path, via ground, for the current to return to the voltage source. This is also known as a ground loop. The path we intuitively think of the current returning by is path A, but the sharing of grounds has created a new path through the motherboard, path B:

All current gets 'pumped' in a loop by voltage, and so it will use all return paths available to it, assuming all paths are equally easy (electrically) to use. This extends the pipe analogy, where water will flow in every path that exists. So, if your battery (or other power source with ground #2) is quite powerful, you can actually harm your motherboard within your PC (or at least your USB bus ground), because path B runs through the motherboard circuitry on the way back to the voltage source.

This problem does not apply to using a different power source between a black power plug and for the green control terminal block on, say, a DC motor controller. Although the grounds are connected, and they run across a part of a Phidget board, creating a ground loop does not actually run through any circuitry if only these types of boards are used. If you have a complex system with other types of boards and therefore circuitry between black plug power port and green terminal block connections, draw out your system carefully to identify the loops.

Ground loops can be fixed by one of the ways described in How to Fix This below.

##### Single Board Computer And Powered Hub

When combining one externally powered Phidget and the Phidget Single Board Computer or the Product - 1019 - PhidgetInterfaceKit 8/8/8 w/6 Port Hub on the same external power source, you still may inadvertently create a ground loop as described above in the multiple powered Phidgets section. If they share a true Earth ground, this is not a problem. But if the ground is from a battery, or uninterruptible power supply, etc. then you should carefully draw out your system circuit and examine it for ground loops.

#### How To Fix This

Once you are aware of shared grounds in your system, you have two options.

One, for ground loop problems in simple systems (two Phidgets), you could make the normal return path (path A) the most electrically desirable path. This is best for simple systems where you have a lot of control over all of the ground wires within your system. For the ground wires leading directly from the Phidget to the external power supply (path A), lower the resistance in the wire as much as possible. You can do this by keeping the wires short, and using a thick (large gague) wire for the hookups.

Although this solution works, sometimes you do not have much choice on how long your ground return wires can be, because the location of your power supply and and Phidgets are set by your system design. If you cannot be totally sure that the direct ground path is the shortest and most electrically desirable path, it is best to use the second option: a USB Isolator such as the 3060 - USB Isolator. This isolator is like any other USB isolator - it can be used on a Phidget system, as well as any system that needs ground isolation.

You need isolators for every USB cable in your system, less one. If you have two USB connections, you need one isolator; three USB connections, two isolators, and so on. The one USB connection can remain non-isolated because a single ground connection cannot form a loop. However, if you are concerned about connecting the grounds as described in the single connected Phidget section above, use a USB isolator on every cable.

### Precise Voltage Control

Precise voltage (or other system) control and measurement is related to the concept of shared ground above. But here, you want to keep grounds separate not only to prevent ground loops, but also to make your system more sensitive to what it will control or measure.

For example, we make Phidgets that can create power precisely, or that can take it in and measure it. One such product is the 1002, which outputs a precise analog voltage with which to control an analog system. Now that you know about relative ground, however, you would be right to expect that you do not want to combine the ground in the PC and the ground in the system.

Even if you don't care about system sensitivity, you can still create ground loops in a system with multiple of these types of Phidgets. In addition, if you are using the Phidget to control a large, powerful system, even a single Phidget can receive damage from connecting two powerful power sources meeting across it, also as described earlier.

But above and beyond the powered Phidget problems, there is another reason to separate (isolate) the electrical grounds in your system. The reason is: to make your system control more precise. For example, with the 1002, if you are trying to control an external system with an Phidget output voltage, that output voltage should be relative to the system you are trying to control, not relative to the PC. Rather than forcing the grounds - and therefore the relative voltages - to be equal to each other, you can provide more precise control by isolating the grounds and working with the relative voltage of the controlled system on its own terms.

Schematic-type image of a ground isolated analog out on a 1002

#### How To Fix This

The solution to all of these problems in precise voltage control systems is to use USB isolation, even for a single Phidget. The 3060 - USB Isolator is one such isolator. It inserts along the USB connection between your PC and the Phidget, and it separates the Phidget (and controlled system) ground from the PC ground. This fixes ground loops, separates relative voltage mis-matches, and isolates the control system for better precision.

Image of 1002 and Isolator connected, with lines superimposed on the image to show non-copper connection in isolator

## Affected Products

If you're not sure whether a certain concept applies to your Phidget within a complex system, the best way to figure this out is by doing some mental (or pencil and paper) simulation. Draw the inputs and outputs for the entire board, and label them with voltage, list their required amperage (or watts), and draw connections (such as ground connections) through any circuitry.

With a technique like this, it is easy to see that some products - such as the Phidget Spatial - are simply not complex at all. Although you could conceivably create problems (such as by using separate power supplies instead of using USB power and connecting the grounds incorrectly, or by using really long wires), this would be an exceptional case.

Other Phidgets can be more easily used incorrectly without realizing it. These are often devices that are simple in some systems and yet complex in others. Your primary defense against designing unreliable systems is to draw the system out and identifying any problems using the concepts in this primer. To help you, however, you can generally think of two classes of Phidgets which usually need careful handling when they are part of complex systems:

1. Phidgets with more than one power source, (these can be subject to the multiple power source problems described above)
2. Phidgets needing precise measuring of an external power source (these can be subject to the multiple power source problems and precise voltage control problems)

Expanded into individual products, the Phidgets which are most often affected are.....

1. These Phidgets use a second type of external power:
2. And these Phidgets may have a need to be sensitive to external power: