<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.phidgets.com/docs/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=192.168.3.103</id>
	<title>Phidgets Support - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.phidgets.com/docs/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=192.168.3.103"/>
	<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/Special:Contributions/192.168.3.103"/>
	<updated>2026-09-18T01:26:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Electricity_Primer&amp;diff=19913</id>
		<title>Electricity Primer</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Electricity_Primer&amp;diff=19913"/>
		<updated>2012-05-23T15:04:09Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Selecting Cables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
There are two reasons why you should read this primer:&lt;br /&gt;
# You want to build a complex system, more complex than we illustrate in our documentation.  To succeed, you need to understand concepts.&lt;br /&gt;
# You understand how to make your system work, and you want to ensure it is well designed for maximum reliability and/or precision.&lt;br /&gt;
&lt;br /&gt;
==The Basics==&lt;br /&gt;
&lt;br /&gt;
To understand our discussion of potential problems and their solutions below, you&#039;ll need to be familiar with the basics.  For this page, &#039;being familiar&#039; 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.&lt;br /&gt;
&lt;br /&gt;
First, some terminology.  We introduce it by analogy.  If a circuit is a water system,&lt;br /&gt;
* The &#039;&#039;&#039;voltage&#039;&#039;&#039; is the &#039;&#039;pressure&#039;&#039; in the system&lt;br /&gt;
* The &#039;&#039;&#039;power supply&#039;&#039;&#039; is the &#039;&#039;pump&#039;&#039; creating the pressure&lt;br /&gt;
* The &#039;&#039;&#039;amperage&#039;&#039;&#039;, also known as current, is the amount of &#039;&#039;flow&#039;&#039;&lt;br /&gt;
* The &#039;&#039;&#039;load&#039;&#039;&#039; is the &#039;&#039;faucet&#039;&#039; - adjusting your load will adjust the flow&lt;br /&gt;
* The &#039;&#039;&#039;resistance&#039;&#039;&#039; is an attribute of the load - how tight or loose the faucet is&lt;br /&gt;
* The &#039;&#039;&#039;ground&#039;&#039;&#039; is the return path from load to pump.&lt;br /&gt;
&lt;br /&gt;
The basic concepts for all of these terms are presented below.&lt;br /&gt;
 &lt;br /&gt;
===Load===&lt;br /&gt;
&lt;br /&gt;
We start with the load, because the load is the purpose of your entire system.  &lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
 &lt;br /&gt;
[[Image:elec_flow.png|150px]]&lt;br /&gt;
&lt;br /&gt;
The load and the pump must &#039;&#039;&#039;match&#039;&#039;&#039;.  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 &#039;&#039;&#039;resistance&#039;&#039;&#039;. 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|Voltage and Amperage]] below.&lt;br /&gt;
&lt;br /&gt;
===Voltage and Amperage===&lt;br /&gt;
&lt;br /&gt;
Within the flow concept [[#Load|above]], voltage is pressure.  Specifically, it is the &#039;&#039;difference&#039;&#039; in pressure between the flow and the return.  Voltage is measured in volts, and is denoted by &#039;&#039;&#039;V&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;amount&#039;&#039; of current is always the same.  Amperage is measured in Amps, and is denoted by &#039;&#039;&#039;A&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
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 Power|wall mains]], or [[#Battery Power|batteries]] - in the [[#Power Needs|Power Needs section]] farther along in the document, but we need a few more concepts before we get there.&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
This can be counterintuitive - in reference to safety (for humans) around electronics, you may have heard &amp;quot;It is not the voltage that will kill you, it is the amperage&amp;quot;.  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.  &lt;br /&gt;
&lt;br /&gt;
====Set Voltage (No Control)====&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;as an exact value&#039;&#039;.  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.&lt;br /&gt;
&lt;br /&gt;
====Controlled Power====&lt;br /&gt;
&lt;br /&gt;
{{Template:ContentNeeded|This section, and perhaps the Voltage and Amperage section, and perhaps even the entire &amp;quot;The Basics&amp;quot; section, will probably eventually be moved to a new page}}&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;&#039;regulation&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You can tell that a pre-designed load (like a Phidget) falls into this &amp;quot;power-regulated device&amp;quot; category because it gives its voltage need &#039;&#039;as a range&#039;&#039;. For example, the [[SBC|Phidget Single Board Computer]] can take 6 V to 15 V.  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_flywheel.png]]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;more&#039;&#039; 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.  &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
These regulated systems often list the power they need directly, using a type of power rating called &#039;&#039;&#039;watts&#039;&#039;&#039;.  Watts are voltage and amperage together (i.e. power):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{Amperage} =\frac{\text{Watts}}{\text{Voltage}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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&#039;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.&lt;br /&gt;
&lt;br /&gt;
===Ground===&lt;br /&gt;
&lt;br /&gt;
All circuits have a &#039;&#039;&#039;ground&#039;&#039;&#039;.  This is simply the return pipe to the pump.  In a circuit, it is denoted by an upside-down triangle:&lt;br /&gt;
&lt;br /&gt;
[[Image:ground.png]]&lt;br /&gt;
&lt;br /&gt;
When drawing a circuit diagram, the symbol is placed on the wires that return to the pump:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_flow_ground.png|170px]]&lt;br /&gt;
&lt;br /&gt;
This electric ground provides a voltage reference throughout the circuit.  Ground is always &#039;&#039;&#039;0&#039;&#039;&#039; volts as far as the circuit is concerned. (Remember, voltage is the &#039;&#039;difference&#039;&#039; 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 &amp;quot;voltage language&amp;quot; to each other, which matters a lot when a certain voltage means &amp;quot;1&amp;quot; and a certain voltage means &amp;quot;0&amp;quot;.  &lt;br /&gt;
&lt;br /&gt;
There is only one &#039;&#039;&#039;absolute&#039;&#039;&#039; 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 &#039;&#039;&#039;relative&#039;&#039;&#039; voltage.  The upside-down triangle above denotes a &#039;&#039;relative&#039;&#039; ground.&lt;br /&gt;
&lt;br /&gt;
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&#039;t &amp;quot;feel&amp;quot; charged.  This is the same as how you don&#039;t &amp;quot;feel&amp;quot; charged after skidding your feet in socks across a carpeted floor.  But, when you &amp;quot;compare&amp;quot; yourself to Earth ground by touching some well-grounded metal, you receive a static electricity shock.&lt;br /&gt;
&lt;br /&gt;
The same thing can happen when you combine two different power supplies, as we discuss [[#Projects With Different Power Sources|below]].&lt;br /&gt;
&lt;br /&gt;
===Power===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_battery_basic.png|200px]]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
This is the symbol for alternating current (AC) that you would get directly from the wall:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_wall_basic.png|200px]]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
This connecting of multiple power supplies is quite a complex subject, and is described further in both [[#Power Needs|picking different power supplies]] and [[#One Powered Phidget|connecting different power supplies]] later on in this Primer.&lt;br /&gt;
&lt;br /&gt;
===Emissions and Wires===&lt;br /&gt;
&lt;br /&gt;
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&#039;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 &#039;&#039;also&#039;&#039; 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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_phidget_basic.png|200px]]&lt;br /&gt;
&lt;br /&gt;
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 &#039;use&#039; 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.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_phidget_wires.png|200px]]&lt;br /&gt;
&lt;br /&gt;
When talking about the 5V relative ground in this system, we are in fact talking about the ground &#039;&#039;right at the battery&#039;&#039; so we move the ground symbol to the battery itself.&lt;br /&gt;
&lt;br /&gt;
{{ContentNeeded|The discussion of emissions, like the discussion of [[#Controlled Power|Controlled Power]] above, will probably be moved to a new page and expanded in the future.}}&lt;br /&gt;
&lt;br /&gt;
Then, the resistance on these wires creates a possible problem - the emission of electromagnetic radiation as the wires naturally drop the voltage:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_phidget_emissions.png|200px]]&lt;br /&gt;
&lt;br /&gt;
These emissions are at a set frequency determined by the length of the wire:&lt;br /&gt;
* Long wires create low frequencies (harmful interference)&lt;br /&gt;
* Short wires create high frequencies (less harmful interference)&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
So, the way you design your connections (i.e. the resistance and placement of your wire) will have a direct affect on:&lt;br /&gt;
# The voltage that reaches the Phidget&lt;br /&gt;
# The emissions that your system produces&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Identification of and solutions to these (and other more complex) problems are discussed in detail in the [[#Selecting Cables|section on choosing cables]] and the [[#Hooking Up The Pieces|section on connecting the pieces]] below.&lt;br /&gt;
&lt;br /&gt;
===Multiple Loads===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_phidget_parallel.png|250px]]&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_phidget_wire_drop.png|350px]]&lt;br /&gt;
&lt;br /&gt;
In this way, you can create difficult-to-debug problems within a complex system, where one Phidget works but others mysteriously fail.&lt;br /&gt;
&lt;br /&gt;
==Power Needs==&lt;br /&gt;
&lt;br /&gt;
Now that you&#039;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&#039;s say you want to run the [[SBC|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.&lt;br /&gt;
&lt;br /&gt;
As described [[#Voltage and Amperage|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 &#039;&#039;matches the range the Phidget can accept&#039;&#039;.  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.&lt;br /&gt;
&lt;br /&gt;
But the faucet doesn&#039;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.&lt;br /&gt;
&lt;br /&gt;
The specification [[#Device List|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.&lt;br /&gt;
&lt;br /&gt;
However, some Phidgets (e.g. motors, and the [[SBC|Single Board Computer]]) do not have a straight amperage and voltage specification.  Instead, their power draw will be listed in watts, for which you [[#Voltage and Amperage|saw a relation earlier]] to convert to the values you need.&lt;br /&gt;
&lt;br /&gt;
===Wall Power===&lt;br /&gt;
&lt;br /&gt;
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&#039;ll want to match your Phidget&#039;s needs against the 12 Volts at 2 Amps. &lt;br /&gt;
&lt;br /&gt;
*The voltage must match exactly&lt;br /&gt;
**If the Phidget takes a range of voltages, the supply must fall within the range&lt;br /&gt;
*The amperage can be equal to or greater than the Phidget needs&lt;br /&gt;
&lt;br /&gt;
A wall power supply is essentially an inexhaustible supply of current, so you don&#039;t need to worry about it running out like you would with batteries.&lt;br /&gt;
&lt;br /&gt;
===Battery Power===&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
====Battery Chemistries====&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
{| {{table}} border = 1&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Chemistry&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Nominal Cell Voltage&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Specific Energy (MJ/kg)&#039;&#039;&#039;&lt;br /&gt;
| align=&amp;quot;center&amp;quot; style=&amp;quot;background:#f0f0f0;&amp;quot;|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| align = &amp;quot;center&amp;quot; colspan = 4|Primary Batteries&lt;br /&gt;
|-&lt;br /&gt;
| Alkaline||1.5||0.4||These are the most common form of battery.  Many commercially available AA and AAA batteries are alkaline. &lt;br /&gt;
|-&lt;br /&gt;
| 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.&lt;br /&gt;
|-&lt;br /&gt;
| Silver-oxide||1.55||0.47||Only used in small button cells as these are quite expensive.&lt;br /&gt;
|-&lt;br /&gt;
| align = &amp;quot;center&amp;quot; colspan = 4|Secondary Batteries&lt;br /&gt;
|-&lt;br /&gt;
| NiCd||1.2||0.14||Older technology, suffers from [[Electricity Primer#Memory Effect|memory effect]].  Capable of very high discharge rates with no ill effects.  Moderate self discharge rate.&lt;br /&gt;
|-&lt;br /&gt;
| Lead-acid||2.1||0.14||Not particularly good with high discharge rate.  Moderate rate of self discharge.  &lt;br /&gt;
|-&lt;br /&gt;
| 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.  &lt;br /&gt;
|-&lt;br /&gt;
| 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. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Choosing a Battery====&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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&amp;amp;deg;C.&lt;br /&gt;
&lt;br /&gt;
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|voltage and amperage section]].&lt;br /&gt;
&lt;br /&gt;
For an example, let us say you want to use battery power to run the [[SBC|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 [[#Voltage and Amperage|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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{Maximum Running Days} =\frac{\text{Battery Amp Hours}}{\text{Device Amps} * \text{24}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, to estimate &#039;&#039;average&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
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 [http://en.wikipedia.org/wiki/Peukert%27s_law Peukert&#039;s Law].&lt;br /&gt;
&lt;br /&gt;
There are plenty of [http://www.google.ca/search?&amp;amp;q=battery+calculator 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.&lt;br /&gt;
&lt;br /&gt;
====Setting up Multiple Batteries====&lt;br /&gt;
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 &#039;&#039;one&#039;&#039; of the lantern batteries, because you will be essentially using them both at once: &lt;br /&gt;
&lt;br /&gt;
[[Image:elec_battery_series.png|250px]]&lt;br /&gt;
&lt;br /&gt;
The upside down triangle (ground) is explained above in a [[#Ground|section of its own]].&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:elec_battery_parallel.png|250px]]&lt;br /&gt;
&lt;br /&gt;
====Heat====&lt;br /&gt;
*all batteries have some sort of internal resistance&lt;br /&gt;
*can be found on the battery&#039;s data sheet&lt;br /&gt;
*the more power you pull from the battery the more heat is going to build up as a consequence of the internal resistance.&lt;br /&gt;
*larger internal resistances will cause heat to build up faster.&lt;br /&gt;
*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&lt;br /&gt;
**this is why charging batteries is a bit of a tricky business.&lt;br /&gt;
**many batteries come with custom chargers that have control systems to prevent this type of overcharging.&lt;br /&gt;
&lt;br /&gt;
====Weight====&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Selecting Cables==&lt;br /&gt;
&lt;br /&gt;
{{ContentNeeded|The content from the [[Cable FAQ]] should be merged here... or wherever this ends up.}}&lt;br /&gt;
&lt;br /&gt;
===USB Cables===&lt;br /&gt;
&lt;br /&gt;
In general, use the shortest cables possible.  There are many reasons for this [[#Emissions and Wires|described above]], but as a summary:&lt;br /&gt;
&lt;br /&gt;
; Long cables reduce the voltage that reaches the Phidget.&lt;br /&gt;
: 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.&lt;br /&gt;
&lt;br /&gt;
; Long cables increase the width of your circuit.  &lt;br /&gt;
: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.&lt;br /&gt;
&lt;br /&gt;
; Longer cables have more length exposed to external interfering emissions.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
====Options for longer cables====&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
===Power Cables===&lt;br /&gt;
&lt;br /&gt;
There are &amp;quot;DC Wire Table&amp;quot; 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 [[#USB Cables|described above]].  A long extension cord can create huge electromagnetic interference for your circuit and other systems in the area when first plugged in.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
===Hubs===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
===Sensor and Motor Wiring===&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
===Cable Gauges for Terminal Blocks===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Terminal Block Size and Wire Gauge&#039;&#039;&#039;&lt;br /&gt;
! Terminal Block Width (mm/port)&lt;br /&gt;
! Recommended Wire Gauge (AWG)&lt;br /&gt;
|-&lt;br /&gt;
| 3.81&lt;br /&gt;
| 14 to 26&lt;br /&gt;
|-&lt;br /&gt;
| 5.0&lt;br /&gt;
| 12 to 26&lt;br /&gt;
|-&lt;br /&gt;
| 9.5&lt;br /&gt;
| 10 to 26&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;American Wire Gauge Sizes&#039;&#039;&#039;&lt;br /&gt;
! AWG Size&lt;br /&gt;
! Diameter (mm)&lt;br /&gt;
! Area (mm²)&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 2.588&lt;br /&gt;
| 5.26&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 2.305&lt;br /&gt;
| 4.17&lt;br /&gt;
|-&lt;br /&gt;
| 12&lt;br /&gt;
| 2.053&lt;br /&gt;
| 3.31&lt;br /&gt;
|-&lt;br /&gt;
| 13&lt;br /&gt;
| 1.828&lt;br /&gt;
| 2.62&lt;br /&gt;
|-&lt;br /&gt;
| 14&lt;br /&gt;
| 1.628&lt;br /&gt;
| 2.08&lt;br /&gt;
|-&lt;br /&gt;
| 15&lt;br /&gt;
| 1.450&lt;br /&gt;
| 1.65&lt;br /&gt;
|-&lt;br /&gt;
| 16&lt;br /&gt;
| 1.291&lt;br /&gt;
| 1.31&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| 1.150&lt;br /&gt;
| 1.04&lt;br /&gt;
|-&lt;br /&gt;
| 18&lt;br /&gt;
| 1.024&lt;br /&gt;
| 0.823&lt;br /&gt;
|-&lt;br /&gt;
| 19&lt;br /&gt;
| 0.912&lt;br /&gt;
| 0.653&lt;br /&gt;
|-&lt;br /&gt;
| 20&lt;br /&gt;
| 0.812&lt;br /&gt;
| 0.518&lt;br /&gt;
|-&lt;br /&gt;
| 21&lt;br /&gt;
| 0.723&lt;br /&gt;
| 0.410&lt;br /&gt;
|-&lt;br /&gt;
| 22&lt;br /&gt;
| 0.644&lt;br /&gt;
| 0.326&lt;br /&gt;
|-&lt;br /&gt;
| 23&lt;br /&gt;
| 0.573&lt;br /&gt;
| 0.258&lt;br /&gt;
|-&lt;br /&gt;
| 24&lt;br /&gt;
| 0.511&lt;br /&gt;
| 0.205&lt;br /&gt;
|-&lt;br /&gt;
| 25&lt;br /&gt;
| 0.455&lt;br /&gt;
| 0.162&lt;br /&gt;
|-&lt;br /&gt;
| 26&lt;br /&gt;
| 0.405&lt;br /&gt;
| 0.129&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Hooking Up The Pieces==&lt;br /&gt;
&lt;br /&gt;
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&#039;t explicitly list the boards most commonly affected until the [[#Affected Products|end of this Primer]].&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;categories&#039;&#039; of the boards which require special attention within a complex system are:&lt;br /&gt;
&lt;br /&gt;
# Phidgets with more than one power source, and&lt;br /&gt;
# Phidgets needing precise measuring or control of an external power source&lt;br /&gt;
&lt;br /&gt;
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&#039;re on the right track!  The list of [[#Affected Products|commonly affected boards]] are only the common ones... with a sufficiently complex system, you could conceivably create problems with &#039;&#039;any&#039;&#039; boards.&lt;br /&gt;
&lt;br /&gt;
Both types of projects require a full understanding of [[#The Basics|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.  &lt;br /&gt;
&lt;br /&gt;
===Shared Grounds===&lt;br /&gt;
&lt;br /&gt;
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|ground]] of the computer it gets data and power from over a USB port:&lt;br /&gt;
&lt;br /&gt;
[[Image:ground_simple_case.png]]&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
=====One Powered Phidget=====&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;relative&#039;&#039; ground.  Through the Phidget, relative ground #1 (from the PC) and #2 (from the battery) actually become the same ground:&lt;br /&gt;
&lt;br /&gt;
[[Image:ground_wall_power.png]]&lt;br /&gt;
&lt;br /&gt;
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|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 &#039;float&#039;.&lt;br /&gt;
&lt;br /&gt;
If ground #2 comes from the wall, on the other hand, the ground does not &#039;float&#039; 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|How To Fix This]] below.&lt;br /&gt;
&lt;br /&gt;
=====Multiple Powered Phidgets=====&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
[[Image:ground_two_phidget.png]]&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;&#039;ground loop&#039;&#039;&#039;. The path we intuitively think of the current returning by is  &#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;path A&amp;lt;/span&amp;gt;&#039;&#039;&#039;, but the sharing of grounds has created a new path through the motherboard, &#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;path B&amp;lt;/span&amp;gt;&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
[[Image:ground_two_paths.png]]&lt;br /&gt;
&lt;br /&gt;
All current gets &#039;pumped&#039; 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 &#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;path B&amp;lt;/span&amp;gt;&#039;&#039;&#039; runs through the motherboard circuitry on the way back to the voltage source.&lt;br /&gt;
&lt;br /&gt;
This problem does &#039;&#039;not&#039;&#039; apply to using a different power source between a black power plug and for the green control terminal block on, say, a [[DC Motor and Controller Primer|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.&lt;br /&gt;
&lt;br /&gt;
Ground loops can be fixed by one of the ways described in [[#How To Fix This|How to Fix This]] below.&lt;br /&gt;
&lt;br /&gt;
=====Single Board Computer And Powered Hub=====&lt;br /&gt;
&lt;br /&gt;
When combining one externally powered Phidget and the [[SBC|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 [[#Multiple Powered Phidgets|the multiple powered Phidgets section]].  If they share a true [[#Ground|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.&lt;br /&gt;
&lt;br /&gt;
====How To Fix This====&lt;br /&gt;
&lt;br /&gt;
Once you are aware of shared grounds in your system, you have two options.  &lt;br /&gt;
&lt;br /&gt;
One, for ground loop problems in simple systems (two Phidgets), you could make the normal return path (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;path A&amp;lt;/span&amp;gt;&#039;&#039;&#039;) 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 (&#039;&#039;&#039;&amp;lt;span style=&amp;quot;color:blue;&amp;quot;&amp;gt;path A&amp;lt;/span&amp;gt;&#039;&#039;&#039;), 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.  &lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;&#039;USB Isolator&#039;&#039;&#039; such as the [[Product - 3060 - USB Isolator|Phidget 3060]].  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.&lt;br /&gt;
&lt;br /&gt;
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 [[#One Powered Phidget|single connected Phidget section above]], use a USB isolator on every cable.&lt;br /&gt;
&lt;br /&gt;
===Precise Voltage Control===&lt;br /&gt;
&lt;br /&gt;
Precise voltage (or other system) control and measurement is related to the concept of [[#Shared Ground|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.&lt;br /&gt;
&lt;br /&gt;
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 [[#Ground|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.&lt;br /&gt;
&lt;br /&gt;
Even if you don&#039;t care about system sensitivity, you can still create [[#Multiple Powered Phidgets|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 [[#One Powered Phidget|described earlier]].&lt;br /&gt;
&lt;br /&gt;
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 &#039;&#039;system you are trying to control&#039;&#039;, 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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;Schematic-type image of a ground isolated analog out on a 1002&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====How To Fix This====&lt;br /&gt;
&lt;br /&gt;
The solution to all of these problems in precise voltage control systems is to use USB isolation, even for a single Phidget.  The [[Product - 3060 - USB Isolator|Phidget 3060]] 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.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:red;&amp;quot;&amp;gt;Image of 1002 and Isolator connected, with lines superimposed on the image to show non-copper connection in isolator&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Affected Products==&lt;br /&gt;
&lt;br /&gt;
If you&#039;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.  &lt;br /&gt;
&lt;br /&gt;
With a technique like this, it is easy to see that some products - such as the [[Product - 1049 - PhidgetSpatial 0/0/3|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.  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
# Phidgets with more than one power source, (these can be subject to the [[#Shared Grounds|multiple power source problems]] described above)&lt;br /&gt;
# Phidgets needing precise measuring of an external power source (these can be subject to the [[#Shared Grounds|multiple power source problems]] &#039;&#039;and&#039;&#039; [[#Precise Voltage Control|precise voltage control]] problems)&lt;br /&gt;
&lt;br /&gt;
Expanded into individual products, the Phidgets which are most often affected are.....&lt;br /&gt;
&lt;br /&gt;
# These Phidgets use a second type of external power:&lt;br /&gt;
#* Motor controllers &lt;br /&gt;
#**[[DC Motor and Controller Primer|DC controllers]] &lt;br /&gt;
#**[[Stepper Motor and Controller Primer|Stepper controllers]]&lt;br /&gt;
#**[[Servo Motor and Controller Primer|Servo controllers]]&lt;br /&gt;
#* Pure relay boards &lt;br /&gt;
#**[[Solid State Relay Primer|Solid state relay boards]]&lt;br /&gt;
#**[[Mechanical Relay Primer|Mechanical relay boards]]&lt;br /&gt;
#* Interface kits with relays &lt;br /&gt;
#**[[Product - 1017 - PhidgetInterfaceKit 0/0/8]]&lt;br /&gt;
#**[[Product - 1014 - PhidgetInterfaceKit 0/0/4]]&lt;br /&gt;
#* Powered Digital Output Interface Kits &lt;br /&gt;
#** [[Product - 1012 - PhidgetInterfaceKit 0/16/16]]&lt;br /&gt;
#* Interface Kits with Powered Hubs&lt;br /&gt;
#** The [[SBC|Single Board Computer]]&lt;br /&gt;
#** [[Product - 1019 - PhidgetInterfaceKit 8/8/8 w/6 Port Hub]]&lt;br /&gt;
# And these Phidgets may have a need to be sensitive to external power:&lt;br /&gt;
#* [[Temperature Sensor Primer|Thermocouple]] control&lt;br /&gt;
#* Analog Output ([[Product - 1002 - PhidgetAnalog 4-Output]])&lt;br /&gt;
#* Frequency Counter ([[Product - 1054 - PhidgetFrequencyCounter]])&lt;br /&gt;
&lt;br /&gt;
==Conclusions==&lt;br /&gt;
&lt;br /&gt;
This page should have helped you to: &lt;br /&gt;
*Choose a power supply from either the [[#Wall Power|wall]] or a [[#Battery Power|battery]]&lt;br /&gt;
*Properly [[#Ground|ground]] and/or [[#How To Fix This|isolate]] that power supply from looping through other circuitry&lt;br /&gt;
*Also use [[#How To Fix This|isolation]] to make your control or measurement system more precise&lt;br /&gt;
*Keep your cables short and thick to reduce electromagnetic emissions and limit voltage drop&lt;br /&gt;
*Be more aware of system-wide power problems in general, and use drawing and analysis of systems to identify problems&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
===Memory Effect===&lt;br /&gt;
Memory effect is an effect observed in NiCd batteries that causes them to hold less charge.  It pertains to the specific situation in which NiCd batteries lose their maximum capacity if they are repeatedly recharged without being fully discharged.  The battery appears to remember the smaller capacity.  The term is often misused in cases where other batteries seem to hold less charge than originally, however this is most likely due to age and use.  This phenomenon is unique NiCd batteries.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Stepper_Motor_and_Controller_Guide&amp;diff=19905</id>
		<title>Stepper Motor and Controller Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Stepper_Motor_and_Controller_Guide&amp;diff=19905"/>
		<updated>2012-05-23T14:05:01Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Setting the Current Limit */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[Image:3302.jpg]]&lt;br /&gt;
| [[Image:1063.jpg]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Stepper motors are broadly available motors commonly used for positioning.  The rotor of a stepper moves in a series of discrete steps.  By energizing the coils of the motor in sequence through many of these steps, the direction of rotation, number of rotations, and exact position of the motor shaft can be easily controlled.  By controlling the time between the steps, the speed and acceleration of the stepper is regulated.  In contrast, a DC motor will blindly spin at the highest speed possible when powered, unless it is controlled with an [[Encoder|Encoder Primer]] and a control system program. It is not necessary to use an encoder on a stepper motor unless you&#039;re concerned about the motor losing count of the steps over a long period of time or in high torque situations.&lt;br /&gt;
&lt;br /&gt;
Each stepper motor is designed to move by a certain angle with each discrete step.  The simplest stepper motors will rotate 90 degrees per step.  Standard industrial steppers will rotate 1.8 degrees per step. The stepping angle can be further reduced through use of a gearbox.&lt;br /&gt;
&lt;br /&gt;
In addition to the ease of precisely controlling position and speed, Steppers have other advantages:&lt;br /&gt;
&lt;br /&gt;
*Most motors have very little torque when they are operating at low speed or standstill. Since a stepper’s rotor is held in place by a magnetic field during each step,  steppers have full torque at low speed or standstill, making them very useful for low speed rotation and actuation. Additionally, a stepper motor can remain in a fixed position for long periods of time with the rated current in the windings, whereas with DC motors, stalling and remaining in a fixed position for long periods of time will cause motor burnout. &lt;br /&gt;
*DC Motors have brushes with a finite lifetime.  Steppers have no brushes, and are limited only by the life of the bearings.&lt;br /&gt;
&lt;br /&gt;
Compared to DC Motors, there are disadvantages to Steppers:&lt;br /&gt;
&lt;br /&gt;
*Each step will produce vibration in the motor.  If these vibrations are at the mechanical resonant frequency of the motor, they can cause the rotor to overshoot and bounce back and forth, resulting in a severe loss of torque. This phenomenon is called “ringing” and is often accompanied by a loud buzzing or grinding noise. To prevent the motor from operating in such a way, you should test the motor at various speeds in the physical application it is intended for, and try to avoid running the motor at a speed which exhibits ringing behaviour. &lt;br /&gt;
*If the motor encounters a brief overload, the fixed coils on the stator and  the free-spinning rotor can lose track of each other. If this happens at higher speeds, the motor will often stall.  Even at lower speeds, your system will have lost track of where exactly the motor is positioned – unless there is an independent system (e.g., an optical encoder) tracking the position.&lt;br /&gt;
*A Stepper motor cannot be loaded at its maximum torque, as it will almost certainly be overloaded during operation.  A DC Motor will naturally adjust its speed depending on how much power is provided, and the torque required to turn it’s shaft.&lt;br /&gt;
&lt;br /&gt;
==Choosing a Stepper Motor and Controller==&lt;br /&gt;
&lt;br /&gt;
* merge in some info from types of steppers (or the whole section, like SSRs)&lt;br /&gt;
* talk about non-phidgets motors and controllers&lt;br /&gt;
&lt;br /&gt;
==Types of Stepper Motors==&lt;br /&gt;
&lt;br /&gt;
We find it useful to classify motors according to how the coils are wound (Bipolar / Unipolar), the internal magnetic construction (Permanent Magnet / Hybrid), and how the current in the coils is regulated (Chopper Drive / Resistive Limited).&lt;br /&gt;
&lt;br /&gt;
===Coils===&lt;br /&gt;
=====Bipolar=====&lt;br /&gt;
These motors are manufactured with two coils of wire, resulting in one winding per phase.  By alternating the power between coils, as well as the direction of the current, the motor is rotated. This configuration produces magnetic fields within the coils in either direction, hence the term “Bipolar.”  The controller is more expensive because it has to be able to produce both positive and negative electrical currents, but the advantage is that the entire coil is being used, thus increasing torque capabilities at all speeds. We do not recommend using a bipolar controller to run a unipolar motor, even though it is theoretically possible.&lt;br /&gt;
&lt;br /&gt;
=====Unipolar=====&lt;br /&gt;
In a unipolar motor, the motor windings consist of two identical coils per phase, wound in opposite directions (each occupying half of the space a coil normally would in a bipolar stepper).   As a result, the controller only needs to select which of the two coils to pass current through in order to change the magnetic polarity, and only a positive current is required to be generated.  Due to this simplified control mechanism which uses only half of each coil, the torque of unipolar motors are usually much lower, but the overall cost of the system is much cheaper. The simplicity of the unipolar controller also means that you cannot use it to run a bipolar stepper motor.&lt;br /&gt;
&lt;br /&gt;
===Magnets===&lt;br /&gt;
=====Permanent Magnet=====&lt;br /&gt;
Permanent magnet motors are small, low torque, and inexpensive. They use a permanent magnet in the rotor that is attracted or repelled by magnetic field generated by the stator coils. Step angles are often 7.5 or 15 degrees, and the motors are usually unipolar.&lt;br /&gt;
&lt;br /&gt;
=====Variable Reluctance=====&lt;br /&gt;
The rotor of a variable reluctance stepper is made of iron, and it therefore aligns with the magnetic field generated by the stator coils. Since it doesn’t use a permanent magnet, it doesn’t matter which direction the current flows as long as each coil is wound in the opposite direction as the coil across from it. Therefore, variable reluctance steppers are unipolar and are typically designed to have larger step angles of 15 or more degrees.&lt;br /&gt;
&lt;br /&gt;
=====Hybrid=====&lt;br /&gt;
Hybrid Motors dominate the stepper motor world – they use a combination of characteristics from permanent magnet and variable reluctance steppers and have the best torque and speed, but are more expensive to produce. Step angles are typically 0.9 to 3.75 degrees, giving much better step resolution.&lt;br /&gt;
&lt;br /&gt;
===Drive===&lt;br /&gt;
=====Chopper Drive=====&lt;br /&gt;
Chopper Drive is an electronic control technique which allows specific motors to produce more power, torque, speed, and be more efficient.  Instead of relying on the resistance of the coil wiring, the inductance of the wiring is exploited by sophisticated control electronics as a short-term limitation of motor current.  Motor Manufacturers don’t do a good job of distinguishing motors suitable for use with Chopper Drive electronics.  The motors will often be large, square, with very low resistance.&lt;br /&gt;
=====Resistive Limited=====&lt;br /&gt;
Small, inexpensive steppers are designed to be built and controlled as cheaply as possible.  To simplify the control electronics, the length and thickness of the wire in the coils is selected for a particular control voltage.  This allows the coil itself to regulate the power available to the motor – provided the appropriate voltage is used, of course.  We call this type of motor Resistive Limited.&lt;br /&gt;
&lt;br /&gt;
==How it Works==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Stepper_back_web.jpg|left|thumb|230px|Cross-Section of a Hybrid Bipolar Stepper]]&lt;br /&gt;
&lt;br /&gt;
===Hybrid Bipolar Steppers===&lt;br /&gt;
This section of the primer will cover the general principle of operation for stepper motors. While this information is by no means necessary to use a stepper motor, those who are curious about their inner workings may read on. &lt;br /&gt;
&lt;br /&gt;
The thumbnail to the left is a cross-sectional view of the inside of a hybrid bipolar stepper motor. As you can see, it has eight poles with six teeth each. This motor contains two coils- one wrapping the odd-numbered poles, and the other wrapping the even-numbered poles. The steel end-cap in the center of the image covers a cylindrical permanent magnet which surrounds the shaft. &lt;br /&gt;
&lt;br /&gt;
If positive current is sent to the odd-numbered coil, poles 1 and 5 are magnetized as south, and poles 3 and 7 are magnetized as north. Assuming the permanent magnet in the center of the motor has its north pole facing toward us, this will result in the rotor turning so that the teeth line up with stator poles 1 and 5, as they are in the image. At the same time, poles 3 and 7 will become aligned on the opposite end of the motor, where the gear on the rotor is permanently offset by the width of one tooth and the permanent magnet has magnetized the rotor as south. The rotation of the motor is continued by sending negative current through the even-numbered phase, then negative current through the odd-numbered phase, then positive current through the even-numbered phase, and so on. The stepper controller can reverse the direction of rotation simply by reversing this sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Hybrid Unipolar Steppers===&lt;br /&gt;
The operation of a hybrid unipolar stepper is very similar to the bipolar stepper described above, except that each pole has two seperate coils wound in opposite directions. This results in four phases which only require positive current to operate. Rather than alternating the direction of current, the motor controller simply sends positive current to the appropriate half of the coil.&lt;br /&gt;
&lt;br /&gt;
==Controlling the Stepper Motor==&lt;br /&gt;
&lt;br /&gt;
The following information has been derived from using the 3308 - “Bipolar-Hybrid-Chopper Drive”  stepper motor connected to a 1063 - PhidgetStepper Bipolar 1-Motor controller.&lt;br /&gt;
===Setting the Current Limit===&lt;br /&gt;
The current limit is an important control property of stepper controllers. Since many stepper motors have a very low coil resistance, the current through the coils cannot “self-regulate” to a safe level on their own.  They require the sophisticated control techniques of a Chopper Drive, which are used in the 1063 PhidgetStepper controller.  As a result, the maximum current allowed should be explicitly set.&lt;br /&gt;
There are many factors that influence what the current limit should be set to. These include, but are not limited to,the acceleration and speed of the stepper, the supply voltage, applied torque, motor inductance, and coil resistance. The process of choosing the current limit can be simplified by following some general rules of thumb. Below are a set of speed vs. current graphs for the 3308 stepper with various power supplies. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Graph12v.jpg|border]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Graph24v.jpg|border]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Graph30v.jpg|border]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the preceding graphs, the “actual speed” of the motor is the maximum speed attainable in a real world test done with no load on the motor, but at very high acceleration.  The “max speed” shows the limitation on speed imposed by the inductance of the motor coils at a given supply voltage.  Given that the 1063 controller is only able to run at a maximum speed of 2048 full steps per second, our graphs don’t show data at higher speeds. &lt;br /&gt;
&lt;br /&gt;
When the current limit is set low and the acceleration is high, the motor will not be able to provide enough power to accelerate itself and the load it’s driving.  The motor also has to overcome friction losses within the system, and do work on the load - for example, lifting a weight.  By increasing the current limit, more current and power is made available to accelerate and maintain maximum speeds.  This can be seen on any of the graphs in the initial steep ramp of the actual speed.  As the current limit increases, the motor is able to achieve higher speeds.&lt;br /&gt;
&lt;br /&gt;
In the case of this particular motor, the large inductance of the coils - great for producing lots of torque, quickly overwhelms a 12V power supply.  To get higher speeds and more performance out of this motor, higher supply voltages are necessary.  Compare the actual speed curve on the 12V graph to the 30V graph.  At 30V, the motor is able to achieve a much higher speed.  It’s important to remember that the actual speed was measured at very high accelerations - by lowering acceleration, higher velocities can be achieved.  Of course, if your motor is doing a lot of work, you’ll need to supply enough current to produce the necessary torque, therefore limiting the maximum speed. &lt;br /&gt;
&lt;br /&gt;
There is no point in setting the current limit to be greater than the motor’s rated current- the increased inductance will only further limit the motor speed. In this case, the 30V graph shows that it’s not feasible to operate this motor at maximum torque (1.7 Amps) at a speed greater than 1100 full steps per second. By reducing the current limit, greater speeds are possible, but less torque will be available.  Most motors designed for Chopper Drive control can operate at much higher voltages, but Phidgets Inc. does not carry a controller that can provide these voltages at this time.&lt;br /&gt;
&lt;br /&gt;
Note that just because you have set the current limit to some amount (for the sake of example let&#039;s say 2A) the motor will not draw 2A at all times.  The motor will only draw as much current as it needs.  This means that if there is only a small load on the motor and it is spinning at less than its top speed the motor might only draw a small fraction of the allotted 2A.  Even as low as 300 or 400mA.  As more load or higher speed is applied, the current usage will go up until the controller is giving the motor the full current limit. As a motor draws more current, it will also produce more heat. It is normal for a stepper motor to be hot to the touch after running for a while. If the motor is getting very hot, you may be trying to drive too large a load for that particular motor.&lt;br /&gt;
&lt;br /&gt;
===Setting the Acceleration===&lt;br /&gt;
The acceleration of a stepper motor is an important consideration when driving a load.  Setting the acceleration too high can result in the motor stalling, especially with a heavy load. Try to use low acceleration in high-torque applications.&lt;br /&gt;
&lt;br /&gt;
==Stepping Modes==&lt;br /&gt;
&lt;br /&gt;
===Full Stepping===&lt;br /&gt;
This is the default mode of stepping for bipolar motors, where both phases of the motor are controlled by two square waves of current. One wave lags behind the other by 90 degrees, and the motion of the motor is locked to these waves. A full step is completed when the square waves advance by 90 degrees. Since both phases are always fully energized, full stepping provides the best torque. &lt;br /&gt;
&lt;br /&gt;
===Half Stepping===&lt;br /&gt;
In this stepping mode, the controller alternates between having one phase energized and both phases energized. This results in the rotor pausing at half-steps in between the poles, effectively halving the step angle. However, since the current to each coil cannot be exactly balanced, the angle that the rotor comes to rest at between poles may not be exactly half the step angle. The downside to half stepping is that the motor will have less torque on the steps when only one phase is energized. &lt;br /&gt;
&lt;br /&gt;
===Mini/Micro-stepping===&lt;br /&gt;
By controlling the the relative current of both phases, the rotor position can come to rest at various equally spaced sub-steps between the two phases. This is achieved by following the same procedure for Full Stepping, except that the current supplied more closely resembles a sine wave rather than a square wave. Some bipolar controllers are designed to micro-step at low speeds to allow for smooth rotation.&lt;br /&gt;
&lt;br /&gt;
==Selecting a Gearbox==&lt;br /&gt;
&lt;br /&gt;
Using a stepper motor with a gearbox can be a good solution in applications that need very low rotation speeds and/or lots of torque.  Selecting a gearbox to attach to the stepper will result in increasing the output torque and decreasing the speed.  &lt;br /&gt;
Simply, the Gearbox Output Speed is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \text{Output Speed} =\frac{\text{Motor Speed}}{\text{Gearbox Ratio}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Although the reduction ratio plays a large part in determining the Gearbox Output Torque, there is also an inefficiency that is introduced through the use of a gearbox.  Some of the torque of the motor is internally converted into heat and lost. So to calculate the Gearbox Output Torque:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \text{Output Torque} = \text{Motor Output Torque  } \times \text{  Gearbox Ratio  } \times \text{  Gearbox Efficiency}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When choosing a stepper motor with a gearbox, keep in mind that the gearbox is rated to sustain a specific amount of torque, beyond which the gearbox could become damaged. This limit is often much lower than the amount of torque specified by the above equation.&lt;br /&gt;
&lt;br /&gt;
The Gearbox Step Angle can be determined by:                  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
 \text{Gearbox Step Angle} = \frac{\text{Motor Step Angle}}{\text{Gearbox Ratio}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Gearbox Terminology===&lt;br /&gt;
&lt;br /&gt;
Here is a short list of terms you might come across when deciding upon a gearbox:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Backlash&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The amount of clearance between mated gear teeth.  Theoretically, the backlash should be “the smaller the better,” but in actual practice, some backlash must be allowed to prevent jamming.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gear Ratio&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gearbox accepts the power (think of power as a torque that rotates) from the motor, reducing the speed (exactly) by a given ratio, while increasing the torque (roughly) by the same ratio – a ratio of the gear head with which the gear head reduces the motor speed.	For example, if a motor has a speed of 500RPM and the reduction ratio is 100:1, the speed of the gear head is 500/100 = 5RPM. This is the actual reduction ratio. The calculated speed from the gear head should be based on this ratio.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gearbox Step Angle&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A full step of the motor will result in the gearbox making a smaller step.  The angle of this step is the step angle of the motor divided by the gearbox reduction ratio. For example, a motor with a step angle of 1.8º and a gearbox with a reduction ratio of 20:1 will have a step angle of 1.8/20 = 0.09º at the output of the gearbox.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gearbox Output Torque&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The gearbox takes the torque from the output shaft of the motor, reducing the speed and increasing the torque. The gearbox, depending on its efficiency, loses some of the torque as it is converted into heat. Therefore, the Gearbox Output Torque is the motor output torque multiplied by the reduction ratio multiplied by the efficiency of the gearbox. For example, a motor with a low-speed output torque of 500g*cm and a gearbox with a reduction ratio of 5:1 and 90% efficiency will have a Gearbox Output Torque of 500*5*0.9 = 2.25 kg*cm. Remember, however, that if the Gearbox Output Torque exceeds the allowable torque the gearbox is rated for, you can cause damage to the gearbox.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gear Trains&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Planetary gearboxes use multiple gear sets to achieve large gear reductions.  Each gear set makes the gearbox longer, and reduces the efficiency.&lt;br /&gt;
&lt;br /&gt;
==Product Comparison Tables==&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Stepper Motor Product Specifications&#039;&#039;&#039;&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Motor Model Number&lt;br /&gt;
! Motor Type (Unipolar/Bipolar) &lt;br /&gt;
! Step Angle (deg)&lt;br /&gt;
! Holding Torque (g•cm)&lt;br /&gt;
! Low-Speed Torque (g•cm)&lt;br /&gt;
! Rated Current (A)&lt;br /&gt;
! Number of Leads&lt;br /&gt;
! Mounting Plate Size&lt;br /&gt;
! Shaft Diameter (mm)&lt;br /&gt;
! Total Weight (g)&lt;br /&gt;
! Motor Length (mm)&lt;br /&gt;
! Motor Size/Diameter (mm)&lt;br /&gt;
! Max Speed* (RPM)&lt;br /&gt;
|-&lt;br /&gt;
| 3300&lt;br /&gt;
| 28BYGH102&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 1.8&lt;br /&gt;
| 600&lt;br /&gt;
| ???&lt;br /&gt;
| 0.67&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-11&lt;br /&gt;
| 5&lt;br /&gt;
| 107&lt;br /&gt;
| 32&lt;br /&gt;
| 28 x 28&lt;br /&gt;
| 600&lt;br /&gt;
|-&lt;br /&gt;
| 3301&lt;br /&gt;
| 35BYG304&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 1.8&lt;br /&gt;
| 1250&lt;br /&gt;
| 1090&lt;br /&gt;
| 1&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-14&lt;br /&gt;
| 5&lt;br /&gt;
| 130&lt;br /&gt;
| 27&lt;br /&gt;
| 35 x 35&lt;br /&gt;
| 600&lt;br /&gt;
|-&lt;br /&gt;
| 3302&lt;br /&gt;
| 42BYGHM810&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 0.9&lt;br /&gt;
| 4800&lt;br /&gt;
| 4280&lt;br /&gt;
| 2.4&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-17&lt;br /&gt;
| 5&lt;br /&gt;
| 362&lt;br /&gt;
| 48&lt;br /&gt;
| 42 x 42&lt;br /&gt;
| ???&lt;br /&gt;
|-&lt;br /&gt;
| 3303&lt;br /&gt;
| 42BYGHW811&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 1.8&lt;br /&gt;
| 4800&lt;br /&gt;
| 4240&lt;br /&gt;
| 2.5&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-17&lt;br /&gt;
| 5&lt;br /&gt;
| 332&lt;br /&gt;
| 48&lt;br /&gt;
| 42 x 42&lt;br /&gt;
| ???&lt;br /&gt;
|-&lt;br /&gt;
| 3304&lt;br /&gt;
| 39BYGS202&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 3.75&lt;br /&gt;
| 750&lt;br /&gt;
| 590&lt;br /&gt;
| 1&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-17&lt;br /&gt;
| 5&lt;br /&gt;
| 171&lt;br /&gt;
| 32&lt;br /&gt;
| 39 x 39&lt;br /&gt;
| 1250&lt;br /&gt;
|-&lt;br /&gt;
| 3305&lt;br /&gt;
| 39BYG013&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 1.8&lt;br /&gt;
| 550&lt;br /&gt;
| 450&lt;br /&gt;
| 0.4&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-17&lt;br /&gt;
| 5&lt;br /&gt;
| 110&lt;br /&gt;
| 20&lt;br /&gt;
| 39 x 39&lt;br /&gt;
| 600&lt;br /&gt;
|-&lt;br /&gt;
| 3306&lt;br /&gt;
| 57BYGH013&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 1.8&lt;br /&gt;
| 4000&lt;br /&gt;
| 3580&lt;br /&gt;
| 1.5&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-23&lt;br /&gt;
| 6.35&lt;br /&gt;
| 424&lt;br /&gt;
| 41&lt;br /&gt;
| 56 x 56&lt;br /&gt;
| 600&lt;br /&gt;
|-&lt;br /&gt;
| 3307&lt;br /&gt;
| 57BYG621&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 1.8&lt;br /&gt;
| 12500&lt;br /&gt;
| 11060&lt;br /&gt;
| 2.2&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-23&lt;br /&gt;
| 6.35&lt;br /&gt;
| 916&lt;br /&gt;
| 76&lt;br /&gt;
| 56 x 56&lt;br /&gt;
| 600&lt;br /&gt;
|-&lt;br /&gt;
| 3308&lt;br /&gt;
| 57BYGHM201&lt;br /&gt;
| Hybrid Bipolar&lt;br /&gt;
| 0.9&lt;br /&gt;
| 9000&lt;br /&gt;
| 8480&lt;br /&gt;
| 1.7&lt;br /&gt;
| 4&lt;br /&gt;
| NEMA-23&lt;br /&gt;
| 6.35&lt;br /&gt;
| 580&lt;br /&gt;
| 50&lt;br /&gt;
| 56 x 56&lt;br /&gt;
| 260&lt;br /&gt;
|-&lt;br /&gt;
| 3314&lt;br /&gt;
| PM42L-048-17&lt;br /&gt;
| Hybrid Unipolar&lt;br /&gt;
| 7.5&lt;br /&gt;
| 950&lt;br /&gt;
| 710&lt;br /&gt;
| 0.28&lt;br /&gt;
| 6&lt;br /&gt;
| N/A&lt;br /&gt;
| 3&lt;br /&gt;
| 138&lt;br /&gt;
| 14.4&lt;br /&gt;
| 42&lt;br /&gt;
| ???&lt;br /&gt;
|-&lt;br /&gt;
| 3315&lt;br /&gt;
| PM25S-048-15&lt;br /&gt;
| Hybrid Unipolar&lt;br /&gt;
| 7.5&lt;br /&gt;
| 140&lt;br /&gt;
| 50&lt;br /&gt;
| 0.1&lt;br /&gt;
| 6&lt;br /&gt;
| N/A&lt;br /&gt;
| 2&lt;br /&gt;
| 31&lt;br /&gt;
| 15&lt;br /&gt;
| 25&lt;br /&gt;
| ???&lt;br /&gt;
|-&lt;br /&gt;
| 3316&lt;br /&gt;
| PM20L-20-14&lt;br /&gt;
| Hybrid Unipolar&lt;br /&gt;
| 18&lt;br /&gt;
| 50&lt;br /&gt;
| 30&lt;br /&gt;
| 0.08&lt;br /&gt;
| 6&lt;br /&gt;
| N/A&lt;br /&gt;
| 1.5&lt;br /&gt;
| 24&lt;br /&gt;
| 16.5&lt;br /&gt;
| 20&lt;br /&gt;
| ???&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
|+&#039;&#039;&#039;Gearbox Stepper Motor Product Specifications&#039;&#039;&#039;&lt;br /&gt;
!Product #&lt;br /&gt;
!Motor Model #&lt;br /&gt;
!Motor Type&lt;br /&gt;
!Step Angle&amp;lt;sup&amp;gt;†&amp;lt;/sup&amp;gt; (deg)&lt;br /&gt;
!Holding Torque*,&amp;lt;sup&amp;gt;†&amp;lt;/sup&amp;gt; (g-cm)&lt;br /&gt;
!Low-speed Torque*,&amp;lt;sup&amp;gt;†&amp;lt;/sup&amp;gt; (g-cm)&lt;br /&gt;
!Rated Current (A)&lt;br /&gt;
!# of Leads&lt;br /&gt;
!Mounting Plate Size&lt;br /&gt;
!Shaft Diameter (mm)&lt;br /&gt;
!Total Weight (g)&lt;br /&gt;
!Motor Length (mm)&lt;br /&gt;
!Gearbox Length (mm)&lt;br /&gt;
!Motor Size/Diameter (mm)&lt;br /&gt;
!Gear Ratio&lt;br /&gt;
!Gearbox Max Torque (g-cm)&lt;br /&gt;
!Gearbox Efficiency&lt;br /&gt;
!Max Speed&amp;lt;sup&amp;gt;†&amp;lt;/sup&amp;gt; (RPM)&lt;br /&gt;
|-&lt;br /&gt;
| 3310||57BYG630-07AG20||Hybrid Bipolar||0.09||30000||30000||2.8||4||NEMA-23||8||1330||73||38||56x56||20:1||30000||||30&lt;br /&gt;
|-&lt;br /&gt;
| 3311||42BYGHW811-AG5.18||Hybrid Bipolar||0.35||24860||17790||2.5||4||NEMA-17||8||513||48||31||42x42||5.18:1||30000||0.9||115&lt;br /&gt;
|-&lt;br /&gt;
| 3312||42BYGHW811-AG26.8||Hybrid Bipolar||0.07||40000||40000||2.5||4||NEMA-17||8||526||48||39||42x42||26.8:1||40000||0.81||22&lt;br /&gt;
|-&lt;br /&gt;
| 3313||42BYGHW811-AG99.5||Hybrid Bipolar||0.02||50000||50000||2.5||4||NEMA-17||8||610||48||47||42x42||99.5:1||50000||0.73||6&lt;br /&gt;
|-&lt;br /&gt;
| 3317||42BYGH40(M)-160-4A||Hybrid Bipolar||0.35||16780||12000||1.6||4||NEMA-17||8||464||40||30||42x42||5.18:1||20000||0.9||115&lt;br /&gt;
|-&lt;br /&gt;
| 3318||42BYGH40(M)-160-4A||Hybrid Bipolar||0.07||30000||30000||1.6||4||NEMA-17||8||464||40||38||42x42||26.8:1||30000||0.8||22&lt;br /&gt;
|-&lt;br /&gt;
| 3319||42BYGH40(M)-160-4A||Hybrid Bipolar||0.02||40000||40000||1.6||4||NEMA-17||8||464||40||46||42x42||99.5:1||40000||0.7||6&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;sup&amp;gt;†&amp;lt;/sup&amp;gt;Step angle, torque values, and max speed are all measured at the output of the gearbox. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;Holding torque and low speed torque for gearbox motors are limited by the max torque that the gearbox is rated to sustain.&lt;br /&gt;
&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Glossary of Terms==&lt;br /&gt;
&lt;br /&gt;
===Motor Terms===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Coil Resistance&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The electrical resistance (to direct current) of the wiring within the motor. This resistance causes some of the energy being applied to the motor to be converted into heat.  Some motors and motor controllers rely solely on the electrical resistance to regulate the current flowing through the motor. The Unipolar Motors we sell, and the 1062 PhidgetStepper Unipolar rely on this inexpensive, but inefficient technique. Other motors will have very low resistance, increasing their efficiency, but requiring very sophisticated control techniques because the resistance cannot regulate the current to a safe level on its own.  The 1063 PhidgetStepper Bipolar controller and our Bipolar motors use this technique, otherwise known as Chopper Drive.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Holding Torque&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Holding Torque is the amount of torque needed to rotate the shaft of the stepper motor while the controller attempts to hold the position, using the maximum current allowed for the motor. Holding Torque is the sum of the magnetic force exerted by the electrical coils to hold the current position, and the detent torque, which is the natural resistance of the motor against rotation due to the permanent magnet inside the motor.  Once the motor begins to rotate, the torque it can exert (at least at low speeds) is Holding Torque minus twice the detent torque (because the motor is now working against the detent). As the motor speed increases, torque begins to decrease.  If the power supply voltage is low, or the inductance of the motor is high, the torque will fall more rapidly.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Motor Inductance&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Stepper motors are built with a specific coil inductance. A high inductance motor will provide a greater amount of torque at low speeds, at the cost of having lower torque at high speeds. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Overhung Load (OHL)&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An external load applied on the output shaft of the gearbox.  This load is often produced if pulleys are mounted directly on the shaft, pulling perpendicular to it. When the OHL exceeds a safe value, the bearings can fail, or the shaft can break from bending fatigue. While OHL and Thrust Load specifications are only available for our gearbox motors, both types of load should be avoided when using any of our motors.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rated Current&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The rated current is the maximum current that should be applied to each coil of the motor.  Current generates heat within the motor, and exceeding the regulated current will cause the motor to overheat.  If the motor is operated in a hot environment, or is enclosed, it can overheat at currents lower than the rated current.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step Angle&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The change in the shaft angle when the motor moves forward or backward by one full step. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Step Accuracy&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Depending on the motor and how it is loaded down, the step positions will vary slightly.  Fortunately, this variance doesn’t accumulate – so if you move the motor by one step or one million steps, the angle that the motor stops at will have the same margin of error.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Thrust load&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A load applied directly in line with the output shaft of the gearbox.  Avoid thrust as much as possible.  If thrust load is unavoidable, keep it to no more than the permissible value.&lt;br /&gt;
&lt;br /&gt;
===Feedback===&lt;br /&gt;
* With Steppers and BLDC motors, you can usually be sure of what they are doing. Some applications still call for using encoders to ensure the motors and mechanisms they are driving are running smoothly.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17128</id>
		<title>Encoder Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17128"/>
		<updated>2012-03-15T21:02:11Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* How they work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1047.jpg|300px|link=]]&lt;br /&gt;
| [[File:3258E_0_Web.jpg|400px|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Encoders are a type of sensor that measures the movement of a mechanical part. For example, a rotary encoder can measure the rotation of a motor, or the position of a dial or knob. A linear encoder could measure the position of a piston in a robot, or it could be used in a digital caliper to precisely measure the width of the object it&#039;s gripping. Both devices work on the same principle, but a rotary encoder can be thought of as a linear encoder that has been &amp;quot;rolled up&amp;quot; into a circle. The majority of the information on this page will be about rotary encoders, although much of it can be applied to linear encoders because of their similarity.&lt;br /&gt;
&lt;br /&gt;
Encoders are often used in control systems, as a type of feedback to ensure that a mechanical part is moving exactly as much as planned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How they work==&lt;br /&gt;
&lt;br /&gt;
[[File:Optical_encoder.jpg|thumb|300px|link=|&#039;&#039;&#039;US Digital Optical Encoder&#039;&#039;&#039;&amp;lt;br/&amp;gt;On the left is an encoder disk for a US Digital optical encoder. The thin lines around the edge of the disk are read by a pair of phototransistors, which are encased in plastic on the top of the circuit board in the right image. One phototransistor is slightly offset from the other, in order to generate a [[#Quadrature Encoding|quadrature]] signal.&amp;lt;br/&amp;gt;[[Media:Optical_encoder.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
An encoder has two major components- a disk, and a detector. The disk is covered with a unique pattern that the detector will be able to read when it moves across them. For example, optical encoders use light sensors to read the contrasting sections on the surface, while a mechanical encoder uses brushes to read gaps in a metal surface on a circuit board. As the detector moves across the pattern, the encoder generates a signal. The encoder then sends this data out to be processed by the encoder interface. You can learn about the specific details of the wide variety of encoder types in the [[#Types of Encoders|Types of Encoders]] section. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quadrature Encoding===&lt;br /&gt;
&lt;br /&gt;
[[File:PhaseRelation.jpg|300px|thumb|link=|&#039;&#039;&#039;Quadrature Phase Difference&#039;&#039;&#039;&amp;lt;br/&amp;gt;The signals in the A and B channels of a quadrature encoder are always offset by 90 degrees. In this diagram, channel A is leading by 90 degrees. If channel B was leading by 90 degrees, it would mean the encoder is rotating in the opposite direction as in this diagram. ]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureDirection.jpg|300px|link=|thumb|&#039;&#039;&#039;Quadrature Direction Change&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates a direction change in quadrature. By comparing the A and B channels, the encoder interface can detect which channel is leading the other. When the leading channel becomes the lagging channel, the direction has changed.]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureTerms.jpg|thumb|link=|&#039;&#039;&#039;Quadrature Terminology&#039;&#039;&#039;&amp;lt;br/&amp;gt;A typical quadrature encoder signal. A cycle consists of a full quadrature cycle, which contains four edges.]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoding is an [[#Absolute vs. Incremental|incremental]] signal method that encoders use to report a change in position and the direction of change. There are two channels, &#039;&#039;&#039;Channel A&#039;&#039;&#039; and &#039;&#039;&#039;Channel B&#039;&#039;&#039;, and they both range from 0 to 5 volts. When the reader for channel A passes over a light area on the encoder disk, it generates a square pulse on channel A. The areas on the encoder wheel or the readers are slightly offset so the reader for channel B will detect areas 90° out of phase from the reader for channel A. By reading the number of pulses and which channel is leading, the encoder interface can tell how far the encoder has rotated, and in which direction. Some encoders also have an &#039;&#039;&#039;index&#039;&#039;&#039; channel, which sends a pulse once every complete rotation. This allows the encoder to behave more like a [[#Absolute vs. Incremental|absolute]] encoder without incurring too much additional cost. &lt;br /&gt;
&lt;br /&gt;
In order to interpret the data sent out by the encoder, you need to connect it to an [[#Encoder Interfaces|encoder interface]]. The interface will convert the signals sent from the encoder into a number of &amp;quot;counts&amp;quot; or &amp;quot;cycles&amp;quot; which can be converted into number of rotations based on the encoder&#039;s &#039;&#039;&#039;CPR&#039;&#039;&#039; (Counts/Cycles per Rotation). The terminology surrounding this specification for encoders can be confusing because there is no consistently agreed upon term to describe these units. Some retailers may call these &amp;quot;pulses&amp;quot; or they might use any of these terms to describe each edge in the signal. In this document, and the rest of the Phidgets Inc. documentation, we will use the term &amp;quot;Cycle&amp;quot; to refer to a complete quadrature cycle, and the term &amp;quot;Edge&amp;quot; will refer to a single rising or falling edge of a pulse in the quadrature signal.&lt;br /&gt;
&lt;br /&gt;
====Interface Resolution====&lt;br /&gt;
&lt;br /&gt;
There are a few ways the encoder interface can interpret the quadrature data. It can update the position variable once per quadrature cycle (that is, when a full pulse has been seen on both channel A and channel B)- this would be considered to have a resolution of &#039;&#039;&#039;&amp;quot;1x&amp;quot;&#039;&#039;&#039;. Or, it could update the position variable twice per quadrature cycle- once when it sees a rising edge on both channels, and again when it sees a falling edge on both channels. The resulting position variable would therefore have double the resolution, so the encoder interface&#039;s resolution would be &#039;&#039;&#039;&amp;quot;2x&amp;quot;&#039;&#039;&#039;. If even more precision is required, the encoder interface could update the position variable whenever an edge is detected on either channel. This would result in a position variable that is &#039;&#039;&#039;&amp;quot;4x&amp;quot;&#039;&#039;&#039; more precise than usual. However, not every encoder interface has the ability to detect these edges precisely enough to get 4x resolution. In order to figure out how much of the position variable corresponds to a full rotation of your encoder, take the &#039;&#039;&#039;Cycles per Rotation&#039;&#039;&#039; of the encoder and multiply it by the encoder interface resolution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Encoder Interfaces===&lt;br /&gt;
&lt;br /&gt;
An encoder interface is a device that converts encoder data into a useful format, such as number of counts and direction of rotation. For example, the [[1057_2 - PhidgetEncoder HighSpeed]] reads in a pair of quadrature signals, and uses them to continually update the position of the encoder, automatically taking care of direction changes. These updates are sent to your computer via USB, and when your program makes a call to get the encoder&#039;s position, it retrieves the latest value that has been sent. The speed at which these updates occur is called the &#039;&#039;&#039;Software Update Rate&#039;&#039;&#039;. The encoder interface will also typically provide power and ground to the encoder. Phidgets Inc. encoder interfaces supply +5V, which is a common voltage requirement for many encoders. If you&#039;re planning on using an optical encoder with one of our encoder interfaces, you should make sure that it&#039;s rated for +5V operation. Mechanical encoders, on the other hand, usually don&#039;t use the +5V pin at all- they just use the pull-up voltage on the data lines and switch to ground to generate the signal.&lt;br /&gt;
&lt;br /&gt;
Even if you&#039;re up to the task of trying to decode the quadrature signal yourself in software, we do not recommend it, because the [[Digital Input Primer|Digital Inputs]] on Phidgets devices do not sample fast enough to detect a quadrature signal.&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
&lt;br /&gt;
The encoders available at Phidgets, Inc. have either four or five wires in the connector: &lt;br /&gt;
&lt;br /&gt;
[[File:EncPinout.jpg|200px|link=]]&lt;br /&gt;
* &#039;&#039;&#039;A Channel&#039;&#039;&#039; - This is one of the output channels the encoder uses to report changes in its position.&lt;br /&gt;
* &#039;&#039;&#039;B Channel&#039;&#039;&#039; - This is the other output channel the encoder uses to report changes in its position. &lt;br /&gt;
* &#039;&#039;&#039;Index&#039;&#039;&#039; &#039;&#039;(Optional)&#039;&#039; - This is an output channel that some encoders have. It sends a pulse every time the encoder makes a full rotation. &lt;br /&gt;
* &#039;&#039;&#039;+5V&#039;&#039;&#039; - This wire supplies power to the encoder.&lt;br /&gt;
* &#039;&#039;&#039;Ground&#039;&#039;&#039; - This wire supplies a ground to the encoder. &lt;br /&gt;
&lt;br /&gt;
The four-wire encoders still use a 5-wire connector, with the index wire not included. This means you can still use these encoders with encoder interfaces that normally accept 5-wire encoders. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of encoder cables available at Phidgets Inc.:&lt;br /&gt;
&lt;br /&gt;
(table: +cable +needs_encoder_input)&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Encoder Cables&#039;&#039;&#039;&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Connector Type&lt;br /&gt;
! Length (cm)&lt;br /&gt;
|-&lt;br /&gt;
| 3019_0 || Molex 50-57-940 || 50&lt;br /&gt;
|-&lt;br /&gt;
| 3032_0 || E4P || 50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Choosing an encoder==&lt;br /&gt;
&lt;br /&gt;
The first thing to consider when choosing an encoder is what degree of accuracy you are going to require.  Is the application a simple human interface (knob or something similar) or are you trying to precisely track the movement of a motor?  Mechanical encoders have the advantage of being extremely cheap, but they don&#039;t have as high accuracy as optical encoders. For applications that don&#039;t require accuracy, they are sufficient.  For any situation where you need high accuracy, the best choice is an optical encoder.&lt;br /&gt;
&lt;br /&gt;
Encoders often advertise having a &#039;&#039;&#039;&amp;quot;detent&amp;quot;&#039;&#039;&#039;. This means that the encoder will have perceptible clicks as it rotates and snaps into position. These types of encoders are best for applications where the encoder will be turned by people, such as a knob or dial. Some of these encoders will also include a pushbutton switch on the shaft, so that a dial can have a secondary function when it is pushed. Many of our encoder interfaces have [[Digital Input Primer|digital inputs]] included so that these switches can be wired into the same board as the encoder.&lt;br /&gt;
&lt;br /&gt;
If you want to buy an encoder to use with Phidgets Inc. encoder interfaces, you should look for encoders with [[#Quadrature Encoding|quadrature]] output, since this is the type of signal our interfaces are meant to interpret.&lt;br /&gt;
&lt;br /&gt;
==Types of encoders==&lt;br /&gt;
&lt;br /&gt;
===Rotary vs. Linear===&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;rotary encoder&#039;&#039;&#039; measures rotation and is often used in dials and knobs, or on the shaft of a motor to keep track of its position. This document focuses primarily on rotary encoders.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;linear encoder&#039;&#039;&#039; measures distance and is typically used in applications that involve precise linear movement, such as digital calipers, scanners, and various robotic applications.&lt;br /&gt;
&lt;br /&gt;
===Absolute vs. Incremental===&lt;br /&gt;
&lt;br /&gt;
[[File:Absolute vs incremental.jpg|thumb|link=|300px|&#039;&#039;&#039;Encoder Disk Diagrams&#039;&#039;&#039;&amp;lt;br/&amp;gt;The diagram on the left shows a simplified example of an incremental [[#Quadrature Encoding|quadrature]] encoder disk, with separate tracks for the A and B channels. The diagram on the right is a simplified representation of an absolute grey code encoder disk.]]&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;incremental&#039;&#039;&#039; encoder uses a series of thin lines on the read surface to keep track of its position. The most common kind of incremental encoder is called a &#039;&#039;&#039;quadrature encoder&#039;&#039;&#039;, which uses two sets of these lines, slightly offset. This allows the encoder to detect the position relative to the starting position, even if the encoder changes direction. Incremental encoders provide output in the form of a series of pulses. This topic is explained further in the [[#Output Circuit|Output Circuit]] section. &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;absolute&#039;&#039;&#039; encoder uses a pattern of concentric rings on the encoder disk to keep track of its position. Each ring provides additional accuracy- the innermost ring reveals which half of the encoder the sensors are currently on, the next one shows which quarter of the encoder the sensors are reading, and so on. Many absolute encoders also have an extra inner track that is the same size as the first, which allows the use of grey code instead of ordinary binary. The advantage to an absolute encoder is that you can immediately tell the position of the encoder as soon as it turns on, since each position on the encoder disk corresponds to a unique sequence of binary bits. The downside of an absolute encoder is that they are much more expensive than incremental encoders.&lt;br /&gt;
Absolute encoders are not compatible with Phidgets Inc. encoder interfaces. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Read Method===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Mechanical&#039;&#039;&#039; encoders consist of a series of wire brushes which move over a circuit board with a quadrature pattern.  When the brushes are over a blank portion of the PCB the circuit remains open, but when the brushes contact metal on the circuit board, they close the circuit. Because of their physical complexity, mechanical encoders need to be larger than the alternatives to get the same degree of accuracy. They are rarely used for high-speed applications because the faster they move, the more likely it is that the encoder signal will be lost in noises caused by the brushes. Also, the brushes wear down quickly in high-speed applications. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Optical&#039;&#039;&#039; encoders work on a similar principle as mechanical encoders except the encoder disk has a number of visual areas instead of slots. An [[LED Primer|LED]] in conjunction with a set of phototransistors perform the same function as the wire brushes in a mechanical encoder. This allows them to spin much faster than a mechanical encoder. An optical encoder&#039;s maximum speed is limited by the response rate of its electronics. Optical encoders use the power supplied by the encoder interface to power their LEDs, and usually they have resistors built-in to keep the current at an optimal level. If you&#039;re using an optical encoder not sold by Phidgets Inc., you should check the data sheet to ensure that the current is limited internally. If it isn&#039;t, you might have to put a resistor in series with the +5V supply line. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Magnetic&#039;&#039;&#039; encoders have a series of magnets on the encoder disk and use Hall Effect sensors to measure the position.   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capacitive&#039;&#039;&#039; encoders work by sensing the capacitance between reader and disk. They are inexpensive and can be made thinner than other types of encoders. The main downside is that they are vulnerable to foreign materials such as dust or dirt.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
&lt;br /&gt;
====Absolute Encoders====&lt;br /&gt;
&lt;br /&gt;
Absolute encoders report their position in the form of a series of binary bits (one bit for every ring on the encoder). Some encoders convert this binary data to BCD, or gray code before sending it out. &lt;br /&gt;
&lt;br /&gt;
====Quadrature Encoders====&lt;br /&gt;
&lt;br /&gt;
[[File:Quadrature output circuits.jpg|thumb|400px|link=|&#039;&#039;&#039;Single-ended Output Types&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates the various types of output a quadrature encoder could provide. Each quadrature channel (A, B, and sometimes Index) would have one of these circuits attached to its sensor.&amp;lt;br/&amp;gt;[[Media:Quadrature output circuits.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
[[File:Encoder-pull-up.jpg|thumb|400px|link=|&#039;&#039;&#039;Adding Pull-Up Resistors&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram shows the basic modification you can make to the encoder cable to reduce pull-up resistance. &amp;lt;br/&amp;gt;[[Media:Encoder-pull-up.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoders have varying methods of output, which affect the resulting waveforms. These methods of output can be classified as either a [[#Single-Ended Signal|Single-Ended Signal]] or a [[#Differential Signal|Differential Signal]].&lt;br /&gt;
&lt;br /&gt;
=====Single-Ended Signal=====&lt;br /&gt;
&lt;br /&gt;
In the case of mechanical encoders, the brushes simply switch to ground. &lt;br /&gt;
The most basic optical encoders will similarly use phototransistors to switch to ground. This method is called &#039;&#039;&#039;&amp;quot;Open Collector&amp;quot;&#039;&#039;&#039;. These devices require pull-up resistors in order to generate the output waveform. They may be included in the encoder, or they may rely on the encoder interface to provide them. Phidget Inc.&#039;s encoder interfaces come with fairly weak pull-up resistors built in. If your encoder requires an external pull-up resistance greater than the Phidgets Inc. interface provides, you won&#039;t be able to use the encoder with Phidgets. If your encoder needs a lower pull-up resistance (and therefore, a &#039;&#039;&#039;stronger&#039;&#039;&#039; pull-up resistor in parallel), it may still work, but at a lower response rate. If you want to make the pull-up resistor stronger, you can add pull-up resistors on the A, and B channels (and the index channel, if applicable) on the cable, as shown in the diagram. When choosing the resistance &#039;&#039;&#039;R&#039;&#039;&#039; for the pull-up, use this formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{R} = \left (\frac{1}{\text{Desired Pull-up Resistance}}-\frac{1}{\text{Existing Pull-up Resistance}} \right )^{-1}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;&amp;quot;Line Drive&amp;quot;&#039;&#039;&#039; output circuit is the opposite of an open collector output- each phototransistor is connected to a pull-up resistor, so they need pull-down resistors or a sinking input to generate the output waveform. Phidgets Inc. encoder interfaces will not work with line drive encoders, because the interface does not come with built in pull-down resistors. &lt;br /&gt;
&lt;br /&gt;
Another output circuit design called &#039;&#039;&#039;&amp;quot;Push-pull&amp;quot;&#039;&#039;&#039; combines the two methods above, connecting each phototransistor to both a pull-up and a pull-down resistor. A push-pull encoder will still work with a Phidgets Inc. encoder interface- the built-in pull-up resistors are unnecessary but won&#039;t cause any problems. Push-pull encoders are desirable because the output waveform can quickly transition from 0 to 5V. A shorter transition time allows the encoder to track faster movement. Another advantage of push-pull is that the output signal is less susceptible to electromagnetic interference, because the output is always strongly connected to either +5V or ground. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Differential Signal=====&lt;br /&gt;
&lt;br /&gt;
[[File:Differential pulses.jpg|thumb|400px|link=|&#039;&#039;&#039;Differential Encoder Noise Protection&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates how a differential encoder is able to ignore noise. Channel Ā is the inverse of channel A, generated inside the encoder. However, when noise is introduced along the wire between the encoder and the encoder interface, the noise will be almost identical on both channels. Since the noise is not inverted on channel Ā, the differential encoder interface can perform a few simple operations to filter out the noise.]]&lt;br /&gt;
&lt;br /&gt;
Differential encoders greatly reduce susceptibility to noise by starting with a push-pull quadrature encoder and then adding an additional push-pull driver for each signal line (A, B and I). In each driver pair, one driver is always transmitting the opposite of the other. This redundancy allows each signal to be interpreted relative to its inverse, rather than relative to ground. Since two wires in the same environment will experience very similar interference, the differential encoder interface will be able to tell the difference between a real pulse and noise. Another advantage of a differential encoder is that it emits less electromagnetic interference. &lt;br /&gt;
&lt;br /&gt;
Phidgets Inc.&#039;s encoder interfaces do not support differential encoders, although as long as each signal is still in the form of 0-5V pulses, you could just hook up the non-inverted wire from each pair (which would cause it to act like a normal single-ended quadrature encoder with no protection against interference).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Interference==&lt;br /&gt;
&lt;br /&gt;
[[File:Shieldedcable.jpg|link=|thumb|300px|&#039;&#039;&#039;Re-purposed USB Cable&#039;&#039;&#039;&amp;lt;br/&amp;gt;This USB cable has been cut at both ends and re-purposed into a shielded encoder cable. One end shows what the cable will look like when soldered, and the other end shows the result after soldering and using heat-shrink tubing.]] &lt;br /&gt;
&lt;br /&gt;
One of the main concerns for encoders is their vulnerability to interference. The encoder reports how far it has moved or rotated by generating a series of pulses. If interference causes an extra pulse to be detected by the encoder interface, it gradually loses track of the encoder&#039;s true position. This is especially true when the cable between the encoder and interface is very long. If your encoder is detecting extra counts, or missing counts, there may be electromagnetic interference in your environment. A good way to test for interference is to keep the encoder stationary and monitor it to see if it registers any counts. If you have an [[#Single-Ended Signal|open collector]] encoder, it will be more susceptible to noise when the A and B lines are at +5V, as opposed to ground. &lt;br /&gt;
&lt;br /&gt;
The heavyweight solution to interference is using a [[#Differential Signal|Differential]] encoder and interface. For a cheaper and more practical solution, you can use a single-ended encoder and connect it to the encoder interface with a section of shielded cable. Shielded encoder cables can easily be made from USB cables. Make sure you solder the ground pin to the shielding. It doesn&#039;t matter which wires the other pins are soldered to as long as you stay consistent on both ends. You can use electrical tape or heat-shrink tubing to make sure the wires don&#039;t short.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
Encoders are sensors designed to keep track of the movement of a mechanical part, usually for the purposes of feedback control or user input. &lt;br /&gt;
&lt;br /&gt;
[[#Quadrature Encoding|Quadrature encoders]] are the most common and inexpensive solution for tracking the amount of movement and direction of movement relative to the starting position. They output position data in the form of pulses on two separate lines, which is what allows the encoder interface to determine the rotation direction.&lt;br /&gt;
&lt;br /&gt;
An encoder can connect to an [[#Encoder Interfaces|encoder interface]], which converts the raw data from the encoder into a useful position variable, sent to your computer via USB. &lt;br /&gt;
&lt;br /&gt;
There is a wide variety of encoders available, each suited to a particular application. [[#Rotary vs. Linear|Rotary]] encoders measure angular movement, like the rotation of a motor shaft, while [[#Rotary vs. Linear|linear]] encoders measure movement along a straight line, like a volume slider. [[#Absolute vs. Incremental|Incremental]] encoders are able to detect movement and direction of movement relative to the encoder&#039;s starting position when it&#039;s powered up, whereas [[#Absolute vs. Incremental|absolute]] encoders will always report their exact position in the form of a binary sequence. Encoders also differ in the [[#Read Method|method they use to read]] the encoder disk. Optical encoders use light, which passes through or bounces off contrasting sections of the encoder disk. Mechanical encoders use brushes that either float at the line voltage when at a gap in the disk, or ground out when brushing against the disk. Magnetic encoders use magnetic sensors positioned over a disk with magnetized sections, and capacitive encoders sense the change in capacitance as different parts of the disk pass between the sensor and the emitter. &lt;br /&gt;
&lt;br /&gt;
Encoders can be susceptible to [[#Interference|interference]], especially when there is a long wire between the encoder and the encoder interface. This problem can be mitigated by adding shielded cable or using a differential encoder instead. &lt;br /&gt;
&lt;br /&gt;
==Products that fall under this category==&lt;br /&gt;
*[[1047 - PhidgetEncoder HighSpeed 4-Input]]&lt;br /&gt;
*[[1057 - PhidgetEncoder HighSpeed]]&lt;br /&gt;
*[[1052 - PhidgetEncoder]]&lt;br /&gt;
*[[3530 - Optical Rotary Encoder ISC3004]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
* Specify our standard encoder connector&lt;br /&gt;
** Steal from the 1047/1057 product manual&lt;br /&gt;
** Spec the connectors part numbers involved&lt;br /&gt;
** List of cables for encoders&lt;br /&gt;
&lt;br /&gt;
===Response Frequency===&lt;br /&gt;
* If we are considering an encoder, this is one of the specs that dictates the maximum speed the encoder can turn at.&lt;br /&gt;
** This is the internal limitation of the electronics in the encoder.  For a given encoder, this limits the maximum number of pulses/counts it can interpret per second.  &lt;br /&gt;
** This spec should probably be destroyed, and replaced with a upper limit on how fast the encoder can turn (in RPM)&lt;br /&gt;
** Each encoder will have a limit dictated by the lower of the maximum mechanical rotation rate, or the response rate of the electronics.&lt;br /&gt;
** Is the ICS3004 360 PPR spec based on counts or pulses?&lt;br /&gt;
&lt;br /&gt;
* The maximum response of a mechanical encoder depends on the amount of contact bounce.  Once the encoder is turning fast enough, individual switch closures are lost in the noise.&lt;br /&gt;
&lt;br /&gt;
===Supply Voltage===&lt;br /&gt;
* We should consider specifying for the encoder interfaces that they provide +5V to the encoder.&lt;br /&gt;
* Any encoder that connects to Phidgets should be rated for +5V operation.&lt;br /&gt;
* This spec is not important for mechanical encoders, that are just a series of switches.  In fact, a mechanical encoder doesn&#039;t even use the +5V power supply.&lt;br /&gt;
* Optical encoders use the power supply for (among other things) powering LEDs.  Usually optical encoders will have a series resistor on the LED to limit the current to an optimal value.  If you are using an optical encoder not sold by Phidgets, please check the datasheet to ensure the LED current is limited internally - otherwise, you might have to put a series resistor on the +5V line.&lt;br /&gt;
&lt;br /&gt;
===Number of Pulses===&lt;br /&gt;
* Consider renaming, or standardizing &lt;br /&gt;
* Counts is the lower resolution spec&lt;br /&gt;
* Pulses is the higher resolution spec.  &lt;br /&gt;
* Do a survey, and figure out what is most prominent.&lt;br /&gt;
* We&#039;d also have to standardize in our code samples and API documentation.&lt;br /&gt;
* 1065_0 returns the lower resolution value.&lt;br /&gt;
* Consider giving both as specs, so customers who have the wrong model (by our standard) can see the difference and infer what we mean.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
* In the case of a mechanical encoder, the output circuit is just switches to ground.&lt;br /&gt;
&lt;br /&gt;
* In the case of optical encoders, there are a lot of different options.&lt;br /&gt;
&lt;br /&gt;
* Very simple optical encoders will use phototransistors as a &#039;switch&#039; to ground.&lt;br /&gt;
* Also called open collector.&lt;br /&gt;
** These encoders may have pullup resistors built into the encoder, or they may rely on the interface to provide them.&lt;br /&gt;
** Phidgets encoder interfaces have reasonably weak pullup resistors built into them.&lt;br /&gt;
** If your encoder specifies an external pullup of greater resistance than the Phidget has integrated, you won&#039;t be able to use the encoder with Phidgets.&lt;br /&gt;
** If your encoder needs a lower resistance (a stronger pullup), it may still work, but at a lower response rate.  If you want to make the pullup stronger, you can add pullup resistors on the cable.  (Show picture / diagram of this)&lt;br /&gt;
* Open collector is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Push Pull optical encoders have more complex electronics, and they can actively drive the A/B lines high or low.  The Phidget still has pullup resistors - which are not necessary, but in practice they don&#039;t cause any problems.&lt;br /&gt;
* Another way of saying this is that Push Pull optical encoders can respond much more quickly than the photo transistor based optical encoders - because they are not relying on pullup resistors, which have to be weak by definition.  The push pull electronics can very quickly drive the cable to 0 or 1.&lt;br /&gt;
* Push pull is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Differential output optical encoders&lt;br /&gt;
** Differential outputs use two push-pull drivers per signal line (A, B, I).  In each driver pair, one driver is always transmitting the opposite of the other. The benefit of differential is it will emit less electromagnetic interference, and is less susceptible to electromagnetic interference on the cable introducing extra counts.&lt;br /&gt;
** Phidgets do not support differential optical encoders.  US Digital makes an adapter board (find part number), which will convert differential signals to single ended, so differential encoders can be used with Phidgets.&lt;br /&gt;
&lt;br /&gt;
* Making your encoder more immune to electromagnetic interference.&lt;br /&gt;
** If you are finding that your encoder is showing extra counts, or losing counts during operation, there may be electromagnetic interference in your environment, coupling into the cable.&lt;br /&gt;
** A good test is to leave the encoder not moving.  If your encoder is open collector, it will be more susceptible to interference when the A/B lines are at +5V (as opposed to ground).  If any counts appear as the encoder is still, interference is likely to blame.&lt;br /&gt;
** The heavyweight solution is to use a differential encoder.&lt;br /&gt;
** A more practical solution is to make a shielded cable.&lt;br /&gt;
*** USB cables are easily repurposed as shielded cables.&lt;br /&gt;
*** Show picture of USB Cable chopped up, soldered onto encoder jacks.&lt;br /&gt;
&lt;br /&gt;
===MAX RPM===&lt;br /&gt;
* Merge this with the maximum RPM based on electrical limitations, &lt;br /&gt;
** We could indicate whether this is a mechanical or electrical limitation.&lt;br /&gt;
&lt;br /&gt;
===Maximum Count Rate===&lt;br /&gt;
* For encoder interfaces&lt;br /&gt;
** This is the maximum count/pulse rate that the interface can receive without losing pulses.&lt;br /&gt;
** Have to standardize if we are talking about high or low res spec.&lt;br /&gt;
&lt;br /&gt;
===Internal Output Pullup Resistance===&lt;br /&gt;
* Discussed above&lt;br /&gt;
** Customer can put resistors on cable in parallel if they want to lower resistance. - Put resistors on A/B channels, to +5V.&lt;br /&gt;
&lt;br /&gt;
===Software Update Rate (typical)===&lt;br /&gt;
* This is how often the number of counts / pulses that have been recognized is streamed up to the PC.&lt;br /&gt;
* Customers often think that when they call a function, we poll the device, but actually the data is being streamed at a constant rate, and they are retrieving the latest values received by our libraries.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input Low Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage below this specified value to be absolutely sure the interface will interpret the signal as a &#039;Zero&#039;.&lt;br /&gt;
* If you are unsure, you can use a multimeter to measure the voltage on A/B/I.  This does not guarantee that this voltage spec will be achieved as the encoder is being operated at high speed.  If you are unsure, and you have an oscilloscope, you can monitor the voltage on A/B/I during operation.  Alternatively, you can operate the encoder at greater speed than you will see in your application and verify it does not lose counts.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input High Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a &#039;One&#039;.&lt;br /&gt;
* See comments above.&lt;br /&gt;
&lt;br /&gt;
=List of encoders=&lt;br /&gt;
* Sourced from Digikey&lt;br /&gt;
* Customers should look for encoders that advertise &#039;Quadrature&#039;&lt;br /&gt;
* Encoders often advertise &#039;detents&#039; - which are perceptible clicks as the encoder is rotated.  Encoders with detents are usually meant for operation by people as control knobs.&lt;br /&gt;
* Encoders for manual (people) operation will often have a built in pushbutton switch on the shaft.  This functionality is seperate from the encoder.  Encoder interfaces available from Phidgets will often have support for digital inputs - this switch can be wired in to a digital input.&lt;br /&gt;
&lt;br /&gt;
==Mechanical encoders==&lt;br /&gt;
* Mechnical encoders are usually very cheap, and meant for manual (people) operation.&lt;br /&gt;
* Mechanical encoders will have a shorter lifespan, measured in the number of rotations.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17124</id>
		<title>Encoder Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17124"/>
		<updated>2012-03-15T20:45:53Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* How they work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1047.jpg|300px|link=]]&lt;br /&gt;
| [[File:3258E_0_Web.jpg|400px|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Encoders are a type of sensor that measures the movement of a mechanical part. For example, a rotary encoder can measure the rotation of a motor, or the position of a dial or knob. A linear encoder could measure the position of a piston in a robot, or it could be used in a digital caliper to precisely measure the width of the object it&#039;s gripping. Both devices work on the same principle, but a rotary encoder can be thought of as a linear encoder that has been &amp;quot;rolled up&amp;quot; into a circle. The majority of the information on this page will be about rotary encoders, although much of it can be applied to linear encoders because of their similarity.&lt;br /&gt;
&lt;br /&gt;
Encoders are often used in control systems, as a type of feedback to ensure that a mechanical part is moving exactly as much as planned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How they work==&lt;br /&gt;
&lt;br /&gt;
[[File:Optical_encoder.jpg|thumb|300px|link=|&#039;&#039;&#039;US Digital Optical Encoder&#039;&#039;&#039;&amp;lt;br/&amp;gt;On the left is an encoder disk for a US Digital optical encoder. The thin lines around the edge of the disk are read by a pair of phototransistors, which are encased in plastic on the top of the circuit board in the right image. One phototransistor is slightly offset from the other, in order to generate a [[#Quadrature Encoding|quadrature]] signal.&amp;lt;br/&amp;gt;[[Media:Optical_encoder.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
An encoder has two major components- a disk, and a detector. The disk is covered with a series of areas that the detector will be able to pick up when it moves across them. For example, optical encoders use light sensors to read the contrasting sections on the surface, while a mechanical encoder uses brushes to read holes in the surface. The encoder then sends this data out to be processed by the encoder interface. You can learn about the specific details of the wide variety of encoder types in the [[#Types of Encoders|Types of Encoders]] section. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quadrature Encoding===&lt;br /&gt;
&lt;br /&gt;
[[File:PhaseRelation.jpg|300px|thumb|link=|&#039;&#039;&#039;Quadrature Phase Difference&#039;&#039;&#039;&amp;lt;br/&amp;gt;The signals in the A and B channels of a quadrature encoder are always offset by 90 degrees. In this diagram, channel A is leading by 90 degrees. If channel B was leading by 90 degrees, it would mean the encoder is rotating in the opposite direction as in this diagram. ]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureDirection.jpg|300px|link=|thumb|&#039;&#039;&#039;Quadrature Direction Change&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates a direction change in quadrature. By comparing the A and B channels, the encoder interface can detect which channel is leading the other. When the leading channel becomes the lagging channel, the direction has changed.]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureTerms.jpg|thumb|link=|&#039;&#039;&#039;Quadrature Terminology&#039;&#039;&#039;&amp;lt;br/&amp;gt;A typical quadrature encoder signal. A cycle consists of a full quadrature cycle, which contains four edges.]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoding is an [[#Absolute vs. Incremental|incremental]] signal method that encoders use to report a change in position and the direction of change. There are two channels, &#039;&#039;&#039;Channel A&#039;&#039;&#039; and &#039;&#039;&#039;Channel B&#039;&#039;&#039;, and they both range from 0 to 5 volts. When the reader for channel A passes over a light area on the encoder disk, it generates a square pulse on channel A. The areas on the encoder wheel or the readers are slightly offset so the reader for channel B will detect areas 90° out of phase from the reader for channel A. By reading the number of pulses and which channel is leading, the encoder interface can tell how far the encoder has rotated, and in which direction. Some encoders also have an &#039;&#039;&#039;index&#039;&#039;&#039; channel, which sends a pulse once every complete rotation. This allows the encoder to behave more like a [[#Absolute vs. Incremental|absolute]] encoder without incurring too much additional cost. &lt;br /&gt;
&lt;br /&gt;
In order to interpret the data sent out by the encoder, you need to connect it to an [[#Encoder Interfaces|encoder interface]]. The interface will convert the signals sent from the encoder into a number of &amp;quot;counts&amp;quot; or &amp;quot;cycles&amp;quot; which can be converted into number of rotations based on the encoder&#039;s &#039;&#039;&#039;CPR&#039;&#039;&#039; (Counts/Cycles per Rotation). The terminology surrounding this specification for encoders can be confusing because there is no consistently agreed upon term to describe these units. Some retailers may call these &amp;quot;pulses&amp;quot; or they might use any of these terms to describe each edge in the signal. In this document, and the rest of the Phidgets Inc. documentation, we will use the term &amp;quot;Cycle&amp;quot; to refer to a complete quadrature cycle, and the term &amp;quot;Edge&amp;quot; will refer to a single rising or falling edge of a pulse in the quadrature signal.&lt;br /&gt;
&lt;br /&gt;
====Interface Resolution====&lt;br /&gt;
&lt;br /&gt;
There are a few ways the encoder interface can interpret the quadrature data. It can update the position variable once per quadrature cycle (that is, when a full pulse has been seen on both channel A and channel B)- this would be considered to have a resolution of &#039;&#039;&#039;&amp;quot;1x&amp;quot;&#039;&#039;&#039;. Or, it could update the position variable twice per quadrature cycle- once when it sees a rising edge on both channels, and again when it sees a falling edge on both channels. The resulting position variable would therefore have double the resolution, so the encoder interface&#039;s resolution would be &#039;&#039;&#039;&amp;quot;2x&amp;quot;&#039;&#039;&#039;. If even more precision is required, the encoder interface could update the position variable whenever an edge is detected on either channel. This would result in a position variable that is &#039;&#039;&#039;&amp;quot;4x&amp;quot;&#039;&#039;&#039; more precise than usual. However, not every encoder interface has the ability to detect these edges precisely enough to get 4x resolution. In order to figure out how much of the position variable corresponds to a full rotation of your encoder, take the &#039;&#039;&#039;Cycles per Rotation&#039;&#039;&#039; of the encoder and multiply it by the encoder interface resolution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Encoder Interfaces===&lt;br /&gt;
&lt;br /&gt;
An encoder interface is a device that converts encoder data into a useful format, such as number of counts and direction of rotation. For example, the [[1057_2 - PhidgetEncoder HighSpeed]] reads in a pair of quadrature signals, and uses them to continually update the position of the encoder, automatically taking care of direction changes. These updates are sent to your computer via USB, and when your program makes a call to get the encoder&#039;s position, it retrieves the latest value that has been sent. The speed at which these updates occur is called the &#039;&#039;&#039;Software Update Rate&#039;&#039;&#039;. The encoder interface will also typically provide power and ground to the encoder. Phidgets Inc. encoder interfaces supply +5V, which is a common voltage requirement for many encoders. If you&#039;re planning on using an optical encoder with one of our encoder interfaces, you should make sure that it&#039;s rated for +5V operation. Mechanical encoders, on the other hand, usually don&#039;t use the +5V pin at all- they just use the pull-up voltage on the data lines and switch to ground to generate the signal.&lt;br /&gt;
&lt;br /&gt;
Even if you&#039;re up to the task of trying to decode the quadrature signal yourself in software, we do not recommend it, because the [[Digital Input Primer|Digital Inputs]] on Phidgets devices do not sample fast enough to detect a quadrature signal.&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
&lt;br /&gt;
The encoders available at Phidgets, Inc. have either four or five wires in the connector: &lt;br /&gt;
&lt;br /&gt;
[[File:EncPinout.jpg|200px|link=]]&lt;br /&gt;
* &#039;&#039;&#039;A Channel&#039;&#039;&#039; - This is one of the output channels the encoder uses to report changes in its position.&lt;br /&gt;
* &#039;&#039;&#039;B Channel&#039;&#039;&#039; - This is the other output channel the encoder uses to report changes in its position. &lt;br /&gt;
* &#039;&#039;&#039;Index&#039;&#039;&#039; &#039;&#039;(Optional)&#039;&#039; - This is an output channel that some encoders have. It sends a pulse every time the encoder makes a full rotation. &lt;br /&gt;
* &#039;&#039;&#039;+5V&#039;&#039;&#039; - This wire supplies power to the encoder.&lt;br /&gt;
* &#039;&#039;&#039;Ground&#039;&#039;&#039; - This wire supplies a ground to the encoder. &lt;br /&gt;
&lt;br /&gt;
The four-wire encoders still use a 5-wire connector, with the index wire not included. This means you can still use these encoders with encoder interfaces that normally accept 5-wire encoders. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of encoder cables available at Phidgets Inc.:&lt;br /&gt;
&lt;br /&gt;
(table: +cable +needs_encoder_input)&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Encoder Cables&#039;&#039;&#039;&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Connector Type&lt;br /&gt;
! Length (cm)&lt;br /&gt;
|-&lt;br /&gt;
| 3019_0 || Molex 50-57-940 || 50&lt;br /&gt;
|-&lt;br /&gt;
| 3032_0 || E4P || 50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Choosing an encoder==&lt;br /&gt;
&lt;br /&gt;
The first thing to consider when choosing an encoder is what degree of accuracy you are going to require.  Is the application a simple human interface (knob or something similar) or are you trying to precisely track the movement of a motor?  Mechanical encoders have the advantage of being extremely cheap, but they don&#039;t have as high accuracy as optical encoders. For applications that don&#039;t require accuracy, they are sufficient.  For any situation where you need high accuracy, the best choice is an optical encoder.&lt;br /&gt;
&lt;br /&gt;
Encoders often advertise having a &#039;&#039;&#039;&amp;quot;detent&amp;quot;&#039;&#039;&#039;. This means that the encoder will have perceptible clicks as it rotates and snaps into position. These types of encoders are best for applications where the encoder will be turned by people, such as a knob or dial. Some of these encoders will also include a pushbutton switch on the shaft, so that a dial can have a secondary function when it is pushed. Many of our encoder interfaces have [[Digital Input Primer|digital inputs]] included so that these switches can be wired into the same board as the encoder.&lt;br /&gt;
&lt;br /&gt;
If you want to buy an encoder to use with Phidgets Inc. encoder interfaces, you should look for encoders with [[#Quadrature Encoding|quadrature]] output, since this is the type of signal our interfaces are meant to interpret.&lt;br /&gt;
&lt;br /&gt;
==Types of encoders==&lt;br /&gt;
&lt;br /&gt;
===Rotary vs. Linear===&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;rotary encoder&#039;&#039;&#039; measures rotation and is often used in dials and knobs, or on the shaft of a motor to keep track of its position. This document focuses primarily on rotary encoders.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;linear encoder&#039;&#039;&#039; measures distance and is typically used in applications that involve precise linear movement, such as digital calipers, scanners, and various robotic applications.&lt;br /&gt;
&lt;br /&gt;
===Absolute vs. Incremental===&lt;br /&gt;
&lt;br /&gt;
[[File:Absolute vs incremental.jpg|thumb|link=|300px|&#039;&#039;&#039;Encoder Disk Diagrams&#039;&#039;&#039;&amp;lt;br/&amp;gt;The diagram on the left shows a simplified example of an incremental [[#Quadrature Encoding|quadrature]] encoder disk, with separate tracks for the A and B channels. The diagram on the right is a simplified representation of an absolute grey code encoder disk.]]&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;incremental&#039;&#039;&#039; encoder uses a series of thin lines on the read surface to keep track of its position. The most common kind of incremental encoder is called a &#039;&#039;&#039;quadrature encoder&#039;&#039;&#039;, which uses two sets of these lines, slightly offset. This allows the encoder to detect the position relative to the starting position, even if the encoder changes direction. Incremental encoders provide output in the form of a series of pulses. This topic is explained further in the [[#Output Circuit|Output Circuit]] section. &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;absolute&#039;&#039;&#039; encoder uses a pattern of concentric rings on the encoder disk to keep track of its position. Each ring provides additional accuracy- the innermost ring reveals which half of the encoder the sensors are currently on, the next one shows which quarter of the encoder the sensors are reading, and so on. Many absolute encoders also have an extra inner track that is the same size as the first, which allows the use of grey code instead of ordinary binary. The advantage to an absolute encoder is that you can immediately tell the position of the encoder as soon as it turns on, since each position on the encoder disk corresponds to a unique sequence of binary bits. The downside of an absolute encoder is that they are much more expensive than incremental encoders.&lt;br /&gt;
Absolute encoders are not compatible with Phidgets Inc. encoder interfaces. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Read Method===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Mechanical&#039;&#039;&#039; encoders consist of a series of wire brushes which move over a circuit board with a quadrature pattern.  When the brushes are over a blank portion of the PCB the circuit remains open, but when the brushes contact metal on the circuit board, they close the circuit. Because of their physical complexity, mechanical encoders need to be larger than the alternatives to get the same degree of accuracy. They are rarely used for high-speed applications because the faster they move, the more likely it is that the encoder signal will be lost in noises caused by the brushes. Also, the brushes wear down quickly in high-speed applications. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Optical&#039;&#039;&#039; encoders work on a similar principle as mechanical encoders except the encoder disk has a number of visual areas instead of slots. An [[LED Primer|LED]] in conjunction with a set of phototransistors perform the same function as the wire brushes in a mechanical encoder. This allows them to spin much faster than a mechanical encoder. An optical encoder&#039;s maximum speed is limited by the response rate of its electronics. Optical encoders use the power supplied by the encoder interface to power their LEDs, and usually they have resistors built-in to keep the current at an optimal level. If you&#039;re using an optical encoder not sold by Phidgets Inc., you should check the data sheet to ensure that the current is limited internally. If it isn&#039;t, you might have to put a resistor in series with the +5V supply line. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Magnetic&#039;&#039;&#039; encoders have a series of magnets on the encoder disk and use Hall Effect sensors to measure the position.   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capacitive&#039;&#039;&#039; encoders work by sensing the capacitance between reader and disk. They are inexpensive and can be made thinner than other types of encoders. The main downside is that they are vulnerable to foreign materials such as dust or dirt.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
&lt;br /&gt;
====Absolute Encoders====&lt;br /&gt;
&lt;br /&gt;
Absolute encoders report their position in the form of a series of binary bits (one bit for every ring on the encoder). Some encoders convert this binary data to BCD, or gray code before sending it out. &lt;br /&gt;
&lt;br /&gt;
====Quadrature Encoders====&lt;br /&gt;
&lt;br /&gt;
[[File:Quadrature output circuits.jpg|thumb|400px|link=|&#039;&#039;&#039;Single-ended Output Types&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates the various types of output a quadrature encoder could provide. Each quadrature channel (A, B, and sometimes Index) would have one of these circuits attached to its sensor.&amp;lt;br/&amp;gt;[[Media:Quadrature output circuits.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
[[File:Encoder-pull-up.jpg|thumb|400px|link=|&#039;&#039;&#039;Adding Pull-Up Resistors&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram shows the basic modification you can make to the encoder cable to reduce pull-up resistance. &amp;lt;br/&amp;gt;[[Media:Encoder-pull-up.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoders have varying methods of output, which affect the resulting waveforms. These methods of output can be classified as either a [[#Single-Ended Signal|Single-Ended Signal]] or a [[#Differential Signal|Differential Signal]].&lt;br /&gt;
&lt;br /&gt;
=====Single-Ended Signal=====&lt;br /&gt;
&lt;br /&gt;
In the case of mechanical encoders, the brushes simply switch to ground. &lt;br /&gt;
The most basic optical encoders will similarly use phototransistors to switch to ground. This method is called &#039;&#039;&#039;&amp;quot;Open Collector&amp;quot;&#039;&#039;&#039;. These devices require pull-up resistors in order to generate the output waveform. They may be included in the encoder, or they may rely on the encoder interface to provide them. Phidget Inc.&#039;s encoder interfaces come with fairly weak pull-up resistors built in. If your encoder requires an external pull-up resistance greater than the Phidgets Inc. interface provides, you won&#039;t be able to use the encoder with Phidgets. If your encoder needs a lower pull-up resistance (and therefore, a &#039;&#039;&#039;stronger&#039;&#039;&#039; pull-up resistor in parallel), it may still work, but at a lower response rate. If you want to make the pull-up resistor stronger, you can add pull-up resistors on the A, and B channels (and the index channel, if applicable) on the cable, as shown in the diagram. When choosing the resistance &#039;&#039;&#039;R&#039;&#039;&#039; for the pull-up, use this formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{R} = \left (\frac{1}{\text{Desired Pull-up Resistance}}-\frac{1}{\text{Existing Pull-up Resistance}} \right )^{-1}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;&amp;quot;Line Drive&amp;quot;&#039;&#039;&#039; output circuit is the opposite of an open collector output- each phototransistor is connected to a pull-up resistor, so they need pull-down resistors or a sinking input to generate the output waveform. Phidgets Inc. encoder interfaces will not work with line drive encoders, because the interface does not come with built in pull-down resistors. &lt;br /&gt;
&lt;br /&gt;
Another output circuit design called &#039;&#039;&#039;&amp;quot;Push-pull&amp;quot;&#039;&#039;&#039; combines the two methods above, connecting each phototransistor to both a pull-up and a pull-down resistor. A push-pull encoder will still work with a Phidgets Inc. encoder interface- the built-in pull-up resistors are unnecessary but won&#039;t cause any problems. Push-pull encoders are desirable because the output waveform can quickly transition from 0 to 5V. A shorter transition time allows the encoder to track faster movement. Another advantage of push-pull is that the output signal is less susceptible to electromagnetic interference, because the output is always strongly connected to either +5V or ground. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Differential Signal=====&lt;br /&gt;
&lt;br /&gt;
[[File:Differential pulses.jpg|thumb|400px|link=|&#039;&#039;&#039;Differential Encoder Noise Protection&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates how a differential encoder is able to ignore noise. Channel Ā is the inverse of channel A, generated inside the encoder. However, when noise is introduced along the wire between the encoder and the encoder interface, the noise will be almost identical on both channels. Since the noise is not inverted on channel Ā, the differential encoder interface can perform a few simple operations to filter out the noise.]]&lt;br /&gt;
&lt;br /&gt;
Differential encoders greatly reduce susceptibility to noise by starting with a push-pull quadrature encoder and then adding an additional push-pull driver for each signal line (A, B and I). In each driver pair, one driver is always transmitting the opposite of the other. This redundancy allows each signal to be interpreted relative to its inverse, rather than relative to ground. Since two wires in the same environment will experience very similar interference, the differential encoder interface will be able to tell the difference between a real pulse and noise. Another advantage of a differential encoder is that it emits less electromagnetic interference. &lt;br /&gt;
&lt;br /&gt;
Phidgets Inc.&#039;s encoder interfaces do not support differential encoders, although as long as each signal is still in the form of 0-5V pulses, you could just hook up the non-inverted wire from each pair (which would cause it to act like a normal single-ended quadrature encoder with no protection against interference).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Interference==&lt;br /&gt;
&lt;br /&gt;
[[File:Shieldedcable.jpg|link=|thumb|300px|&#039;&#039;&#039;Re-purposed USB Cable&#039;&#039;&#039;&amp;lt;br/&amp;gt;This USB cable has been cut at both ends and re-purposed into a shielded encoder cable. One end shows what the cable will look like when soldered, and the other end shows the result after soldering and using heat-shrink tubing.]] &lt;br /&gt;
&lt;br /&gt;
One of the main concerns for encoders is their vulnerability to interference. The encoder reports how far it has moved or rotated by generating a series of pulses. If interference causes an extra pulse to be detected by the encoder interface, it gradually loses track of the encoder&#039;s true position. This is especially true when the cable between the encoder and interface is very long. If your encoder is detecting extra counts, or missing counts, there may be electromagnetic interference in your environment. A good way to test for interference is to keep the encoder stationary and monitor it to see if it registers any counts. If you have an [[#Single-Ended Signal|open collector]] encoder, it will be more susceptible to noise when the A and B lines are at +5V, as opposed to ground. &lt;br /&gt;
&lt;br /&gt;
The heavyweight solution to interference is using a [[#Differential Signal|Differential]] encoder and interface. For a cheaper and more practical solution, you can use a single-ended encoder and connect it to the encoder interface with a section of shielded cable. Shielded encoder cables can easily be made from USB cables. Make sure you solder the ground pin to the shielding. It doesn&#039;t matter which wires the other pins are soldered to as long as you stay consistent on both ends. You can use electrical tape or heat-shrink tubing to make sure the wires don&#039;t short.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
Encoders are sensors designed to keep track of the movement of a mechanical part, usually for the purposes of feedback control or user input. &lt;br /&gt;
&lt;br /&gt;
[[#Quadrature Encoding|Quadrature encoders]] are the most common and inexpensive solution for tracking the amount of movement and direction of movement relative to the starting position. They output position data in the form of pulses on two separate lines, which is what allows the encoder interface to determine the rotation direction.&lt;br /&gt;
&lt;br /&gt;
An encoder can connect to an [[#Encoder Interfaces|encoder interface]], which converts the raw data from the encoder into a useful position variable, sent to your computer via USB. &lt;br /&gt;
&lt;br /&gt;
There is a wide variety of encoders available, each suited to a particular application. [[#Rotary vs. Linear|Rotary]] encoders measure angular movement, like the rotation of a motor shaft, while [[#Rotary vs. Linear|linear]] encoders measure movement along a straight line, like a volume slider. [[#Absolute vs. Incremental|Incremental]] encoders are able to detect movement and direction of movement relative to the encoder&#039;s starting position when it&#039;s powered up, whereas [[#Absolute vs. Incremental|absolute]] encoders will always report their exact position in the form of a binary sequence. Encoders also differ in the [[#Read Method|method they use to read]] the encoder disk. Optical encoders use light, which passes through or bounces off contrasting sections of the encoder disk. Mechanical encoders use brushes that either float at the line voltage when at a gap in the disk, or ground out when brushing against the disk. Magnetic encoders use magnetic sensors positioned over a disk with magnetized sections, and capacitive encoders sense the change in capacitance as different parts of the disk pass between the sensor and the emitter. &lt;br /&gt;
&lt;br /&gt;
Encoders can be susceptible to [[#Interference|interference]], especially when there is a long wire between the encoder and the encoder interface. This problem can be mitigated by adding shielded cable or using a differential encoder instead. &lt;br /&gt;
&lt;br /&gt;
==Products that fall under this category==&lt;br /&gt;
*[[1047 - PhidgetEncoder HighSpeed 4-Input]]&lt;br /&gt;
*[[1057 - PhidgetEncoder HighSpeed]]&lt;br /&gt;
*[[1052 - PhidgetEncoder]]&lt;br /&gt;
*[[3530 - Optical Rotary Encoder ISC3004]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
* Specify our standard encoder connector&lt;br /&gt;
** Steal from the 1047/1057 product manual&lt;br /&gt;
** Spec the connectors part numbers involved&lt;br /&gt;
** List of cables for encoders&lt;br /&gt;
&lt;br /&gt;
===Response Frequency===&lt;br /&gt;
* If we are considering an encoder, this is one of the specs that dictates the maximum speed the encoder can turn at.&lt;br /&gt;
** This is the internal limitation of the electronics in the encoder.  For a given encoder, this limits the maximum number of pulses/counts it can interpret per second.  &lt;br /&gt;
** This spec should probably be destroyed, and replaced with a upper limit on how fast the encoder can turn (in RPM)&lt;br /&gt;
** Each encoder will have a limit dictated by the lower of the maximum mechanical rotation rate, or the response rate of the electronics.&lt;br /&gt;
** Is the ICS3004 360 PPR spec based on counts or pulses?&lt;br /&gt;
&lt;br /&gt;
* The maximum response of a mechanical encoder depends on the amount of contact bounce.  Once the encoder is turning fast enough, individual switch closures are lost in the noise.&lt;br /&gt;
&lt;br /&gt;
===Supply Voltage===&lt;br /&gt;
* We should consider specifying for the encoder interfaces that they provide +5V to the encoder.&lt;br /&gt;
* Any encoder that connects to Phidgets should be rated for +5V operation.&lt;br /&gt;
* This spec is not important for mechanical encoders, that are just a series of switches.  In fact, a mechanical encoder doesn&#039;t even use the +5V power supply.&lt;br /&gt;
* Optical encoders use the power supply for (among other things) powering LEDs.  Usually optical encoders will have a series resistor on the LED to limit the current to an optimal value.  If you are using an optical encoder not sold by Phidgets, please check the datasheet to ensure the LED current is limited internally - otherwise, you might have to put a series resistor on the +5V line.&lt;br /&gt;
&lt;br /&gt;
===Number of Pulses===&lt;br /&gt;
* Consider renaming, or standardizing &lt;br /&gt;
* Counts is the lower resolution spec&lt;br /&gt;
* Pulses is the higher resolution spec.  &lt;br /&gt;
* Do a survey, and figure out what is most prominent.&lt;br /&gt;
* We&#039;d also have to standardize in our code samples and API documentation.&lt;br /&gt;
* 1065_0 returns the lower resolution value.&lt;br /&gt;
* Consider giving both as specs, so customers who have the wrong model (by our standard) can see the difference and infer what we mean.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
* In the case of a mechanical encoder, the output circuit is just switches to ground.&lt;br /&gt;
&lt;br /&gt;
* In the case of optical encoders, there are a lot of different options.&lt;br /&gt;
&lt;br /&gt;
* Very simple optical encoders will use phototransistors as a &#039;switch&#039; to ground.&lt;br /&gt;
* Also called open collector.&lt;br /&gt;
** These encoders may have pullup resistors built into the encoder, or they may rely on the interface to provide them.&lt;br /&gt;
** Phidgets encoder interfaces have reasonably weak pullup resistors built into them.&lt;br /&gt;
** If your encoder specifies an external pullup of greater resistance than the Phidget has integrated, you won&#039;t be able to use the encoder with Phidgets.&lt;br /&gt;
** If your encoder needs a lower resistance (a stronger pullup), it may still work, but at a lower response rate.  If you want to make the pullup stronger, you can add pullup resistors on the cable.  (Show picture / diagram of this)&lt;br /&gt;
* Open collector is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Push Pull optical encoders have more complex electronics, and they can actively drive the A/B lines high or low.  The Phidget still has pullup resistors - which are not necessary, but in practice they don&#039;t cause any problems.&lt;br /&gt;
* Another way of saying this is that Push Pull optical encoders can respond much more quickly than the photo transistor based optical encoders - because they are not relying on pullup resistors, which have to be weak by definition.  The push pull electronics can very quickly drive the cable to 0 or 1.&lt;br /&gt;
* Push pull is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Differential output optical encoders&lt;br /&gt;
** Differential outputs use two push-pull drivers per signal line (A, B, I).  In each driver pair, one driver is always transmitting the opposite of the other. The benefit of differential is it will emit less electromagnetic interference, and is less susceptible to electromagnetic interference on the cable introducing extra counts.&lt;br /&gt;
** Phidgets do not support differential optical encoders.  US Digital makes an adapter board (find part number), which will convert differential signals to single ended, so differential encoders can be used with Phidgets.&lt;br /&gt;
&lt;br /&gt;
* Making your encoder more immune to electromagnetic interference.&lt;br /&gt;
** If you are finding that your encoder is showing extra counts, or losing counts during operation, there may be electromagnetic interference in your environment, coupling into the cable.&lt;br /&gt;
** A good test is to leave the encoder not moving.  If your encoder is open collector, it will be more susceptible to interference when the A/B lines are at +5V (as opposed to ground).  If any counts appear as the encoder is still, interference is likely to blame.&lt;br /&gt;
** The heavyweight solution is to use a differential encoder.&lt;br /&gt;
** A more practical solution is to make a shielded cable.&lt;br /&gt;
*** USB cables are easily repurposed as shielded cables.&lt;br /&gt;
*** Show picture of USB Cable chopped up, soldered onto encoder jacks.&lt;br /&gt;
&lt;br /&gt;
===MAX RPM===&lt;br /&gt;
* Merge this with the maximum RPM based on electrical limitations, &lt;br /&gt;
** We could indicate whether this is a mechanical or electrical limitation.&lt;br /&gt;
&lt;br /&gt;
===Maximum Count Rate===&lt;br /&gt;
* For encoder interfaces&lt;br /&gt;
** This is the maximum count/pulse rate that the interface can receive without losing pulses.&lt;br /&gt;
** Have to standardize if we are talking about high or low res spec.&lt;br /&gt;
&lt;br /&gt;
===Internal Output Pullup Resistance===&lt;br /&gt;
* Discussed above&lt;br /&gt;
** Customer can put resistors on cable in parallel if they want to lower resistance. - Put resistors on A/B channels, to +5V.&lt;br /&gt;
&lt;br /&gt;
===Software Update Rate (typical)===&lt;br /&gt;
* This is how often the number of counts / pulses that have been recognized is streamed up to the PC.&lt;br /&gt;
* Customers often think that when they call a function, we poll the device, but actually the data is being streamed at a constant rate, and they are retrieving the latest values received by our libraries.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input Low Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage below this specified value to be absolutely sure the interface will interpret the signal as a &#039;Zero&#039;.&lt;br /&gt;
* If you are unsure, you can use a multimeter to measure the voltage on A/B/I.  This does not guarantee that this voltage spec will be achieved as the encoder is being operated at high speed.  If you are unsure, and you have an oscilloscope, you can monitor the voltage on A/B/I during operation.  Alternatively, you can operate the encoder at greater speed than you will see in your application and verify it does not lose counts.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input High Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a &#039;One&#039;.&lt;br /&gt;
* See comments above.&lt;br /&gt;
&lt;br /&gt;
=List of encoders=&lt;br /&gt;
* Sourced from Digikey&lt;br /&gt;
* Customers should look for encoders that advertise &#039;Quadrature&#039;&lt;br /&gt;
* Encoders often advertise &#039;detents&#039; - which are perceptible clicks as the encoder is rotated.  Encoders with detents are usually meant for operation by people as control knobs.&lt;br /&gt;
* Encoders for manual (people) operation will often have a built in pushbutton switch on the shaft.  This functionality is seperate from the encoder.  Encoder interfaces available from Phidgets will often have support for digital inputs - this switch can be wired in to a digital input.&lt;br /&gt;
&lt;br /&gt;
==Mechanical encoders==&lt;br /&gt;
* Mechnical encoders are usually very cheap, and meant for manual (people) operation.&lt;br /&gt;
* Mechanical encoders will have a shorter lifespan, measured in the number of rotations.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17122</id>
		<title>Encoder Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17122"/>
		<updated>2012-03-15T20:37:14Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Quadrature Encoding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1047.jpg|300px|link=]]&lt;br /&gt;
| [[File:3258E_0_Web.jpg|400px|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Encoders are a type of sensor that measures the movement of a mechanical part. For example, a rotary encoder can measure the rotation of a motor, or the position of a dial or knob. A linear encoder could measure the position of a piston in a robot, or it could be used in a digital caliper to precisely measure the width of the object it&#039;s gripping. Both devices work on the same principle, but a rotary encoder can be thought of as a linear encoder that has been &amp;quot;rolled up&amp;quot; into a circle. The majority of the information on this page will be about rotary encoders, although much of it can be applied to linear encoders because of their similarity.&lt;br /&gt;
&lt;br /&gt;
Encoders are often used in control systems, as a type of feedback to ensure that a mechanical part is moving exactly as much as planned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How they work==&lt;br /&gt;
&lt;br /&gt;
[[File:Optical_encoder.jpg|thumb|450px|link=|&#039;&#039;&#039;US Digital Optical Encoder&#039;&#039;&#039;&amp;lt;br/&amp;gt;On the left is an encoder disk for a US Digital optical encoder. The thin lines around the edge of the disk are read by a pair of phototransistors, which are encased in plastic on the top of the circuit board in the right image. One phototransistor is slightly offset from the other, in order to generate a [[#Quadrature Encoding|quadrature]] signal.&amp;lt;br/&amp;gt;[[Media:Optical_encoder.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
An encoder has two major components- a disk, and a detector. The disk is covered with a series of areas that the detector will be able to pick up when it moves across them. For example, optical encoders use light sensors to read the contrasting sections on the surface, while a mechanical encoder uses brushes to read holes in the surface. The encoder then sends this data out to be processed by the encoder interface. You can learn about the specific details of the wide variety of encoder types in the [[#Types of Encoders|Types of Encoders]] section. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quadrature Encoding===&lt;br /&gt;
&lt;br /&gt;
[[File:PhaseRelation.jpg|300px|thumb|link=|&#039;&#039;&#039;Quadrature Phase Difference&#039;&#039;&#039;&amp;lt;br/&amp;gt;The signals in the A and B channels of a quadrature encoder are always offset by 90 degrees. In this diagram, channel A is leading by 90 degrees. If channel B was leading by 90 degrees, it would mean the encoder is rotating in the opposite direction as in this diagram. ]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureDirection.jpg|300px|link=|thumb|&#039;&#039;&#039;Quadrature Direction Change&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates a direction change in quadrature. By comparing the A and B channels, the encoder interface can detect which channel is leading the other. When the leading channel becomes the lagging channel, the direction has changed.]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureTerms.jpg|thumb|link=|&#039;&#039;&#039;Quadrature Terminology&#039;&#039;&#039;&amp;lt;br/&amp;gt;A typical quadrature encoder signal. A cycle consists of a full quadrature cycle, which contains four edges.]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoding is an [[#Absolute vs. Incremental|incremental]] signal method that encoders use to report a change in position and the direction of change. There are two channels, &#039;&#039;&#039;Channel A&#039;&#039;&#039; and &#039;&#039;&#039;Channel B&#039;&#039;&#039;, and they both range from 0 to 5 volts. When the reader for channel A passes over a light area on the encoder disk, it generates a square pulse on channel A. The areas on the encoder wheel or the readers are slightly offset so the reader for channel B will detect areas 90° out of phase from the reader for channel A. By reading the number of pulses and which channel is leading, the encoder interface can tell how far the encoder has rotated, and in which direction. Some encoders also have an &#039;&#039;&#039;index&#039;&#039;&#039; channel, which sends a pulse once every complete rotation. This allows the encoder to behave more like a [[#Absolute vs. Incremental|absolute]] encoder without incurring too much additional cost. &lt;br /&gt;
&lt;br /&gt;
In order to interpret the data sent out by the encoder, you need to connect it to an [[#Encoder Interfaces|encoder interface]]. The interface will convert the signals sent from the encoder into a number of &amp;quot;counts&amp;quot; or &amp;quot;cycles&amp;quot; which can be converted into number of rotations based on the encoder&#039;s &#039;&#039;&#039;CPR&#039;&#039;&#039; (Counts/Cycles per Rotation). The terminology surrounding this specification for encoders can be confusing because there is no consistently agreed upon term to describe these units. Some retailers may call these &amp;quot;pulses&amp;quot; or they might use any of these terms to describe each edge in the signal. In this document, and the rest of the Phidgets Inc. documentation, we will use the term &amp;quot;Cycle&amp;quot; to refer to a complete quadrature cycle, and the term &amp;quot;Edge&amp;quot; will refer to a single rising or falling edge of a pulse in the quadrature signal.&lt;br /&gt;
&lt;br /&gt;
====Interface Resolution====&lt;br /&gt;
&lt;br /&gt;
There are a few ways the encoder interface can interpret the quadrature data. It can update the position variable once per quadrature cycle (that is, when a full pulse has been seen on both channel A and channel B)- this would be considered to have a resolution of &#039;&#039;&#039;&amp;quot;1x&amp;quot;&#039;&#039;&#039;. Or, it could update the position variable twice per quadrature cycle- once when it sees a rising edge on both channels, and again when it sees a falling edge on both channels. The resulting position variable would therefore have double the resolution, so the encoder interface&#039;s resolution would be &#039;&#039;&#039;&amp;quot;2x&amp;quot;&#039;&#039;&#039;. If even more precision is required, the encoder interface could update the position variable whenever an edge is detected on either channel. This would result in a position variable that is &#039;&#039;&#039;&amp;quot;4x&amp;quot;&#039;&#039;&#039; more precise than usual. However, not every encoder interface has the ability to detect these edges precisely enough to get 4x resolution. In order to figure out how much of the position variable corresponds to a full rotation of your encoder, take the &#039;&#039;&#039;Cycles per Rotation&#039;&#039;&#039; of the encoder and multiply it by the encoder interface resolution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Encoder Interfaces===&lt;br /&gt;
&lt;br /&gt;
An encoder interface is a device that converts encoder data into a useful format, such as number of counts and direction of rotation. For example, the [[1057_2 - PhidgetEncoder HighSpeed]] reads in a pair of quadrature signals, and uses them to continually update the position of the encoder, automatically taking care of direction changes. These updates are sent to your computer via USB, and when your program makes a call to get the encoder&#039;s position, it retrieves the latest value that has been sent. The speed at which these updates occur is called the &#039;&#039;&#039;Software Update Rate&#039;&#039;&#039;. The encoder interface will also typically provide power and ground to the encoder. Phidgets Inc. encoder interfaces supply +5V, which is a common voltage requirement for many encoders. If you&#039;re planning on using an optical encoder with one of our encoder interfaces, you should make sure that it&#039;s rated for +5V operation. Mechanical encoders, on the other hand, usually don&#039;t use the +5V pin at all- they just use the pull-up voltage on the data lines and switch to ground to generate the signal.&lt;br /&gt;
&lt;br /&gt;
Even if you&#039;re up to the task of trying to decode the quadrature signal yourself in software, we do not recommend it, because the [[Digital Input Primer|Digital Inputs]] on Phidgets devices do not sample fast enough to detect a quadrature signal.&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
&lt;br /&gt;
The encoders available at Phidgets, Inc. have either four or five wires in the connector: &lt;br /&gt;
&lt;br /&gt;
[[File:EncPinout.jpg|200px|link=]]&lt;br /&gt;
* &#039;&#039;&#039;A Channel&#039;&#039;&#039; - This is one of the output channels the encoder uses to report changes in its position.&lt;br /&gt;
* &#039;&#039;&#039;B Channel&#039;&#039;&#039; - This is the other output channel the encoder uses to report changes in its position. &lt;br /&gt;
* &#039;&#039;&#039;Index&#039;&#039;&#039; &#039;&#039;(Optional)&#039;&#039; - This is an output channel that some encoders have. It sends a pulse every time the encoder makes a full rotation. &lt;br /&gt;
* &#039;&#039;&#039;+5V&#039;&#039;&#039; - This wire supplies power to the encoder.&lt;br /&gt;
* &#039;&#039;&#039;Ground&#039;&#039;&#039; - This wire supplies a ground to the encoder. &lt;br /&gt;
&lt;br /&gt;
The four-wire encoders still use a 5-wire connector, with the index wire not included. This means you can still use these encoders with encoder interfaces that normally accept 5-wire encoders. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of encoder cables available at Phidgets Inc.:&lt;br /&gt;
&lt;br /&gt;
(table: +cable +needs_encoder_input)&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Encoder Cables&#039;&#039;&#039;&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Connector Type&lt;br /&gt;
! Length (cm)&lt;br /&gt;
|-&lt;br /&gt;
| 3019_0 || Molex 50-57-940 || 50&lt;br /&gt;
|-&lt;br /&gt;
| 3032_0 || E4P || 50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Choosing an encoder==&lt;br /&gt;
&lt;br /&gt;
The first thing to consider when choosing an encoder is what degree of accuracy you are going to require.  Is the application a simple human interface (knob or something similar) or are you trying to precisely track the movement of a motor?  Mechanical encoders have the advantage of being extremely cheap, but they don&#039;t have as high accuracy as optical encoders. For applications that don&#039;t require accuracy, they are sufficient.  For any situation where you need high accuracy, the best choice is an optical encoder.&lt;br /&gt;
&lt;br /&gt;
Encoders often advertise having a &#039;&#039;&#039;&amp;quot;detent&amp;quot;&#039;&#039;&#039;. This means that the encoder will have perceptible clicks as it rotates and snaps into position. These types of encoders are best for applications where the encoder will be turned by people, such as a knob or dial. Some of these encoders will also include a pushbutton switch on the shaft, so that a dial can have a secondary function when it is pushed. Many of our encoder interfaces have [[Digital Input Primer|digital inputs]] included so that these switches can be wired into the same board as the encoder.&lt;br /&gt;
&lt;br /&gt;
If you want to buy an encoder to use with Phidgets Inc. encoder interfaces, you should look for encoders with [[#Quadrature Encoding|quadrature]] output, since this is the type of signal our interfaces are meant to interpret.&lt;br /&gt;
&lt;br /&gt;
==Types of encoders==&lt;br /&gt;
&lt;br /&gt;
===Rotary vs. Linear===&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;rotary encoder&#039;&#039;&#039; measures rotation and is often used in dials and knobs, or on the shaft of a motor to keep track of its position. This document focuses primarily on rotary encoders.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;linear encoder&#039;&#039;&#039; measures distance and is typically used in applications that involve precise linear movement, such as digital calipers, scanners, and various robotic applications.&lt;br /&gt;
&lt;br /&gt;
===Absolute vs. Incremental===&lt;br /&gt;
&lt;br /&gt;
[[File:Absolute vs incremental.jpg|thumb|link=|300px|&#039;&#039;&#039;Encoder Disk Diagrams&#039;&#039;&#039;&amp;lt;br/&amp;gt;The diagram on the left shows a simplified example of an incremental [[#Quadrature Encoding|quadrature]] encoder disk, with separate tracks for the A and B channels. The diagram on the right is a simplified representation of an absolute grey code encoder disk.]]&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;incremental&#039;&#039;&#039; encoder uses a series of thin lines on the read surface to keep track of its position. The most common kind of incremental encoder is called a &#039;&#039;&#039;quadrature encoder&#039;&#039;&#039;, which uses two sets of these lines, slightly offset. This allows the encoder to detect the position relative to the starting position, even if the encoder changes direction. Incremental encoders provide output in the form of a series of pulses. This topic is explained further in the [[#Output Circuit|Output Circuit]] section. &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;absolute&#039;&#039;&#039; encoder uses a pattern of concentric rings on the encoder disk to keep track of its position. Each ring provides additional accuracy- the innermost ring reveals which half of the encoder the sensors are currently on, the next one shows which quarter of the encoder the sensors are reading, and so on. Many absolute encoders also have an extra inner track that is the same size as the first, which allows the use of grey code instead of ordinary binary. The advantage to an absolute encoder is that you can immediately tell the position of the encoder as soon as it turns on, since each position on the encoder disk corresponds to a unique sequence of binary bits. The downside of an absolute encoder is that they are much more expensive than incremental encoders.&lt;br /&gt;
Absolute encoders are not compatible with Phidgets Inc. encoder interfaces. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Read Method===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Mechanical&#039;&#039;&#039; encoders consist of a series of wire brushes which move over a circuit board with a quadrature pattern.  When the brushes are over a blank portion of the PCB the circuit remains open, but when the brushes contact metal on the circuit board, they close the circuit. Because of their physical complexity, mechanical encoders need to be larger than the alternatives to get the same degree of accuracy. They are rarely used for high-speed applications because the faster they move, the more likely it is that the encoder signal will be lost in noises caused by the brushes. Also, the brushes wear down quickly in high-speed applications. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Optical&#039;&#039;&#039; encoders work on a similar principle as mechanical encoders except the encoder disk has a number of visual areas instead of slots. An [[LED Primer|LED]] in conjunction with a set of phototransistors perform the same function as the wire brushes in a mechanical encoder. This allows them to spin much faster than a mechanical encoder. An optical encoder&#039;s maximum speed is limited by the response rate of its electronics. Optical encoders use the power supplied by the encoder interface to power their LEDs, and usually they have resistors built-in to keep the current at an optimal level. If you&#039;re using an optical encoder not sold by Phidgets Inc., you should check the data sheet to ensure that the current is limited internally. If it isn&#039;t, you might have to put a resistor in series with the +5V supply line. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Magnetic&#039;&#039;&#039; encoders have a series of magnets on the encoder disk and use Hall Effect sensors to measure the position.   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capacitive&#039;&#039;&#039; encoders work by sensing the capacitance between reader and disk. They are inexpensive and can be made thinner than other types of encoders. The main downside is that they are vulnerable to foreign materials such as dust or dirt.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
&lt;br /&gt;
====Absolute Encoders====&lt;br /&gt;
&lt;br /&gt;
Absolute encoders report their position in the form of a series of binary bits (one bit for every ring on the encoder). Some encoders convert this binary data to BCD, or gray code before sending it out. &lt;br /&gt;
&lt;br /&gt;
====Quadrature Encoders====&lt;br /&gt;
&lt;br /&gt;
[[File:Quadrature output circuits.jpg|thumb|400px|link=|&#039;&#039;&#039;Single-ended Output Types&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates the various types of output a quadrature encoder could provide. Each quadrature channel (A, B, and sometimes Index) would have one of these circuits attached to its sensor.&amp;lt;br/&amp;gt;[[Media:Quadrature output circuits.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
[[File:Encoder-pull-up.jpg|thumb|400px|link=|&#039;&#039;&#039;Adding Pull-Up Resistors&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram shows the basic modification you can make to the encoder cable to reduce pull-up resistance. &amp;lt;br/&amp;gt;[[Media:Encoder-pull-up.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoders have varying methods of output, which affect the resulting waveforms. These methods of output can be classified as either a [[#Single-Ended Signal|Single-Ended Signal]] or a [[#Differential Signal|Differential Signal]].&lt;br /&gt;
&lt;br /&gt;
=====Single-Ended Signal=====&lt;br /&gt;
&lt;br /&gt;
In the case of mechanical encoders, the brushes simply switch to ground. &lt;br /&gt;
The most basic optical encoders will similarly use phototransistors to switch to ground. This method is called &#039;&#039;&#039;&amp;quot;Open Collector&amp;quot;&#039;&#039;&#039;. These devices require pull-up resistors in order to generate the output waveform. They may be included in the encoder, or they may rely on the encoder interface to provide them. Phidget Inc.&#039;s encoder interfaces come with fairly weak pull-up resistors built in. If your encoder requires an external pull-up resistance greater than the Phidgets Inc. interface provides, you won&#039;t be able to use the encoder with Phidgets. If your encoder needs a lower pull-up resistance (and therefore, a &#039;&#039;&#039;stronger&#039;&#039;&#039; pull-up resistor in parallel), it may still work, but at a lower response rate. If you want to make the pull-up resistor stronger, you can add pull-up resistors on the A, and B channels (and the index channel, if applicable) on the cable, as shown in the diagram. When choosing the resistance &#039;&#039;&#039;R&#039;&#039;&#039; for the pull-up, use this formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{R} = \left (\frac{1}{\text{Desired Pull-up Resistance}}-\frac{1}{\text{Existing Pull-up Resistance}} \right )^{-1}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;&amp;quot;Line Drive&amp;quot;&#039;&#039;&#039; output circuit is the opposite of an open collector output- each phototransistor is connected to a pull-up resistor, so they need pull-down resistors or a sinking input to generate the output waveform. Phidgets Inc. encoder interfaces will not work with line drive encoders, because the interface does not come with built in pull-down resistors. &lt;br /&gt;
&lt;br /&gt;
Another output circuit design called &#039;&#039;&#039;&amp;quot;Push-pull&amp;quot;&#039;&#039;&#039; combines the two methods above, connecting each phototransistor to both a pull-up and a pull-down resistor. A push-pull encoder will still work with a Phidgets Inc. encoder interface- the built-in pull-up resistors are unnecessary but won&#039;t cause any problems. Push-pull encoders are desirable because the output waveform can quickly transition from 0 to 5V. A shorter transition time allows the encoder to track faster movement. Another advantage of push-pull is that the output signal is less susceptible to electromagnetic interference, because the output is always strongly connected to either +5V or ground. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Differential Signal=====&lt;br /&gt;
&lt;br /&gt;
[[File:Differential pulses.jpg|thumb|400px|link=|&#039;&#039;&#039;Differential Encoder Noise Protection&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates how a differential encoder is able to ignore noise. Channel Ā is the inverse of channel A, generated inside the encoder. However, when noise is introduced along the wire between the encoder and the encoder interface, the noise will be almost identical on both channels. Since the noise is not inverted on channel Ā, the differential encoder interface can perform a few simple operations to filter out the noise.]]&lt;br /&gt;
&lt;br /&gt;
Differential encoders greatly reduce susceptibility to noise by starting with a push-pull quadrature encoder and then adding an additional push-pull driver for each signal line (A, B and I). In each driver pair, one driver is always transmitting the opposite of the other. This redundancy allows each signal to be interpreted relative to its inverse, rather than relative to ground. Since two wires in the same environment will experience very similar interference, the differential encoder interface will be able to tell the difference between a real pulse and noise. Another advantage of a differential encoder is that it emits less electromagnetic interference. &lt;br /&gt;
&lt;br /&gt;
Phidgets Inc.&#039;s encoder interfaces do not support differential encoders, although as long as each signal is still in the form of 0-5V pulses, you could just hook up the non-inverted wire from each pair (which would cause it to act like a normal single-ended quadrature encoder with no protection against interference).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Interference==&lt;br /&gt;
&lt;br /&gt;
[[File:Shieldedcable.jpg|link=|thumb|300px|&#039;&#039;&#039;Re-purposed USB Cable&#039;&#039;&#039;&amp;lt;br/&amp;gt;This USB cable has been cut at both ends and re-purposed into a shielded encoder cable. One end shows what the cable will look like when soldered, and the other end shows the result after soldering and using heat-shrink tubing.]] &lt;br /&gt;
&lt;br /&gt;
One of the main concerns for encoders is their vulnerability to interference. The encoder reports how far it has moved or rotated by generating a series of pulses. If interference causes an extra pulse to be detected by the encoder interface, it gradually loses track of the encoder&#039;s true position. This is especially true when the cable between the encoder and interface is very long. If your encoder is detecting extra counts, or missing counts, there may be electromagnetic interference in your environment. A good way to test for interference is to keep the encoder stationary and monitor it to see if it registers any counts. If you have an [[#Single-Ended Signal|open collector]] encoder, it will be more susceptible to noise when the A and B lines are at +5V, as opposed to ground. &lt;br /&gt;
&lt;br /&gt;
The heavyweight solution to interference is using a [[#Differential Signal|Differential]] encoder and interface. For a cheaper and more practical solution, you can use a single-ended encoder and connect it to the encoder interface with a section of shielded cable. Shielded encoder cables can easily be made from USB cables. Make sure you solder the ground pin to the shielding. It doesn&#039;t matter which wires the other pins are soldered to as long as you stay consistent on both ends. You can use electrical tape or heat-shrink tubing to make sure the wires don&#039;t short.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
Encoders are sensors designed to keep track of the movement of a mechanical part, usually for the purposes of feedback control or user input. &lt;br /&gt;
&lt;br /&gt;
[[#Quadrature Encoding|Quadrature encoders]] are the most common and inexpensive solution for tracking the amount of movement and direction of movement relative to the starting position. They output position data in the form of pulses on two separate lines, which is what allows the encoder interface to determine the rotation direction.&lt;br /&gt;
&lt;br /&gt;
An encoder can connect to an [[#Encoder Interfaces|encoder interface]], which converts the raw data from the encoder into a useful position variable, sent to your computer via USB. &lt;br /&gt;
&lt;br /&gt;
There is a wide variety of encoders available, each suited to a particular application. [[#Rotary vs. Linear|Rotary]] encoders measure angular movement, like the rotation of a motor shaft, while [[#Rotary vs. Linear|linear]] encoders measure movement along a straight line, like a volume slider. [[#Absolute vs. Incremental|Incremental]] encoders are able to detect movement and direction of movement relative to the encoder&#039;s starting position when it&#039;s powered up, whereas [[#Absolute vs. Incremental|absolute]] encoders will always report their exact position in the form of a binary sequence. Encoders also differ in the [[#Read Method|method they use to read]] the encoder disk. Optical encoders use light, which passes through or bounces off contrasting sections of the encoder disk. Mechanical encoders use brushes that either float at the line voltage when at a gap in the disk, or ground out when brushing against the disk. Magnetic encoders use magnetic sensors positioned over a disk with magnetized sections, and capacitive encoders sense the change in capacitance as different parts of the disk pass between the sensor and the emitter. &lt;br /&gt;
&lt;br /&gt;
Encoders can be susceptible to [[#Interference|interference]], especially when there is a long wire between the encoder and the encoder interface. This problem can be mitigated by adding shielded cable or using a differential encoder instead. &lt;br /&gt;
&lt;br /&gt;
==Products that fall under this category==&lt;br /&gt;
*[[1047 - PhidgetEncoder HighSpeed 4-Input]]&lt;br /&gt;
*[[1057 - PhidgetEncoder HighSpeed]]&lt;br /&gt;
*[[1052 - PhidgetEncoder]]&lt;br /&gt;
*[[3530 - Optical Rotary Encoder ISC3004]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
* Specify our standard encoder connector&lt;br /&gt;
** Steal from the 1047/1057 product manual&lt;br /&gt;
** Spec the connectors part numbers involved&lt;br /&gt;
** List of cables for encoders&lt;br /&gt;
&lt;br /&gt;
===Response Frequency===&lt;br /&gt;
* If we are considering an encoder, this is one of the specs that dictates the maximum speed the encoder can turn at.&lt;br /&gt;
** This is the internal limitation of the electronics in the encoder.  For a given encoder, this limits the maximum number of pulses/counts it can interpret per second.  &lt;br /&gt;
** This spec should probably be destroyed, and replaced with a upper limit on how fast the encoder can turn (in RPM)&lt;br /&gt;
** Each encoder will have a limit dictated by the lower of the maximum mechanical rotation rate, or the response rate of the electronics.&lt;br /&gt;
** Is the ICS3004 360 PPR spec based on counts or pulses?&lt;br /&gt;
&lt;br /&gt;
* The maximum response of a mechanical encoder depends on the amount of contact bounce.  Once the encoder is turning fast enough, individual switch closures are lost in the noise.&lt;br /&gt;
&lt;br /&gt;
===Supply Voltage===&lt;br /&gt;
* We should consider specifying for the encoder interfaces that they provide +5V to the encoder.&lt;br /&gt;
* Any encoder that connects to Phidgets should be rated for +5V operation.&lt;br /&gt;
* This spec is not important for mechanical encoders, that are just a series of switches.  In fact, a mechanical encoder doesn&#039;t even use the +5V power supply.&lt;br /&gt;
* Optical encoders use the power supply for (among other things) powering LEDs.  Usually optical encoders will have a series resistor on the LED to limit the current to an optimal value.  If you are using an optical encoder not sold by Phidgets, please check the datasheet to ensure the LED current is limited internally - otherwise, you might have to put a series resistor on the +5V line.&lt;br /&gt;
&lt;br /&gt;
===Number of Pulses===&lt;br /&gt;
* Consider renaming, or standardizing &lt;br /&gt;
* Counts is the lower resolution spec&lt;br /&gt;
* Pulses is the higher resolution spec.  &lt;br /&gt;
* Do a survey, and figure out what is most prominent.&lt;br /&gt;
* We&#039;d also have to standardize in our code samples and API documentation.&lt;br /&gt;
* 1065_0 returns the lower resolution value.&lt;br /&gt;
* Consider giving both as specs, so customers who have the wrong model (by our standard) can see the difference and infer what we mean.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
* In the case of a mechanical encoder, the output circuit is just switches to ground.&lt;br /&gt;
&lt;br /&gt;
* In the case of optical encoders, there are a lot of different options.&lt;br /&gt;
&lt;br /&gt;
* Very simple optical encoders will use phototransistors as a &#039;switch&#039; to ground.&lt;br /&gt;
* Also called open collector.&lt;br /&gt;
** These encoders may have pullup resistors built into the encoder, or they may rely on the interface to provide them.&lt;br /&gt;
** Phidgets encoder interfaces have reasonably weak pullup resistors built into them.&lt;br /&gt;
** If your encoder specifies an external pullup of greater resistance than the Phidget has integrated, you won&#039;t be able to use the encoder with Phidgets.&lt;br /&gt;
** If your encoder needs a lower resistance (a stronger pullup), it may still work, but at a lower response rate.  If you want to make the pullup stronger, you can add pullup resistors on the cable.  (Show picture / diagram of this)&lt;br /&gt;
* Open collector is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Push Pull optical encoders have more complex electronics, and they can actively drive the A/B lines high or low.  The Phidget still has pullup resistors - which are not necessary, but in practice they don&#039;t cause any problems.&lt;br /&gt;
* Another way of saying this is that Push Pull optical encoders can respond much more quickly than the photo transistor based optical encoders - because they are not relying on pullup resistors, which have to be weak by definition.  The push pull electronics can very quickly drive the cable to 0 or 1.&lt;br /&gt;
* Push pull is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Differential output optical encoders&lt;br /&gt;
** Differential outputs use two push-pull drivers per signal line (A, B, I).  In each driver pair, one driver is always transmitting the opposite of the other. The benefit of differential is it will emit less electromagnetic interference, and is less susceptible to electromagnetic interference on the cable introducing extra counts.&lt;br /&gt;
** Phidgets do not support differential optical encoders.  US Digital makes an adapter board (find part number), which will convert differential signals to single ended, so differential encoders can be used with Phidgets.&lt;br /&gt;
&lt;br /&gt;
* Making your encoder more immune to electromagnetic interference.&lt;br /&gt;
** If you are finding that your encoder is showing extra counts, or losing counts during operation, there may be electromagnetic interference in your environment, coupling into the cable.&lt;br /&gt;
** A good test is to leave the encoder not moving.  If your encoder is open collector, it will be more susceptible to interference when the A/B lines are at +5V (as opposed to ground).  If any counts appear as the encoder is still, interference is likely to blame.&lt;br /&gt;
** The heavyweight solution is to use a differential encoder.&lt;br /&gt;
** A more practical solution is to make a shielded cable.&lt;br /&gt;
*** USB cables are easily repurposed as shielded cables.&lt;br /&gt;
*** Show picture of USB Cable chopped up, soldered onto encoder jacks.&lt;br /&gt;
&lt;br /&gt;
===MAX RPM===&lt;br /&gt;
* Merge this with the maximum RPM based on electrical limitations, &lt;br /&gt;
** We could indicate whether this is a mechanical or electrical limitation.&lt;br /&gt;
&lt;br /&gt;
===Maximum Count Rate===&lt;br /&gt;
* For encoder interfaces&lt;br /&gt;
** This is the maximum count/pulse rate that the interface can receive without losing pulses.&lt;br /&gt;
** Have to standardize if we are talking about high or low res spec.&lt;br /&gt;
&lt;br /&gt;
===Internal Output Pullup Resistance===&lt;br /&gt;
* Discussed above&lt;br /&gt;
** Customer can put resistors on cable in parallel if they want to lower resistance. - Put resistors on A/B channels, to +5V.&lt;br /&gt;
&lt;br /&gt;
===Software Update Rate (typical)===&lt;br /&gt;
* This is how often the number of counts / pulses that have been recognized is streamed up to the PC.&lt;br /&gt;
* Customers often think that when they call a function, we poll the device, but actually the data is being streamed at a constant rate, and they are retrieving the latest values received by our libraries.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input Low Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage below this specified value to be absolutely sure the interface will interpret the signal as a &#039;Zero&#039;.&lt;br /&gt;
* If you are unsure, you can use a multimeter to measure the voltage on A/B/I.  This does not guarantee that this voltage spec will be achieved as the encoder is being operated at high speed.  If you are unsure, and you have an oscilloscope, you can monitor the voltage on A/B/I during operation.  Alternatively, you can operate the encoder at greater speed than you will see in your application and verify it does not lose counts.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input High Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a &#039;One&#039;.&lt;br /&gt;
* See comments above.&lt;br /&gt;
&lt;br /&gt;
=List of encoders=&lt;br /&gt;
* Sourced from Digikey&lt;br /&gt;
* Customers should look for encoders that advertise &#039;Quadrature&#039;&lt;br /&gt;
* Encoders often advertise &#039;detents&#039; - which are perceptible clicks as the encoder is rotated.  Encoders with detents are usually meant for operation by people as control knobs.&lt;br /&gt;
* Encoders for manual (people) operation will often have a built in pushbutton switch on the shaft.  This functionality is seperate from the encoder.  Encoder interfaces available from Phidgets will often have support for digital inputs - this switch can be wired in to a digital input.&lt;br /&gt;
&lt;br /&gt;
==Mechanical encoders==&lt;br /&gt;
* Mechnical encoders are usually very cheap, and meant for manual (people) operation.&lt;br /&gt;
* Mechanical encoders will have a shorter lifespan, measured in the number of rotations.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17086</id>
		<title>Encoder Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Encoder_Guide&amp;diff=17086"/>
		<updated>2012-03-15T16:23:59Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1047.jpg|300px|link=]]&lt;br /&gt;
| [[File:3258E_0_Web.jpg|400px|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Encoders are a type of sensor that measures the movement of a mechanical part. For example, a rotary encoder can measure the rotation of a motor, or the position of a dial or knob. A linear encoder could measure the position of a piston in a robot, or it could be used in a digital caliper to precisely measure the width of the object it&#039;s gripping. Both devices work on the same principle, but a rotary encoder can be thought of as a linear encoder that has been &amp;quot;rolled up&amp;quot; into a circle. The majority of the information on this page will be about rotary encoders, although much of it can be applied to linear encoders because of their similarity.&lt;br /&gt;
&lt;br /&gt;
Encoders are often used in control systems, as a type of feedback to ensure that a mechanical part is moving exactly as much as planned.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How they work==&lt;br /&gt;
&lt;br /&gt;
[[File:Optical_encoder.jpg|thumb|450px|link=|&#039;&#039;&#039;US Digital Optical Encoder&#039;&#039;&#039;&amp;lt;br/&amp;gt;On the left is an encoder disk for a US Digital optical encoder. The thin lines around the edge of the disk are read by a pair of phototransistors, which are encased in plastic on the top of the circuit board in the right image. One phototransistor is slightly offset from the other, in order to generate a [[#Quadrature Encoding|quadrature]] signal.&amp;lt;br/&amp;gt;[[Media:Optical_encoder.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
An encoder has two major components- a disk, and a detector. The disk is covered with a series of areas that the detector will be able to pick up when it moves across them. For example, optical encoders use light sensors to read the contrasting sections on the surface, while a mechanical encoder uses brushes to read holes in the surface. The encoder then sends this data out to be processed by the encoder interface. You can learn about the specific details of the wide variety of encoder types in the [[#Types of Encoders|Types of Encoders]] section. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quadrature Encoding===&lt;br /&gt;
&lt;br /&gt;
[[File:PhaseRelation.jpg|300px|thumb|link=|&#039;&#039;&#039;Quadrature Phase Difference&#039;&#039;&#039;&amp;lt;br/&amp;gt;The signals in the A and B channels of a quadrature encoder are always offset by 90 degrees. In this diagram, channel A is leading by 90 degrees. If channel B was leading by 90 degrees, it would mean the encoder is rotating in the opposite direction as in this diagram. ]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureDirection.jpg|300px|link=|thumb|&#039;&#039;&#039;Quadrature Direction Change&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates a direction change in quadrature. By comparing the A and B channels, the encoder interface can detect which channel is leading the other. When the leading channel becomes the lagging channel, the direction has changed.]]&lt;br /&gt;
&lt;br /&gt;
[[File:QuadratureTerms.jpg|thumb|link=|&#039;&#039;&#039;Quadrature Terminology&#039;&#039;&#039;&amp;lt;br/&amp;gt;A typical quadrature encoder signal. A cycle consists of a full quadrature cycle, which contains four edges.]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoding is an [[#Absolute vs. Incremental|incremental]] signal method that encoders use to report a change in position and the direction of change. There are two channels, &#039;&#039;&#039;Channel A&#039;&#039;&#039; and &#039;&#039;&#039;Channel B&#039;&#039;&#039;, and they both range from 0 to 5 volts. When the reader for channel A passes over a light area on the encoder disk, it generates a square pulse on channel A. The areas on the encoder wheel or the readers are slightly offset so the reader for channel B will detect areas 90° out of phase from the reader for channel A. By reading the number of pulses and which channel is leading, the encoder interface can tell how far the encoder has rotated, and in which direction. Some encoders also have an &#039;&#039;&#039;index&#039;&#039;&#039; channel, which sends a pulse once every complete rotation. This allows the encoder to behave more like a [[#Absolute vs. Incremental|absolute]] encoder without incurring too much additional cost. &lt;br /&gt;
&lt;br /&gt;
In order to interpret the data sent out by the encoder, you need to connect it to an &#039;&#039;&#039;encoder interface&#039;&#039;&#039;. The interface will convert the signals sent from the encoder into a number of &amp;quot;counts&amp;quot; or &amp;quot;cycles&amp;quot; which can be converted into number of rotations based on the encoder&#039;s &#039;&#039;&#039;CPR&#039;&#039;&#039; (Counts/Cycles per Rotation). The terminology surrounding this specification for encoders can be confusing because there is no consistently agreed upon term to describe these units. Some retailers may call these &amp;quot;pulses&amp;quot; or they might use any of these terms to describe each edge in the signal. In this document, and the rest of the Phidgets Inc. documentation, we will use the term &amp;quot;Cycle&amp;quot; to refer to a complete quadrature cycle, and the term &amp;quot;Edge&amp;quot; will refer to a single rising or falling edge of a pulse in the quadrature signal.&lt;br /&gt;
&lt;br /&gt;
====Interface Resolution====&lt;br /&gt;
&lt;br /&gt;
There are a few ways the encoder interface can interpret the quadrature data. It can update the position variable once per quadrature cycle (that is, when a full pulse has been seen on both channel A and channel B)- this would be considered to have a resolution of &#039;&#039;&#039;&amp;quot;1x&amp;quot;&#039;&#039;&#039;. Or, it could update the position variable twice per quadrature cycle- once when it sees a rising edge on both channels, and again when it sees a falling edge on both channels. The resulting position variable would therefore have double the resolution, so the encoder interface&#039;s resolution would be &#039;&#039;&#039;&amp;quot;2x&amp;quot;&#039;&#039;&#039;. If even more precision is required, the encoder interface could update the position variable whenever an edge is detected on either channel. This would result in a position variable that is &#039;&#039;&#039;&amp;quot;4x&amp;quot;&#039;&#039;&#039; more precise than usual. However, not every encoder interface has the ability to detect these edges precisely enough to get 4x resolution. In order to figure out how much of the position variable corresponds to a full rotation of your encoder, take the &#039;&#039;&#039;Cycles per Rotation&#039;&#039;&#039; of the encoder and multiply it by the encoder interface resolution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Encoder Interfaces===&lt;br /&gt;
&lt;br /&gt;
An encoder interface is a device that converts encoder data into a useful format, such as number of counts and direction of rotation. For example, the [[1057_2 - PhidgetEncoder HighSpeed]] reads in a pair of quadrature signals, and uses them to continually update the position of the encoder, automatically taking care of direction changes. These updates are sent to your computer via USB, and when your program makes a call to get the encoder&#039;s position, it retrieves the latest value that has been sent. The speed at which these updates occur is called the &#039;&#039;&#039;Software Update Rate&#039;&#039;&#039;. The encoder interface will also typically provide power and ground to the encoder. Phidgets Inc. encoder interfaces supply +5V, which is a common voltage requirement for many encoders. If you&#039;re planning on using an optical encoder with one of our encoder interfaces, you should make sure that it&#039;s rated for +5V operation. Mechanical encoders, on the other hand, usually don&#039;t use the +5V pin at all- they just use the pull-up voltage on the data lines and switch to ground to generate the signal.&lt;br /&gt;
&lt;br /&gt;
Even if you&#039;re up to the task of trying to decode the quadrature signal yourself in software, we do not recommend it, because the [[Digital Input Primer|Digital Inputs]] on Phidgets devices do not sample fast enough to detect a quadrature signal.&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
&lt;br /&gt;
The encoders available at Phidgets, Inc. have either four or five wires in the connector: &lt;br /&gt;
&lt;br /&gt;
[[File:EncPinout.jpg|200px|link=]]&lt;br /&gt;
* &#039;&#039;&#039;A Channel&#039;&#039;&#039; - This is one of the output channels the encoder uses to report changes in its position.&lt;br /&gt;
* &#039;&#039;&#039;B Channel&#039;&#039;&#039; - This is the other output channel the encoder uses to report changes in its position. &lt;br /&gt;
* &#039;&#039;&#039;Index&#039;&#039;&#039; &#039;&#039;(Optional)&#039;&#039; - This is an output channel that some encoders have. It sends a pulse every time the encoder makes a full rotation. &lt;br /&gt;
* &#039;&#039;&#039;+5V&#039;&#039;&#039; - This wire supplies power to the encoder.&lt;br /&gt;
* &#039;&#039;&#039;Ground&#039;&#039;&#039; - This wire supplies a ground to the encoder. &lt;br /&gt;
&lt;br /&gt;
The four-wire encoders still use a 5-wire connector, with the index wire not included. This means you can still use these encoders with encoder interfaces that normally accept 5-wire encoders. &lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of encoder cables available at Phidgets Inc.:&lt;br /&gt;
&lt;br /&gt;
(table: +cable +needs_encoder_input)&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Encoder Cables&#039;&#039;&#039;&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Connector Type&lt;br /&gt;
! Length (cm)&lt;br /&gt;
|-&lt;br /&gt;
| 3019_0 || Molex 50-57-940 || 50&lt;br /&gt;
|-&lt;br /&gt;
| 3032_0 || E4P || 50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Choosing an encoder==&lt;br /&gt;
&lt;br /&gt;
The first thing to consider when choosing an encoder is what degree of accuracy you are going to require.  Is the application a simple human interface (knob or something similar) or are you trying to precisely track the movement of a motor?  Mechanical encoders have the advantage of being extremely cheap, but they don&#039;t have as high accuracy as optical encoders. For applications that don&#039;t require accuracy, they are sufficient.  For any situation where you need high accuracy, the best choice is an optical encoder.&lt;br /&gt;
&lt;br /&gt;
Encoders often advertise having a &#039;&#039;&#039;&amp;quot;detent&amp;quot;&#039;&#039;&#039;. This means that the encoder will have perceptible clicks as it rotates and snaps into position. These types of encoders are best for applications where the encoder will be turned by people, such as a knob or dial. Some of these encoders will also include a pushbutton switch on the shaft, so that a dial can have a secondary function when it is pushed. Many of our encoder interfaces have [[Digital Input Primer|digital inputs]] included so that these switches can be wired into the same board as the encoder.&lt;br /&gt;
&lt;br /&gt;
If you want to buy an encoder to use with Phidgets Inc. encoder interfaces, you should look for encoders with [[#Quadrature Encoding|quadrature]] output, since this is the type of signal our interfaces are meant to interpret.&lt;br /&gt;
&lt;br /&gt;
==Types of encoders==&lt;br /&gt;
&lt;br /&gt;
===Rotary vs. Linear===&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;rotary encoder&#039;&#039;&#039; measures rotation and is often used in dials and knobs, or on the shaft of a motor to keep track of its position. This document focuses primarily on rotary encoders.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;linear encoder&#039;&#039;&#039; measures distance and is typically used in applications that involve precise linear movement, such as digital calipers, scanners, and various robotic applications.&lt;br /&gt;
&lt;br /&gt;
===Absolute vs. Incremental===&lt;br /&gt;
&lt;br /&gt;
[[File:Absolute vs incremental.jpg|thumb|link=|300px|&#039;&#039;&#039;Encoder Disk Diagrams&#039;&#039;&#039;&amp;lt;br/&amp;gt;The diagram on the left shows a simplified example of an incremental [[#Quadrature Encoding|quadrature]] encoder disk, with separate tracks for the A and B channels. The diagram on the right is a simplified representation of an absolute grey code encoder disk.]]&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;incremental&#039;&#039;&#039; encoder uses a series of thin lines on the read surface to keep track of its position. The most common kind of incremental encoder is called a &#039;&#039;&#039;quadrature encoder&#039;&#039;&#039;, which uses two sets of these lines, slightly offset. This allows the encoder to detect the position relative to the starting position, even if the encoder changes direction. Incremental encoders provide output in the form of a series of pulses. This topic is explained further in the [[#Output Circuit|Output Circuit]] section. &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;absolute&#039;&#039;&#039; encoder uses a pattern of concentric rings on the encoder disk to keep track of its position. Each ring provides additional accuracy- the innermost ring reveals which half of the encoder the sensors are currently on, the next one shows which quarter of the encoder the sensors are reading, and so on. Many absolute encoders also have an extra inner track that is the same size as the first, which allows the use of grey code instead of ordinary binary. The advantage to an absolute encoder is that you can immediately tell the position of the encoder as soon as it turns on, since each position on the encoder disk corresponds to a unique sequence of binary bits. The downside of an absolute encoder is that they are much more expensive than incremental encoders.&lt;br /&gt;
Absolute encoders are not compatible with Phidgets Inc. encoder interfaces. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Read Method===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Mechanical&#039;&#039;&#039; encoders consist of a series of wire brushes which move over a circuit board with a quadrature pattern.  When the brushes are over a blank portion of the PCB the circuit remains open, but when the brushes contact metal on the circuit board, they close the circuit. Because of their physical complexity, mechanical encoders need to be larger than the alternatives to get the same degree of accuracy. They are rarely used for high-speed applications because the faster they move, the more likely it is that the encoder signal will be lost in noises caused by the brushes. Also, the brushes wear down quickly in high-speed applications. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Optical&#039;&#039;&#039; encoders work on a similar principle as mechanical encoders except the encoder disk has a number of visual areas instead of slots. An [[LED Primer|LED]] in conjunction with a set of phototransistors perform the same function as the wire brushes in a mechanical encoder. This allows them to spin much faster than a mechanical encoder. An optical encoder&#039;s maximum speed is limited by the response rate of its electronics. Optical encoders use the power supplied by the encoder interface to power their LEDs, and usually they have resistors built-in to keep the current at an optimal level. If you&#039;re using an optical encoder not sold by Phidgets Inc., you should check the data sheet to ensure that the current is limited internally. If it isn&#039;t, you might have to put a resistor in series with the +5V supply line. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Magnetic&#039;&#039;&#039; encoders have a series of magnets on the encoder disk and use Hall Effect sensors to measure the position.   &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Capacitive&#039;&#039;&#039; encoders work by sensing the capacitance between reader and disk. They are inexpensive and can be made thinner than other types of encoders. The main downside is that they are vulnerable to foreign materials such as dust or dirt.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
&lt;br /&gt;
====Absolute Encoders====&lt;br /&gt;
&lt;br /&gt;
Absolute encoders report their position in the form of a series of binary bits (one bit for every ring on the encoder). Some encoders convert this binary data to BCD, or gray code before sending it out. &lt;br /&gt;
&lt;br /&gt;
====Quadrature Encoders====&lt;br /&gt;
&lt;br /&gt;
[[File:Quadrature output circuits.jpg|thumb|400px|link=|&#039;&#039;&#039;Single-ended Output Types&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates the various types of output a quadrature encoder could provide. Each quadrature channel (A, B, and sometimes Index) would have one of these circuits attached to its sensor.&amp;lt;br/&amp;gt;[[Media:Quadrature output circuits.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
[[File:Encoder-pull-up.jpg|thumb|400px|link=|&#039;&#039;&#039;Adding Pull-Up Resistors&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram shows the basic modification you can make to the encoder cable to reduce pull-up resistance. &amp;lt;br/&amp;gt;[[Media:Encoder-pull-up.jpg|Full-sized Image]]]]&lt;br /&gt;
&lt;br /&gt;
Quadrature encoders have varying methods of output, which affect the resulting waveforms. These methods of output can be classified as either a [[#Single-Ended Signal|Single-Ended Signal]] or a [[#Differential Signal|Differential Signal]].&lt;br /&gt;
&lt;br /&gt;
=====Single-Ended Signal=====&lt;br /&gt;
&lt;br /&gt;
In the case of mechanical encoders, the brushes simply switch to ground. &lt;br /&gt;
The most basic optical encoders will similarly use phototransistors to switch to ground. This method is called &#039;&#039;&#039;&amp;quot;Open Collector&amp;quot;&#039;&#039;&#039;. These devices require pull-up resistors in order to generate the output waveform. They may be included in the encoder, or they may rely on the encoder interface to provide them. Phidget Inc.&#039;s encoder interfaces come with fairly weak pull-up resistors built in. If your encoder requires an external pull-up resistance greater than the Phidgets Inc. interface provides, you won&#039;t be able to use the encoder with Phidgets. If your encoder needs a lower pull-up resistance (and therefore, a &#039;&#039;&#039;stronger&#039;&#039;&#039; pull-up resistor in parallel), it may still work, but at a lower response rate. If you want to make the pull-up resistor stronger, you can add pull-up resistors on the A, and B channels (and the index channel, if applicable) on the cable, as shown in the diagram. When choosing the resistance &#039;&#039;&#039;R&#039;&#039;&#039; for the pull-up, use this formula:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{R} = \left (\frac{1}{\text{Desired Pull-up Resistance}}-\frac{1}{\text{Existing Pull-up Resistance}} \right )^{-1}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;&amp;quot;Line Drive&amp;quot;&#039;&#039;&#039; output circuit is the opposite of an open collector output- each phototransistor is connected to a pull-up resistor, so they need pull-down resistors or a sinking input to generate the output waveform. Phidgets Inc. encoder interfaces will not work with line drive encoders, because the interface does not come with built in pull-down resistors. &lt;br /&gt;
&lt;br /&gt;
Another output circuit design called &#039;&#039;&#039;&amp;quot;Push-pull&amp;quot;&#039;&#039;&#039; combines the two methods above, connecting each phototransistor to both a pull-up and a pull-down resistor. A push-pull encoder will still work with a Phidgets Inc. encoder interface- the built-in pull-up resistors are unnecessary but won&#039;t cause any problems. Push-pull encoders are desirable because the output waveform can quickly transition from 0 to 5V. A shorter transition time allows the encoder to track faster movement. Another advantage of push-pull is that the output signal is less susceptible to electromagnetic interference, because the output is always strongly connected to either +5V or ground. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Differential Signal=====&lt;br /&gt;
&lt;br /&gt;
[[File:Differential pulses.jpg|thumb|400px|link=|&#039;&#039;&#039;Differential Encoder Noise Protection&#039;&#039;&#039;&amp;lt;br/&amp;gt;This diagram illustrates how a differential encoder is able to ignore noise. Channel Ā is the inverse of channel A, generated inside the encoder. However, when noise is introduced along the wire between the encoder and the encoder interface, the noise will be almost identical on both channels. Since the noise is not inverted on channel Ā, the differential encoder interface can perform a few simple operations to filter out the noise.]]&lt;br /&gt;
&lt;br /&gt;
Differential encoders greatly reduce susceptibility to noise by starting with a push-pull quadrature encoder and then adding an additional push-pull driver for each signal line (A, B and I). In each driver pair, one driver is always transmitting the opposite of the other. This redundancy allows each signal to be interpreted relative to its inverse, rather than relative to ground. Since two wires in the same environment will experience very similar interference, the differential encoder interface will be able to tell the difference between a real pulse and noise. Another advantage of a differential encoder is that it emits less electromagnetic interference. &lt;br /&gt;
&lt;br /&gt;
Phidgets Inc.&#039;s encoder interfaces do not support differential encoders, although as long as each signal is still in the form of 0-5V pulses, you could just hook up the non-inverted wire from each pair (which would cause it to act like a normal single-ended quadrature encoder with no protection against interference).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Interference==&lt;br /&gt;
&lt;br /&gt;
[[File:Shieldedcable.jpg|link=|thumb|300px|&#039;&#039;&#039;Re-purposed USB Cable&#039;&#039;&#039;&amp;lt;br/&amp;gt;This USB cable has been cut at both ends and re-purposed into a shielded encoder cable. One end shows what the cable will look like when soldered, and the other end shows the result after soldering and using heat-shrink tubing.]] &lt;br /&gt;
&lt;br /&gt;
One of the main concerns for encoders is their vulnerability to interference. The encoder reports how far it has moved or rotated by generating a series of pulses. If interference causes an extra pulse to be detected by the encoder interface, it gradually loses track of the encoder&#039;s true position. This is especially true when the cable between the encoder and interface is very long. If your encoder is detecting extra counts, or missing counts, there may be electromagnetic interference in your environment. A good way to test for interference is to keep the encoder stationary and monitor it to see if it registers any counts. If you have an [[#Single-Ended Signal|open collector]] encoder, it will be more susceptible to noise when the A and B lines are at +5V, as opposed to ground. &lt;br /&gt;
&lt;br /&gt;
The heavyweight solution to interference is using a [[#Differential Signal|Differential]] encoder and interface. For a cheaper and more practical solution, you can use a single-ended encoder and connect it to the encoder interface with a section of shielded cable. Shielded encoder cables can easily be made from USB cables. Make sure you solder the ground pin to the shielding. It doesn&#039;t matter which wires the other pins are soldered to as long as you stay consistent on both ends. You can use electrical tape or heat-shrink tubing to make sure the wires don&#039;t short.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
Encoders are sensors designed to keep track of the movement of a mechanical part, usually for the purposes of feedback control or user input. &lt;br /&gt;
&lt;br /&gt;
[[#Quadrature Encoding|Quadrature encoders]] are the most common and inexpensive solution for tracking the amount of movement and direction of movement relative to the starting position. They output position data in the form of pulses on two separate lines, which is what allows the encoder interface to determine the rotation direction.&lt;br /&gt;
&lt;br /&gt;
An encoder can connect to an [[#Encoder Interfaces|encoder interface]], which converts the raw data from the encoder into a useful position variable, sent to your computer via USB. &lt;br /&gt;
&lt;br /&gt;
There is a wide variety of encoders available, each suited to a particular application. [[#Rotary vs. Linear|Rotary]] encoders measure angular movement, like the rotation of a motor shaft, while [[#Rotary vs. Linear|linear]] encoders measure movement along a straight line, like a volume slider. [[#Absolute vs. Incremental|Incremental]] encoders are able to detect movement and direction of movement relative to the encoder&#039;s starting position when it&#039;s powered up, whereas [[#Absolute vs. Incremental|absolute]] encoders will always report their exact position in the form of a binary sequence. Encoders also differ in the [[#Read Method|method they use to read]] the encoder disk. Optical encoders use light, which passes through or bounces off contrasting sections of the encoder disk. Mechanical encoders use brushes that either float at the line voltage when at a gap in the disk, or ground out when brushing against the disk. Magnetic encoders use magnetic sensors positioned over a disk with magnetized sections, and capacitive encoders sense the change in capacitance as different parts of the disk pass between the sensor and the emitter. &lt;br /&gt;
&lt;br /&gt;
Encoders can be susceptible to [[#Interference|interference]], especially when there is a long wire between the encoder and the encoder interface. This problem can be mitigated by adding shielded cable or using a differential encoder instead. &lt;br /&gt;
&lt;br /&gt;
==Products that fall under this category==&lt;br /&gt;
*[[1047 - PhidgetEncoder HighSpeed 4-Input]]&lt;br /&gt;
*[[1057 - PhidgetEncoder HighSpeed]]&lt;br /&gt;
*[[1052 - PhidgetEncoder]]&lt;br /&gt;
*[[3530 - Optical Rotary Encoder ISC3004]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Connector===&lt;br /&gt;
* Specify our standard encoder connector&lt;br /&gt;
** Steal from the 1047/1057 product manual&lt;br /&gt;
** Spec the connectors part numbers involved&lt;br /&gt;
** List of cables for encoders&lt;br /&gt;
&lt;br /&gt;
===Response Frequency===&lt;br /&gt;
* If we are considering an encoder, this is one of the specs that dictates the maximum speed the encoder can turn at.&lt;br /&gt;
** This is the internal limitation of the electronics in the encoder.  For a given encoder, this limits the maximum number of pulses/counts it can interpret per second.  &lt;br /&gt;
** This spec should probably be destroyed, and replaced with a upper limit on how fast the encoder can turn (in RPM)&lt;br /&gt;
** Each encoder will have a limit dictated by the lower of the maximum mechanical rotation rate, or the response rate of the electronics.&lt;br /&gt;
** Is the ICS3004 360 PPR spec based on counts or pulses?&lt;br /&gt;
&lt;br /&gt;
* The maximum response of a mechanical encoder depends on the amount of contact bounce.  Once the encoder is turning fast enough, individual switch closures are lost in the noise.&lt;br /&gt;
&lt;br /&gt;
===Supply Voltage===&lt;br /&gt;
* We should consider specifying for the encoder interfaces that they provide +5V to the encoder.&lt;br /&gt;
* Any encoder that connects to Phidgets should be rated for +5V operation.&lt;br /&gt;
* This spec is not important for mechanical encoders, that are just a series of switches.  In fact, a mechanical encoder doesn&#039;t even use the +5V power supply.&lt;br /&gt;
* Optical encoders use the power supply for (among other things) powering LEDs.  Usually optical encoders will have a series resistor on the LED to limit the current to an optimal value.  If you are using an optical encoder not sold by Phidgets, please check the datasheet to ensure the LED current is limited internally - otherwise, you might have to put a series resistor on the +5V line.&lt;br /&gt;
&lt;br /&gt;
===Number of Pulses===&lt;br /&gt;
* Consider renaming, or standardizing &lt;br /&gt;
* Counts is the lower resolution spec&lt;br /&gt;
* Pulses is the higher resolution spec.  &lt;br /&gt;
* Do a survey, and figure out what is most prominent.&lt;br /&gt;
* We&#039;d also have to standardize in our code samples and API documentation.&lt;br /&gt;
* 1065_0 returns the lower resolution value.&lt;br /&gt;
* Consider giving both as specs, so customers who have the wrong model (by our standard) can see the difference and infer what we mean.&lt;br /&gt;
&lt;br /&gt;
===Output Circuit===&lt;br /&gt;
* In the case of a mechanical encoder, the output circuit is just switches to ground.&lt;br /&gt;
&lt;br /&gt;
* In the case of optical encoders, there are a lot of different options.&lt;br /&gt;
&lt;br /&gt;
* Very simple optical encoders will use phototransistors as a &#039;switch&#039; to ground.&lt;br /&gt;
* Also called open collector.&lt;br /&gt;
** These encoders may have pullup resistors built into the encoder, or they may rely on the interface to provide them.&lt;br /&gt;
** Phidgets encoder interfaces have reasonably weak pullup resistors built into them.&lt;br /&gt;
** If your encoder specifies an external pullup of greater resistance than the Phidget has integrated, you won&#039;t be able to use the encoder with Phidgets.&lt;br /&gt;
** If your encoder needs a lower resistance (a stronger pullup), it may still work, but at a lower response rate.  If you want to make the pullup stronger, you can add pullup resistors on the cable.  (Show picture / diagram of this)&lt;br /&gt;
* Open collector is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Push Pull optical encoders have more complex electronics, and they can actively drive the A/B lines high or low.  The Phidget still has pullup resistors - which are not necessary, but in practice they don&#039;t cause any problems.&lt;br /&gt;
* Another way of saying this is that Push Pull optical encoders can respond much more quickly than the photo transistor based optical encoders - because they are not relying on pullup resistors, which have to be weak by definition.  The push pull electronics can very quickly drive the cable to 0 or 1.&lt;br /&gt;
* Push pull is an example of a single ended drive - as opposed to differential.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Differential output optical encoders&lt;br /&gt;
** Differential outputs use two push-pull drivers per signal line (A, B, I).  In each driver pair, one driver is always transmitting the opposite of the other. The benefit of differential is it will emit less electromagnetic interference, and is less susceptible to electromagnetic interference on the cable introducing extra counts.&lt;br /&gt;
** Phidgets do not support differential optical encoders.  US Digital makes an adapter board (find part number), which will convert differential signals to single ended, so differential encoders can be used with Phidgets.&lt;br /&gt;
&lt;br /&gt;
* Making your encoder more immune to electromagnetic interference.&lt;br /&gt;
** If you are finding that your encoder is showing extra counts, or losing counts during operation, there may be electromagnetic interference in your environment, coupling into the cable.&lt;br /&gt;
** A good test is to leave the encoder not moving.  If your encoder is open collector, it will be more susceptible to interference when the A/B lines are at +5V (as opposed to ground).  If any counts appear as the encoder is still, interference is likely to blame.&lt;br /&gt;
** The heavyweight solution is to use a differential encoder.&lt;br /&gt;
** A more practical solution is to make a shielded cable.&lt;br /&gt;
*** USB cables are easily repurposed as shielded cables.&lt;br /&gt;
*** Show picture of USB Cable chopped up, soldered onto encoder jacks.&lt;br /&gt;
&lt;br /&gt;
===MAX RPM===&lt;br /&gt;
* Merge this with the maximum RPM based on electrical limitations, &lt;br /&gt;
** We could indicate whether this is a mechanical or electrical limitation.&lt;br /&gt;
&lt;br /&gt;
===Maximum Count Rate===&lt;br /&gt;
* For encoder interfaces&lt;br /&gt;
** This is the maximum count/pulse rate that the interface can receive without losing pulses.&lt;br /&gt;
** Have to standardize if we are talking about high or low res spec.&lt;br /&gt;
&lt;br /&gt;
===Internal Output Pullup Resistance===&lt;br /&gt;
* Discussed above&lt;br /&gt;
** Customer can put resistors on cable in parallel if they want to lower resistance. - Put resistors on A/B channels, to +5V.&lt;br /&gt;
&lt;br /&gt;
===Software Update Rate (typical)===&lt;br /&gt;
* This is how often the number of counts / pulses that have been recognized is streamed up to the PC.&lt;br /&gt;
* Customers often think that when they call a function, we poll the device, but actually the data is being streamed at a constant rate, and they are retrieving the latest values received by our libraries.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input Low Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage below this specified value to be absolutely sure the interface will interpret the signal as a &#039;Zero&#039;.&lt;br /&gt;
* If you are unsure, you can use a multimeter to measure the voltage on A/B/I.  This does not guarantee that this voltage spec will be achieved as the encoder is being operated at high speed.  If you are unsure, and you have an oscilloscope, you can monitor the voltage on A/B/I during operation.  Alternatively, you can operate the encoder at greater speed than you will see in your application and verify it does not lose counts.&lt;br /&gt;
&lt;br /&gt;
===Encoder Input High Voltage===&lt;br /&gt;
* The encoder must output (on A/B/I) a voltage above this specified value to be absolutely sure the interface will interpret the signal as a &#039;One&#039;.&lt;br /&gt;
* See comments above.&lt;br /&gt;
&lt;br /&gt;
=List of encoders=&lt;br /&gt;
* Sourced from Digikey&lt;br /&gt;
* Customers should look for encoders that advertise &#039;Quadrature&#039;&lt;br /&gt;
* Encoders often advertise &#039;detents&#039; - which are perceptible clicks as the encoder is rotated.  Encoders with detents are usually meant for operation by people as control knobs.&lt;br /&gt;
* Encoders for manual (people) operation will often have a built in pushbutton switch on the shaft.  This functionality is seperate from the encoder.  Encoder interfaces available from Phidgets will often have support for digital inputs - this switch can be wired in to a digital input.&lt;br /&gt;
&lt;br /&gt;
==Mechanical encoders==&lt;br /&gt;
* Mechnical encoders are usually very cheap, and meant for manual (people) operation.&lt;br /&gt;
* Mechanical encoders will have a shorter lifespan, measured in the number of rotations.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Mechanical_Relay_Guide&amp;diff=15691</id>
		<title>Mechanical Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Mechanical_Relay_Guide&amp;diff=15691"/>
		<updated>2012-02-17T17:30:24Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1017.jpg|link=]]&lt;br /&gt;
| [[File:3051.jpg|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays are designed to turn on or turn off the power supplied to other devices using a simple signal from a [[Digital Output Primer|digital output]]. &lt;br /&gt;
They are similar to [[Solid State Relay Primer|Solid State Relays]] except they are less expensive, but are also less sophisticated and have a shorter lifespan.&lt;br /&gt;
You can use them to control [[LED Primer|LEDs]], heaters, appliances, and generally powered device as long as the power you&#039;re switching falls within the limits of the relay you&#039;re using.&lt;br /&gt;
&lt;br /&gt;
Phidgets sells boards with multiple relays on them, making it easy to control many separate circuits when used with an Interface Kit (or any device with enough [[Digital Output Primer|Digital Outputs]]).&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays use a simple electromagnetic coil to open or close the circuit. When current runs through the input and energizes the coil, it creates a small magnetic field which either pulls the arm of the switch away from the other contact of the switch, or pushes it down to close the switch depending on the how the switch is made. A relay also serves as an isolator, because the control (input) and load (output) ends of the relay are not directly connected. This allows you to protect the device you&#039;re using to control the relay from power surges in your application. &lt;br /&gt;
&lt;br /&gt;
* (add diagram)&lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling a mechanical relay is as easy as turning on an LED. Any Phidgets device with a [[Digital Output Primer|Digital Output]] will be able to control a mechanical relay.&lt;br /&gt;
Relays are often used in large quantities to turn multiple devices on and off in a particular order or timing. For example, a popular trend has been to hook up many strands of Christmas lights to multiple relays and a control system in order to make them flash in rhythm with specific music.&lt;br /&gt;
&lt;br /&gt;
Relays are designed to be controlled by a particular voltage applied to the coil.  If you buy a relay product from Phidgets with integrated electronics, this is taken care of for you.  If you are integrating your own relay, you&#039;ll want to keep an eye on the specifications. The relay coil is also specified for a particular current.  For example, a 5V relay might require 70mA.  If you connect this relay to a very weak source of 5V, like a digital output, the output will not be able to provide 70mA, and there will not be enough current to switch the relay.&lt;br /&gt;
&lt;br /&gt;
The load side of the relay also requires a minimum current. This minimum load current exists because the electricity needs to conduct through an oxide layer that has formed on the contacts of the relay. If the minimum load current is too high, you won&#039;t be able to use your relay to switch a signal, you&#039;ll only be able to switch power to a circuit. If you&#039;re using a relay to switch a signal, [[#Contact Bounce|contact bounce]] might also be a problem.&lt;br /&gt;
&lt;br /&gt;
====Switching Speed and High-Frequency Switching====&lt;br /&gt;
&lt;br /&gt;
Even though they use moving mechanical parts, mechanical relays switch very quickly. The amount of time it takes for current to begin flowing through the circuit from when the relay&#039;s input is activated is in the order of tens of milliseconds. For extremely time-sensitive applications that need to minimize switching delay, [[Solid State Relay Primer|Solid State Relays]] can switch as quickly as 1ms. &lt;br /&gt;
&lt;br /&gt;
You should be careful when using mechanical relays in applications that require very frequent switching. Typically, mechanical relays can only safely manage one contact every few seconds.&lt;br /&gt;
&lt;br /&gt;
==Choosing a Relay==&lt;br /&gt;
&lt;br /&gt;
Since mechanical relays are nothing more than a controllable switch, they support both AC and DC operation. &lt;br /&gt;
&lt;br /&gt;
The major deciding factor in choosing a mechanical relay is the amount of current it&#039;s capable of switching.&lt;br /&gt;
For example, the most current you can switch with the largest mechanical relay we sell is 5A DC or 10A AC. &lt;br /&gt;
If the load you&#039;re switching consumes more current than a mechanical relay can handle, take a look at our [[Solid State Relay Primer|Solid State Relays]].&lt;br /&gt;
&lt;br /&gt;
==Types or Classes==&lt;br /&gt;
&lt;br /&gt;
===Switch Type===&lt;br /&gt;
&lt;br /&gt;
One of the major characteristics of a mechanical relay is the design of the switch inside. (diagram with basic switch types)&lt;br /&gt;
&lt;br /&gt;
====Single Pole, Single Throw (SPST)====&lt;br /&gt;
&lt;br /&gt;
This is a simple switch with only one path for the current to follow. The relay is either designed to be &#039;&#039;&#039;normally open&#039;&#039;&#039; or &#039;&#039;&#039;normally closed&#039;&#039;&#039;. If it is normally open, the arm of the switch is held away from the contact with a spring when the relay is off and the electromagnet pulls the arm to make contact and close the switch when the relay is turned on. If it is normally closed, the arm of the switch is held to the contact when the relay is off, and the electromagnet pulls the arm away when the relay is turned on.&lt;br /&gt;
&lt;br /&gt;
====Single Pole, Double Throw (SPDT)====&lt;br /&gt;
&lt;br /&gt;
[[Image:relay2loads.png|thumb|300px|By connecting the power supply to the common terminal, and connecting a different load to the other two terminals, a relay with a SPDT switch can be used to toggle power between the two loads.]]&lt;br /&gt;
&lt;br /&gt;
This switch has two paths for the current to follow. This type of relay is useful if you want to toggle power between two different loads, as pictured. You can also use a SPDT relay as a single pole, single throw switch, and it can function as &#039;&#039;&#039;normally open&#039;&#039;&#039; or &#039;&#039;&#039;normally closed&#039;&#039;&#039; depending on which pins you connect the load to. (another diagram)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Double Pole, Double Throw (DPDT)====&lt;br /&gt;
&lt;br /&gt;
This switch functions the same as a SPDT switch, except there are two of them, but are both controlled by a single input on the relay. You can use this type of switch to simultaneously control two separate circuits.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
===Contact Bounce===&lt;br /&gt;
&lt;br /&gt;
As with any mechanical switch, relays are susceptible to [[Switch Primer#Bounce|contact bounce]]. This means that when the switch closes, the arm can bounce on the contact, causing the load&#039;s power to flicker slightly. This usually only matters when the application is detecting when the power signal turns on. For example, a circuit designed to increment a counter every time power is applied to its input could incorrectly interpret a bouncing switch as multiple events. Check the [[Switch Primer|switch primer]] for information on how to deal with switch bounce. It&#039;s worth noting that [[Solid State Relay Primer|Solid State Relays]] don&#039;t suffer from contact bounce, because they operate without using moving mechanical parts.&lt;br /&gt;
&lt;br /&gt;
===Arcing, Interference, and Sticking===&lt;br /&gt;
&lt;br /&gt;
When a mechanical relay opens or closes, and the arm of the switch is very close to the contact, the electric current can arc through the air between the contacts.&lt;br /&gt;
This arc can cause interference with nearby electrical instruments and sensors. (diagram)&lt;br /&gt;
&lt;br /&gt;
This arcing can heat up the contacts of the switch enough that they can eventually degrade away until the relay no longer functions. They could also weld together, causing the relay to stay on permanently, which means your load will be powered constantly. If this imposes safety concerns, you should install a fail-safe of some kind. For example, sauna heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
===Prolonging Relay Lifespan===&lt;br /&gt;
&lt;br /&gt;
In order to prolong the lifespan of your relay, avoid switching loads of higher voltage or current than the relay is built for, and avoid highly inductive loads, which worsen the effects of contact arcing. &lt;br /&gt;
&lt;br /&gt;
Additionally,  you should avoid rapid switching if possible. In fact, you can think of a mechanical relay&#039;s lifespan in terms of number times switched rather than the amount of time it&#039;s used for. A relay that doesn&#039;t need to be switched very often can last a long time. &lt;br /&gt;
&lt;br /&gt;
====Arc Suppression ====&lt;br /&gt;
&lt;br /&gt;
The main cause of failure for mechanical relays is electricity arcing across the contacts during switching. To lengthen the lifespan of your relay, you can add various circuit elements that mitigate arcing.&lt;br /&gt;
&lt;br /&gt;
For DC powered applications, one simple method of mitigating the effects of contact arcing is to place a feedback diode across the load (diagram, digikey). This will allow some of the residual electricity in the circuit to recirculate through the load instead of contributing to the arc that forms when the switch makes the transition from closed to open.&lt;br /&gt;
&lt;br /&gt;
For AC powered applications, you can put a Metal Oxide Varistor (MOV) across the load terminals of the relay in order to protect it from voltage spikes. An MOV will not remove the entire arc, but it will be helpful in circuits up to several hundred volts.(diagram, digikey)&lt;br /&gt;
&lt;br /&gt;
For low-voltage AC applications, a bi-directional transient voltage suppression diode (&amp;quot;transil diode&amp;quot;) that is rated for higher than the AC voltage of the circuit can be placed across the relay terminals in order to protect it from voltage spikes. (diagram, digikey)&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays are inexpensive and simple devices that allow AC or DC circuits to be switched on and off using a 0-5V digital signal.&lt;br /&gt;
They come in a variety of switch formats, enabling the user to build some very clever control into a circuit. &lt;br /&gt;
&lt;br /&gt;
Contact arcing and switch bounce can be an obstacle for some applications, but both are common problems and can be worked around fairly easily. &lt;br /&gt;
Mechanical relays don&#039;t last as long as solid state relays, but if you take care of them, they can be a good cost-effective alternative.&lt;br /&gt;
&lt;br /&gt;
==Products in this Category==&lt;br /&gt;
&lt;br /&gt;
* [[1014_2 - PhidgetInterfaceKit 0/0/4]]&lt;br /&gt;
* [[1017_1 - PhidgetInterfaceKit 0/0/8]]&lt;br /&gt;
* [[3051_1 - Dual Relay Board]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Switch Type===&lt;br /&gt;
* SPST - either normally open or normally closed. Simple on/off switch.&lt;br /&gt;
* SPDT - 3 pins, has both a NO and NC pin and can function like a SPST switch of either type, or can be used to toggle power between two different loads. &lt;br /&gt;
* DPDT - Same as SPDT but there are two controlled by the same relay input. Useful for controlling 2 seperate circuits in a synchronized manner. &lt;br /&gt;
* Potential selection criteria for specific switching circuits.&lt;br /&gt;
&lt;br /&gt;
===Contact Arcing===&lt;br /&gt;
* As the switch moves from the &amp;quot;on&amp;quot; position to the &amp;quot;off&amp;quot; position (and vice-versa) there is a moment when the arm of the switch in close enough to the contact that electricity will arc through the air, creating lots of heat and possibly damaging the contact. (Diagram would be useful)&lt;br /&gt;
* Arcing can lead to sticking, where the switch welds itself closed. If your relay is always on, it might be stuck. &lt;br /&gt;
* Arcing will be more severe with higher power loads or highly inductive loads. &lt;br /&gt;
* Arcing is expected, but can be mitigated by:&lt;br /&gt;
** For DC, feedback diode across load&lt;br /&gt;
** For AC, Snubber circuit or&lt;br /&gt;
** MOV or&lt;br /&gt;
** TVS&lt;br /&gt;
&lt;br /&gt;
===Switching Speed===&lt;br /&gt;
* Lifespan of relay is measured in number of contacts, not time in use. Faster switching -&amp;gt; shorter life.&lt;br /&gt;
* Switching is audible - you can hear the switching, which might be annoying / undesirable, or it might be good as a confirmation the system is operating.&lt;br /&gt;
* Switching speed is limited by heating in the contacts - the arcing generates heat, and switching high loads faster than the rated switching speed will cause the relay to overheat.&lt;br /&gt;
&lt;br /&gt;
===Operating Time===&lt;br /&gt;
* Time it takes for the arm of the switch to connect with the contact after being activated&lt;br /&gt;
* If 10ms is too slow, look at SSRs&lt;br /&gt;
&lt;br /&gt;
===Control Voltage===&lt;br /&gt;
* Can be controlled via digital output&lt;br /&gt;
* Relay offers isolation between load circuit and control circuit&lt;br /&gt;
&lt;br /&gt;
===Maximum (AC/DC) Switching Voltage===&lt;br /&gt;
* Secondary selection criteria. &lt;br /&gt;
&lt;br /&gt;
===Maximum (AC/DC) Switching Current===&lt;br /&gt;
* Main selection criteria.&lt;br /&gt;
* If they need to switch more than 5A DC, or 10A AC, go to SSRs&lt;br /&gt;
* Inductive loads- does the same multiplier apply as for SSRs? &lt;br /&gt;
&lt;br /&gt;
===Minimum Switching Current===&lt;br /&gt;
* A certain amount of current is needed on the LOAD side of a relay. &lt;br /&gt;
* Oxide films build up on the contacts, so this minimum is required to conduct through them.&lt;br /&gt;
* This spec determines whether or not the relay can switch a signal instead of power.&lt;br /&gt;
** If you are switching a signal rather than power, contact bounce could be a problem.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Mechanical_Relay_Guide&amp;diff=15689</id>
		<title>Mechanical Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Mechanical_Relay_Guide&amp;diff=15689"/>
		<updated>2012-02-17T16:34:44Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Arc Suppression */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1017.jpg|link=]]&lt;br /&gt;
| [[File:3051.jpg|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays are designed to turn on or turn off the power supplied to other devices using a simple signal from a [[Digital Output Primer|digital output]]. &lt;br /&gt;
They are similar to [[Solid State Relay Primer|Solid State Relays]] except they are less expensive, but are also less sophisticated and have a shorter lifespan.&lt;br /&gt;
You can use them to control [[LED Primer|LEDs]], heaters, appliances, and generally powered device as long as the power you&#039;re switching falls within the limits of the relay you&#039;re using.&lt;br /&gt;
&lt;br /&gt;
Phidgets sells boards with multiple relays on them, making it easy to control many separate circuits when used with an Interface Kit (or any device with enough [[Digital Output Primer|Digital Outputs]]).&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays use a simple electromagnetic coil to open or close the circuit. When current runs through the input and energizes the coil, it creates a small magnetic field which either pulls the arm of the switch away from the other contact of the switch, or pushes it down to close the switch depending on the how the switch is made. A relay also serves as an isolator, because the control (input) and load (output) ends of the relay are not directly connected. This allows you to protect the device you&#039;re using to control the relay from power surges in your application. &lt;br /&gt;
&lt;br /&gt;
* (add diagram)&lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling a mechanical relay is as easy as turning on an LED. Any Phidgets device with a [[Digital Output Primer|Digital Output]] will be able to control a mechanical relay.&lt;br /&gt;
Relays are often used in large quantities to turn multiple devices on and off in a particular order or timing. For example, a popular trend has been to hook up many strands of Christmas lights to multiple relays and a control system in order to make them flash in rhythm with specific music.&lt;br /&gt;
&lt;br /&gt;
Relays are designed to be controlled by a particular voltage applied to the coil.  If you buy a relay product from Phidgets with integrated electronics, this is taken care of for you.  If you are integrating your own relay, you&#039;ll want to keep an eye on the specifications. The relay coil is also specified for a particular current.  For example, a 5V relay might require 70mA.  If you connect this relay to a very weak source of 5V, like a digital output, the output will not be able to provide 70mA, and there will not be enough current to switch the relay.&lt;br /&gt;
&lt;br /&gt;
The load side of the relay also requires a minimum current. This minimum load current exists because the electricity needs to conduct through an oxide layer that has formed on the contacts of the relay. If the minimum load current is too high, you won&#039;t be able to use your relay to switch a signal, you&#039;ll only be able to switch power to a circuit. If you&#039;re using a relay to switch a signal, [[#Contact Bounce|contact bounce]] might also be a problem.&lt;br /&gt;
&lt;br /&gt;
====Switching Speed and High-Frequency Switching====&lt;br /&gt;
&lt;br /&gt;
Even though they use moving mechanical parts, mechanical relays switch very quickly. The amount of time it takes for current to begin flowing through the circuit from when the relay&#039;s input is activated is in the order of tens of milliseconds. For extremely time-sensitive applications that need to minimize switching delay, [[Solid State Relay Primer|Solid State Relays]] can switch as quickly as 1ms. &lt;br /&gt;
&lt;br /&gt;
You should be careful when using mechanical relays in applications that require very frequent switching. Typically, mechanical relays can only safely manage one contact every few seconds.&lt;br /&gt;
&lt;br /&gt;
==Choosing a Relay==&lt;br /&gt;
&lt;br /&gt;
Since mechanical relays are nothing more than a controllable switch, they support both AC and DC operation. &lt;br /&gt;
&lt;br /&gt;
The major deciding factor in choosing a mechanical relay is the amount of current it&#039;s capable of switching.&lt;br /&gt;
For example, the most current you can switch with the largest mechanical relay we sell is 5A DC or 10A AC. &lt;br /&gt;
If the load you&#039;re switching consumes more current than a mechanical relay can handle, take a look at our [[Solid State Relay Primer|Solid State Relays]].&lt;br /&gt;
&lt;br /&gt;
==Types or Classes==&lt;br /&gt;
&lt;br /&gt;
===Switch Type===&lt;br /&gt;
&lt;br /&gt;
One of the major characteristics of a mechanical relay is the design of the switch inside. (diagram with basic switch types)&lt;br /&gt;
&lt;br /&gt;
====Single Pole, Single Throw (SPST)====&lt;br /&gt;
&lt;br /&gt;
This is a simple switch with only one path for the current to follow. The relay is either designed to be &#039;&#039;&#039;normally open&#039;&#039;&#039; or &#039;&#039;&#039;normally closed&#039;&#039;&#039;. If it is normally open, the arm of the switch is held away from the contact with a spring when the relay is off and the electromagnet pulls the arm to make contact and close the switch when the relay is turned on. If it is normally closed, the arm of the switch is held to the contact when the relay is off, and the electromagnet pulls the arm away when the relay is turned on.&lt;br /&gt;
&lt;br /&gt;
====Single Pole, Double Throw (SPDT)====&lt;br /&gt;
&lt;br /&gt;
[[Image:relay2loads.png|thumb|300px|By connecting the power supply to the common terminal, and connecting a different load to the other two terminals, a relay with a SPDT switch can be used to toggle power between the two loads.]]&lt;br /&gt;
&lt;br /&gt;
This switch has two paths for the current to follow. This type of relay is useful if you want to toggle power between two different loads, as pictured. You can also use a SPDT relay as a single pole, single throw switch, and it can function as &#039;&#039;&#039;normally open&#039;&#039;&#039; or &#039;&#039;&#039;normally closed&#039;&#039;&#039; depending on which pins you connect the load to. (another diagram)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Double Pole, Double Throw (DPDT)====&lt;br /&gt;
&lt;br /&gt;
This switch functions the same as a SPDT switch, except there are two of them, but are both controlled by a single input on the relay. You can use this type of switch to simultaneously control two separate circuits.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
===Contact Bounce===&lt;br /&gt;
&lt;br /&gt;
As with any mechanical switch, relays are susceptible to [[Switch Primer#Bounce|contact bounce]]. This means that when the switch closes, the arm can bounce on the contact, causing the load&#039;s power to flicker slightly. This usually only matters when the application is detecting when the power signal turns on. For example, a circuit designed to increment a counter every time power is applied to its input could incorrectly interpret a bouncing switch as multiple events. Check the [[Switch Primer|switch primer]] for information on how to deal with switch bounce. It&#039;s worth noting that [[Solid State Relay Primer|Solid State Relays]] don&#039;t suffer from contact bounce, because they operate without using moving mechanical parts.&lt;br /&gt;
&lt;br /&gt;
===Arcing, Interference, and Sticking===&lt;br /&gt;
&lt;br /&gt;
When a mechanical relay opens or closes, and the arm of the switch is very close to the contact, the electric current can arc through the air between the contacts.&lt;br /&gt;
This arc can cause interference with nearby electrical instruments and sensors. (diagram)&lt;br /&gt;
&lt;br /&gt;
This arcing can heat up the contacts of the switch enough that they can eventually degrade away until the relay no longer functions. They could also weld together, causing the relay to stay on permanently, which means your load will be powered constantly. If this imposes safety concerns, you should install a fail-safe of some kind. For example, sauna heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
===Prolonging Relay Lifespan===&lt;br /&gt;
&lt;br /&gt;
In order to prolong the lifespan of your relay, avoid switching loads of higher voltage or current than the relay is built for, and avoid highly inductive loads, which worsen the effects of contact arcing. &lt;br /&gt;
&lt;br /&gt;
Additionally,  you should avoid rapid switching if possible. In fact, you can think of a mechanical relay&#039;s lifespan in terms of number times switched rather than the amount of time it&#039;s used for. A relay that doesn&#039;t need to be switched very often can last a long time. &lt;br /&gt;
&lt;br /&gt;
====Arc Suppression ====&lt;br /&gt;
&lt;br /&gt;
The main cause of failure for mechanical relays is electricity arcing across the contacts during switching. To lengthen the lifespan of your relay, you can add various circuit elements that mitigate arcing.&lt;br /&gt;
&lt;br /&gt;
For DC powered applications, one simple method of mitigating the effects of contact arcing is to place a feedback diode across the load (diagram, digikey). This will allow some of the residual electricity in the circuit to recirculate through the load instead of contributing to the arc that forms when the switch makes the transition from closed to open.&lt;br /&gt;
&lt;br /&gt;
For AC powered applications, you can put a Metal Oxide Varistor (MOV) across the load terminals of the relay in order to protect it from voltage spikes. An MOV will not remove the entire arc, but it will be helpful in circuits up to several hundred volts.(diagram, digikey)&lt;br /&gt;
&lt;br /&gt;
For low-voltage AC applications, a bi-directional transient voltage suppression diode (&amp;quot;transil diode&amp;quot;) that is rated for higher than the AC voltage of the circuit can be placed across the relay terminals in order to protect it from voltage spikes. (diagram, digikey)&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
* Much the same as the Introduction, but using reference to supplied information to justify the statements.&lt;br /&gt;
&lt;br /&gt;
==Products in this Category==&lt;br /&gt;
&lt;br /&gt;
* [[1014_2 - PhidgetInterfaceKit 0/0/4]]&lt;br /&gt;
* [[1017_1 - PhidgetInterfaceKit 0/0/8]]&lt;br /&gt;
* [[3051_1 - Dual Relay Board]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Switch Type===&lt;br /&gt;
* SPST - either normally open or normally closed. Simple on/off switch.&lt;br /&gt;
* SPDT - 3 pins, has both a NO and NC pin and can function like a SPST switch of either type, or can be used to toggle power between two different loads. &lt;br /&gt;
* DPDT - Same as SPDT but there are two controlled by the same relay input. Useful for controlling 2 seperate circuits in a synchronized manner. &lt;br /&gt;
* Potential selection criteria for specific switching circuits.&lt;br /&gt;
&lt;br /&gt;
===Contact Arcing===&lt;br /&gt;
* As the switch moves from the &amp;quot;on&amp;quot; position to the &amp;quot;off&amp;quot; position (and vice-versa) there is a moment when the arm of the switch in close enough to the contact that electricity will arc through the air, creating lots of heat and possibly damaging the contact. (Diagram would be useful)&lt;br /&gt;
* Arcing can lead to sticking, where the switch welds itself closed. If your relay is always on, it might be stuck. &lt;br /&gt;
* Arcing will be more severe with higher power loads or highly inductive loads. &lt;br /&gt;
* Arcing is expected, but can be mitigated by:&lt;br /&gt;
** For DC, feedback diode across load&lt;br /&gt;
** For AC, Snubber circuit or&lt;br /&gt;
** MOV or&lt;br /&gt;
** TVS&lt;br /&gt;
&lt;br /&gt;
===Switching Speed===&lt;br /&gt;
* Lifespan of relay is measured in number of contacts, not time in use. Faster switching -&amp;gt; shorter life.&lt;br /&gt;
* Switching is audible - you can hear the switching, which might be annoying / undesirable, or it might be good as a confirmation the system is operating.&lt;br /&gt;
* Switching speed is limited by heating in the contacts - the arcing generates heat, and switching high loads faster than the rated switching speed will cause the relay to overheat.&lt;br /&gt;
&lt;br /&gt;
===Operating Time===&lt;br /&gt;
* Time it takes for the arm of the switch to connect with the contact after being activated&lt;br /&gt;
* If 10ms is too slow, look at SSRs&lt;br /&gt;
&lt;br /&gt;
===Control Voltage===&lt;br /&gt;
* Can be controlled via digital output&lt;br /&gt;
* Relay offers isolation between load circuit and control circuit&lt;br /&gt;
&lt;br /&gt;
===Maximum (AC/DC) Switching Voltage===&lt;br /&gt;
* Secondary selection criteria. &lt;br /&gt;
&lt;br /&gt;
===Maximum (AC/DC) Switching Current===&lt;br /&gt;
* Main selection criteria.&lt;br /&gt;
* If they need to switch more than 5A DC, or 10A AC, go to SSRs&lt;br /&gt;
* Inductive loads- does the same multiplier apply as for SSRs? &lt;br /&gt;
&lt;br /&gt;
===Minimum Switching Current===&lt;br /&gt;
* A certain amount of current is needed on the LOAD side of a relay. &lt;br /&gt;
* Oxide films build up on the contacts, so this minimum is required to conduct through them.&lt;br /&gt;
* This spec determines whether or not the relay can switch a signal instead of power.&lt;br /&gt;
** If you are switching a signal rather than power, contact bounce could be a problem.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Mechanical_Relay_Guide&amp;diff=15657</id>
		<title>Mechanical Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Mechanical_Relay_Guide&amp;diff=15657"/>
		<updated>2012-02-16T22:39:09Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Prolonging Relay Lifespan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Primer]]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[File:1017.jpg|link=]]&lt;br /&gt;
| [[File:3051.jpg|link=]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays are designed to turn on or turn off the power supplied to other devices using a simple signal from a [[Digital Output Primer|digital output]]. &lt;br /&gt;
They are similar to [[Solid State Relay Primer|Solid State Relays]] except they are less expensive, but are also less sophisticated and have a shorter lifespan.&lt;br /&gt;
You can use them to control [[LED Primer|LEDs]], heaters, appliances, and generally powered device as long as the power you&#039;re switching falls within the limits of the relay you&#039;re using.&lt;br /&gt;
&lt;br /&gt;
Phidgets sells boards with multiple relays on them, making it easy to control many separate circuits when used with an Interface Kit (or any device with enough [[Digital Output Primer|Digital Outputs]]).&lt;br /&gt;
&lt;br /&gt;
==How it works==&lt;br /&gt;
&lt;br /&gt;
Mechanical relays use a simple electromagnetic coil to open or close the circuit. When current runs through the input and energizes the coil, it creates a small magnetic field which either pulls the arm of the switch away from the other contact of the switch, or pushes it down to close the switch depending on the how the switch is made. A relay also serves as an isolator, because the control (input) and load (output) ends of the relay are not directly connected. This allows you to protect the device you&#039;re using to control the relay from power surges in your application. &lt;br /&gt;
&lt;br /&gt;
* (add diagram)&lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling a mechanical relay is as easy as turning on an LED. Any Phidgets device with a [[Digital Output Primer|Digital Output]] will be able to control a mechanical relay.&lt;br /&gt;
Relays are often used in large quantities to turn multiple devices on and off in a particular order or timing. For example, a popular trend has been to hook up many strands of Christmas lights to multiple relays and a control system in order to make them flash in rhythm with specific music.&lt;br /&gt;
&lt;br /&gt;
Relays are designed to be controlled by a particular voltage applied to the coil.  If you buy a relay product from Phidgets with integrated electronics, this is taken care of for you.  If you are integrating your own relay, you&#039;ll want to keep an eye on the specifications. The relay coil is also specified for a particular current.  For example, a 5V relay might require 70mA.  If you connect this relay to a very weak source of 5V, like a digital output, the output will not be able to provide 70mA, and there will not be enough current to switch the relay.&lt;br /&gt;
&lt;br /&gt;
The load side of the relay also requires a minimum current. This minimum load current exists because the electricity needs to conduct through an oxide layer that has formed on the contacts of the relay. If the minimum load current is too high, you won&#039;t be able to use your relay to switch a signal, you&#039;ll only be able to switch power to a circuit. If you&#039;re using a relay to switch a signal, [[#Contact Bounce|contact bounce]] might also be a problem.&lt;br /&gt;
&lt;br /&gt;
====Switching Speed and High-Frequency Switching====&lt;br /&gt;
&lt;br /&gt;
Even though they use moving mechanical parts, mechanical relays switch very quickly. The amount of time it takes for current to begin flowing through the circuit from when the relay&#039;s input is activated is in the order of tens of milliseconds. For extremely time-sensitive applications that need to minimize switching delay, [[Solid State Relay Primer|Solid State Relays]] can switch as quickly as 1ms. &lt;br /&gt;
&lt;br /&gt;
You should be careful when using mechanical relays in applications that require very frequent switching. Typically, mechanical relays can only safely manage one contact every few seconds.&lt;br /&gt;
&lt;br /&gt;
==Choosing a Relay==&lt;br /&gt;
&lt;br /&gt;
Since mechanical relays are nothing more than a controllable switch, they support both AC and DC operation. &lt;br /&gt;
&lt;br /&gt;
The major deciding factor in choosing a mechanical relay is the amount of current it&#039;s capable of switching.&lt;br /&gt;
For example, the most current you can switch with the largest mechanical relay we sell is 5A DC or 10A AC. &lt;br /&gt;
If the load you&#039;re switching consumes more current than a mechanical relay can handle, take a look at our [[Solid State Relay Primer|Solid State Relays]].&lt;br /&gt;
&lt;br /&gt;
==Types or Classes==&lt;br /&gt;
&lt;br /&gt;
===Switch Type===&lt;br /&gt;
&lt;br /&gt;
One of the major characteristics of a mechanical relay is the design of the switch inside. (diagram with basic switch types)&lt;br /&gt;
&lt;br /&gt;
====Single Pole, Single Throw (SPST)====&lt;br /&gt;
&lt;br /&gt;
This is a simple switch with only one path for the current to follow. The relay is either designed to be &#039;&#039;&#039;normally open&#039;&#039;&#039; or &#039;&#039;&#039;normally closed&#039;&#039;&#039;. If it is normally open, the arm of the switch is held away from the contact with a spring when the relay is off and the electromagnet pulls the arm to make contact and close the switch when the relay is turned on. If it is normally closed, the arm of the switch is held to the contact when the relay is off, and the electromagnet pulls the arm away when the relay is turned on.&lt;br /&gt;
&lt;br /&gt;
====Single Pole, Double Throw (SPDT)====&lt;br /&gt;
&lt;br /&gt;
[[Image:relay2loads.png|thumb|300px|By connecting the power supply to the common terminal, and connecting a different load to the other two terminals, a relay with a SPDT switch can be used to toggle power between the two loads.]]&lt;br /&gt;
&lt;br /&gt;
This switch has two paths for the current to follow. This type of relay is useful if you want to toggle power between two different loads, as pictured. You can also use a SPDT relay as a single pole, single throw switch, and it can function as &#039;&#039;&#039;normally open&#039;&#039;&#039; or &#039;&#039;&#039;normally closed&#039;&#039;&#039; depending on which pins you connect the load to. (another diagram)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Double Pole, Double Throw (DPDT)====&lt;br /&gt;
&lt;br /&gt;
This switch functions the same as a SPDT switch, except there are two of them, but are both controlled by a single input on the relay. You can use this type of switch to simultaneously control two separate circuits.&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
===Contact Bounce===&lt;br /&gt;
&lt;br /&gt;
As with any mechanical switch, relays are susceptible to [[Switch Primer#Bounce|contact bounce]]. This means that when the switch closes, the arm can bounce on the contact, causing the load&#039;s power to flicker slightly. This usually only matters when the application is detecting when the power signal turns on. For example, a circuit designed to increment a counter every time power is applied to its input could incorrectly interpret a bouncing switch as multiple events. Check the [[Switch Primer|switch primer]] for information on how to deal with switch bounce. It&#039;s worth noting that [[Solid State Relay Primer|Solid State Relays]] don&#039;t suffer from contact bounce, because they operate without using moving mechanical parts.&lt;br /&gt;
&lt;br /&gt;
===Arcing, Interference, and Sticking===&lt;br /&gt;
&lt;br /&gt;
When a mechanical relay opens or closes, and the arm of the switch is very close to the contact, the electric current can arc through the air between the contacts.&lt;br /&gt;
This arc can cause interference with nearby electrical instruments and sensors. (diagram)&lt;br /&gt;
&lt;br /&gt;
This arcing can heat up the contacts of the switch enough that they can eventually degrade away until the relay no longer functions. They could also weld together, causing the relay to stay on permanently, which means your load will be powered constantly. If this imposes safety concerns, you should install a fail-safe of some kind. For example, sauna heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
===Prolonging Relay Lifespan===&lt;br /&gt;
&lt;br /&gt;
In order to prolong the lifespan of your relay, avoid switching loads of higher voltage or current than the relay is built for, and avoid highly inductive loads, which worsen the effects of contact arcing. &lt;br /&gt;
&lt;br /&gt;
Additionally,  you should avoid rapid switching if possible. In fact, you can think of a mechanical relay&#039;s lifespan in terms of number times switched rather than the amount of time it&#039;s used for. A relay that doesn&#039;t need to be switched very often can last a long time. &lt;br /&gt;
&lt;br /&gt;
====Arc Suppression ====&lt;br /&gt;
&lt;br /&gt;
The main cause of failure for mechanical relays is electricity arcing across the contacts. To lengthen the lifespan of your relay, you can add various circuit elements that mitigate arcing.&lt;br /&gt;
&lt;br /&gt;
For DC powered applications, one simple method of arc suppression is to place a feedback diode across the load (diagram). This will allow some of the residual electricity in the circuit to recirculate through the load instead of contributing to the arc that forms when the switch makes the transition from closed to open.&lt;br /&gt;
&lt;br /&gt;
For AC powered applications, there are a number of options for arc suppression:&lt;br /&gt;
&lt;br /&gt;
* You can put a Metal Oxide Varistor (MOV) across the load terminals in order to protect the relay from voltage spikes. (diagram, digikey)&lt;br /&gt;
* You can put a Transient Voltage Suppressor (TVS) such as a SIDAC (Silicon Diode for Alternating Current) to suppress contact arcing. (diagram, digikey)&lt;br /&gt;
&lt;br /&gt;
* How to choose which of the three above?&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
* Much the same as the Introduction, but using reference to supplied information to justify the statements.&lt;br /&gt;
&lt;br /&gt;
==Products in this Category==&lt;br /&gt;
&lt;br /&gt;
* [[1014_2 - PhidgetInterfaceKit 0/0/4]]&lt;br /&gt;
* [[1017_1 - PhidgetInterfaceKit 0/0/8]]&lt;br /&gt;
* [[3051_1 - Dual Relay Board]]&lt;br /&gt;
&lt;br /&gt;
==Glossary==&lt;br /&gt;
&lt;br /&gt;
===Switch Type===&lt;br /&gt;
* SPST - either normally open or normally closed. Simple on/off switch.&lt;br /&gt;
* SPDT - 3 pins, has both a NO and NC pin and can function like a SPST switch of either type, or can be used to toggle power between two different loads. &lt;br /&gt;
* DPDT - Same as SPDT but there are two controlled by the same relay input. Useful for controlling 2 seperate circuits in a synchronized manner. &lt;br /&gt;
* Potential selection criteria for specific switching circuits.&lt;br /&gt;
&lt;br /&gt;
===Contact Arcing===&lt;br /&gt;
* As the switch moves from the &amp;quot;on&amp;quot; position to the &amp;quot;off&amp;quot; position (and vice-versa) there is a moment when the arm of the switch in close enough to the contact that electricity will arc through the air, creating lots of heat and possibly damaging the contact. (Diagram would be useful)&lt;br /&gt;
* Arcing can lead to sticking, where the switch welds itself closed. If your relay is always on, it might be stuck. &lt;br /&gt;
* Arcing will be more severe with higher power loads or highly inductive loads. &lt;br /&gt;
* Arcing is expected, but can be mitigated by:&lt;br /&gt;
** For DC, feedback diode across load&lt;br /&gt;
** For AC, Snubber circuit or&lt;br /&gt;
** MOV or&lt;br /&gt;
** TVS&lt;br /&gt;
&lt;br /&gt;
===Switching Speed===&lt;br /&gt;
* Lifespan of relay is measured in number of contacts, not time in use. Faster switching -&amp;gt; shorter life.&lt;br /&gt;
* Switching is audible - you can hear the switching, which might be annoying / undesirable, or it might be good as a confirmation the system is operating.&lt;br /&gt;
* Switching speed is limited by heating in the contacts - the arcing generates heat, and switching high loads faster than the rated switching speed will cause the relay to overheat.&lt;br /&gt;
&lt;br /&gt;
===Operating Time===&lt;br /&gt;
* Time it takes for the arm of the switch to connect with the contact after being activated&lt;br /&gt;
* If 10ms is too slow, look at SSRs&lt;br /&gt;
&lt;br /&gt;
===Control Voltage===&lt;br /&gt;
* Can be controlled via digital output&lt;br /&gt;
* Relay offers isolation between load circuit and control circuit&lt;br /&gt;
&lt;br /&gt;
===Maximum (AC/DC) Switching Voltage===&lt;br /&gt;
* Secondary selection criteria. &lt;br /&gt;
&lt;br /&gt;
===Maximum (AC/DC) Switching Current===&lt;br /&gt;
* Main selection criteria.&lt;br /&gt;
* If they need to switch more than 5A DC, or 10A AC, go to SSRs&lt;br /&gt;
* Inductive loads- does the same multiplier apply as for SSRs? &lt;br /&gt;
&lt;br /&gt;
===Minimum Switching Current===&lt;br /&gt;
* A certain amount of current is needed on the LOAD side of a relay. &lt;br /&gt;
* Oxide films build up on the contacts, so this minimum is required to conduct through them.&lt;br /&gt;
* This spec determines whether or not the relay can switch a signal instead of power.&lt;br /&gt;
** If you are switching a signal rather than power, contact bounce could be a problem.&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10841</id>
		<title>Solid State Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10841"/>
		<updated>2011-12-16T15:47:40Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* DC SSR Protection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[Image:SSR.jpg]]&lt;br /&gt;
| [[Image:3052.jpg|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Solid state relays (SSRs) turn on or off the power being supplied to other devices, in a similar fashion as a physical [[Switch Primer|switch]]. However, instead of being switched by human interaction like a physical switch, SSRs are switched digitally.&lt;br /&gt;
With relays, you can control high-current devices such as lights or appliances with low-current signals, like a standard DC signal from a [[Digital Output Primer|Digital Output]]. Most SSRs will switch on with a voltage of 3V or higher. This makes them perfect for use with [[Interface Kits]], or any device with a digital output. &lt;br /&gt;
&lt;br /&gt;
SSRs perform the same job as [[Mechanical Relay Primer|Mechanical Relays]], but have the following advantages:&lt;br /&gt;
* SSRs produce less electromagnetic interference than mechanical relays during operation. This is mostly due to a phenomenon called [[Mechanical Relay Primer#Arcing, Interference, and Sticking|contact arcing]] only present in mechanical relays, where the physical contacts of the relay tend to spark internally while switching. The reduced interference can also be attributed to the fact that SSRs do not use electromagnets to switch.&lt;br /&gt;
* The switch contacts of a mechanical relay will eventually wear down from sparking.  An SSR will have a longer life because its internals are purely digital.  Properly used, they will last for millions of cycles.&lt;br /&gt;
* SSRs turn on and off faster than mechanical relays (≈1ms compared to ≈10ms).&lt;br /&gt;
* SSRs are less susceptible to physical vibrations than mechanical relays.&lt;br /&gt;
* Since the switch inside an SSR isn&#039;t a mechanical switch, it does not suffer from [[Switch Primer#Bounce|contact bounce]], and operates silently.&lt;br /&gt;
&lt;br /&gt;
However, compared to Mechanical Relays, SSRs: &lt;br /&gt;
* Are more expensive to produce.&lt;br /&gt;
* Will dissipate more energy in the form of heat (1-2% of the energy intended to power the load).&lt;br /&gt;
&lt;br /&gt;
==How SSRs Work==&lt;br /&gt;
&lt;br /&gt;
[[Image:SSR_Internals.png|thumb|A conceptual diagram of the insides of an SSR.]]&lt;br /&gt;
&lt;br /&gt;
The control inputs are connected internally to an LED, which shines across an air gap to light sensors.  The pairing of an LED with light sensors is called an optocoupler, and is a common technique to link two parts of a circuit without direct connection.  The light sensor is connected to the transistors which open or close, supplying the relay&#039;s load with power. &lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling an SSR is no more complicated than driving an LED.  There are many ways of accomplishing this with Phidgets - &lt;br /&gt;
*[[Link to Digital Output Page, SSR Section]]&lt;br /&gt;
*[[Link to Digital Output Page 0/16/16, SSR Section]]&lt;br /&gt;
*[[Link to LED Output Page, SSR Section]]&lt;br /&gt;
&lt;br /&gt;
The ability of an SSR to switch a load is very similar to a [[Mechanical Relay Primer|mechanical relay]] or simple switch.  &lt;br /&gt;
&lt;br /&gt;
The challenge is to pick an appropriate type of SSR for your application. There is no single SSR perfect for all applications. To choose an SSR for your application, please follow the [[#Choosing an SSR|Choosing an SSR]] section.&lt;br /&gt;
&lt;br /&gt;
===Safety===&lt;br /&gt;
&lt;br /&gt;
Since relays switch high currents and voltages, standard precautions apply.  Make sure you never touch the terminals while the relay is powered. If your SSR came with a plastic cover, use it.  Even when the SSR is switched off, a very small amount of current will flow.&lt;br /&gt;
&lt;br /&gt;
When an SSR fails, it most often fails permanently closed. This is because when the transistor inside fails due to excessive current or heat, it will usually short out, allowing current to pass through unimpeded. &lt;br /&gt;
This means that as long as the power supply remains on, the device will be powered, possibly creating a fire or safety hazard.&lt;br /&gt;
&lt;br /&gt;
==Choosing an SSR==&lt;br /&gt;
&lt;br /&gt;
===Identify your voltage===&lt;br /&gt;
&lt;br /&gt;
First, determine whether you need to switch AC or DC voltage. The electrical grid, and thus your wall outlet, runs AC, whereas batteries and most small power supplies are DC.  &lt;br /&gt;
&lt;br /&gt;
Next, estimate the number of volts you will be switching.  If you are switching DC, particularly with batteries, assume your voltage is at least 25% more than what your battery is rated for.  Even larger fluctuations occur on AC, but AC SSRs are designed to handle it, so you don&#039;t need to add anything to your estimate. For example, typical AC voltage from a wall socket is 110VAC, whereas in Europe it is 220VAC.&lt;br /&gt;
&lt;br /&gt;
===Identify your current===&lt;br /&gt;
&lt;br /&gt;
The current drawn by your load when turned on affects how large of an SSR you need, and how hot it will be when it runs.  If you know how much current, on average, your load draws, this is what we call &#039;&#039;&#039;Average Load Current&#039;&#039;&#039;.  If you don&#039;t know the average current, but you know the watts of your device, you can calculate Average Load Current by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{Average Load Current} =\frac{\text{Watts}}{\text{Operating Voltage}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, you need to know the current drawn by your device when it is first turned on.  Many devices demand a huge inrush of current when the device is first turned on. This places a significant amount of stress on the electronics.  If you&#039;ve ever noticed the lights dimming in the house for a second when the furnace kicks in, this is caused by the fan motor starting up.  It&#039;s very difficult to measure the &#039;&#039;&#039;Surge Current&#039;&#039;&#039; itself, so we use a multiplier based on your device type.  Surge Current is also referred to as inrush current.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Surge Current Multiplier&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Multiplier&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Motors || 6x&lt;br /&gt;
|-&lt;br /&gt;
| LEDs || 1x&lt;br /&gt;
|-&lt;br /&gt;
| Complex Electronics i.e., Motor Controllers, Phidgets || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures   (AC Only) || 10x&lt;br /&gt;
|-&lt;br /&gt;
| Transformers || ?             &lt;br /&gt;
|-&lt;br /&gt;
| Heaters || ?&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiply your Average Load Current by the multiplier for your device type to calculate the Surge Current.&lt;br /&gt;
&lt;br /&gt;
===I need to switch AC===&lt;br /&gt;
&lt;br /&gt;
Most AC applications will be switching 110 to 240 Volt power coming from the grid.  If that&#039;s you, go to the [[#Mains Voltage (110 to 240V AC)|Mains Voltage (110 to 240V AC)]] section.&lt;br /&gt;
&lt;br /&gt;
We also cover low voltage AC applications - 28 VAC (Volts AC) or less. For more information, visit the [[#AC/DC SSRs|AC/DC SSRs]] section.&lt;br /&gt;
&lt;br /&gt;
===I need to switch DC===&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need to switch a lot of current - 9 Amps or less, consider our compact, cost effective [[#AC/DC SSRs|AC/DC SSRs]].&lt;br /&gt;
&lt;br /&gt;
At more than 9 Amps, you need a serious [[#DC SSRs|DC SSR]].&lt;br /&gt;
&lt;br /&gt;
==Mains Voltage (110 to 240V AC)==&lt;br /&gt;
&lt;br /&gt;
We sell AC SSRs for 120 VAC or 240 VAC operation. This information can be found on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could eventually need to switch, the 240 VAC relays can be used to switch 120 VAC with no problems.  Please note we are very conservative in how we rate relays - our 120 VAC relays are rated by the manufacturer for 240 VAC, and the 240 VAC for 380 VAC - but we strongly recommend against using them to the manufacturer rated voltage.  To understand why, read the [[#AC SSR Protection|AC SSR Protection]] section.&lt;br /&gt;
&lt;br /&gt;
===Load Type - Inductive vs. Resistive===&lt;br /&gt;
&lt;br /&gt;
[[Image:zero cross.png|right|thumb|300px|This graph shows the difference between zero-cross and random turn-on. The blue line represents the oscillating voltage of an AC load, and the shaded areas represent the sections when the relay is turned on and letting current pass through. As you can see, the random turn-on SSR immediately opens when activated, while the zero-cross turn-on SSR waits until the voltage crosses zero before opening.]]&lt;br /&gt;
&lt;br /&gt;
If your load is inductive, you need to choose a &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; relay.  If your load is resistive, choose a &#039;&#039;&#039;Zero Crossing&#039;&#039;&#039; relay.&lt;br /&gt;
&lt;br /&gt;
Your Load will probably be inductive if it is built around a large coil of wire - motors and transformers are typical examples.  A load considered resistive may also have loops of wire - for instance, hair dryers, toasters, incandescent bulbs use twisted wire elements to generate the heat.  An inductive load will have thousands of loops of wire - it&#039;s a matter of scale.  There is no such thing as a perfectly resistive load - but the load has to be really inductive to cause the zero crossing SSRs to malfunction.&lt;br /&gt;
&lt;br /&gt;
SSRs are designed to either turn on immediately (&#039;&#039;&#039;Random Turn On&#039;&#039;&#039;), or wait until the next &#039;alternation&#039; of the voltage (&#039;&#039;&#039;Zero Crossing&#039;&#039;&#039;).  Zero Crossing SSRs create less electromagnetic &#039;noise&#039; when they turn on, &amp;lt;font color=red&amp;gt;and &#039;&#039;&#039;MIGHT TBD&#039;&#039;&#039;&amp;lt;/font&amp;gt; cost more money.  They are best used with resistive loads - Zero Crossing SSRs are not able to turn off some inductive loads.  It&#039;s very difficult to determine which inductive loads will create problems - well beyond the scope of this document.  If your load is inductive, we recommend buying the &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; SSRs.&lt;br /&gt;
&lt;br /&gt;
Another good reason to use Random Turn On SSRs for inductive loads is the coils will be wrapped around a magnetic material like iron.  As the current flow generates magnetic fields, the iron is repeatedly magnetized in opposite directions.  Depending on how the iron was magnetized when the power was removed, and your luck when the load is turned on, an effect called saturation can produce a huge inrush of current.  Zero Crossing SSRs are more likely to turn on the load at exactly the worst time.  &lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+ &#039;&#039;&#039;Inductive and Resistive Loads&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Load Type&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs   || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures || Inductive or Resistive &amp;lt;font size=4&amp;gt;&#039;&#039;&#039;*&#039;&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Motors                     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Transformers               || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Heaters                    || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Computer / Electronics     || ???&lt;br /&gt;
|-&lt;br /&gt;
| AC/DC power supplies (brick heavy type)     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
|AC/DC Power supplies (lightweight switchers) || Resistive&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=4&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/font&amp;gt; &#039;&#039;For fluorescent light fixtures, older units (magnetic ballast) may be inductive, and newer units are often resistive (electronic ballast).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Picking your AC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, and your load type (inductive or resistive), you can create a short list of relays whose &lt;br /&gt;
* &#039;&#039;&#039;Maximum Load Voltage&#039;&#039;&#039; are greater than or equal to your operating voltage, &lt;br /&gt;
* &#039;&#039;&#039;Maximum Surge Current&#039;&#039;&#039; are greater than or equal to your surge current, and &lt;br /&gt;
* &#039;&#039;&#039;Load type&#039;&#039;&#039; matches what you chose for random turn on/zero crossing.&lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you may need a heat sink.  For selecting a heatsink, please consult [[#Picking a heatsink|Picking a Heatsink]]. Alternatively, look at other SSRs on your list - there may be an SSR that can handle your average load current with no heatsink.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
Instead of simply turning the load on/off, if you want to dim it gradually, you can use a proportional control SSR.  They are able to reduce the average power to the load gradually, in proportion to the strength of the input signal. For more information, you can visit the [[#Proportional Control SSR|Proportional Control SSR Section]].&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===AC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
{{ContentNeeded | This section needs information that has been requested from Future Electronics by Chester}}&lt;br /&gt;
&lt;br /&gt;
[[Image:MOV.jpg|thumb|An MOV, which comes packaged with our AC &amp;quot;Hockey Puck&amp;quot; relays. ]]&lt;br /&gt;
&lt;br /&gt;
Your AC SSR from Phidgets comes with a circular disc with two legs (pictured). This is a Metal Oxide Varistor (MOV) and should be installed across the load (larger) terminals of your SSR &amp;lt;Picture&amp;gt;.  MOVs are the classic surge protector - an inexpensive component that absorbs high voltage spikes.  High voltage spikes are caused by inductive loads when they are turned off, and also happen very often on the electrical grid, as nearby devices are operated.  Even if your load is resistive, use an MOV to protect the SSR.&lt;br /&gt;
&lt;br /&gt;
MOVs have a limited life span, they must be carefully chosen.  If an MOV is chosen for too low of a voltage spike, it will wear out quickly.  If it is chosen for too high of a voltage spike, it will not protect the SSR adequately.  MOVs are not perfect devices - therefore we have chosen SSRs which can survive much higher voltage spikes than what we recommend them for.  For example, this is why the AC SSRs we recommend for 120 VAC operation are rated by the manufacturer for 240 VAC.  If you must operate our AC SSRs on higher voltages than we recommend, do not use the included MOV.&lt;br /&gt;
&lt;br /&gt;
As MOVs wear out from use, they will become more sensitive to common voltage spikes, causing them to wear out quicker.  When they entirely fail, they will become a short circuit, potentially creating a fire hazard.  The MOV included with your SSR has a fuse built in which will disable the MOV when it becomes a hazard.  Please consider (and avoid!) nearby flammable material when mounting your SSR.&lt;br /&gt;
&lt;br /&gt;
*TMOV20RP200E&lt;br /&gt;
*TMOV20RP385E&lt;br /&gt;
&lt;br /&gt;
===Proportional Control SSR===&lt;br /&gt;
&lt;br /&gt;
Proportional Control Relays (often simply called &amp;quot;Control Relays&amp;quot;) are SSRs you can use to control the amount of power to the load.  Rather than reduce the voltage, or somehow limit the current - which would be very expensive solutions, the Proportional SSR reduces power by turning the load on/off quickly, feeding full power in short pulses.  A similar technology is used for motor control, called PWM (Pulse Width Modulation).  &lt;br /&gt;
&lt;br /&gt;
Proportional SSRs are controlled by a variable voltage - as the voltage increases, more power is available to the load.  Our PhidgetAnalog product can be used to control Proportional SSRs.  We don&#039;t sell Proportional SSRs - but they can be purchased from Digikey, where they are called AC Linear Controlled SSRs.&lt;br /&gt;
&lt;br /&gt;
A quick and dirty (and inexpensive!) solution for dimming with Phidgets is to use an [[Servo Motor and Controller Primer|RC Servo Motor]] with a PhidgetAdvancedServo to rotate the knob on a light dimmer.  From software, the RC Servo Motor is rotated to an absolute position, cranking the knob as it turns. &amp;lt;font color=red&amp;gt; EXPAND &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:AC SSR Load.png|right|thumb|300px|Schematic of an AC SSR switching a generic load. A metal oxide varistor is added across the load to protect the SSR.]]&lt;br /&gt;
&lt;br /&gt;
When wiring up an AC circuit, particularly for long term installation, you may find it helpful to buy a book on residential wiring from your local hardware store.  There are many wiring conventions (and often legal codes) which will help you plan your project, and the legal codes are often a great source of wisdom.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DC SSRs (0 to 50V DC)==&lt;br /&gt;
&lt;br /&gt;
We sell DC SSRs for up to 50 Volts DC Operation.  This is indicated on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could be switching in the future, higher voltage DC SSRs can be used to switch lower voltages.  If your voltage is close - be conservative.  For instance, a 24 Volt system built from 2 Lead Acid batteries can reach 30 volts when charging - so using a 30V SSR would be cutting it close.&lt;br /&gt;
&lt;br /&gt;
===Picking your DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you may need a heat sink.  For selecting a heatsink, please consult [[#Picking a Heatsink|Picking a Heatsink]]. Alternatively, look at other SSRs on your list - there may be an SSR that can handle your average load current without a heatsink. SSRs rated for a larger load will be more efficient for the same current.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===DC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
[[Image:Diode.jpg|thumb| A diode, included with our DC &amp;quot;hockey puck&amp;quot; SSRs. The cathode is marked with a line. The blue symbol shows circuit diagram equivalent of the diode.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:relaymotor.jpg|thumb| A DC SSR switching an electric motor. The 1018 Phidget InterfaceKit controls the SSR using its digital outputs. A diode is shown installed across the motor, and a fuse is hooked up between the power supply and the rest of the circuit.]]&lt;br /&gt;
&lt;br /&gt;
Your DC SSR from Phidgets comes with a diode. This diode should be installed across your load, with the Cathode installed towards the power supply.  &lt;br /&gt;
&lt;br /&gt;
If the diode is installed backwards, as soon as the SSR is turned on, the load will be shorted out, likely destroying the diode, or the SSR, or your power supply.&lt;br /&gt;
A fuse protecting your power supply is always a good idea.&lt;br /&gt;
&lt;br /&gt;
The diode protects the SSR from powerful residual currents after the SSR is turned off.  These residual currents are used to produce the sparks for spark plugs - they are easily capable of destroying your SSR.  The diode allows these currents to recirculate in the load until they have lost their energy. &amp;lt;font color=red&amp;gt; EXPAND ON THIS EXAMPLE &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with DC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:DC SSR Load.png|right|thumb|300px|Schematic of an DC SSR switching a generic load, which is protected by a diode connected in parallel. The circuit is protected by a fuse in series after the power supply.]]&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, voltage offsets.&lt;br /&gt;
&lt;br /&gt;
With a DC SSR, always make sure the positive load terminal (labeled +) is facing towards the positive terminal of the power supply. If the load terminals are reversed, your load will immediately turn on - there is a diode inside of the SSR.&lt;br /&gt;
&lt;br /&gt;
The DC SSR can be installed on either side of the load, and it will work properly, but there is an advantage to installing the SSR between the power supply and the load.  If the load is connected to the power supply, it will always have a potentially dangerous voltage on it, even when it is not operating.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AC/DC SSRs (0 to 40V DC / 0 to 28V AC)==&lt;br /&gt;
&lt;br /&gt;
Our AC/DC SSRs are built on a small PCB, making them physically smaller than the hockey puck SSRs, and less expensive.  They are limited to lower currents, and cannot be mounted on a heatsink.  &amp;lt;Put in a picture of the 3052 SSR, with an arrow showing the SSR chip on the board&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We sell AC/DC SSRs that can switch up to 40 Volts DC or 28 Volts AC.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  There is no lower limit on the voltages that the AC/DC SSRs can switch.  If your voltage is close - be conservative.  For instance, a 36 Volt system built from 3 Lead Acid batteries can reach 45 volts when charging.&lt;br /&gt;
&lt;br /&gt;
===Picking your AC/DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
* Maximum Average Current is greater than or equal to your Average current.&lt;br /&gt;
&lt;br /&gt;
If you are interested in minimum cost, you will likely choose the cheapest option that meets these criteria.  If you are interested in high efficiency operation and less heat generation, consider buying an SSR with higher current rating.&lt;br /&gt;
&lt;br /&gt;
Your AC/DC SSR from Phidgets has built in protection from static electricity, and dangerous residual currents  after the SSR is turned off.  If you are switching DC, installing a diode across the load will offer even more protection.  Refer to the [[#DC SSR Protection|DC SSR Protection]] section for more information.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC/DC SSRs===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching a DC Load.  Point out that the AC/DC ssr output terminals are bidirectional - it doesn&#039;t matter which way you hook them up.  Show the optional diode, make sure it&#039;s clear that it&#039;s optional&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching an AC Load&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a AC/DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, careful consideration of voltage offsets.&lt;br /&gt;
&lt;br /&gt;
==Using heatsinks with Hockey Puck SSRs==&lt;br /&gt;
&lt;br /&gt;
SSRs will only achieve their promise of reliability and long life if they are kept cool.  Cool is relative, of course, but a good rule of thumb is to keep the metal base of the SSR at less than 85 Celsius.  A thermocouple can be used to precisely measure the temperature of the metal base.&lt;br /&gt;
&lt;br /&gt;
Excess heat usually comes from too much current and too little heatsinking.  A lot of heat can also be generated by turning the relay on and off frequently.  If your relay is being operated for brief periods of time, you may not need as large of a heatsink - provided the relay is never accidentally left on for extended periods.  Unless space is a concern, it&#039;s better to err on the side of caution.&lt;br /&gt;
&lt;br /&gt;
Before buying a heatsink, consider if you actually need it.  If your application is running at room temperature, and your average current is less than the &#039;&#039;&#039;Load with no Heatsink&#039;&#039;&#039; specification of your SSR, then no, you don&#039;t need a heatsink.  Alternatively, if your project has a large metal chassis that the SSR can bolt to, this can be used as your heat sink.&lt;br /&gt;
&lt;br /&gt;
Each SSR suitable for use with heatsinks will include a specification of how much current it can switch with each heatsink we sell.  This specification assumes a reasonable airflow over the heatsink, and that the flowing air is at room temperature.  Our SSRs have a sheet of metal underneath, where the heat is concentrated - this is also where the heat is measured to tell if the SSR is too hot.  Phidgets includes a grey pad with our Hockey Puck form factor SSRs.  You place this pad under an SSR when mounting it on a heatsink, or on large metal surfaces that can dissipate heat.  The pad takes the place of thermal grease - if you are more comfortable with thermal grease, you can use it instead.  Our heat sinks include screws for mounting SSRs.  &amp;lt;Show picture of heat sink + thermal pad + SSR&amp;gt;, and another picture assembled.&amp;gt;  Use a good size screwdriver when tightening the SSR down on the heat sink to ensure good conduction.&lt;br /&gt;
&lt;br /&gt;
==Hooking up wires to the Hockey Puck SSR==&lt;br /&gt;
&lt;br /&gt;
&amp;lt; Need picture of wires clamped onto the SSR, with the MOV on top &amp;gt;&lt;br /&gt;
&lt;br /&gt;
When wiring your load to the SSR, the wire is looped clockwise around the terminal, so as the screw is tightened down, it will draw the wire in tighter.  We recommend using wires up to 10 AWG in size - any larger, and the screws will not have enough thread left to tighten down, and they will strip.  10 AWG wiring is conservatively rated at 30 Amps, &#039;&#039;&#039;TBD&#039;&#039;&#039; posing a problem to use SSRs rated higher than 30 AMPS.  Larger wires can be attached using a wiring lug.  The lug is clamped under the SSR screw, and the wire attaches to the lug.  &amp;lt;picture of TRM6 on SSR with big wire attached&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Loose wire connections can generate a lot of heat - use a good size screwdriver when clamping down the load wires.&lt;br /&gt;
&lt;br /&gt;
For the current ratings of various wires sizes, please see [[Page on Wire Sizes]]&lt;br /&gt;
&lt;br /&gt;
===Did you know?===&lt;br /&gt;
&lt;br /&gt;
Mains Voltage &#039;&#039;&#039;AC SSRs&#039;&#039;&#039; cannot switch DC. They will never turn off.  AC SSRs turn off twice per AC Cycle - in North America, AC is 60 Hz, so the AC SSR has 120 opportunities per second to turn off.  If the SSR is operating from DC, the current will flow continuously, and the SSR will not turn off, even when the control input is off.&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; turns off automatically every time the current is zero.  An AC SSR will have a current value that it regards as &#039;zero&#039;.  If your load requires less than this current, your SSR will never turn on - or will not reliably turn on.&lt;br /&gt;
&lt;br /&gt;
Very fast voltage changes can disturb the internal circuitry on an &#039;&#039;&#039;AC SSR&#039;&#039;&#039; enough to turn it on accidentally.  SSR Manufacturers protect against this by adding a simple circuit inside the SSR, across the load terminals, called a snubber.  The snubber absorbs very fast electrical changes, converting them to heat.  When the AC SSR is turned on, there is little voltage difference between the terminals, so the snubber has very little effect.  When the AC SSR is turned off, the snubber is actively protecting the SSR - but at a cost, as it allows a small current through the SSR, which is wasted.  &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; uses bipolar transistors - an old technology that has been replaced by CMOS transistors in modern digital circuits.  Bipolar transistors are still superior for handling high voltages.  Bipolar transistors, and the more complex transistors built from them, will lose a constant voltage as current flows through them.  The collection of transistors in your SSR will lose about 1.7 volts - so on a 120 VAC system, you will lose about 1.5% to the SSR.  This energy goes into heating the SSR, and the heating from these transistors is the reason SSRs often need heat sinks.&lt;br /&gt;
&lt;br /&gt;
SSRs, and semiconductors in general, usually fail as a short circuit.  This means your load will probably turn on permanently (or until you remove the power) - make sure this doesn&#039;t cause a safety hazard.  For instance, Sauna Heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DC SSRs&#039;&#039;&#039; (at least the units we sell) use MOSFETs - Metal Oxide Semiconductor Field Effect Transistors.  Say that three times fast.  MOSFETs do not lose a constant voltage - instead, when they turn on, they act as a very slight restriction to the flow of current - a resistor.  At low currents, the slight restriction wastes very little power, giving high efficiency and often not requiring a heat sink.  This efficiency is lost as the current increases - a doubling of current quadruples the production of heat.  &lt;br /&gt;
&lt;br /&gt;
MOSFETs can switch AC, but a single MOSFET has a diode in parallel with it.  The MOSFET can only block current in one direction - as soon as the voltage reverses, the current flows through the diode.  If a MOSFET is used to switch AC, your load will be turned on half the time.  A solution is to use two MOSFETs back to back - which is what we do with our &#039;&#039;&#039;AC/DC SSRs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Product Specification Table ===&lt;br /&gt;
&amp;lt;Eventually we want this table to be generated automatically somehow.&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Manufacturer Part #&lt;br /&gt;
! Current Type&lt;br /&gt;
! Turn-on Type&lt;br /&gt;
! Control Voltage (V)&lt;br /&gt;
! Max. Load Voltage (V)&lt;br /&gt;
! Max. Load Current Without Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU2 Heatsink (A)&lt;br /&gt;
! Max. Surge Current (A)&lt;br /&gt;
! Output Type&lt;br /&gt;
|-&lt;br /&gt;
| 3052_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 2.5 || N/A || N/A || 5    || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3053_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 9   || N/A || N/A || ???  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3950_0 || HFS33/D-30D50M     || DC    || N/A            || 3-32VDC || 30	     || 18  || 50  || 50  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3951_0 || HFS33/D-50D80M     || DC    || N/A            || 3-32VDC || 50           || 20  || 40  || 80  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3952_0 || HFS33/D-30D100M    || DC    || N/A            || 3-32VDC || 30           || 25  || 50  || 100 || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3953_0 || HFS34/D-240A20PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 8   || 15  || 20  || 1000 || SCR&lt;br /&gt;
|-&lt;br /&gt;
| 3954_0 || HFS34/D-240A80PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 10  || 20  || 50  || 1000 || SCR&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10835</id>
		<title>Solid State Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10835"/>
		<updated>2011-12-15T22:43:25Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* DC SSRs (0 to 50V DC) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[Image:SSR.jpg]]&lt;br /&gt;
| [[Image:3052.jpg|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Solid state relays (SSRs) turn on or off the power being supplied to other devices, in a similar fashion as a physical [[Switch Primer|switch]]. However, instead of being switched by human interaction like a physical switch, SSRs are switched digitally.&lt;br /&gt;
With relays, you can control high-current devices such as lights or appliances with low-current signals, like a standard DC signal from a [[Digital Output Primer|Digital Output]]. Most SSRs will switch on with a voltage of 3V or higher. This makes them perfect for use with [[Interface Kits]], or any device with a digital output. &lt;br /&gt;
&lt;br /&gt;
SSRs perform the same job as [[Mechanical Relay Primer|Mechanical Relays]], but have the following advantages:&lt;br /&gt;
* SSRs produce less electromagnetic interference than mechanical relays during operation. This is mostly due to a phenomenon called [[Mechanical Relay Primer#Arcing, Interference, and Sticking|contact arcing]] only present in mechanical relays, where the physical contacts of the relay tend to spark internally while switching. The reduced interference can also be attributed to the fact that SSRs do not use electromagnets to switch.&lt;br /&gt;
* The switch contacts of a mechanical relay will eventually wear down from sparking.  An SSR will have a longer life because its internals are purely digital.  Properly used, they will last for millions of cycles.&lt;br /&gt;
* SSRs turn on and off faster than mechanical relays (≈1ms compared to ≈10ms).&lt;br /&gt;
* SSRs are less susceptible to physical vibrations than mechanical relays.&lt;br /&gt;
* Since the switch inside an SSR isn&#039;t a mechanical switch, it does not suffer from [[Switch Primer#Bounce|contact bounce]], and operates silently.&lt;br /&gt;
&lt;br /&gt;
However, compared to Mechanical Relays, SSRs: &lt;br /&gt;
* Are more expensive to produce.&lt;br /&gt;
* Will dissipate more energy in the form of heat (1-2% of the energy intended to power the load).&lt;br /&gt;
&lt;br /&gt;
==How SSRs Work==&lt;br /&gt;
&lt;br /&gt;
[[Image:SSR_Internals.png|thumb|A conceptual diagram of the insides of an SSR.]]&lt;br /&gt;
&lt;br /&gt;
The control inputs are connected internally to an LED, which shines across an air gap to light sensors.  The pairing of an LED with light sensors is called an optocoupler, and is a common technique to link two parts of a circuit without direct connection.  The light sensor is connected to the transistors which open or close, supplying the relay&#039;s load with power. &lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling an SSR is no more complicated than driving an LED.  There are many ways of accomplishing this with Phidgets - &lt;br /&gt;
*[[Link to Digital Output Page, SSR Section]]&lt;br /&gt;
*[[Link to Digital Output Page 0/16/16, SSR Section]]&lt;br /&gt;
*[[Link to LED Output Page, SSR Section]]&lt;br /&gt;
&lt;br /&gt;
The ability of an SSR to switch a load is very similar to a [[Mechanical Relay Primer|mechanical relay]] or simple switch.  &lt;br /&gt;
&lt;br /&gt;
The challenge is to pick an appropriate type of SSR for your application. There is no single SSR perfect for all applications. To choose an SSR for your application, please follow the [[#Choosing an SSR|Choosing an SSR]] section.&lt;br /&gt;
&lt;br /&gt;
===Safety===&lt;br /&gt;
&lt;br /&gt;
Since relays switch high currents and voltages, standard precautions apply.  Make sure you never touch the terminals while the relay is powered. If your SSR came with a plastic cover, use it.  Even when the SSR is switched off, a very small amount of current will flow.&lt;br /&gt;
&lt;br /&gt;
When an SSR fails, it most often fails permanently closed. This is because when the transistor inside fails due to excessive current or heat, it will usually short out, allowing current to pass through unimpeded. &lt;br /&gt;
This means that as long as the power supply remains on, the device will be powered, possibly creating a fire or safety hazard.&lt;br /&gt;
&lt;br /&gt;
==Choosing an SSR==&lt;br /&gt;
&lt;br /&gt;
===Identify your voltage===&lt;br /&gt;
&lt;br /&gt;
First, determine whether you need to switch AC or DC voltage. The electrical grid, and thus your wall outlet, runs AC, whereas batteries and most small power supplies are DC.  &lt;br /&gt;
&lt;br /&gt;
Next, estimate the number of volts you will be switching.  If you are switching DC, particularly with batteries, assume your voltage is at least 25% more than what your battery is rated for.  Even larger fluctuations occur on AC, but AC SSRs are designed to handle it, so you don&#039;t need to add anything to your estimate. For example, typical AC voltage from a wall socket is 110VAC, whereas in Europe it is 220VAC.&lt;br /&gt;
&lt;br /&gt;
===Identify your current===&lt;br /&gt;
&lt;br /&gt;
The current drawn by your load when turned on affects how large of an SSR you need, and how hot it will be when it runs.  If you know how much current, on average, your load draws, this is what we call &#039;&#039;&#039;Average Load Current&#039;&#039;&#039;.  If you don&#039;t know the average current, but you know the watts of your device, you can calculate Average Load Current by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{Average Load Current} =\frac{\text{Watts}}{\text{Operating Voltage}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, you need to know the current drawn by your device when it is first turned on.  Many devices demand a huge inrush of current when the device is first turned on. This places a significant amount of stress on the electronics.  If you&#039;ve ever noticed the lights dimming in the house for a second when the furnace kicks in, this is caused by the fan motor starting up.  It&#039;s very difficult to measure the &#039;&#039;&#039;Surge Current&#039;&#039;&#039; itself, so we use a multiplier based on your device type.  Surge Current is also referred to as inrush current.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Surge Current Multiplier&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Multiplier&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Motors || 6x&lt;br /&gt;
|-&lt;br /&gt;
| LEDs || 1x&lt;br /&gt;
|-&lt;br /&gt;
| Complex Electronics i.e., Motor Controllers, Phidgets || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures   (AC Only) || 10x&lt;br /&gt;
|-&lt;br /&gt;
| Transformers || ?             &lt;br /&gt;
|-&lt;br /&gt;
| Heaters || ?&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiply your Average Load Current by the multiplier for your device type to calculate the Surge Current.&lt;br /&gt;
&lt;br /&gt;
===I need to switch AC===&lt;br /&gt;
&lt;br /&gt;
Most AC applications will be switching 110 to 240 Volt power coming from the grid.  If that&#039;s you, go to the [[#Mains Voltage (110 to 240V AC)|Mains Voltage (110 to 240V AC)]] section.&lt;br /&gt;
&lt;br /&gt;
We also cover low voltage AC applications - 28 VAC (Volts AC) or less. For more information, visit the [[#AC/DC SSRs|AC/DC SSRs]] section.&lt;br /&gt;
&lt;br /&gt;
===I need to switch DC===&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need to switch a lot of current - 9 Amps or less, consider our compact, cost effective [[#AC/DC SSRs|AC/DC SSRs]].&lt;br /&gt;
&lt;br /&gt;
At more than 9 Amps, you need a serious [[#DC SSRs|DC SSR]].&lt;br /&gt;
&lt;br /&gt;
==Mains Voltage (110 to 240V AC)==&lt;br /&gt;
&lt;br /&gt;
We sell AC SSRs for 120 VAC or 240 VAC operation. This information can be found on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could eventually need to switch, the 240 VAC relays can be used to switch 120 VAC with no problems.  Please note we are very conservative in how we rate relays - our 120 VAC relays are rated by the manufacturer for 240 VAC, and the 240 VAC for 380 VAC - but we strongly recommend against using them to the manufacturer rated voltage.  To understand why, read the [[#AC SSR Protection|AC SSR Protection]] section.&lt;br /&gt;
&lt;br /&gt;
===Load Type - Inductive vs. Resistive===&lt;br /&gt;
&lt;br /&gt;
[[Image:zero cross.png|right|thumb|300px|This graph shows the difference between zero-cross and random turn-on. The blue line represents the oscillating voltage of an AC load, and the shaded areas represent the sections when the relay is turned on and letting current pass through. As you can see, the random turn-on SSR immediately opens when activated, while the zero-cross turn-on SSR waits until the voltage crosses zero before opening.]]&lt;br /&gt;
&lt;br /&gt;
If your load is inductive, you need to choose a &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; relay.  If your load is resistive, choose a &#039;&#039;&#039;Zero Crossing&#039;&#039;&#039; relay.&lt;br /&gt;
&lt;br /&gt;
Your Load will probably be inductive if it is built around a large coil of wire - motors and transformers are typical examples.  A load considered resistive may also have loops of wire - for instance, hair dryers, toasters, incandescent bulbs use twisted wire elements to generate the heat.  An inductive load will have thousands of loops of wire - it&#039;s a matter of scale.  There is no such thing as a perfectly resistive load - but the load has to be really inductive to cause the zero crossing SSRs to malfunction.&lt;br /&gt;
&lt;br /&gt;
SSRs are designed to either turn on immediately (&#039;&#039;&#039;Random Turn On&#039;&#039;&#039;), or wait until the next &#039;alternation&#039; of the voltage (&#039;&#039;&#039;Zero Crossing&#039;&#039;&#039;).  Zero Crossing SSRs create less electromagnetic &#039;noise&#039; when they turn on, &amp;lt;font color=red&amp;gt;and &#039;&#039;&#039;MIGHT TBD&#039;&#039;&#039;&amp;lt;/font&amp;gt; cost more money.  They are best used with resistive loads - Zero Crossing SSRs are not able to turn off some inductive loads.  It&#039;s very difficult to determine which inductive loads will create problems - well beyond the scope of this document.  If your load is inductive, we recommend buying the &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; SSRs.&lt;br /&gt;
&lt;br /&gt;
Another good reason to use Random Turn On SSRs for inductive loads is the coils will be wrapped around a magnetic material like iron.  As the current flow generates magnetic fields, the iron is repeatedly magnetized in opposite directions.  Depending on how the iron was magnetized when the power was removed, and your luck when the load is turned on, an effect called saturation can produce a huge inrush of current.  Zero Crossing SSRs are more likely to turn on the load at exactly the worst time.  &lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+ &#039;&#039;&#039;Inductive and Resistive Loads&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Load Type&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs   || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures || Inductive or Resistive &amp;lt;font size=4&amp;gt;&#039;&#039;&#039;*&#039;&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Motors                     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Transformers               || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Heaters                    || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Computer / Electronics     || ???&lt;br /&gt;
|-&lt;br /&gt;
| AC/DC power supplies (brick heavy type)     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
|AC/DC Power supplies (lightweight switchers) || Resistive&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=4&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/font&amp;gt; &#039;&#039;For fluorescent light fixtures, older units (magnetic ballast) may be inductive, and newer units are often resistive (electronic ballast).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Picking your AC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, and your load type (inductive or resistive), you can create a short list of relays whose &lt;br /&gt;
* &#039;&#039;&#039;Maximum Load Voltage&#039;&#039;&#039; are greater than or equal to your operating voltage, &lt;br /&gt;
* &#039;&#039;&#039;Maximum Surge Current&#039;&#039;&#039; are greater than or equal to your surge current, and &lt;br /&gt;
* &#039;&#039;&#039;Load type&#039;&#039;&#039; matches what you chose for random turn on/zero crossing.&lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you may need a heat sink.  For selecting a heatsink, please consult [[#Picking a heatsink|Picking a Heatsink]]. Alternatively, look at other SSRs on your list - there may be an SSR that can handle your average load current with no heatsink.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
Instead of simply turning the load on/off, if you want to dim it gradually, you can use a proportional control SSR.  They are able to reduce the average power to the load gradually, in proportion to the strength of the input signal. For more information, you can visit the [[#Proportional Control SSR|Proportional Control SSR Section]].&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===AC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
{{ContentNeeded | This section needs information that has been requested from Future Electronics by Chester}}&lt;br /&gt;
&lt;br /&gt;
[[Image:MOV.jpg|thumb|An MOV, which comes packaged with our AC &amp;quot;Hockey Puck&amp;quot; relays. ]]&lt;br /&gt;
&lt;br /&gt;
Your AC SSR from Phidgets comes with a circular disc with two legs (pictured). This is a Metal Oxide Varistor (MOV) and should be installed across the load (larger) terminals of your SSR &amp;lt;Picture&amp;gt;.  MOVs are the classic surge protector - an inexpensive component that absorbs high voltage spikes.  High voltage spikes are caused by inductive loads when they are turned off, and also happen very often on the electrical grid, as nearby devices are operated.  Even if your load is resistive, use an MOV to protect the SSR.&lt;br /&gt;
&lt;br /&gt;
MOVs have a limited life span, they must be carefully chosen.  If an MOV is chosen for too low of a voltage spike, it will wear out quickly.  If it is chosen for too high of a voltage spike, it will not protect the SSR adequately.  MOVs are not perfect devices - therefore we have chosen SSRs which can survive much higher voltage spikes than what we recommend them for.  For example, this is why the AC SSRs we recommend for 120 VAC operation are rated by the manufacturer for 240 VAC.  If you must operate our AC SSRs on higher voltages than we recommend, do not use the included MOV.&lt;br /&gt;
&lt;br /&gt;
As MOVs wear out from use, they will become more sensitive to common voltage spikes, causing them to wear out quicker.  When they entirely fail, they will become a short circuit, potentially creating a fire hazard.  The MOV included with your SSR has a fuse built in which will disable the MOV when it becomes a hazard.  Please consider (and avoid!) nearby flammable material when mounting your SSR.&lt;br /&gt;
&lt;br /&gt;
*TMOV20RP200E&lt;br /&gt;
*TMOV20RP385E&lt;br /&gt;
&lt;br /&gt;
===Proportional Control SSR===&lt;br /&gt;
&lt;br /&gt;
Proportional Control Relays (often simply called &amp;quot;Control Relays&amp;quot;) are SSRs you can use to control the amount of power to the load.  Rather than reduce the voltage, or somehow limit the current - which would be very expensive solutions, the Proportional SSR reduces power by turning the load on/off quickly, feeding full power in short pulses.  A similar technology is used for motor control, called PWM (Pulse Width Modulation).  &lt;br /&gt;
&lt;br /&gt;
Proportional SSRs are controlled by a variable voltage - as the voltage increases, more power is available to the load.  Our PhidgetAnalog product can be used to control Proportional SSRs.  We don&#039;t sell Proportional SSRs - but they can be purchased from Digikey, where they are called AC Linear Controlled SSRs.&lt;br /&gt;
&lt;br /&gt;
A quick and dirty (and inexpensive!) solution for dimming with Phidgets is to use an [[Servo Motor and Controller Primer|RC Servo Motor]] with a PhidgetAdvancedServo to rotate the knob on a light dimmer.  From software, the RC Servo Motor is rotated to an absolute position, cranking the knob as it turns. &amp;lt;font color=red&amp;gt; EXPAND &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:AC SSR Load.png|right|thumb|300px|Schematic of an AC SSR switching a generic load. A metal oxide varistor is added across the load to protect the SSR.]]&lt;br /&gt;
&lt;br /&gt;
When wiring up an AC circuit, particularly for long term installation, you may find it helpful to buy a book on residential wiring from your local hardware store.  There are many wiring conventions (and often legal codes) which will help you plan your project, and the legal codes are often a great source of wisdom.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DC SSRs (0 to 50V DC)==&lt;br /&gt;
&lt;br /&gt;
We sell DC SSRs for up to 50 Volts DC Operation.  This is indicated on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could be switching in the future, higher voltage DC SSRs can be used to switch lower voltages.  If your voltage is close - be conservative.  For instance, a 24 Volt system built from 2 Lead Acid batteries can reach 30 volts when charging - so using a 30V SSR would be cutting it close.&lt;br /&gt;
&lt;br /&gt;
===Picking your DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you may need a heat sink.  For selecting a heatsink, please consult [[#Picking a Heatsink|Picking a Heatsink]]. Alternatively, look at other SSRs on your list - there may be an SSR that can handle your average load current without a heatsink. SSRs rated for a larger load will be more efficient for the same current.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===DC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
[[Image:Diode.jpg|thumb| A diode, included with our DC &amp;quot;hockey puck&amp;quot; SSRs. The cathode is marked with a line. The blue symbol shows circuit diagram equivalent of the diode.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:relaymotor.jpg|thumb| A DC SSR switching an electric motor. The 1018 Phidget InterfaceKit controls the SSR using its digital outputs. A diode is shown installed across the motor, and a fuse is hooked up between the power supply and the rest of the circuit.]]&lt;br /&gt;
&lt;br /&gt;
Your DC SSR from Phidgets comes with a diode. This diode should be installed across your load, with the Cathode installed towards the power supply.  &lt;br /&gt;
&lt;br /&gt;
If the diode is installed backwards, as soon as the SSR is turned on, the load will be shorted out, likely destroying the diode, or the SSR, or your power supply.&lt;br /&gt;
A fuse protecting your power supply is always a good idea.&lt;br /&gt;
&lt;br /&gt;
The diode protects the SSR from powerful residual currents after the SSR is turned off.  These residual currents are used to produce the sparks for spark plugs - they are easily capable of destroying your SSR.  The diode allows these currents to recirculate in the load until they have lost their energy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with DC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:DC SSR Load.png|right|thumb|300px|Schematic of an DC SSR switching a generic load, which is protected by a diode connected in parallel. The circuit is protected by a fuse in series after the power supply.]]&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, voltage offsets.&lt;br /&gt;
&lt;br /&gt;
With a DC SSR, always make sure the positive load terminal (labeled +) is facing towards the positive terminal of the power supply. If the load terminals are reversed, your load will immediately turn on - there is a diode inside of the SSR.&lt;br /&gt;
&lt;br /&gt;
The DC SSR can be installed on either side of the load, and it will work properly, but there is an advantage to installing the SSR between the power supply and the load.  If the load is connected to the power supply, it will always have a potentially dangerous voltage on it, even when it is not operating.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AC/DC SSRs (0 to 40V DC / 0 to 28V AC)==&lt;br /&gt;
&lt;br /&gt;
Our AC/DC SSRs are built on a small PCB, making them physically smaller than the hockey puck SSRs, and less expensive.  They are limited to lower currents, and cannot be mounted on a heatsink.  &amp;lt;Put in a picture of the 3052 SSR, with an arrow showing the SSR chip on the board&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We sell AC/DC SSRs that can switch up to 40 Volts DC or 28 Volts AC.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  There is no lower limit on the voltages that the AC/DC SSRs can switch.  If your voltage is close - be conservative.  For instance, a 36 Volt system built from 3 Lead Acid batteries can reach 45 volts when charging.&lt;br /&gt;
&lt;br /&gt;
===Picking your AC/DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
* Maximum Average Current is greater than or equal to your Average current.&lt;br /&gt;
&lt;br /&gt;
If you are interested in minimum cost, you will likely choose the cheapest option that meets these criteria.  If you are interested in high efficiency operation and less heat generation, consider buying an SSR with higher current rating.&lt;br /&gt;
&lt;br /&gt;
Your AC/DC SSR from Phidgets has built in protection from static electricity, and dangerous residual currents  after the SSR is turned off.  If you are switching DC, installing a diode across the load will offer even more protection.  Refer to the [[#DC SSR Protection|DC SSR Protection]] section for more information.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC/DC SSRs===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching a DC Load.  Point out that the AC/DC ssr output terminals are bidirectional - it doesn&#039;t matter which way you hook them up.  Show the optional diode, make sure it&#039;s clear that it&#039;s optional&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching an AC Load&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a AC/DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, careful consideration of voltage offsets.&lt;br /&gt;
&lt;br /&gt;
==Using heatsinks with Hockey Puck SSRs==&lt;br /&gt;
&lt;br /&gt;
SSRs will only achieve their promise of reliability and long life if they are kept cool.  Cool is relative, of course, but a good rule of thumb is to keep the metal base of the SSR at less than 85 Celsius.  A thermocouple can be used to precisely measure the temperature of the metal base.&lt;br /&gt;
&lt;br /&gt;
Excess heat usually comes from too much current and too little heatsinking.  A lot of heat can also be generated by turning the relay on and off frequently.  If your relay is being operated for brief periods of time, you may not need as large of a heatsink - provided the relay is never accidentally left on for extended periods.  Unless space is a concern, it&#039;s better to err on the side of caution.&lt;br /&gt;
&lt;br /&gt;
Before buying a heatsink, consider if you actually need it.  If your application is running at room temperature, and your average current is less than the &#039;&#039;&#039;Load with no Heatsink&#039;&#039;&#039; specification of your SSR, then no, you don&#039;t need a heatsink.  Alternatively, if your project has a large metal chassis that the SSR can bolt to, this can be used as your heat sink.&lt;br /&gt;
&lt;br /&gt;
Each SSR suitable for use with heatsinks will include a specification of how much current it can switch with each heatsink we sell.  This specification assumes a reasonable airflow over the heatsink, and that the flowing air is at room temperature.  Our SSRs have a sheet of metal underneath, where the heat is concentrated - this is also where the heat is measured to tell if the SSR is too hot.  Phidgets includes a grey pad with our Hockey Puck form factor SSRs.  You place this pad under an SSR when mounting it on a heatsink, or on large metal surfaces that can dissipate heat.  The pad takes the place of thermal grease - if you are more comfortable with thermal grease, you can use it instead.  Our heat sinks include screws for mounting SSRs.  &amp;lt;Show picture of heat sink + thermal pad + SSR&amp;gt;, and another picture assembled.&amp;gt;  Use a good size screwdriver when tightening the SSR down on the heat sink to ensure good conduction.&lt;br /&gt;
&lt;br /&gt;
==Hooking up wires to the Hockey Puck SSR==&lt;br /&gt;
&lt;br /&gt;
&amp;lt; Need picture of wires clamped onto the SSR, with the MOV on top &amp;gt;&lt;br /&gt;
&lt;br /&gt;
When wiring your load to the SSR, the wire is looped clockwise around the terminal, so as the screw is tightened down, it will draw the wire in tighter.  We recommend using wires up to 10 AWG in size - any larger, and the screws will not have enough thread left to tighten down, and they will strip.  10 AWG wiring is conservatively rated at 30 Amps, &#039;&#039;&#039;TBD&#039;&#039;&#039; posing a problem to use SSRs rated higher than 30 AMPS.  Larger wires can be attached using a wiring lug.  The lug is clamped under the SSR screw, and the wire attaches to the lug.  &amp;lt;picture of TRM6 on SSR with big wire attached&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Loose wire connections can generate a lot of heat - use a good size screwdriver when clamping down the load wires.&lt;br /&gt;
&lt;br /&gt;
For the current ratings of various wires sizes, please see [[Page on Wire Sizes]]&lt;br /&gt;
&lt;br /&gt;
===Did you know?===&lt;br /&gt;
&lt;br /&gt;
Mains Voltage &#039;&#039;&#039;AC SSRs&#039;&#039;&#039; cannot switch DC. They will never turn off.  AC SSRs turn off twice per AC Cycle - in North America, AC is 60 Hz, so the AC SSR has 120 opportunities per second to turn off.  If the SSR is operating from DC, the current will flow continuously, and the SSR will not turn off, even when the control input is off.&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; turns off automatically every time the current is zero.  An AC SSR will have a current value that it regards as &#039;zero&#039;.  If your load requires less than this current, your SSR will never turn on - or will not reliably turn on.&lt;br /&gt;
&lt;br /&gt;
Very fast voltage changes can disturb the internal circuitry on an &#039;&#039;&#039;AC SSR&#039;&#039;&#039; enough to turn it on accidentally.  SSR Manufacturers protect against this by adding a simple circuit inside the SSR, across the load terminals, called a snubber.  The snubber absorbs very fast electrical changes, converting them to heat.  When the AC SSR is turned on, there is little voltage difference between the terminals, so the snubber has very little effect.  When the AC SSR is turned off, the snubber is actively protecting the SSR - but at a cost, as it allows a small current through the SSR, which is wasted.  &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; uses bipolar transistors - an old technology that has been replaced by CMOS transistors in modern digital circuits.  Bipolar transistors are still superior for handling high voltages.  Bipolar transistors, and the more complex transistors built from them, will lose a constant voltage as current flows through them.  The collection of transistors in your SSR will lose about 1.7 volts - so on a 120 VAC system, you will lose about 1.5% to the SSR.  This energy goes into heating the SSR, and the heating from these transistors is the reason SSRs often need heat sinks.&lt;br /&gt;
&lt;br /&gt;
SSRs, and semiconductors in general, usually fail as a short circuit.  This means your load will probably turn on permanently (or until you remove the power) - make sure this doesn&#039;t cause a safety hazard.  For instance, Sauna Heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DC SSRs&#039;&#039;&#039; (at least the units we sell) use MOSFETs - Metal Oxide Semiconductor Field Effect Transistors.  Say that three times fast.  MOSFETs do not lose a constant voltage - instead, when they turn on, they act as a very slight restriction to the flow of current - a resistor.  At low currents, the slight restriction wastes very little power, giving high efficiency and often not requiring a heat sink.  This efficiency is lost as the current increases - a doubling of current quadruples the production of heat.  &lt;br /&gt;
&lt;br /&gt;
MOSFETs can switch AC, but a single MOSFET has a diode in parallel with it.  The MOSFET can only block current in one direction - as soon as the voltage reverses, the current flows through the diode.  If a MOSFET is used to switch AC, your load will be turned on half the time.  A solution is to use two MOSFETs back to back - which is what we do with our &#039;&#039;&#039;AC/DC SSRs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Product Specification Table ===&lt;br /&gt;
&amp;lt;Eventually we want this table to be generated automatically somehow.&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Manufacturer Part #&lt;br /&gt;
! Current Type&lt;br /&gt;
! Turn-on Type&lt;br /&gt;
! Control Voltage (V)&lt;br /&gt;
! Max. Load Voltage (V)&lt;br /&gt;
! Max. Load Current Without Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU2 Heatsink (A)&lt;br /&gt;
! Max. Surge Current (A)&lt;br /&gt;
! Output Type&lt;br /&gt;
|-&lt;br /&gt;
| 3052_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 2.5 || N/A || N/A || 5    || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3053_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 9   || N/A || N/A || ???  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3950_0 || HFS33/D-30D50M     || DC    || N/A            || 3-32VDC || 30	     || 18  || 50  || 50  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3951_0 || HFS33/D-50D80M     || DC    || N/A            || 3-32VDC || 50           || 20  || 40  || 80  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3952_0 || HFS33/D-30D100M    || DC    || N/A            || 3-32VDC || 30           || 25  || 50  || 100 || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3953_0 || HFS34/D-240A20PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 8   || 15  || 20  || 1000 || SCR&lt;br /&gt;
|-&lt;br /&gt;
| 3954_0 || HFS34/D-240A80PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 10  || 20  || 50  || 1000 || SCR&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10834</id>
		<title>Solid State Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10834"/>
		<updated>2011-12-15T22:34:35Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Mains Voltage (110 to 240V AC) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[Image:SSR.jpg]]&lt;br /&gt;
| [[Image:3052.jpg|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Solid state relays (SSRs) turn on or off the power being supplied to other devices, in a similar fashion as a physical [[Switch Primer|switch]]. However, instead of being switched by human interaction like a physical switch, SSRs are switched digitally.&lt;br /&gt;
With relays, you can control high-current devices such as lights or appliances with low-current signals, like a standard DC signal from a [[Digital Output Primer|Digital Output]]. Most SSRs will switch on with a voltage of 3V or higher. This makes them perfect for use with [[Interface Kits]], or any device with a digital output. &lt;br /&gt;
&lt;br /&gt;
SSRs perform the same job as [[Mechanical Relay Primer|Mechanical Relays]], but have the following advantages:&lt;br /&gt;
* SSRs produce less electromagnetic interference than mechanical relays during operation. This is mostly due to a phenomenon called [[Mechanical Relay Primer#Arcing, Interference, and Sticking|contact arcing]] only present in mechanical relays, where the physical contacts of the relay tend to spark internally while switching. The reduced interference can also be attributed to the fact that SSRs do not use electromagnets to switch.&lt;br /&gt;
* The switch contacts of a mechanical relay will eventually wear down from sparking.  An SSR will have a longer life because its internals are purely digital.  Properly used, they will last for millions of cycles.&lt;br /&gt;
* SSRs turn on and off faster than mechanical relays (≈1ms compared to ≈10ms).&lt;br /&gt;
* SSRs are less susceptible to physical vibrations than mechanical relays.&lt;br /&gt;
* Since the switch inside an SSR isn&#039;t a mechanical switch, it does not suffer from [[Switch Primer#Bounce|contact bounce]], and operates silently.&lt;br /&gt;
&lt;br /&gt;
However, compared to Mechanical Relays, SSRs: &lt;br /&gt;
* Are more expensive to produce.&lt;br /&gt;
* Will dissipate more energy in the form of heat (1-2% of the energy intended to power the load).&lt;br /&gt;
&lt;br /&gt;
==How SSRs Work==&lt;br /&gt;
&lt;br /&gt;
[[Image:SSR_Internals.png|thumb|A conceptual diagram of the insides of an SSR.]]&lt;br /&gt;
&lt;br /&gt;
The control inputs are connected internally to an LED, which shines across an air gap to light sensors.  The pairing of an LED with light sensors is called an optocoupler, and is a common technique to link two parts of a circuit without direct connection.  The light sensor is connected to the transistors which open or close, supplying the relay&#039;s load with power. &lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling an SSR is no more complicated than driving an LED.  There are many ways of accomplishing this with Phidgets - &lt;br /&gt;
*[[Link to Digital Output Page, SSR Section]]&lt;br /&gt;
*[[Link to Digital Output Page 0/16/16, SSR Section]]&lt;br /&gt;
*[[Link to LED Output Page, SSR Section]]&lt;br /&gt;
&lt;br /&gt;
The ability of an SSR to switch a load is very similar to a [[Mechanical Relay Primer|mechanical relay]] or simple switch.  &lt;br /&gt;
&lt;br /&gt;
The challenge is to pick an appropriate type of SSR for your application. There is no single SSR perfect for all applications. To choose an SSR for your application, please follow the [[#Choosing an SSR|Choosing an SSR]] section.&lt;br /&gt;
&lt;br /&gt;
===Safety===&lt;br /&gt;
&lt;br /&gt;
Since relays switch high currents and voltages, standard precautions apply.  Make sure you never touch the terminals while the relay is powered. If your SSR came with a plastic cover, use it.  Even when the SSR is switched off, a very small amount of current will flow.&lt;br /&gt;
&lt;br /&gt;
When an SSR fails, it most often fails permanently closed. This is because when the transistor inside fails due to excessive current or heat, it will usually short out, allowing current to pass through unimpeded. &lt;br /&gt;
This means that as long as the power supply remains on, the device will be powered, possibly creating a fire or safety hazard.&lt;br /&gt;
&lt;br /&gt;
==Choosing an SSR==&lt;br /&gt;
&lt;br /&gt;
===Identify your voltage===&lt;br /&gt;
&lt;br /&gt;
First, determine whether you need to switch AC or DC voltage. The electrical grid, and thus your wall outlet, runs AC, whereas batteries and most small power supplies are DC.  &lt;br /&gt;
&lt;br /&gt;
Next, estimate the number of volts you will be switching.  If you are switching DC, particularly with batteries, assume your voltage is at least 25% more than what your battery is rated for.  Even larger fluctuations occur on AC, but AC SSRs are designed to handle it, so you don&#039;t need to add anything to your estimate. For example, typical AC voltage from a wall socket is 110VAC, whereas in Europe it is 220VAC.&lt;br /&gt;
&lt;br /&gt;
===Identify your current===&lt;br /&gt;
&lt;br /&gt;
The current drawn by your load when turned on affects how large of an SSR you need, and how hot it will be when it runs.  If you know how much current, on average, your load draws, this is what we call &#039;&#039;&#039;Average Load Current&#039;&#039;&#039;.  If you don&#039;t know the average current, but you know the watts of your device, you can calculate Average Load Current by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{Average Load Current} =\frac{\text{Watts}}{\text{Operating Voltage}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, you need to know the current drawn by your device when it is first turned on.  Many devices demand a huge inrush of current when the device is first turned on. This places a significant amount of stress on the electronics.  If you&#039;ve ever noticed the lights dimming in the house for a second when the furnace kicks in, this is caused by the fan motor starting up.  It&#039;s very difficult to measure the &#039;&#039;&#039;Surge Current&#039;&#039;&#039; itself, so we use a multiplier based on your device type.  Surge Current is also referred to as inrush current.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Surge Current Multiplier&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Multiplier&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Motors || 6x&lt;br /&gt;
|-&lt;br /&gt;
| LEDs || 1x&lt;br /&gt;
|-&lt;br /&gt;
| Complex Electronics i.e., Motor Controllers, Phidgets || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures   (AC Only) || 10x&lt;br /&gt;
|-&lt;br /&gt;
| Transformers || ?             &lt;br /&gt;
|-&lt;br /&gt;
| Heaters || ?&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiply your Average Load Current by the multiplier for your device type to calculate the Surge Current.&lt;br /&gt;
&lt;br /&gt;
===I need to switch AC===&lt;br /&gt;
&lt;br /&gt;
Most AC applications will be switching 110 to 240 Volt power coming from the grid.  If that&#039;s you, go to the [[#Mains Voltage (110 to 240V AC)|Mains Voltage (110 to 240V AC)]] section.&lt;br /&gt;
&lt;br /&gt;
We also cover low voltage AC applications - 28 VAC (Volts AC) or less. For more information, visit the [[#AC/DC SSRs|AC/DC SSRs]] section.&lt;br /&gt;
&lt;br /&gt;
===I need to switch DC===&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need to switch a lot of current - 9 Amps or less, consider our compact, cost effective [[#AC/DC SSRs|AC/DC SSRs]].&lt;br /&gt;
&lt;br /&gt;
At more than 9 Amps, you need a serious [[#DC SSRs|DC SSR]].&lt;br /&gt;
&lt;br /&gt;
==Mains Voltage (110 to 240V AC)==&lt;br /&gt;
&lt;br /&gt;
We sell AC SSRs for 120 VAC or 240 VAC operation. This information can be found on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could eventually need to switch, the 240 VAC relays can be used to switch 120 VAC with no problems.  Please note we are very conservative in how we rate relays - our 120 VAC relays are rated by the manufacturer for 240 VAC, and the 240 VAC for 380 VAC - but we strongly recommend against using them to the manufacturer rated voltage.  To understand why, read the [[#AC SSR Protection|AC SSR Protection]] section.&lt;br /&gt;
&lt;br /&gt;
===Load Type - Inductive vs. Resistive===&lt;br /&gt;
&lt;br /&gt;
[[Image:zero cross.png|right|thumb|300px|This graph shows the difference between zero-cross and random turn-on. The blue line represents the oscillating voltage of an AC load, and the shaded areas represent the sections when the relay is turned on and letting current pass through. As you can see, the random turn-on SSR immediately opens when activated, while the zero-cross turn-on SSR waits until the voltage crosses zero before opening.]]&lt;br /&gt;
&lt;br /&gt;
If your load is inductive, you need to choose a &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; relay.  If your load is resistive, choose a &#039;&#039;&#039;Zero Crossing&#039;&#039;&#039; relay.&lt;br /&gt;
&lt;br /&gt;
Your Load will probably be inductive if it is built around a large coil of wire - motors and transformers are typical examples.  A load considered resistive may also have loops of wire - for instance, hair dryers, toasters, incandescent bulbs use twisted wire elements to generate the heat.  An inductive load will have thousands of loops of wire - it&#039;s a matter of scale.  There is no such thing as a perfectly resistive load - but the load has to be really inductive to cause the zero crossing SSRs to malfunction.&lt;br /&gt;
&lt;br /&gt;
SSRs are designed to either turn on immediately (&#039;&#039;&#039;Random Turn On&#039;&#039;&#039;), or wait until the next &#039;alternation&#039; of the voltage (&#039;&#039;&#039;Zero Crossing&#039;&#039;&#039;).  Zero Crossing SSRs create less electromagnetic &#039;noise&#039; when they turn on, &amp;lt;font color=red&amp;gt;and &#039;&#039;&#039;MIGHT TBD&#039;&#039;&#039;&amp;lt;/font&amp;gt; cost more money.  They are best used with resistive loads - Zero Crossing SSRs are not able to turn off some inductive loads.  It&#039;s very difficult to determine which inductive loads will create problems - well beyond the scope of this document.  If your load is inductive, we recommend buying the &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; SSRs.&lt;br /&gt;
&lt;br /&gt;
Another good reason to use Random Turn On SSRs for inductive loads is the coils will be wrapped around a magnetic material like iron.  As the current flow generates magnetic fields, the iron is repeatedly magnetized in opposite directions.  Depending on how the iron was magnetized when the power was removed, and your luck when the load is turned on, an effect called saturation can produce a huge inrush of current.  Zero Crossing SSRs are more likely to turn on the load at exactly the worst time.  &lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+ &#039;&#039;&#039;Inductive and Resistive Loads&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Load Type&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs   || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures || Inductive or Resistive &amp;lt;font size=4&amp;gt;&#039;&#039;&#039;*&#039;&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Motors                     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Transformers               || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Heaters                    || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Computer / Electronics     || ???&lt;br /&gt;
|-&lt;br /&gt;
| AC/DC power supplies (brick heavy type)     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
|AC/DC Power supplies (lightweight switchers) || Resistive&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=4&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/font&amp;gt; &#039;&#039;For fluorescent light fixtures, older units (magnetic ballast) may be inductive, and newer units are often resistive (electronic ballast).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Picking your AC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, and your load type (inductive or resistive), you can create a short list of relays whose &lt;br /&gt;
* &#039;&#039;&#039;Maximum Load Voltage&#039;&#039;&#039; are greater than or equal to your operating voltage, &lt;br /&gt;
* &#039;&#039;&#039;Maximum Surge Current&#039;&#039;&#039; are greater than or equal to your surge current, and &lt;br /&gt;
* &#039;&#039;&#039;Load type&#039;&#039;&#039; matches what you chose for random turn on/zero crossing.&lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you may need a heat sink.  For selecting a heatsink, please consult [[#Picking a heatsink|Picking a Heatsink]]. Alternatively, look at other SSRs on your list - there may be an SSR that can handle your average load current with no heatsink.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
Instead of simply turning the load on/off, if you want to dim it gradually, you can use a proportional control SSR.  They are able to reduce the average power to the load gradually, in proportion to the strength of the input signal. For more information, you can visit the [[#Proportional Control SSR|Proportional Control SSR Section]].&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===AC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
{{ContentNeeded | This section needs information that has been requested from Future Electronics by Chester}}&lt;br /&gt;
&lt;br /&gt;
[[Image:MOV.jpg|thumb|An MOV, which comes packaged with our AC &amp;quot;Hockey Puck&amp;quot; relays. ]]&lt;br /&gt;
&lt;br /&gt;
Your AC SSR from Phidgets comes with a circular disc with two legs (pictured). This is a Metal Oxide Varistor (MOV) and should be installed across the load (larger) terminals of your SSR &amp;lt;Picture&amp;gt;.  MOVs are the classic surge protector - an inexpensive component that absorbs high voltage spikes.  High voltage spikes are caused by inductive loads when they are turned off, and also happen very often on the electrical grid, as nearby devices are operated.  Even if your load is resistive, use an MOV to protect the SSR.&lt;br /&gt;
&lt;br /&gt;
MOVs have a limited life span, they must be carefully chosen.  If an MOV is chosen for too low of a voltage spike, it will wear out quickly.  If it is chosen for too high of a voltage spike, it will not protect the SSR adequately.  MOVs are not perfect devices - therefore we have chosen SSRs which can survive much higher voltage spikes than what we recommend them for.  For example, this is why the AC SSRs we recommend for 120 VAC operation are rated by the manufacturer for 240 VAC.  If you must operate our AC SSRs on higher voltages than we recommend, do not use the included MOV.&lt;br /&gt;
&lt;br /&gt;
As MOVs wear out from use, they will become more sensitive to common voltage spikes, causing them to wear out quicker.  When they entirely fail, they will become a short circuit, potentially creating a fire hazard.  The MOV included with your SSR has a fuse built in which will disable the MOV when it becomes a hazard.  Please consider (and avoid!) nearby flammable material when mounting your SSR.&lt;br /&gt;
&lt;br /&gt;
*TMOV20RP200E&lt;br /&gt;
*TMOV20RP385E&lt;br /&gt;
&lt;br /&gt;
===Proportional Control SSR===&lt;br /&gt;
&lt;br /&gt;
Proportional Control Relays (often simply called &amp;quot;Control Relays&amp;quot;) are SSRs you can use to control the amount of power to the load.  Rather than reduce the voltage, or somehow limit the current - which would be very expensive solutions, the Proportional SSR reduces power by turning the load on/off quickly, feeding full power in short pulses.  A similar technology is used for motor control, called PWM (Pulse Width Modulation).  &lt;br /&gt;
&lt;br /&gt;
Proportional SSRs are controlled by a variable voltage - as the voltage increases, more power is available to the load.  Our PhidgetAnalog product can be used to control Proportional SSRs.  We don&#039;t sell Proportional SSRs - but they can be purchased from Digikey, where they are called AC Linear Controlled SSRs.&lt;br /&gt;
&lt;br /&gt;
A quick and dirty (and inexpensive!) solution for dimming with Phidgets is to use an [[Servo Motor and Controller Primer|RC Servo Motor]] with a PhidgetAdvancedServo to rotate the knob on a light dimmer.  From software, the RC Servo Motor is rotated to an absolute position, cranking the knob as it turns. &amp;lt;font color=red&amp;gt; EXPAND &amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:AC SSR Load.png|right|thumb|300px|Schematic of an AC SSR switching a generic load. A metal oxide varistor is added across the load to protect the SSR.]]&lt;br /&gt;
&lt;br /&gt;
When wiring up an AC circuit, particularly for long term installation, you may find it helpful to buy a book on residential wiring from your local hardware store.  There are many wiring conventions (and often legal codes) which will help you plan your project, and the legal codes are often a great source of wisdom.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DC SSRs (0 to 50V DC)==&lt;br /&gt;
&lt;br /&gt;
We sell DC SSRs for up to 50 Volts DC Operation.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could be switching in the future, higher voltage DC SSRs can be used to switch lower voltages.  If your voltage is close - be conservative.  For instance, a 24 Volt system built from 2 Lead Acid batteries can reach 30 volts when charging - so using a 30V SSR would be cutting it close.&lt;br /&gt;
&lt;br /&gt;
===Picking your DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you need a heat sink.  For picking a heatsink, please go to [[#Picking a Heatsink|Picking a Heatsink]].  Consider other SSRs on your list - there may be an SSR that can handle your average load current with no heatsink.  The larger SSRs will be more efficient for the same current.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===DC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
[[Image:Diode.jpg|thumb| A diode, included with our DC &amp;quot;hockey puck&amp;quot; SSRs. The cathode is marked with a line. The blue symbol shows circuit diagram equivalent of the diode.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:relaymotor.jpg|thumb| A DC SSR switching an electric motor. The 1018 Phidget InterfaceKit controls the SSR using its digital outputs. A diode is shown installed across the motor, and a fuse is hooked up between the power supply and the rest of the circuit.]]&lt;br /&gt;
&lt;br /&gt;
Your DC SSR from Phidgets comes with a diode. This diode should be installed across your load, with the Cathode installed towards the power supply.  &lt;br /&gt;
&lt;br /&gt;
If the diode is installed backwards, as soon as the SSR is turned on, the load will be shorted out, likely destroying the diode, or the SSR, or your power supply.&lt;br /&gt;
A fuse protecting your power supply is always a good idea.&lt;br /&gt;
&lt;br /&gt;
The diode protects the SSR from powerful residual currents after the SSR is turned off.  These residual currents are used to produce the sparks for spark plugs - they are easily capable of destroying your SSR.  The diode allows these currents to recirculate in the load until they have lost their energy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with DC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:DC SSR Load.png|right|thumb|300px|Schematic of an DC SSR switching a generic load, which is protected by a diode connected in parallel. The circuit is protected by a fuse in series after the power supply.]]&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, voltage offsets.&lt;br /&gt;
&lt;br /&gt;
With a DC SSR, always make sure the positive load terminal (labeled +) is facing towards the positive terminal of the power supply. If the load terminals are reversed, your load will immediately turn on - there is a diode inside of the SSR.&lt;br /&gt;
&lt;br /&gt;
The DC SSR can be installed on either side of the load, and it will work properly, but there is an advantage to installing the SSR between the power supply and the load.  If the load is connected to the power supply, it will always have a potentially dangerous voltage on it, even when it is not operating.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AC/DC SSRs (0 to 40V DC / 0 to 28V AC)==&lt;br /&gt;
&lt;br /&gt;
Our AC/DC SSRs are built on a small PCB, making them physically smaller than the hockey puck SSRs, and less expensive.  They are limited to lower currents, and cannot be mounted on a heatsink.  &amp;lt;Put in a picture of the 3052 SSR, with an arrow showing the SSR chip on the board&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We sell AC/DC SSRs that can switch up to 40 Volts DC or 28 Volts AC.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  There is no lower limit on the voltages that the AC/DC SSRs can switch.  If your voltage is close - be conservative.  For instance, a 36 Volt system built from 3 Lead Acid batteries can reach 45 volts when charging.&lt;br /&gt;
&lt;br /&gt;
===Picking your AC/DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
* Maximum Average Current is greater than or equal to your Average current.&lt;br /&gt;
&lt;br /&gt;
If you are interested in minimum cost, you will likely choose the cheapest option that meets these criteria.  If you are interested in high efficiency operation and less heat generation, consider buying an SSR with higher current rating.&lt;br /&gt;
&lt;br /&gt;
Your AC/DC SSR from Phidgets has built in protection from static electricity, and dangerous residual currents  after the SSR is turned off.  If you are switching DC, installing a diode across the load will offer even more protection.  Refer to the [[#DC SSR Protection|DC SSR Protection]] section for more information.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC/DC SSRs===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching a DC Load.  Point out that the AC/DC ssr output terminals are bidirectional - it doesn&#039;t matter which way you hook them up.  Show the optional diode, make sure it&#039;s clear that it&#039;s optional&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching an AC Load&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a AC/DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, careful consideration of voltage offsets.&lt;br /&gt;
&lt;br /&gt;
==Using heatsinks with Hockey Puck SSRs==&lt;br /&gt;
&lt;br /&gt;
SSRs will only achieve their promise of reliability and long life if they are kept cool.  Cool is relative, of course, but a good rule of thumb is to keep the metal base of the SSR at less than 85 Celsius.  A thermocouple can be used to precisely measure the temperature of the metal base.&lt;br /&gt;
&lt;br /&gt;
Excess heat usually comes from too much current and too little heatsinking.  A lot of heat can also be generated by turning the relay on and off frequently.  If your relay is being operated for brief periods of time, you may not need as large of a heatsink - provided the relay is never accidentally left on for extended periods.  Unless space is a concern, it&#039;s better to err on the side of caution.&lt;br /&gt;
&lt;br /&gt;
Before buying a heatsink, consider if you actually need it.  If your application is running at room temperature, and your average current is less than the &#039;&#039;&#039;Load with no Heatsink&#039;&#039;&#039; specification of your SSR, then no, you don&#039;t need a heatsink.  Alternatively, if your project has a large metal chassis that the SSR can bolt to, this can be used as your heat sink.&lt;br /&gt;
&lt;br /&gt;
Each SSR suitable for use with heatsinks will include a specification of how much current it can switch with each heatsink we sell.  This specification assumes a reasonable airflow over the heatsink, and that the flowing air is at room temperature.  Our SSRs have a sheet of metal underneath, where the heat is concentrated - this is also where the heat is measured to tell if the SSR is too hot.  Phidgets includes a grey pad with our Hockey Puck form factor SSRs.  You place this pad under an SSR when mounting it on a heatsink, or on large metal surfaces that can dissipate heat.  The pad takes the place of thermal grease - if you are more comfortable with thermal grease, you can use it instead.  Our heat sinks include screws for mounting SSRs.  &amp;lt;Show picture of heat sink + thermal pad + SSR&amp;gt;, and another picture assembled.&amp;gt;  Use a good size screwdriver when tightening the SSR down on the heat sink to ensure good conduction.&lt;br /&gt;
&lt;br /&gt;
==Hooking up wires to the Hockey Puck SSR==&lt;br /&gt;
&lt;br /&gt;
&amp;lt; Need picture of wires clamped onto the SSR, with the MOV on top &amp;gt;&lt;br /&gt;
&lt;br /&gt;
When wiring your load to the SSR, the wire is looped clockwise around the terminal, so as the screw is tightened down, it will draw the wire in tighter.  We recommend using wires up to 10 AWG in size - any larger, and the screws will not have enough thread left to tighten down, and they will strip.  10 AWG wiring is conservatively rated at 30 Amps, &#039;&#039;&#039;TBD&#039;&#039;&#039; posing a problem to use SSRs rated higher than 30 AMPS.  Larger wires can be attached using a wiring lug.  The lug is clamped under the SSR screw, and the wire attaches to the lug.  &amp;lt;picture of TRM6 on SSR with big wire attached&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Loose wire connections can generate a lot of heat - use a good size screwdriver when clamping down the load wires.&lt;br /&gt;
&lt;br /&gt;
For the current ratings of various wires sizes, please see [[Page on Wire Sizes]]&lt;br /&gt;
&lt;br /&gt;
===Did you know?===&lt;br /&gt;
&lt;br /&gt;
Mains Voltage &#039;&#039;&#039;AC SSRs&#039;&#039;&#039; cannot switch DC. They will never turn off.  AC SSRs turn off twice per AC Cycle - in North America, AC is 60 Hz, so the AC SSR has 120 opportunities per second to turn off.  If the SSR is operating from DC, the current will flow continuously, and the SSR will not turn off, even when the control input is off.&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; turns off automatically every time the current is zero.  An AC SSR will have a current value that it regards as &#039;zero&#039;.  If your load requires less than this current, your SSR will never turn on - or will not reliably turn on.&lt;br /&gt;
&lt;br /&gt;
Very fast voltage changes can disturb the internal circuitry on an &#039;&#039;&#039;AC SSR&#039;&#039;&#039; enough to turn it on accidentally.  SSR Manufacturers protect against this by adding a simple circuit inside the SSR, across the load terminals, called a snubber.  The snubber absorbs very fast electrical changes, converting them to heat.  When the AC SSR is turned on, there is little voltage difference between the terminals, so the snubber has very little effect.  When the AC SSR is turned off, the snubber is actively protecting the SSR - but at a cost, as it allows a small current through the SSR, which is wasted.  &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; uses bipolar transistors - an old technology that has been replaced by CMOS transistors in modern digital circuits.  Bipolar transistors are still superior for handling high voltages.  Bipolar transistors, and the more complex transistors built from them, will lose a constant voltage as current flows through them.  The collection of transistors in your SSR will lose about 1.7 volts - so on a 120 VAC system, you will lose about 1.5% to the SSR.  This energy goes into heating the SSR, and the heating from these transistors is the reason SSRs often need heat sinks.&lt;br /&gt;
&lt;br /&gt;
SSRs, and semiconductors in general, usually fail as a short circuit.  This means your load will probably turn on permanently (or until you remove the power) - make sure this doesn&#039;t cause a safety hazard.  For instance, Sauna Heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DC SSRs&#039;&#039;&#039; (at least the units we sell) use MOSFETs - Metal Oxide Semiconductor Field Effect Transistors.  Say that three times fast.  MOSFETs do not lose a constant voltage - instead, when they turn on, they act as a very slight restriction to the flow of current - a resistor.  At low currents, the slight restriction wastes very little power, giving high efficiency and often not requiring a heat sink.  This efficiency is lost as the current increases - a doubling of current quadruples the production of heat.  &lt;br /&gt;
&lt;br /&gt;
MOSFETs can switch AC, but a single MOSFET has a diode in parallel with it.  The MOSFET can only block current in one direction - as soon as the voltage reverses, the current flows through the diode.  If a MOSFET is used to switch AC, your load will be turned on half the time.  A solution is to use two MOSFETs back to back - which is what we do with our &#039;&#039;&#039;AC/DC SSRs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Product Specification Table ===&lt;br /&gt;
&amp;lt;Eventually we want this table to be generated automatically somehow.&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Manufacturer Part #&lt;br /&gt;
! Current Type&lt;br /&gt;
! Turn-on Type&lt;br /&gt;
! Control Voltage (V)&lt;br /&gt;
! Max. Load Voltage (V)&lt;br /&gt;
! Max. Load Current Without Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU2 Heatsink (A)&lt;br /&gt;
! Max. Surge Current (A)&lt;br /&gt;
! Output Type&lt;br /&gt;
|-&lt;br /&gt;
| 3052_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 2.5 || N/A || N/A || 5    || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3053_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 9   || N/A || N/A || ???  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3950_0 || HFS33/D-30D50M     || DC    || N/A            || 3-32VDC || 30	     || 18  || 50  || 50  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3951_0 || HFS33/D-50D80M     || DC    || N/A            || 3-32VDC || 50           || 20  || 40  || 80  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3952_0 || HFS33/D-30D100M    || DC    || N/A            || 3-32VDC || 30           || 25  || 50  || 100 || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3953_0 || HFS34/D-240A20PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 8   || 15  || 20  || 1000 || SCR&lt;br /&gt;
|-&lt;br /&gt;
| 3954_0 || HFS34/D-240A80PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 10  || 20  || 50  || 1000 || SCR&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
	<entry>
		<id>https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10774</id>
		<title>Solid State Relay Guide</title>
		<link rel="alternate" type="text/html" href="https://www.phidgets.com/docs/index.php?title=Solid_State_Relay_Guide&amp;diff=10774"/>
		<updated>2011-12-15T16:31:14Z</updated>

		<summary type="html">&lt;p&gt;192.168.3.103: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{|&lt;br /&gt;
|- valign=middle&lt;br /&gt;
| align=center width=300px| __TOC__ &lt;br /&gt;
| [[Image:SSR.jpg]]&lt;br /&gt;
| [[Image:3052.jpg|200px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
Solid state relays (SSRs) turn on or off the power being supplied to other devices, in a similar fashion as a physical [[Switch Primer|switch]]. However, instead of being switched by human interaction like a physical switch, SSRs are switched digitally.&lt;br /&gt;
With relays, you can control high-current devices such as lights or appliances with low-current signals, like a standard DC signal from a [[Digital Output Primer|Digital Output]]. Most SSRs will switch on with a voltage of 3V or higher. This makes them perfect for use with [[Interface Kits]], or any device with a digital output. &lt;br /&gt;
&lt;br /&gt;
SSRs perform the same job as [[Mechanical Relay Primer|Mechanical Relays]], but have the following advantages:&lt;br /&gt;
* SSRs produce less electromagnetic interference than mechanical relays during operation. This is mostly due to a phenomenon called [[Mechanical Relay Primer#Arcing, Interference, and Sticking|contact arcing]] only present in mechanical relays, where the physical contacts of the relay tend to spark internally while switching. The reduced interference can also be attributed to the fact that SSRs do not use electromagnets to switch.&lt;br /&gt;
* The switch contacts of a mechanical relay will eventually wear down from sparking.  An SSR will have a longer life because its internals are purely digital.  Properly used, they will last for millions of cycles.&lt;br /&gt;
* SSRs turn on and off faster than mechanical relays (≈1ms compared to ≈10ms).&lt;br /&gt;
* SSRs are less susceptible to physical vibrations than mechanical relays.&lt;br /&gt;
* Since the switch inside an SSR isn&#039;t a mechanical switch, it does not suffer from [[Switch Primer#Bounce|contact bounce]], and operates silently.&lt;br /&gt;
&lt;br /&gt;
However, compared to Mechanical Relays, SSRs: &lt;br /&gt;
* Are more expensive to produce.&lt;br /&gt;
* Will dissipate more energy in the form of heat (1-2% of the energy intended to power the load).&lt;br /&gt;
&lt;br /&gt;
==How it Works==&lt;br /&gt;
&lt;br /&gt;
The control inputs are connected internally to an LED, which shines across an air gap to light sensors.  The pairing of an LED with light sensors is called an optocoupler, and is a common technique to link two parts of a circuit without direct connection.  The light sensor is connected to the transistors which open or close, supplying the relay&#039;s load with power. &lt;br /&gt;
&lt;br /&gt;
===Basic Use===&lt;br /&gt;
&lt;br /&gt;
Controlling an SSR is no more complicated than driving an LED.  There are many ways of accomplishing this with Phidgets - &lt;br /&gt;
*[[Link to Digital Output Page, SSR Section]]&lt;br /&gt;
*[[Link to Digital Output Page 0/16/16, SSR Section]]&lt;br /&gt;
*[[Link to LED Output Page, SSR Section]]&lt;br /&gt;
&lt;br /&gt;
The ability of an SSR to switch a load is very similar to a relay or simple switch.  In practice however, there is no one SSR perfect for all applications.  To choose an SSR for your application, please follow the [[#Choosing an SSR|Choosing an SSR]] section.&lt;br /&gt;
&lt;br /&gt;
===Safety===&lt;br /&gt;
&lt;br /&gt;
Relays can switch high currents and voltages, and standard precautions apply.  Make sure you never touch the terminals while the relay is powered, and if your SSR came with a plastic cover, use it.  Even when the SSR is switched off, a very small amount of current will flow.&lt;br /&gt;
&lt;br /&gt;
When an SSR fails, it most often fails permanently closed - leaving your load powered, and possibly creating a fire or safety hazard.&lt;br /&gt;
&lt;br /&gt;
==Choosing an SSR==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Identify your voltage===&lt;br /&gt;
&lt;br /&gt;
The first question to ask is - are you switching AC or DC voltage?  The electrical grid, and thus your wall outlet, runs AC, whereas batteries and most small power supplies are DC.  &lt;br /&gt;
&lt;br /&gt;
Next, estimate the number of volts you will be switching.  If you are switching DC, particularly with batteries, assume your voltage is at least 25% more than what your battery is rated for.  Even larger fluctuations occur on AC, but AC SSRs are designed to handle it.&lt;br /&gt;
&lt;br /&gt;
===Identify your current===&lt;br /&gt;
&lt;br /&gt;
The current drawn by your load when turned on affects how large of an SSR you need, and how hot it will be when it runs.  If you know how much current, on average, your load draws, this is what we call &#039;&#039;&#039;Average Load Current&#039;&#039;&#039;.  If you don&#039;t know the average current, but you know the wattage of your device, you can calculate Average Load Current by:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\text{Average Load Current} =\frac{\text{Wattage}}{\text{Operating Voltage}}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, we need to know the current drawn by your device when it is first turned on.  Many devices demand a huge inrush of current, stressing electronics.  If you&#039;ve ever noticed the lights dimming in the house for a second when the furnace kicks in, this is the fan motor starting up.  It&#039;s very difficult to measure the &#039;&#039;&#039;Surge Current&#039;&#039;&#039; itself, so we use a multiplier based on your device type.  Surge Current may also be known as inrush current.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+&#039;&#039;&#039;Surge Current Multiplier&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Multiplier&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Motors || 6x&lt;br /&gt;
|-&lt;br /&gt;
| LEDs || 1x&lt;br /&gt;
|-&lt;br /&gt;
| Complex Electronics i.e., Motor Controllers, Phidgets || 6x&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures   (AC Only) || 10x&lt;br /&gt;
|-&lt;br /&gt;
| Transformers || ?             &lt;br /&gt;
|-&lt;br /&gt;
| Heaters || ?&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Multiply your Average Load Current by the multiplier for your device type to calculate the Surge Current.&lt;br /&gt;
&lt;br /&gt;
===I need to switch AC===&lt;br /&gt;
&lt;br /&gt;
Most AC applications will be switching 110 to 240 Volt power coming from the grid.  If that&#039;s you, go to the [[#Mains Voltage (110 to 240V AC)|Mains Voltage (110 to 240V AC)]] section.&lt;br /&gt;
&lt;br /&gt;
We also cover low voltage AC applications - 28 VAC or less. For more information, visit the [[#AC/DC SSRs|AC/DC SSRs]] section.&lt;br /&gt;
&lt;br /&gt;
===I need to switch DC===&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t need to switch a lot of current - 9 Amps or less, consider our compact, cost effective [[#AC/DC SSRs|AC/DC SSRs]].&lt;br /&gt;
&lt;br /&gt;
At more than 9 Amps, you need a serious [[#DC SSRs|DC SSR]].&lt;br /&gt;
&lt;br /&gt;
==Mains Voltage (110 to 240V AC)==&lt;br /&gt;
&lt;br /&gt;
We sell AC SSRs for 120 VAC or 240 VAC operation.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could be switching in the future, the 240 VAC relays can be used to switch 120 VAC.  Please note we are very conservative in how we rate relays - our 120 VAC relays are rated by the manufacturer for 240 VAC, and the 240 VAC for 380 VAC - but we strongly recommend against using them to the manufacturer rated voltage.  To understand why, read the [[#AC SSR Protection|AC SSR Protection]] section.&lt;br /&gt;
&lt;br /&gt;
===Load Type - Inductive vs. Resistive===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:zero cross.png|right|thumb|300px|This graph shows the difference between zero-cross and random turn-on. The blue line represents the oscillating voltage of an AC load, and the shaded areas represent the sections when the relay is turned on and letting current pass through. As you can see, the random turn-on SSR immediately opens when activated, while the zero-cross turn-on SSR waits until the voltage crosses zero before opening.]]&lt;br /&gt;
&lt;br /&gt;
SSRs are designed to either turn on immediately (&#039;&#039;&#039;Random Turn On&#039;&#039;&#039;), or wait until the next &#039;alternation&#039; of the voltage (&#039;&#039;&#039;Zero Crossing&#039;&#039;&#039;).  Zero Crossing SSRs create less electromagnetic &#039;noise&#039; when they turn on, &amp;lt;font color=red&amp;gt;and &#039;&#039;&#039;MIGHT TBD&#039;&#039;&#039;&amp;lt;/font&amp;gt; cost more money.  They are best used with resistive loads - Zero Crossing SSRs are not able to turn off some inductive loads.  It&#039;s very difficult to determine which inductive loads will create problems - well beyond the scope of this document.  If your load is inductive, we recommend buying the &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; SSRs.&lt;br /&gt;
&lt;br /&gt;
Your Load will probably be inductive if it is built around a large coil of wire - motors and transformers are typical examples.  A load considered resistive may also have loops of wire - for instance, hair dryers, toasters, incandescent bulbs use twisted wire elements to generate the heat.  An inductive load will have thousands of loops of wire - it&#039;s a matter of scale.  There is no such thing as a perfectly resistive load - but the load has to be really inductive to cause the zero crossing SSRs to malfunction.&lt;br /&gt;
&lt;br /&gt;
Another good reason to use Random Turn On SSRs for inductive loads is the coils will be wrapped around a magnetic material like iron.  As the current flow generates magnetic fields, the iron is repeatedly magnetized in opposite directions.  Depending on how the iron was magnetized when the power was removed, and your luck when the load is turned on, an effect called saturation can produce a huge inrush of current.  Zero Crossing SSRs are more likely to turn on the load at exactly the worst time.  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
|+ &#039;&#039;&#039;Inductive and Resistive Loads&#039;&#039;&#039;&lt;br /&gt;
! Application&lt;br /&gt;
! Load Type&lt;br /&gt;
|-&lt;br /&gt;
| Incandescent Light Bulbs   || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Fluorescent Light Fixtures || Inductive or Resistive &amp;lt;font size=4&amp;gt;&#039;&#039;&#039;*&#039;&#039;&#039;&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Motors                     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Transformers               || Inductive&lt;br /&gt;
|-&lt;br /&gt;
| Heaters                    || Resistive&lt;br /&gt;
|-&lt;br /&gt;
| Computer / Electronics     || ???&lt;br /&gt;
|-&lt;br /&gt;
| AC/DC power supplies (brick heavy type)     || Inductive&lt;br /&gt;
|-&lt;br /&gt;
|AC/DC Power supplies (lightweight switchers) || Resistive&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font size=4&amp;gt;&#039;&#039;&#039;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/font&amp;gt; &#039;&#039;For fluorescent light fixtures, older units (magnetic ballast) may be inductive, and newer units are often resistive (electronic ballast).&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Remember, if your load is inductive, choose a &#039;&#039;&#039;Random Turn On&#039;&#039;&#039; relay.  If your load is resistive, choose a &#039;&#039;&#039;Zero Crossing&#039;&#039;&#039; relay.&lt;br /&gt;
&lt;br /&gt;
===Picking your AC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, and your load type (inductive or resistive), you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
* Turn On Type matches what you chose for random turn on/zero crossing.&lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you need a heat sink.  For picking a heatsink, please go to [[#Picking a heatsink|Picking a Heatsink]]  Consider other SSRs on your list - there may be an SSR that can handle your average load current with no heatsink.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
Instead of simply turning the load on/off, do you want to dim it?  SSRs that are able to reduce the average power to the load are called Proportional Control SSRs.  Read about them [[#Proportional Control SSR|here]]&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===AC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
{{ContentNeeded | This section needs information that has been requested from Future Electronics by Chester}}&lt;br /&gt;
&lt;br /&gt;
[[Image:MOV.jpg|thumb|An MOV, which comes packaged with our AC &amp;quot;Hockey Puck&amp;quot; relays. ]]&lt;br /&gt;
&lt;br /&gt;
Your AC SSR from Phidgets comes with a circular disc with two legs (pictured). This is a Metal Oxide Varistor (MOV) and should be installed across the load (larger) terminals of your SSR &amp;lt;Picture&amp;gt;.  MOVs are the classic surge protector - an inexpensive component that absorbs high voltage spikes.  High voltage spikes are caused by inductive loads when they are turned off, and also happen very often on the electrical grid, as nearby devices are operated.  Even if your load is resistive, use an MOV to protect the SSR.&lt;br /&gt;
&lt;br /&gt;
MOVs have a limited life span, they must be carefully chosen.  If an MOV is chosen for too low of a voltage spike, it will wear out quickly.  If it is chosen for too high of a voltage spike, it will not protect the SSR adequately.  MOVs are not perfect devices - therefore we have chosen SSRs which can survive much higher voltage spikes than what we recommend them for.  For example, this is why the AC SSRs we recommend for 120 VAC operation are rated by the manufacturer for 240 VAC.  If you must operate our AC SSRs are higher voltages than we recommend, do not use the included MOV.&lt;br /&gt;
&lt;br /&gt;
As MOVs wear out from use, they will become more sensitive to common voltage spikes, causing them to wear out quicker.  When they entirely fail, they will become a short circuit, potentially creating a fire hazard.  The MOV included with your SSR has a fuse built in which will disable the MOV when it becomes a hazard.  Please consider (and avoid!) nearby flammable material when mounting your SSR.&lt;br /&gt;
&lt;br /&gt;
*TMOV20RP200E&lt;br /&gt;
*TMOV20RP385E&lt;br /&gt;
&lt;br /&gt;
===Proportional Control SSR===&lt;br /&gt;
&lt;br /&gt;
Proportional Control Relays (often simply called &amp;quot;Control Relays&amp;quot;) are SSRs you can use to control the amount of power to the load.  Rather than reduce the voltage, or somehow limit the current - which would be very expensive solutions, the Proportional SSR reduces power by turning the load on/off quickly, feeding full power in short pulses.  A similar technology is used for motor control, called PWM (Pulse Width Modulation).  &lt;br /&gt;
&lt;br /&gt;
Proportional SSRs are controlled by a variable voltage - as the voltage increases, more power is available to the load.  Our PhidgetAnalog product can be used to control Proportional SSRs.  We don&#039;t sell Proportional SSRs - but they can be purchased from Digikey, where they are called AC Linear Controlled SSRs.&lt;br /&gt;
&lt;br /&gt;
A quick and dirty (and inexpensive!) solution for dimming with Phidgets is to use an [[Servo Motor and Controller Primer|RC Servo Motor]] with a PhidgetAdvancedServo to rotate the knob on a light dimmer.  From software, the RC Servo Motor is rotated to an absolute position, cranking the knob as it turns.&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:AC SSR Load.png|right|thumb|300px|Schematic of an AC SSR switching a generic load. A metal oxide varistor is added across the load to protect the SSR.]]&lt;br /&gt;
&lt;br /&gt;
When wiring up an AC circuit, particularly for long term installation, you may find it helpful to buy a book on residential wiring from your local hardware store.  There are many wiring conventions (and often legal codes) which will help you plan your project, and the legal codes are often a great source of wisdom.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==DC SSRs (0 to 50V DC)==&lt;br /&gt;
&lt;br /&gt;
We sell DC SSRs for up to 50 Volts DC Operation.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  If you are unsure what voltages you could be switching in the future, higher voltage DC SSRs can be used to switch lower voltages.  If your voltage is close - be conservative.  For instance, a 24 Volt system built from 2 Lead Acid batteries can reach 30 volts when charging - so using a 30V SSR would be cutting it close.&lt;br /&gt;
&lt;br /&gt;
===Picking your DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
&lt;br /&gt;
Now compare the &#039;&#039;&#039;Load with No Heatsink&#039;&#039;&#039; value for the SSRs on your list to your Average Load Current.  If your Average Load Current is greater, you need a heat sink.  For picking a heatsink, please go to [[#Picking a Heatsink|Picking a Heatsink]].  Consider other SSRs on your list - there may be an SSR that can handle your average load current with no heatsink.  The larger SSRs will be more efficient for the same current.&lt;br /&gt;
&lt;br /&gt;
At this point, you know the SSR you need.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===DC SSR Protection===&lt;br /&gt;
&lt;br /&gt;
[[Image:Diode.jpg|thumb| A diode, included with our DC &amp;quot;hockey puck&amp;quot; SSRs. The cathode is marked with a line. The blue symbol shows circuit diagram equivalent of the diode.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:relaymotor.jpg|thumb| A DC SSR switching an electric motor. The 1018 Phidget InterfaceKit controls the SSR using its digital outputs. A diode is shown installed across the motor, and a fuse is hooked up between the power supply and the rest of the circuit.]]&lt;br /&gt;
&lt;br /&gt;
Your DC SSR from Phidgets comes with a diode. This diode should be installed across your load, with the Cathode installed towards the power supply.  &lt;br /&gt;
&lt;br /&gt;
If the diode is installed backwards, as soon as the SSR is turned on, the load will be shorted out, likely destroying the diode, or the SSR, or your power supply.&lt;br /&gt;
A fuse protecting your power supply is always a good idea.&lt;br /&gt;
&lt;br /&gt;
The diode protects the SSR from powerful residual currents after the SSR is turned off.  These residual currents are used to produce the sparks for spark plugs - they are easily capable of destroying your SSR.  The diode allows these currents to recirculate in the load until they have lost their energy.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example circuits with DC SSRs===&lt;br /&gt;
&lt;br /&gt;
[[Image:DC SSR Load.png|right|thumb|300px|Schematic of an DC SSR switching a generic load, which is protected by a diode connected in parallel. The circuit is protected by a fuse in series after the power supply.]]&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, voltage offsets.&lt;br /&gt;
&lt;br /&gt;
With a DC SSR, always make sure the positive load terminal (labeled +) is facing towards the positive terminal of the power supply. If the load terminals are reversed, your load will immediately turn on - there is a diode inside of the SSR.&lt;br /&gt;
&lt;br /&gt;
The DC SSR can be installed on either side of the load, and it will work properly, but there is an advantage to installing the SSR between the power supply and the load.  If the load is connected to the power supply, it will always have a potentially dangerous voltage on it, even when it is not operating.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==AC/DC SSRs (0 to 40V DC / 0 to 28V AC)==&lt;br /&gt;
&lt;br /&gt;
Our AC/DC SSRs are built on a small PCB, making them physically smaller than the hockey puck SSRs, and less expensive.  They are limited to lower currents, and cannot be mounted on a heatsink.  &amp;lt;Put in a picture of the 3052 SSR, with an arrow showing the SSR chip on the board&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We sell AC/DC SSRs that can switch up to 40 Volts DC or 28 Volts AC.  Look for this on the SSR Product pages under the Maximum Load Voltage specification.  There is no lower limit on the voltages that the AC/DC SSRs can switch.  If your voltage is close - be conservative.  For instance, a 36 Volt system built from 3 Lead Acid batteries can reach 45 volts when charging.&lt;br /&gt;
&lt;br /&gt;
===Picking your AC/DC SSR===&lt;br /&gt;
&lt;br /&gt;
Now that you have identified your Operating Voltage, Average and Surge Current, you can create a short list of relays whose &lt;br /&gt;
* Maximum Load Voltage are greater than or equal to your operating voltage, &lt;br /&gt;
* Maximum Surge Current are greater than or equal to your surge current, and &lt;br /&gt;
* Maximum Average Current is greater than or equal to your Average current.&lt;br /&gt;
&lt;br /&gt;
If you are interested in minimum cost, you will likely choose the cheapest option that meets these criteria.  If you are interested in high efficiency operation and less heat generation, consider buying an SSR with higher current rating.&lt;br /&gt;
&lt;br /&gt;
Your AC/DC SSR from Phidgets has built in protection from static electricity, and dangerous residual currents  after the SSR is turned off.  If you are switching DC, installing a diode across the load will offer even more protection.  Refer to the [[#DC SSR Protection|DC SSR Protection]] section for more information.&lt;br /&gt;
&lt;br /&gt;
If you are interested in learning more about SSRs in general, check out our [[#Did you know?|&amp;quot;Did you know?&amp;quot;]] section.&lt;br /&gt;
&lt;br /&gt;
===Example circuits with AC/DC SSRs===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching a DC Load.  Point out that the AC/DC ssr output terminals are bidirectional - it doesn&#039;t matter which way you hook them up.  Show the optional diode, make sure it&#039;s clear that it&#039;s optional&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Schematic of an AC/DC SSR switching an AC Load&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The electrical isolation built into a AC/DC SSR allows them to be placed within a circuit just like a switch.  Circuits without electrical isolation require a lot more care - proper grounding, careful consideration of voltage offsets.&lt;br /&gt;
&lt;br /&gt;
==Using heatsinks with Hockey Puck SSRs==&lt;br /&gt;
&lt;br /&gt;
SSRs will only achieve their promise of reliability and long life if they are kept cool.  Cool is relative, of course, but a good rule of thumb is to keep the metal base of the SSR at less than 85 Celsius.  A thermocouple can be used to precisely measure the temperature of the metal base.&lt;br /&gt;
&lt;br /&gt;
Excess heat usually comes from too much current and too little heatsinking.  A lot of heat can also be generated by turning the relay on and off frequently.  If your relay is being operated for brief periods of time, you may not need as large of a heatsink - provided the relay is never accidentally left on for extended periods.  Unless space is a concern, it&#039;s better to err on the side of caution.&lt;br /&gt;
&lt;br /&gt;
Before buying a heatsink, consider if you actually need it.  If your application is running at room temperature, and your average current is less than the &#039;&#039;&#039;Load with no Heatsink&#039;&#039;&#039; specification of your SSR, then no, you don&#039;t need a heatsink.  Alternatively, if your project has a large metal chassis that the SSR can bolt to, this can be used as your heat sink.&lt;br /&gt;
&lt;br /&gt;
Each SSR suitable for use with heatsinks will include a specification of how much current it can switch with each heatsink we sell.  This specification assumes a reasonable airflow over the heatsink, and that the flowing air is at room temperature.  Our SSRs have a sheet of metal underneath, where the heat is concentrated - this is also where the heat is measured to tell if the SSR is too hot.  Phidgets includes a grey pad with our Hockey Puck form factor SSRs.  You place this pad under an SSR when mounting it on a heatsink, or on large metal surfaces that can dissipate heat.  The pad takes the place of thermal grease - if you are more comfortable with thermal grease, you can use it instead.  Our heat sinks include screws for mounting SSRs.  &amp;lt;Show picture of heat sink + thermal pad + SSR&amp;gt;, and another picture assembled.&amp;gt;  Use a good size screwdriver when tightening the SSR down on the heat sink to ensure good conduction.&lt;br /&gt;
&lt;br /&gt;
==Hooking up wires to the Hockey Puck SSR==&lt;br /&gt;
&lt;br /&gt;
&amp;lt; Need picture of wires clamped onto the SSR, with the MOV on top &amp;gt;&lt;br /&gt;
&lt;br /&gt;
When wiring your load to the SSR, the wire is looped clockwise around the terminal, so as the screw is tightened down, it will draw the wire in tighter.  We recommend using wires up to 10 AWG in size - any larger, and the screws will not have enough thread left to tighten down, and they will strip.  10 AWG wiring is conservatively rated at 30 Amps, &#039;&#039;&#039;TBD&#039;&#039;&#039; posing a problem to use SSRs rated higher than 30 AMPS.  Larger wires can be attached using a wiring lug.  The lug is clamped under the SSR screw, and the wire attaches to the lug.  &amp;lt;picture of TRM6 on SSR with big wire attached&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Loose wire connections can generate a lot of heat - use a good size screwdriver when clamping down the load wires.&lt;br /&gt;
&lt;br /&gt;
For the current ratings of various wires sizes, please see [[Page on Wire Sizes]]&lt;br /&gt;
&lt;br /&gt;
===Did you know?===&lt;br /&gt;
&lt;br /&gt;
Mains Voltage &#039;&#039;&#039;AC SSRs&#039;&#039;&#039; cannot switch DC. They will never turn off.  AC SSRs turn off twice per AC Cycle - in North America, AC is 60 Hz, so the AC SSR has 120 opportunities per second to turn off.  If the SSR is operating from DC, the current will flow continuously, and the SSR will not turn off, even when the control input is off.&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; turns off automatically every time the current is zero.  An AC SSR will have a current value that it regards as &#039;zero&#039;.  If your load requires less than this current, your SSR will never turn on - or will not reliably turn on.&lt;br /&gt;
&lt;br /&gt;
Very fast voltage changes can disturb the internal circuitry on an &#039;&#039;&#039;AC SSR&#039;&#039;&#039; enough to turn it on accidentally.  SSR Manufacturers protect against this by adding a simple circuit inside the SSR, across the load terminals, called a snubber.  The snubber absorbs very fast electrical changes, converting them to heat.  When the AC SSR is turned on, there is little voltage difference between the terminals, so the snubber has very little effect.  When the AC SSR is turned off, the snubber is actively protecting the SSR - but at a cost, as it allows a small current through the SSR, which is wasted.  &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;AC SSR&#039;&#039;&#039; uses bipolar transistors - an old technology that has been replaced by CMOS transistors in modern digital circuits.  Bipolar transistors are still superior for handling high voltages.  Bipolar transistors, and the more complex transistors built from them, will lose a constant voltage as current flows through them.  The collection of transistors in your SSR will lose about 1.7 volts - so on a 120 VAC system, you will lose about 1.5% to the SSR.  This energy goes into heating the SSR, and the heating from these transistors is the reason SSRs often need heat sinks.&lt;br /&gt;
&lt;br /&gt;
SSRs, and semiconductors in general, usually fail as a short circuit.  This means your load will probably turn on permanently (or until you remove the power) - make sure this doesn&#039;t cause a safety hazard.  For instance, Sauna Heaters have a simple mechanical thermal shutdown to protect if control electronics fails.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;DC SSRs&#039;&#039;&#039; (at least the units we sell) use MOSFETs - Metal Oxide Semiconductor Field Effect Transistors.  Say that three times fast.  MOSFETs do not lose a constant voltage - instead, when they turn on, they act as a very slight restriction to the flow of current - a resistor.  At low currents, the slight restriction wastes very little power, giving high efficiency and often not requiring a heat sink.  This efficiency is lost as the current increases - a doubling of current quadruples the production of heat.  &lt;br /&gt;
&lt;br /&gt;
MOSFETs can switch AC, but a single MOSFET has a diode in parallel with it.  The MOSFET can only block current in one direction - as soon as the voltage reverses, the current flows through the diode.  If a MOSFET is used to switch AC, your load will be turned on half the time.  A solution is to use two MOSFETs back to back - which is what we do with our &#039;&#039;&#039;AC/DC SSRs&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Product Specification Table ===&lt;br /&gt;
&amp;lt;Eventually we want this table to be generated automatically somehow.&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|border=1&lt;br /&gt;
! Phidgets Product #&lt;br /&gt;
! Manufacturer Part #&lt;br /&gt;
! Current Type&lt;br /&gt;
! Turn-on Type&lt;br /&gt;
! Control Voltage (V)&lt;br /&gt;
! Max. Load Voltage (V)&lt;br /&gt;
! Max. Load Current Without Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU Heatsink (A)&lt;br /&gt;
! Max. Load Current with SKU2 Heatsink (A)&lt;br /&gt;
! Max. Surge Current (A)&lt;br /&gt;
! Output Type&lt;br /&gt;
|-&lt;br /&gt;
| 3052_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 2.5 || N/A || N/A || 5    || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3053_0 || N/A                || AC/DC || N/A            || ???     || 40DC or 28AC || 9   || N/A || N/A || ???  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3950_0 || HFS33/D-30D50M     || DC    || N/A            || 3-32VDC || 30	     || 18  || 50  || 50  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3951_0 || HFS33/D-50D80M     || DC    || N/A            || 3-32VDC || 50           || 20  || 40  || 80  || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3952_0 || HFS33/D-30D100M    || DC    || N/A            || 3-32VDC || 30           || 25  || 50  || 100 || 240  || MOSFET&lt;br /&gt;
|-&lt;br /&gt;
| 3953_0 || HFS34/D-240A20PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 8   || 15  || 20  || 1000 || SCR&lt;br /&gt;
|-&lt;br /&gt;
| 3954_0 || HFS34/D-240A80PS-Y || AC    || Random Turn-on || 3-32VDC || 120          || 10  || 20  || 50  || 1000 || SCR&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>192.168.3.103</name></author>
	</entry>
</feed>