Category Archives: Arduino小组

Connector Basics

Introduction

Connectors are used to join subsections of circuits together. Usually, a connector is used where it may be desirable to disconnect the subsections at some future time: power inputs, peripheral connections, or boards which may need to be replaced.

Covered in This Tutorial

In this tutorial we will go over:

  • Basic connector terminology
  • Categorize connectors into distinguishable categories
  • Talk about the differences between connectors within those categories.
  • Show how to identify polarized connectors
  • Talk about which connectors are best suited for certain applications

Suggested Reading

You may find these concepts useful before starting on this tutorial:

Connector Terminology

Before we get started discussing some commonly used connectors, let’s explore the terminology used to describe connectors.

Gender – The gender of a connector refers to whether it plugs in or is plugged into and is typically male or female, respectively (kids, ask your parents for a more thorough explanation). Unfortunately, there are cases where a connector may be referred to as “male” when it would appear to be female; in the examples section, we’ll point a few of those out as we discuss individual component types and explain why that’s the case.

Male and female 2.0mm PH series JST connectors

Male (left) and female 2.0mm PH series JST connectors. In this case, gender is determined by the individual conductor.

Polarity – Most connectors can only be connected in one orientation. This trait is called polarity, and connectors which have some means to prevent them being connected wrong are said to be polarized, or sometimes keyed.

North America wall plug

A polarized North American wall plug. By having two different widths for the plug blades, the plug will only go into the outlet one way.

Contact – Contacts are the business portion of the connector. They are the metal parts which touch each other, forming an electrical connection. This is also where problems occur: the contacts can become soiled or oxidized, or the springiness required to hold the contacts together may fade with time.

ADH8066 mating connector

The contacts on this connector are clearly visible.

Pitch – Many connectors consist of an array of contacts in a repeated pattern. The pitch of the connector is the distance from the center of one contact to the center of the next. This is important, because there are many families of contacts which look very similar but may differ in pitch, making it difficult to know that you are purchasing the right mating connector.

.1" pin header connector examples

The pitch of the pins on the headers on a standard Arduino is .1″.

Mating cycles – Connectors have a finite life, and connecting and disconnecting them is what wears them out. Datasheets usually present that information in terms of mating cycles, and it varies widely from one technology to another. A USB connector may have a lifetime in the thousands or tens of thousands of cycles, while a board-to-board connector designed for use inside of consumer electronics may be limited to tens of cycles. It’s important that you select a connector with a suitable life for the application.

Connector for GS406 GPS module

Mating connector for the GS406 GPS module. The connector’s datasheet indicates a maximum of 50 insertion cycles for this part.

Mount – This one has the potential for being confusing. The term “mount” can refer to several things: how the connector is mounted in use (panel mount, free-hanging, board mount), what the angle of the connector is relative to its attachment (straight or right-angle), or how it is mechanically attached (solder tab, surface mount, through hole). We’ll discuss this more in the examples section for each individual connector.

Comparison of different mounting methods for barrel-type connectors

A comparison of three different methods of mounting the same barrel connector: (left to right) board mount, inline cable mount, and panel mount.

Strain relief – When a connector mounts to a board or cable, the electrical connections tend to be somewhat fragile. It is typical to provide some kind of strain relief to transfer any forces acting on that connector to a more mechanically sound object than the fragile electrical connections. Again, there will be some good examples of this later on.

1/8" Headphone jack showing strain relief

This 1/8″ headphone jack comes with a strain relief “boot” slid over the cable to prevent forces on the cable from being transmitted directly to the electrical joints.

USB Connectors

USB connectors come in two flavors: host and peripheral. In the USB standard, there is a difference between the two, and the connectors on cables and devices reflect this. However, all USB connectors will have some things in common:

  • Polarization – A USB connector can only nominally be inserted one way. It may be possible to force a connector in wrong, but that will result in damage to the device.
  • Four contacts – All USB connectors have at least four contacts (although some may have five, and USB 3.0connectors have even more). These are for power, ground, and two data lines (D+ and D-). USB connectors are designed to transmit 5V, up to 500mA.
  • Shielding – USB connectors are shielded, such that a metal shell which is not part of the electrical circuit is provided. This is important to keep the signal intact in environments with a lot of electrical “noise”.
  • Robust power connection – It’s important for the power pins to make connection before the data lines, to avoid trying to power the device over the data lines. All USB connectors are designed with this in mind.
  • Molded strain relief – All USB cables have plastic overmolding at the connector to prevent strain on the cable that could potentially damage the electrical connections.

Labeled image of USB extension cable

USB extension cable, with some of the common features of USB connectors labeled.

USB-A Connectors

USB-A female is the standard “host” connector type. This is found on computers, hubs, or any device intended to have peripherals plugged into it. It is also possible to find extension cables with a female A connector and a male A connector on the other end.

USB-A ports on a laptop computer.

Female USB-A ports on the side of a laptop. The blue connector is USB 3.0 compliant.

USB-A male is the standard “peripheral” connector type. Most USB cables will have one end terminating in a USB-A male connector, and many devices (such as keyboards and mice) will have a built-in cable terminated with a USB-A male connector. It’s also possible to find USB-A male connectors that are board mountable, for devices like USB memory sticks.

USB-A male connector examples

Two types of Male USB-A connectors, on a SparkFun Cerberus cable and an AVR Stick development board.

USB-B Connectors

USB-B female is a standard for peripheral devices. It’s bulky, but robust, so in applications where size is not an issue, it’s the preferred means for providing a removable connector for USB connectivity. It is usually a through-hole board mount connector, for maximum reliability, but there are panel-mount options for it as well.

USB-B connector on an Arduino Uno

Arduino boards, including this Uno, have long used the female USB-B connector, due to its low cost and durability.

USB-B male is almost exclusively found at the end of a cable. USB-B cables are ubiquitous and inexpensive, which also contributes to the popularity of the USB-B connection.

Male USB-B connector

USB-B male connector on the end of a SparkFun Cerberus cable.

USB-Mini Connectors

The USB-Mini connection was the first standard attempt to reduce the size of the USB connector for smaller devices. USB-Mini female is typically found on smaller peripherals (MP3 players, older cellphones, small external hard drives), and is usually a surface mount connector, trading robustness for size. USB-Mini is slowly being phased out in favor of the USB-Micro connector.

USB-Mini female connector

USB-Mini female connector on a Protosnap Pro Mini.

USB-Mini male is another cable-only connector. As with USB-B, it’s extremely common, and cables can be found cheaply almost anywhere.

USB-Mini male connector

USB-Mini male connector on the end of a SparkFun Cerberus cable.

USB-Micro Connectors

USB-Micro is a fairly recent addition to the USB connector family. As with USB-Mini, the primary concern is size reduction, but USB-Micro adds a fifth pin for low-speed signalling, allowing it to be used in USB-OTG (On-the-go) applications where a device may want to operate as either a host or a peripheral depending on circumstances.

USB-Micro female is found on many newer peripherals, such as digital cameras and MP3 players. The adoption of USB-micro as a standard charge port for all new cellular phones and tablet computers means that chargers and data cables are becoming increasingly common, and USB-Micro is likely to supplant USB-Mini in the coming years as the small-factor USB connector of choice.

USB-Micro female connector

USB-Micro female connector on a LilyPad Arduino USB board.

USB-Micro male is also a cable-only connector. There are generally two types of cables with USB-Micro male ends: one for connecting a device with a USB-Micro port as a peripheral to a USB host device and one for adapting the USB-Micro female port to a USB-A female port, to be used in USB-OTG capable devices.

USB-Micro male connector

USB-Micro male connector on the SparkFun Cerberus cable.

USB-A female to USB-Micro adapter

Adapter pigtail for using USB-OTG capable devices having only a USB-Micro port with standard USB peripherals. Note that not all devices supporting USB-OTG will work with this pigtail.

Audio Connectors

Another familiar connector group are those used for audio-visual applications–RCA and phono. While these can’t truly be considered to be of the same family, as the various USB connectors are, we’ll consider both of them to be in the same vein.

“Phone” Type Connectors

You’ll probably immediately recognize the 1/8″ version of this connector as a the plug on the end of a pair of headphones. These connectors actually come in three common sizes: ¼” (6.35mm), 1/8″ (3.5mm), and 2.5mm. ¼” size connectors find a lot of use in the professional audio and music community- most electric guitars and amplifiers have ¼” tip-sleeve (TS) jacks on them. 1/8″ tip-ring-sleeve (TRS) is very common as the connector for headphones or audio output signals on MP3 players or computers. Some cell phones will provide a 2.5mm tip-ring-ring-sleeve (TRRS) jack for connecting to headphones that also include a microphone for hands-free communications.

The common availability of these connectors and cables makes them a good candidate for general purpose connectivity applications–for instance, long before USB, Texas Instruments graphing calculators used a 2.5mm TRS connector for a serial programming connector. It should be remembered that tip-sleeve connector types are not designed for carrying power; during insertion, the tip and the sleeve can be momentarily shorted together, which may damage the power supply. The lack of shielding makes them poor candidates for high-speed data, but low speed serial data can be passed through these connectors.

1/8" TRS phone plug

Headphone-type TRS phone plug, 1/8″. Typically, tip and ring will carry the stereo audio signals while sleeve will be connected to ground.

1/8" TS phone plug

1/8″ phone plug. Note the lack of a ring contact on this connector.

1/8" board mount headphone jack

1/8″ board mount headphone jack with pins corresponding pin connections labeled. When no jack is inserted, an internal switch connects the tip and ring pins to the adjacent unmarked pins, allowing insertion detection.

RCA Connectors

Familiar as the home-stereo connector of choice for many decades, the RCA connector was introduced in the 1940s by RCA for home phonographs. It is slowly being supplanted by connections like HDMI in the audio-visual realm, but the ubiquity of the connectors and cables makes it a good candidate for home-built systems. It will be a long time before it is obsolete.

Female RCA connectors are usually found on devices, although it is possible to find extension or conversion cables with female jacks on them. Most RCA connectors are connected to one of four types of signals: component video (PAL or NTSC, depending on where the equipment was sold), composite video, stereo audio, or S/PDIF audio.

Female RCA plug, for video signals.

Female RCA connector, for video signals. Typically, NTSC or PAL video signal connectors will be yellow.

Male RCA connectors are usually found on cables.

Male RCA plugs

Male RCA plugs. Red and white are usually for audio applications, with red denoting the “right” audio channel.

Power Connectors

While many connectors carry power in addition to data, some connectors are used specifically to provide power connections to devices. These vary widely by application and size, but we will only focus on some of the most common ones here.

Barrel Connectors

Barrel connectors are typically found on low-cost consumer electronics which can be plugged into wall power via bulky AC wall adaptors. Wall adaptors are widely available, in a variety of power ratings and voltages, making barrel connectors a common means for connecting power to small projects.

The female barrel connector, or “jack”, can be purchased in several varieties: PCB mounted (surface mount or through hole), cable mount, or panel mount. Some of these connectors will have an additional contact that allows the application to detect whether a power supply is plugged into the barrel jack or not, thus allowing the device to bypass batteries and save battery life when running on external power.

Female barrel connector

Female barrel connector. When no plug is inserted, the “insertion detection” pin will be shorted to the “sleeve” pin.

The male barrel connector, or “plug”, is usually only found in a wire termination variety, although there are multiple methods of attaching the plug to the end of the wire. It’s also possible to get plugs that come pre-attached to a cable.

Male barrel plug

Unattached male barrel plug, for attachment to any power supply. Note that the sleeve connection is designed to be crimped onto the wire for extra strain relief.

Barrel connectors provide only two connections, frequently referred to as “pin” or “tip” and “sleeve”. When ordering, there are three differentiating characteristics of a barrel connection- inner diameter (the diameter of the pin inside the jack), outer diameter (the diameter of the sleeve on the outside of the plug), and polarity (whether the sleeve voltage is higher or lower than the tip voltage).

Sleeve diameter is most commonly either 5.5mm or 3.5mm.

Pin diameter is contingent upon sleeve diameter; a 5.5mm sleeve will have either a 2.5mm or 2.1mm pin. Unfortunately, this means that a plug designed for a 2.5mm pin will fit in a 2.1mm jack, but that the connection will be, at best, intermittent. 3.5mm sleeve plugs usually mate to a jack with a 1.3mm pin.

Polarity is the final aspect to consider; most often, the sleeve will be considered 0V and the tip will be a positive voltage relative to the sleeve. Many devices will have a small diagram indicating the polarity expected by the device; care should be taken to adhere to this, as an improper power supply may damage the device.

Plugs of both sleeve sizes are usually 9.5mm long, but longer and shorter ones do exist. All SparkFun products use a positive polarity 5.5mm sleeve and a 2.1mm pin; we recommend sticking to that standard where possible, as it seems to be the most common flavor found in the wild.

Barrel connector polarity label

Common polarity diagrams for AC adaptors with barrel plugs. Positive polarity (tip positive, sleeve 0V) is most common. Diagram courtesy Wikipedia user Three-quarter-ten.

“Molex” Connectors

Most computer hard drives, optical drives, and other internal peripherals get power through what is typically called a “Molex” connector. To be more accurate, it’s a Molex series 8981 connector–Molex is actually the name of the company which initially designed this connector back in the 1950s–but common usage has denuded that fact somewhat.

Molex connectors are designed to carry a lot of current: up to 11A per pin. For projects where a lot of power may be needed–a CNC machine, for instance, or a 3D printer- a very common method for powering the project is to use a desktop PC power supply and connecting the various system circuits through Molex connectors.

The Molex connector is one where the male/female terminology is a bit odd. The female connector is usually found on the end of a cable, and it slips inside of a plastic shell which surrounds the male pins on the male connector. Usually, the connectors are press-fit only, and very, very tight–they are intended to be connected and disconnected only a few times and, as such, are a bad choice for systems where connections will frequently be changed.

Male Molex connector

Male Molex connector. The gender of the pins inside the connector is what signifies the gender of the connector as a whole.

Female Molex connector

Female Molex connector on a project power supply.

IEC Connector

As with the Molex connector, this is a case where a generalized component name has come to be synonymous with a single, particular item. IEC connector usually refers to the power supply inlet which is commonly seen on desktop PC power supplies. Strictly speaking, that’s an IEC 60320-1 C13 (female) and C14 (male) connector.

IEC 60320-1 C14 male connector

C14 male IEC power inlet, on a DC project power supply. Note that, as with the Molex connector, the gender of the connector is defined by the pins within the hood.

C13 female IEC power connector

C13 female IEC power connector, on a fairly standard AC power supply cable. Cables with this end can be found all around the world, usually with the dominant local AC connector at the other end.

IEC connectors are used almost exclusively for AC power input. The nice thing about using one on a project is that IEC-to-wall cables are extremely common and available with localized wall plugs for most international locations!

JST Connector

At SparkFun, we frequently refer to “2.0mm JST Connectors”. This is yet another generalization of a specific product- JST is a Japanese company which makes high-quality connectors, and our 2.0mm JST connector of choice is the PH series two-position polarized connector.

All of SparkFun’s single-cell lithium-polymer ion batteries come standard with this type of JST connector, and many of our boards include this connector (or a footprint for it) as a power supply input. It has the advantage of being compact, durable, and difficult to connect backwards. Another feature, which can be an advantage or a disadvantage, depending on how you look at it, is that the JST connector is wicked hard to disconnect (although a carefully applied diagonal cuttercan be helpful!) once it’s mated. While this makes it unlikely to fail during use, it also means that disconnecting the battery for charging can damage the battery connector.

2-Pin JST male connector on a LilyPad Arduino USB board

2-Pin JST male connector on a LilyPad Arduino USB board. Again, as with the Molex, the pins inside the hood determine the gender of the connector.

Male and female 2-pin JST connectors

Male and female 2-pin JST connectors.

There are PH series connectors with more than two positions; SparkFun even sells them. However, our most frequent application is for the 2-position battery connection.

Pin Header Connectors

Pin header connectors comprise several different means of connection. Generally, one side is a series of pins which are soldered to a PCB, and they can either be at a right-angle to the PCB surface (usually called “straight”) or parallel to the board’s surface (confusingly referred to as “right-angle” pins). Such connectors come in a variety of pitches, and may have any number of individual rows of pins.

Right angle female header pin connector

Right-angle female header pin connection on an FTDI basic board.

The most commonly seen pin headers are .1″ single or double row connectors. These come in male and femaleversions, and are the connectors used to connect Arduino boards and shields together. Other pitches are not uncommon; for instance, the XBee wireless module uses a 2.0mm pitch version of the same connector.

.1" pin header connector examples

.1″ pin header connectors, male and female, on an Arduino Uno board.

A common variation on this part is a “machine pin” version. While the normal version is formed out of stamped and folded sheet metal, machine pin connectors are formed by tooling the metal into the desired shape. The result is a more robust connector, with a better joint and longer life, making it somewhat more expensive.

Female machine pin headers

Female machine pin headers. Note that these are designed to be snapped apart into smaller sections, while standard .1″ female header pin connectors are not. It’s also important to note that not all non-machine pin header connectors will mate with the machine pin variety.

Cables made to connect to these pin headers are usually one of two types: individual wires with crimp connectors on them or ribbon cables with insulation displacement connectors. These can simply be clamped onto the end of a ribbon cable, which creates a connection to each one of the conductors in the ribbon cable. Generally, cables are only available as female gender and expect a male pin to mate with.

Crimp connected header cable

Six-position crimp-type cable. Each wire is individually stripped, a connector crimped to it, and then the connectors are inserted into the plastic frame.

2x5 insulation displacement connectors on a ribbon cable

2×5 insulation displacement connectors (IDC) on a ribbon cable. This type of cable can be quickly assembled because it does not require stripping of individual connectors. It also has polarizing tabs on each end, to prevent incorrect insertion in the mating board-side connector.

Temporary connectors

Screw Terminals

In some cases, it may be desirable to be able to connect bare, unterminated wire to a circuit. Screw terminals provide a good solution for this. They are also good for situations in which a connection should be capable of supporting multiple different connecting devices.

The downside of screw terminals is that they can come undone fairly easily, leaving a bare wire waving around in your circuit. A small dab of hot glue can address this without being too difficult to remove later.

Screw terminals are typically designed for a narrow range of wire gauges, and wires that are too small can be as big a problem as wires that are too big. SparkFun carries two types of screw terminal–a .1″ pitch version and a 3.5mm version. Most screw terminals are highly modular, and they can easily be extended at the same pitch by simply connecting two or more smaller sections together.

3.5mm screw terminals


-> 3.5mm pitch screw terminals, showing the insertion point of the wire to be connected, the retention screw which holds the wire in place, and the modular connectors on the sides of the individual units allowing multiple pieces to be ganged together. <-

Banana Connector

Most pieces of power test equipment (multimeters, power supplies) have a very simple connector called a “banana jack” on it. These mate to “banana plugs”, crimped, sprung metal plugs, meant to make a single power connection. They are frequently available in a stackable configuration and can be easily connected to any type of wire. They are capable of carrying several amps of current and are inexpensive.

Banana plug

Stackable banana plug. Note that there are two different ways to plug in an additional banana plug.

Variable power supply with banana plugs

Extech variable bench supply with banana jacks on the front.

Alligator Clip

Named for obvious reasons, alligator clips are good for test connections to posts or bare wires. They tend to be bulky, easily cause shorts to nearby bare metal, and have a reasonably poor grip that can be easily compromised. They are primarily used for low-cost connections during debugging.

Alligator clips

“third hand” tool, which uses alligator clips to hold work pieces, holding a wire terminated with an alligator clip for electrical test. Note the plastic boot surrounding the alligator clip, to make it less likely to short to other connections.

IC Clip (or IC Hook)

For more delicate probing operations, there are a variety of IC clips on the market. These are sized to allow a user to clip them onto the pins of an IC without contacting adjacent pins; some of them are delicate enough to be clipped onto even fine-pitched SMD component legs. These smaller clips can be found on logic analyzers as well as test leads, which are great for prototyping or troubleshooting circuits.

Large IC clip

large IC clip on the end of a wire. This clip is still small enough to be connected to a single leg on a through-hole chip without causing a problem for adjacent pins.

Other Connectors

RJ-type Modular Connectors

Registered jack connectors are standard for telecommunications equipment into a local exchange. The names one normally hears associated with them (RJ45, RJ12, etc) are not necessarily correct, as the RJ designator is a based on a combination of the number of positions, the number of conductors actually present, and the wiring pattern. For example, while the ends of a standard ethernet cable are usually referred to as “RJ45”, RJ45 actually implies not only an 8 position, 8 conductor modular jack, it also implies that it is wired for ethernet.

These modular connectors can be very useful, since they combine ready availability, multiple conductors, moderate flexibility, low cost, and moderate current carrying capacity. While not originally intended to deliver a great deal of power, these cables can be used to deliver data and a couple of hundred milliamps from one device to another. Care should be taken to ensure that jacks provided for applications like this are not connected to conventional ethernet ports, as damage will result.

8p8c "RJ45" style modular jack

A standard 8p8c (8-position, 8-conductor) “RJ45” modular jack. Be aware that if you intend to use this type of jack to pass DC signals and power, you must avoid using connectors with built-in signal transformers.

D-sub Type Connectors

Named for the shape of their shell, D-subminiature connectors are a classic standard in the computing world. There are four very common varieties of this connector: DA-15, DB-25, DE-15, and DE-9. The pin number indicates the number of connections provided, and the letter combination indicates the size of the shell. Thus, DE-15 and DE-9 have the same shell size, but a different number of connections.

Female board-mount DE9 connector

Female DE-9 board-mount connector. Gender is defined by the pins or sockets associated with each signal, not the connector as a whole, making this connector female despite the fact that it effectively inserts into the shell of the mating connector.

DB-25 and DE-9 are the most useful to the hardware hacker; many desktop computers still include at least one DE-9 serial port, and often one DB-25 parallel port. Cables terminated with DE-9 and DB-25 connectors are widely available, too. As with the modular connector above, these can be used to provide power and point-to-point communications between two devices. Again, since the common usage of these cables does not include power transmission, it is very important that any repurposing of the cables be done cautiously, as a non-standard device plugged into a standard port can easily cause damage.

Resources and Going Further

You should now have a good idea which connectors are suited best for certain applications and which connectors will be useful to you in your next project. Please check out these other links to lean more about connectors.

  • Giant database of connectors and pinouts – Everything you never wanted to know about pretty much any connector, ever. A good site for basic info about connectors, but often quite shy on interface details.
  • Wikipedia article on registered jack connectors – More on the confusing world of the registered jack (RJ) connector, which is often misunderstood and misused.
  • Wikipedia article on D-subminiature connectors – As with the registered jack connector, misinformation abounds on the D-subminiature standard. Wikipedia has a great article about it.
  • Mouser electronics catalog – Browsing an electronics supplier catalog is often a great place to start looking for the name of an unidentified connector; Mouser’s enhanced online catalog is just as good as the print version, with fewer papercuts!

If you’d like top explore more SparkFun tutorials, check out these other offerings:

 


cc

 Creative Commonstutorials are CC BY-SA 4.0

Original From:

https://learn.sparkfun.com/tutorials/connector-basics

Analog vs. Digital

Overview

We live in an analog world. There are an infinite amount of colors to paint an object (even if the difference is indiscernible to our eye), there are an infinite number of tones we can hear, and there are an infinite number of smells we can smell. The common theme among all of these analog signals is their infinite possibilities.

Digital signals and objects deal in the realm of the discrete or finite, meaning there is a limited set of values they can be. That could mean just two total possible values, 255, 4,294,967,296, or anything as long as it’s not ∞ (infinity).

Analog and digital real-life items

Real-world objects can display data, gather inputs by either analog or digital means. (From left to right): Clocks, multimeters, and joysticks can all take either form (analog above, digital below).

Working with electronics means dealing with both analog and digital signals, inputs and outputs. Our electronics projects have to interact with the real, analog world in some way, but most of our microprocessors, computers, and logic units are purely digital components. These two types of signals are like different electronic languages; some electronics components are bi-lingual, others can only understand and speak one of the two.

In this tutorial, we’ll cover the basics of both digital and analog signals, including examples of each. We’ll also talk about analog and digital circuits, and components.

Suggested Reading

The concepts of analog and digital stand on their own, and don’t require a lot of previous electronics knowledge. That said, if you haven’t already, you should peek through some of these tutorials:

Analog Signals

Define: Signals

Before going too much further, we should talk a bit about what a signal actually is, electronic signals specifically (as opposed to traffic signals, albums by the ultimate power-trio, or a general means for communication). The signals we’re talking about are time-varying “quantities” which convey some sort of information. In electrical engineering the quantitythat’s time-varying is usually voltage (if not that, then usually current). So when we talk about signals, just think of them as a voltage that’s changing over time.

Signals are passed between devices in order to send and receive information, which might be video, audio, or some sort of encoded data. Usually the signals are transmitted through wires, but they could also pass through the air via radio frequency (RF) waves. Audio signals, for example might be transferred between your computer’s audio card and speakers, while data signals might be passed through the air between a tablet and a WiFi router.

Analog Signal Graphs

Because a signal varies over time, it’s helpful to plot it on a graph where time is plotted on the horizontal, x-axis, and voltage on the vertical, y-axis. Looking at a graph of a signal is usually the easiest way to identify if it’s analog or digital; a time-versus-voltage graph of an analog signal should be smooth and continuous.

Analog Sine Wave

While these signals may be limited to a range of maximum and minimum values, there are still an infinite number of possible values within that range. For example, the analog voltage coming out of your wall socket might be clamped between -120V and +120V, but, as you increase the resolution more and more, you discover an infinite number of values that the signal can actually be (like 64.4V, 64.42V, 64.424V, and infinite, increasingly precise values).

Example Analog Signals

Video and audio transmissions are often transferred or recorded using analog signals. The composite video coming out of an old RCA jack, for example, is a coded analog signal usually ranging between 0 and 1.073V. Tiny changes in the signal have a huge effect on the color or location of the video.

Composite video signal

An analog signal representing one line of composite video data.

Pure audio signals are also analog. The signal that comes out of a microphone is full of analog frequencies and harmonics, which combine to make beautiful music.

Digital Signals

Digital signals must have a finite set of possible values. The number of values in the set can be anywhere between two and a-very-large-number-that’s-not-infinity. Most commonly digital signals will be one of two values – like either 0V or 5V. Timing graphs of these signals look like square waves.

Square wave signal. Two values, either 0V or 5V.

Or a digital signal might be a discrete representation of an analog waveform. Viewed from afar, the wave function below may seem smooth and analog, but when you look closely there are tiny discrete steps as the signal tries to approximate values:

Digital Sine Wave

That’s the big difference between analog and digital waves. Analog waves are smooth and continuous, digital waves are stepping, square, and discrete.

Example Digital Signals

Not all audio and video signals are analog. Standardized signals like HDMI for video (and audio) and MIDII2S, or AC’97for audio are all digitally transmitted.

Most communication between integrated circuits is digital. Interfaces like serialI2C, and SPI all transmit data via a coded sequence of square waves.

SPI square wave signals

Serial peripheral interface (SPI) uses many digital signals to transmit data between devices.

Analog and Digital Circuits

Analog Electronics

Most of the fundamental electronic components – resistorscapacitors, inductors, diodes, transistors, and operational amplifiers – are all inherently analog. Circuits built with a combination of solely these components are usually analog.

Example analog circuit

Analog circuits are usually complex combinations of op amps, resistors, caps, and other foundational electronic components. This is an example of a class B analog audio amplifier.

Analog circuits can be very elegant designs with many components, or they can be very simple, like two resistors combining to make a voltage divider. In general, though, analog circuits are much more difficult to design than those which accomplish the same task digitally. It takes a special kind of analog circuit wizard to design an analog radio receiver, or an analog battery charger; digital components exist to make those designs much simpler.

Analog circuits are usually much more susceptible to noise (small, undesired variations in voltage). Small changes in the voltage level of an analog signal may produce significant errors when being processed.

Digital Electronics

Digital circuits operate using digital, discrete signals. These circuits are usually made of a combination of transistors and logic gates and, at higher levels, microcontrollers or other computing chips. Most processors, whether they’re big beefy processors in your computer, or tiny little microcontrollers, operate in the digital realm.

Example digital circuit

Digital circuits make use of components like logic gates, or more complicated digital ICs (usually represented by rectangles with labeled pins extending from them).

Digital circuits usually use a binary scheme for digital signaling. These systems assign two different voltages as two different logic levels – a high voltage (usually 5V, 3.3V, or 1.8V) represents one value and a low voltage (usually 0V) represents the other.

Although digital circuits are generally easier to design, they do tend to be a bit more expensive than an equally tasked analog circuit.

Analog and Digital Combined

It’s not rare to see a mixture of analog and digital components in a circuit. Although microcontrollers are usually digital beasts, they often have internal circuitry which enables them to interface with analog circuitry (analog-to-digital converterspulse-width modulation, and digital-to-analog converters. An analog-to-digital converter (ADC) allows a microcontroller to connect to an analog sensor (like photocells or temperature sensors), to read in an analog voltage. The less common digital-to-analog converter allows a microcontroller to produce analog voltages, which is handy when it needs to make sound.

Resources and Going Further

Now that you know the difference between analog and digital signals, we’d suggest checking out the Analog to Digital Conversion tutorial. Working with microcontrollers, or really any logic-based electronics, means working in the digital realm most of the time. If you want to sense light, temperature, or interface a microcontroller with a variety of other analog sensors, you’ll need to know how to convert the analog voltage they produce into a digital value.

Also, consider reading our Pulse Width Modulation (PWM) tutorial. PWM is a trick microcontrollers can use to make a digital signal appear to be analog.

Here are some other subjects which deal heavily with digital interfaces:

Or, if you’d like to delve further into the analog realm, consider checking out these tutorials:

 


cc

 Creative Commonstutorials are CC BY-SA 4.0

Original From:

https://learn.sparkfun.com/tutorials/analog-vs-digital?_ga=2.115872645.205432072.1519278474-2127327188.1495905514

PCB Basics

Overview

One of the key concepts in electronics is the printed circuit board or PCB. It’s so fundamental that people often forget to explain what a PCB is. This tutorial will breakdown what makes up a PCB and some of the common terms used in the PCB world.

Blank PCB from the ClockIt Kit

Over the next few pages, we’ll discuss the composition of a printed circuit board, cover some terminology, a look at methods of assembly, and discuss briefly the design process behind creating a new PCB.

Suggested Reading

Before you get started you may want to read up on some concepts we build upon in this tutorial:


Translations

Minh Tuấn was kind enough to translate this tutorial to Vietnamese. You can view the translation here.

What’s a PCB?

Printed circuit board is the most common name but may also be called “printed wiring boards” or “printed wiring cards”. Before the advent of the PCB circuits were constructed through a laborious process of point-to-point wiring. This led to frequent failures at wire junctions and short circuits when wire insulation began to age and crack.

Mass of wire wrap
courtesy Wikipedia user Wikinaut

A significant advance was the development of wire wrapping, where a small gauge wire is literally wrapped around a post at each connection point, creating a gas-tight connection which is highly durable and easily changeable.

As electronics moved from vacuum tubes and relays to silicon and integrated circuits, the size and cost of electronic components began to decrease. Electronics became more prevalent in consumer goods, and the pressure to reduce the size and manufacturing costs of electronic products drove manufacturers to look for better solutions. Thus was born the PCB.

LilyPad PCB

PCB is an acronym for printed circuit board. It is a board that has lines and pads that connect various points together. In the picture above, there are traces that electrically connect the various connectors and components to each other. A PCB allows signals and power to be routed between physical devices. Solder is the metal that makes the electrical connections between the surface of the PCB and the electronic components. Being metal, solder also serves as a strong mechanical adhesive.

Composition

A PCB is sort of like a layer cake or lasagna- there are alternating layers of different materials which are laminated together with heat and adhesive such that the result is a single object.

alt text

Let’s start in the middle and work our way out.

FR4

The base material, or substrate, is usually fiberglass. Historically, the most common designator for this fiberglass is “FR4”. This solid core gives the PCB its rigidity and thickness. There are also flexible PCBs built on flexible high-temperature plastic (Kapton or the equivalent).

You will find many different thickness PCBs; the most common thickness for SparkFun products is 1.6mm (0.063″). Some of our products- LilyPad boards and Arudino Pro Micro boards- use a 0.8mm thick board.

Perf board

Cheaper PCBs and perf boards (shown above) will be made with other materials such as epoxies or phenolics which lack the durability of FR4 but are much less expensive. You will know you are working with this type of PCB when you solder to it – they have a very distictive bad smell. These types of substrates are also typically found in low-end consumer electronics. Phenolics have a low thermal decomposition temperature which causes them to delaminate, smoke and char when the soldering iron is held too long on the board.

Copper

The next layer is a thin copper foil, which is laminated to the board with heat and adhesive. On common, double sided PCBs, copper is applied to both sides of the substrate. In lower cost electronic gadgets the PCB may have copper on only one side. When we refer to a double sided or 2-layer board we are referring to the number of copper layers (2) in our lasagna. This can be as few as 1 layer or as many as 16 layers or more.

Exposed Copper on PCB

PCB with copper exposed, no solder mask or silkscreen.

The copper thickness can vary and is specified by weight, in ounces per square foot. The vast majority of PCBs have 1 ounce of copper per square foot but some PCBs that handle very high power may use 2 or 3 ounce copper. Each ounce per square translates to about 35 micrometers or 1.4 thousandths of an inch of thickness of copper.

Soldermask

The layer on top of the copper foil is called the soldermask layer. This layer gives the PCB its green (or, at SparkFun, red) color. It is overlaid onto the copper layer to insulate the copper traces from accidental contact with other metal, solder, or conductive bits. This layer helps the user to solder to the correct places and prevent solder jumpers.

In the example below, the green solder mask is applied to the majority of the PCB, covering up the small traces but leaving the silver rings and SMD pads exposed so they can be soldered to.

Green Solder Mask

Soldermask is most commonly green in color but nearly any color is possible. We use red for almost all the SparkFun boards, white for the IOIO board, and purple for the LilyPad boards.

Silkscreen

The white silkscreen layer is applied on top of the soldermask layer. The silkscreen adds letters, numbers, and symbols to the PCB that allow for easier assembly and indicators for humans to better understand the board. We often use silkscreen labels to indicate what the function of each pin or LED.

PCB with silkscreen

Silkscreen is most commonly white but any ink color can be used. Black, gray, red, and even yellow silkscreen colors are widely available; it is, however, uncommon to see more than one color on a single board.

Terminology

Now that you’ve got an idea of what a PCB structure is, let’s define some terms that you may hear when dealing with PCBs:

  • Annular ring – the ring of copper around a plated through hole in a PCB.

Annular ring on resistor Annular ring on vias

Examples of annular rings.

  • DRC – design rule check. A software check of your design to make sure the design does not contain errors such as traces that incorrectly touch, traces too skinny, or drill holes that are too small.
  • Drill hit – places on a design where a hole should be drilled, or where they actually were drilled on the board. Inaccurate drill hits caused by dull bits are a common manufacturing issue.

Bad drill hits

Not so accurate, but functional drill hits.

  • Finger – exposed metal pads along the edge of a board, used to create a connection between two circuit boards. Common examples are along the edges of computer expansion or memory boards and older cartridge-based video games.
  • Mouse bites – an alternative to v-score for separating boards from panels. A number of drill hits are clustered close together, creating a weak spot where the board can be broken easily after the fact. See the SparkFun Protosnap boards for a good example.

LilyPad Protosnap with mouse bites

Mouse bites on the LilyPad ProtoSnap allow the PCB to be snapped apart easily.

  • Pad – a portion of exposed metal on the surface of a board to which a component is soldered.

PTH Pads SMD Pads

PTH (plated through-hole) pads on the left, SMD (surface mount device) pads on the right.

  • Panel – a larger circuit board composed of many smaller boards which will be broken apart before use. Automated circuit board handling equipment frequently has trouble with smaller boards, and by aggregating several boards together at once, the process can be sped up significantly.
  • Paste stencil – a thin, metal (or sometimes plastic) stencil which lies over the board, allowing solder paste to be deposited in specific areas during assembly.

Abe does a quick demonstration of how to line up a paste stencil and apply solder paste.

  • Pick-and-place – the machine or process by which components are placed on a circuit board.

Bob shows us the SparkFun MyData Pick and Place machine. It’s pretty awesome.

  • Plane – a continuous block of copper on a circuit board, define by borders rather than by a path. Also commonly called a “pour”.

PCB ground pour

Various portions of the PCB that have no traces but has a ground pour instead.

  • Plated through hole – a hole on a board which has an annular ring and which is plated all the way through the board. May be a connection point for a through hole component, a via to pass a signal through, or a mounting hole.

Plated through hole resistor

A PTH resistor inserted into the FabFM PCB, ready to be soldered. The legs of the resistor go through the holes. The plated holes can have traces connected to them on the front of the PCB and the rear of the PCB.

  • Pogo pin – spring-loaded contact used to make a temporary connection for test or programming purposes.

Pogo Pin

The popular pogo pin with pointed tip. We use tons of these on our test beds.

  • Reflow – melting the solder to create joints between pads and component leads.
  • Silkscreen – the letters, number, symbols, and imagery on a circuit board. Usually only one color is available, and resolution is usually fairly low.

Silkscreen

Silkscreen identifying this LED as the power LED.

  • Slot – any hole in a board which is not round. Slots may or may not be plated. Slots sometimes add to add cost to the board because they require extra cut-out time.

slot

Complex slots cut into the ProtoSnap – Pro Mini. There are also many mouse bites shown. Note: the corners of the slots cannot be made completely square because they are cut with a circular routing bit.

  • Solder paste – small balls of solder suspended in a gel medium which, with the aid of a paste stencil, are applied to the surface mount pads on a PCB before the components are placed. During reflow, the solder in the paste melts, creating electrical and mechanical joints between the pads and the component.

alt text

Solder paste on a PCB shortly before the components are placed. Be sure to read about paste stencil above as well.

  • Solder pot – a pot used to quickly hand solder boards with through hole components. Usually contains a small amount of molten solder into which the board is quickly dipped, leaving solder joints on all exposed pads.
  • Soldermask – a layer of protective material laid over the metal to prevent short circuits, corrosion, and other problems. Frequently green, although other colors (SparkFun red, Arduino blue, or Apple black) are possible. Occasionally referred to as “resist”.

alt text

Solder mask covers up the signal traces but leaves the pads to solder to.

  • Solder jumper – a small, blob of solder connecting two adjacent pins on a component on a circuit board. Depending on the design, a solder jumper can be used to connect two pads or pins together. It can also cause unwanted shorts.
  • Surface mount – construction method which allows components to be simply set on a board, not requiring that leads pass through holes in the board. This is the dominant method of assembly in use today, and allows boards to be populated quickly and easily.
  • Thermal – a small trace used to connect a pad to a plane. If a pad is not thermally relieved, it becomes difficult to get the pad to a high enough temperature to create a good solder joint. An improperly thermally relieved pad will feel “sticky” when you attempt to solder to it, and will take an abnormally long time to reflow.

thermal

On the left, a solder pad with two small traces (thermals) connecting the pin to the ground plane. On the right, a via with no thermals connecting it completely to the ground plane.

  • Thieving – hatching, gridlines, or dots of copper left in areas of a board where no plane or traces exist. Reduces difficulty of etching because less time in the bath is required to remove unneeded copper.
  • Trace – a continuous path of copper on a circuit board.

Traces on PCB

A small trace connecting the Reset pad to elsewhere on the board. A larger, thicker trace connects to the 5V power pin.

  • V-score– a partial cut through a board, allowing the board to be easily snapped along a line.
  • Via – a hole in a board used to pass a signal from one layer to another. Tented vias are covered by soldermask to protect them from being soldered to. Vias where connectors and components are to be attached are often untented (uncovered) so that they can be easily soldered.

alt text alt text

Front and back of the same PCB showing a tented via. This via brings the signal from the front side of the PCB, through the middle of the board, to the back side.

  • Wave solder – a method of soldering used on boards with through-hole components where the board is passed over a standing wave of molten solder, which adheres to exposed pads and component leads.

Designing Your Own!

How do you go about designing your own PCB? The ins and outs of PCB design are way too in depth to get into here, but if you really want to get started, here are some pointers:

  1. Find a CAD package: there are a lot of low-cost or free options out there on the market for PCB design. Things to consider when choosing a package:
    • Community support: are there a lot of people using the package? The more people using it, the more likely you are to find ready-made libraries with the parts you need.
    • Ease-of-use: if it’s painful to use it, you won’t.
    • Capability: some programs place limitations on your design- number of layers, number of components, size of board, etc. Most of them allow you to pay for a license to upgrade their capability.
    • Portability: some free programs do not allow you to export or convert your designs, locking you in to one supplier only. Maybe that’s a fair price to pay for convenience and price, maybe not.
  2. Look at other people’s layouts to see what they have done. Open Source Hardware makes this easier than ever.
  3. Practice, practice, practice.
  4. Maintain low expectations. Your first board design will have lots of problems. Your 20th board design will have fewer, but will still have some. You’ll never get rid of them all.
  5. Schematics are important. Trying to design a board without a good schematic in place first is an exercise in futility.

Finally, a few words on the utility of designing your own circuit boards. If you plan on making more than one or two of a given project, the payback on designing a board is pretty good- point-to-point wiring circuits on a protoboard is a hassle, and they tend to be less robust than purpose-designed boards. It also allows you to sell your design if it turns out to be popular.

(中文) PIR传感器相关知识

How PIRs Work

PIR sensors are more complicated than many of the other sensors explained in these tutorials (like photocells, FSRs and tilt switches) because there are multiple variables that affect the sensors input and output. To begin explaining how a basic sensor works, we’ll use this rather nice diagram

The PIR sensor itself has two slots in it, each slot is made of a special material that is sensitive to IR. The lens used here is not really doing much and so we see that the two slots can ‘see’ out past some distance (basically the sensitivity of the sensor). When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from the room or walls or outdoors. When a warm body like a human or animal passes by, it first intercepts one half of the PIR sensor, which causes a positive differential change between the two halves. When the warm body leaves the sensing area, the reverse happens, whereby the sensor generates a negative differential change. These change pulses are what is detected.

The PIR Sensor

The IR sensor itself is housed in a hermetically sealed metal can to improve noise/temperature/humidity immunity. There is a window made of IR-transmissive material (typically coated silicon since that is very easy to come by) that protects the sensing element. Behind the window are the two balanced sensors.

Image from RE200B datasheet

You can see above the diagram showing the element window, the two pieces of sensing material

Image from RE200B datasheet

This image shows the internal schematic. There is actually a JFET inside (a type of transistor) which is very low-noise and buffers the extremely high impedence of the sensors into something a low-cost chip (like the BIS0001) can sense.

Lenses

PIR sensors are rather generic and for the most part vary only in price and sensitivity. Most of the real magic happens with the optics. This is a pretty good idea for manufacturing: the PIR sensor and circuitry is fixed and costs a few dollars. The lens costs only a few cents and can change the breadth, range, sensing pattern, very easily.In the diagram up top, the lens is just a piece of plastic, but that means that the detection area is just two rectangles. Usually we’d like to have a detection area that is much larger. To do that, we use a simple lens such as those found in a camera: they condenses a large area (such as a landscape) into a small one (on film or a CCD sensor). For reasons that will be apparent soon, we would like to make the PIR lenses small and thin and moldable from cheap plastic, even though it may add distortion. For this reason the sensors are actually Fresnel lenses:

Image from Sensors Magazine

The Fresnel lens condenses light, providing a larger range of IR to the sensor.

Image from Cypress appnote 2105

OK, so now we have a much larger range. However, remember that we actually have two sensors, and more importantly we dont want two really big sensing-area rectangles, but rather a scattering of multiple small areas. So what we do is split up the lens into multiple section, each section of which is a fresnel lens.

Here you can see the multiple facet-sections

This macro shot shows the different Frenel lenses in each facet!

The different faceting and sub-lenses create a range of detection areas, interleaved with each other. Thats why the lens centers in the facets above are ‘inconsistant’ – every other one points to a different half of the PIR sensing element

Connecting to a PIR

Most PIR modules have a 3-pin connection at the side or bottom. The pinout may vary between modules so triple-check the pinout! It’s often silkscreened on right next to the connection (at least, ours is!) One pin will be ground, another will be signal and the final one will be power. Power is usually 3-5VDC input but may be as high as 12V. Sometimes larger modules don’t have direct output and instead just operate a relay in which case there is ground, power and the two switch connections.

The output of some relays may be ‘open collector’ – that means it requires a pullup resistor. If you’re not getting a variable output be sure to try attaching a 10K pullup between the signal and power pins.

An easy way of prototyping with PIR sensors is to connect it to a breadboard since the connection port is 0.1″ spacing. Some PIRs come with header on them already, the one’s from adafruit have a straight 3-pin header on them for connecting a cable

For our PIR’s the red cable is + voltage power, black cable is – ground power and yellow is the signal out. Just make sure you plug the cable in as shown above! If you get it backwards you won’t damage the PIR but it won’t work.

Testing a PIR

Now when the PIR detects motion, the output pin will go “high” to 3.3V and light up the LED!

Once you have the breadboard wired up, insert batteries and wait 30-60 seconds for the PIR to ‘stabilize’. During that time the LED may blink a little. Wait until the LED is off and then move around in front of it, waving a hand, etc, to see the LED light up!

Retriggering

There’s a couple options you may have with your PIR. First up we’ll explore the ‘Retriggering’ option.

Once you have the LED blinking, look on the back of the PIR sensor and make sure that the jumper is placed in the L position as shown below.

Now set up the testing board again. You may notice that when connecting up the PIR sensor as above, the LED does not stay on when moving in front of it but actually turns on and off every second or so. That is called “non-retriggering”.
Now change the jumper so that it is in the H position. If you set up the test, you will notice that now the LED does stay on the entire time that something is moving. That is called “retriggering”.

(The graphs above are from the BISS0001 datasheet, they kinda suck)

For most applications, “retriggering” (jumper in H position as shown below) mode is a little nicer.

If you need to connect the sensor to something edge-triggered, you’ll want to set it to “non-retriggering” (jumper in L position).

Changing sensitivity

The Adafruit PIR has a trimpot on the back for adjusting sensitivity. You can adjust this if your PIR is too sensitive or not sensitive enough – clockwise makes it more sensitive.

Changing Pulse Time and Timeout Length

There are two ‘timeouts’ associated with the PIR sensor. One is the “Tx” timeout: how long the LED is lit after it detects movement – this is easy to adjust on Adafruit PIR’s because there’s a potentiometer.

The second is the “Ti” timeout which is how long the LED is guaranteed to be off when there is no movement. This one is not easily changed but if you’re handy with a soldering iron it is within reason.First, lets take a look at the BISS datasheet again

On Adafruit PIR sensors, there’s a little trim potentiometer labeled TIME. This is a 1 Megaohm adjustable resistor which is added to a 10K series resistor. And C6 is 0.01uF so

Tx = 24576 x (10K + Rtime) x 0.01uF

If the Rtime potentiometer is turned all the way down counter-clockwise (to 0 ohms) then

Tx = 24576 x (10K) x 0.01uF = 2.5 seconds (approx)

If the Rtime potentiometer is turned all the way up clockwise to 1 Megaohm then

Tx = 24576 x (1010K) x 0.01uF = 250 seconds (approx)

If RTime is in the middle, that’d be about 120 seconds (two minutes) so you can tweak it as necessary. For example if you want motion from someone to turn on a fan for a minimum of 1 minute, set the Rtime potentiometer to about 1/4 the way around.

For older/other PIR sensors

If you have a PIR sensor from somewhere else that does not have a potentiometer adjust, you can trace out the adjustment resistors this way:

Determining R10 and R9 isnt too tough. Unfortunately this PIR sensor is mislabeled (it looks like they swapped R9 R17). You can trace the pins by looking at the BISS001 datasheet and figuring out what pins they are – R10 connects to pin 3 and R9 connects to pin 7. the capacitors are a little tougher to determine, but you can ‘reverse engineer’ them from timing the sensor and solving!

For example:

Tx is = 24576 * R10 * C6 = ~1.2 seconds
R10 = 4.7K and C6 = 10nF

Likewise,

Ti = 24 * R9 * C7 = ~1.2 seconds
R9 = 470K and C7 = 0.1uF

Using a PIR

Reading PIR Sensors

Connecting PIR sensors to a microcontroller is really simple. The PIR acts as a digital output so all you need to do is listen for the pin to flip high (detected) or low (not detected).Its likely that you’ll want reriggering, so be sure to put the jumper in the H position!

Power the PIR with 5V and connect ground to ground. Then connect the output to a digital pin. In this example we’ll use pin 2.

The code is very simple, and is basically just keeps track of whether the input to pin 2 is high or low. It also tracks the state of the pin, so that it prints out a message when motion has started and stopped.
  1. /*
  2. * PIR sensor tester
  3. */
  4. int ledPin = 13; // choose the pin for the LED
  5. int inputPin = 2; // choose the input pin (for PIR sensor)
  6. int pirState = LOW; // we start, assuming no motion detected
  7. int val = 0; // variable for reading the pin status
  8. void setup() {
  9. pinMode(ledPin, OUTPUT); // declare LED as output
  10. pinMode(inputPin, INPUT); // declare sensor as input
  11. Serial.begin(9600);
  12. }
  13. void loop(){
  14. val = digitalRead(inputPin); // read input value
  15. if (val == HIGH) { // check if the input is HIGH
  16. digitalWrite(ledPin, HIGH); // turn LED ON
  17. if (pirState == LOW) {
  18. // we have just turned on
  19. Serial.println(“Motion detected!”);
  20. // We only want to print on the output change, not state
  21. pirState = HIGH;
  22. }
  23. } else {
  24. digitalWrite(ledPin, LOW); // turn LED OFF
  25. if (pirState == HIGH){
  26. // we have just turned of
  27. Serial.println(“Motion ended!”);
  28. // We only want to print on the output change, not state
  29. pirState = LOW;
  30. }
  31. }
  32. }
Don’t forget that there are some times when you don’t need a microcontroller. A PIR sensor can be connected to a relay (perhaps with a transistor buffer) without a micro!

Make Your Own Fritzing Parts 

What is Fritzing?

Fritzing Logo

Fritzing is a great open source tool for anyone to teach, share, and prototype their electronic projects! It allows you to design a schematic, and thus a part, which can then be added to very professional-looking wiring diagrams. You can even design your own PCBs and have them fabricated from the files you design. Here at SparkFun, we use Fritzing in the classrooms, our hook-up guides, and any other place we need to show how to hook-up our boards to other hardware.

Fritzing Hookup Example

Fritzing example of the INA169 connected to an Arduino

The awesome thing about Fritzing is that you can make your own Fritzing parts for your project and share with the community! This tutorial is going to go over how to make a custom Fritzing part in the Fritzing (New) Parts Editor, starting from the beginning.

Do You Need to Make a Custom Fritzing Part?

Fritzing comes with tons of electronic parts already installed with the software. SparkFun also has a Fritzing Github repofor housing parts we’ve created not already in Fritzing. Before creating your own part, double check to see if it exists in those two locations or if another Fritzing user already made the part you need on the Fritzing forum. It will save you a lot of time if the part is already made! However, if you’re certain that the part you need doesn’t live in Fritzing land already, read on!

Suggested Reading

This tutorial assumes that you are already familiar with Adobe Illustrator, Inscape, or both. Using these programs is beyond the scope of this tutorial. If you need more info on how to use eithwer of these programs, their respective websites should have lots of tutorials and guides on how to get started with vector graphics. If that fails, there’s always Google.

Here are other related tutorials you may want to check out before reading this one:

Download and Install

You will need to download and install the following software in order to follow along and make your own custom Fritzing part.

Please Note: If you only need to make a basic IC, Fritzing (New) Parts Editor allows you to make custom ICs easily, and you won’t need to download a vector graphic editor. You can still follow along, since this tutorial will be building off a custom IC in the Fritzing (New) Parts Editor.

Fritzing

Go to the download page on the Fritzing site to download the latest Fritzing version for your OS. Find where you want to put the Fritzing application on your hard drive, and unzip the Fritzing folder in that location.

Vector Graphics Editor

There is a lot of different types of vector graphics editors out there. The vector graphics editors we use here at SparkFun are Adobe Illustrator and Inkscape. Choose the one you are the most familiar and comfortable with. If you don’t have a vector graphics editor, Inkscape is a great open source choice, and it is free.

Inkscape

Inkscape Logo

Go to the Inkscape download page and download the appropriate Official Release Package for your computer.

Windows Users: Double click on the executable. Follow along the Inkscape Setup Wizard.

Mac OS X Users: Follow along the newest instructions on the Inkscape site.

Adobe Illustrator

Adobe Illustrator Logo

Adobe Illustrator is not free, but if you already have the Adobe Creative Cloud you can download it. You can also purchase an Illustrator monthly membership.

Please Note: We have no affiliation with Adobe and are only promoting Illustrator because it is a great piece of software that works well for what we need in this tutorial.

Other Downloads

Fritzing Fonts and Templates

Fritzing uses the OCR-A font for ICs. For all the other parts you can use OCR-A and Droid Sans fonts. Fritzing has fonts and templates available for download on their site. You will need to download Fritzing’s Graphic Standards to follow this tutorial. Go to their template download page, and download the Fritzing’s Graphic Standards folder. After you download their zip file, you will need to make sure to unzip the folder, and place anywhere on your computer. You will want to install the fonts on your computer.

SparkFun Fritzing Example Templates

This tutorial will reference the SparkFun Fritzing Example Templates a lot. If you are making a Fritzing part for a SparkFun board or want a starting point, download this set of example templates from the SparkFun Fritzing Parts Github repo. The SparkFun Fritzing templates will have this tutorial’s example, SparkFun T5403 Barometer Breakout SVG, files to compare and work with.

Breadboard View

When the Fritzing starts up, you should be in the Welcome view. You will want to go to Breadboard view.

breadboard view

There is two main steps you will need to do in Breadboard view. First, create your breadboard SVG, and upload it. Fritzing prefers using SVG format, so your images look great when you are zoomed in and out! Second, you’ll need to change the connector pins.

Please note: If you are only making a basic IC you can skip to Editing Breadboard View section of this tutorial.

Fritzing Graphic Standards

On the Fritzing website, there are a lot of graphic standards to follow. It is a great idea to follow the graphic standards that way your parts match other Fritzing parts.

Templates

When making you part, it is recommended to start from a template. Have an image of the part to refer to, so, when making your SVG files, the process will go faster.

Tip: If you are making a custom Fritzing part for a board you made in EAGLE, you can download an ULP that converts boards to SVG. This way you can have an accurate SVG of your EAGLE board for a reference. You can find EAGLE ULPs on the Cadsoft site.

It is time to make your graphic for the Breadboard view!

Create a New Part

For this tutorial, we are going to create a Fritzing part for the SparkFun T5403 Barometer Breakout.

T5403 Breakout Image

EAGLE image of the SparkFun T5403 Barometer Breakout

Open the Fritzing application. You should see tabs for Welcome, Breadboard, Schematic, and PCB towards the top of the program. Click on Breadboard button to make sure you are in the Breadboard view.

Breadboard Button

Check for Pre-made Parts

If you are just updating a board in Fritzing, first check to see if there is a part that is closely related to the Fritzing part you are trying to create. You can type the part’s name into the search bar.

Search for Part

The search bar can be found at the top of the Parts window

You can also look in the different sections of the Fritzing’s Parts window for a similar part.

Parts Window

Look for the SparkFun flame to see a huge section of SparkFun Fritzing parts

Using an IC as a Starting Point

If there is not a part like the one you are trying to make, using an IC as a base is a great place to start. Click on the CORE tab in the Part Window. Scroll down until you see the ICs. Under the ICs section, click and drag the IC icon onto the Breadboard window.

Core Tab

Custom ICs are simple, since Fritzing lets you change the number of pins and the IC package

Dragging IC on breadboard window

Changing the Name of the IC

Look for the IC properties in the Inspector window on the right. Change the name of the IC to your part’s name. Then, change the number of pins needed for the board or part in the pins section. For the SparkFun T5403 Barometer Breakout, we need 8 pins. You will see the IC, in the Breadboard view, change to your part’s name.

Changing name

Fritzing (New) Parts Editor

Right-click the IC in the Breadboard window, and select Edit (new parts editor). The Fritzing (New) Parts Editor should pop up.

Go to Parts Editor

There are 6 main sections of the Fritzing (New) Parts Editor in which you will need to make changes. Those are:

  • Breadboard
  • Schematic
  • PCB
  • Icon
  • Metadata
  • Connectors

There really isn’t an order you need to follow. After making a couple different custom parts you will probably end up starting in one view before the others. In this tutorial, we’re just going to go down the list.

Author note: I found, for boards with a large number of pins, that starting off in the Connectors view saves a little bit more time, since you can go down the list to name the connector pins faster.

Before you continue on, it is a good idea to save as a new part first. If you need to stop anytime when making the custom part, you can come back to it in the future. Go to File. Then, select Save as new part.

Save as new Part

You can choose to name the prefix if you want.


Let’s continue on to Breadboard view!

Custom Breadboard SVG

Create a File

Open up your vector graphics editor and create a new file. The image size of the file should be the same size of your board. The SparkFun T5403 Barometer Breakout size is 1″ x 0.650″. You are going to want to save the file with a good naming convention, since you are going to end up needing 3 different svg files when creating your Fritzing part.

Illustrator Users: You can save by going to File->Save As, saving as a SVG, and hitting Save.

For this example the Breadboard SVG is named: SFE_T5403_Barometer_Breakout_breadboard.svg

Use Templates as References

To compare the different layers and groups, you can open up the Fritzing BreadboardViewGraphic_Template.svg file found in the Fritzing Fonts and Template folder you downloaded earlier. You can also open the example SparkFun T5403 Barometer Breakout breadboard SVG template file from the SparkFun Fritzing Parts Github repo.

You can see with the example templates how you can kept the layers organized. For the SparkFun T5403 Barometer Breakout, there is a “breadboard” group. Inside that breadboard group it will have the group of parts, copper layers, silkscreen group, and the board path.

Tips for Making Your Custom Breadboard Graphic

You are now able to create your custom part’s breadboard graphic. Here are some helpful tips!

Follow the Fritzing Graphic Standards

Here are some main color standards for Breadboard images:

To keep with the Fritzing graphics standards, you are going to want to make the copper contacts the copper/tinned color.

Copper Green

HEX: 9A916C, RGB: 154 145 108

If you have legs on any of your parts on your board, the color to use is grey.

Leg Grey

HEX: 8C8C8C, RGB: 140 140 140

SparkFun Red is: HEX: E62C2E, RGB: 230 44 46

Keep It Simple

The great thing with Fritzing is you can make your board as simple or as complex as you want. Since SparkFun is always trying to make our products better with revisions and have a lot of boards, it is easier and faster for us to not included certain details, like traces or every component, on our boards. That way if there is a new change with the board, like a resistor value change, we don’t have to go in and change that resistor in the Fritzing part. Focusing more on the important components, like ICs, might be a better way to spend your tine. It will still look nice, but less work!

Use Components That Already Exist

If you need an SMD LED on your board that is already in Fritzing, go ahead and use it! This will save you time and keep the all the Fritzing parts having the same look and feel. If you create a custom board with components that others can use, you can share them on the Fritzing site, so others can use too! Make sure to organize the component graphics nicely in the vector graphics editor you are using, so the parts are easy to find when using on future boards.

Name Connector Pins in Copper Groups

Naming your connectors will be a huge time saver. For the SparkFun T5403 Barometer Breakout example, under the copper group, each connector is named connector#pad.

Copper Layers

Example in Illustrator. If you are using Inkscape, you will still want to make sure the connectors are appropriately named.

Use the ORC-A or Droid Sans Fonts.

Stick with the Fritzing fonts to kept all Fritzing parts looking alike. It is suggested that the standard font size is 5pt. However, there will be times you won’t have space for smaller boards. You won’t want to go lower then 3pt, because it starts to become harder to see without zooming in. On the Fritzing site they mention using black as the font color. Whatever your silkscreen color is tends to look better. For this example we are using white, since that is the breakout board’s silkscreen color and it is easier to read against a red background.

Create a Compound Path to Make Board Openings See-through

Illustrator Users: Create a path in the size of your PCB. For the SparkFun T5403 Barometer Breakout, you can use the rectangle tool to make a 1″ x 0.650″ rectangle. Then, make paths where you have openings in your board. For example, you can use the ellipse tool, under the rectangle tool, to make perfect circles where there are openings for stand-offs and connector pins. Select all the hole opening layers and the bottom PCB layer.

Select All

Make sure the bottom PCB layer is selected

Next go to Object->Compound Path->Make. You should now have a compound path, and you will be able to see through the openings in Fritzing.

Final Breadboard Image

Final breadboard graphic

Save

Make sure to Save as SVG again once you are done creating your custom board! Now, you can continue on to Editing Breadboard View.

Breadboard View – Parts Editor

Load Image

After you created your custom breadboard image, you will want to load the breadboard SVG in the Fritzing (New) Parts Editor. First, go back to the Fritzing (New) Parts Editor and click the Breadboard button to get into the Breadboard view. Go to File->Load image for view.

Load graphic

Next, you will select the breadboard SVG you just created and hit Open. The graphic should be now in the Fritzing (New) Parts Editor.

Connectors

When working in the main Fritzing application, you connect different Fritzing parts with colored wires to show how the parts connect to one and another. In order for Fritzing to know where connector pins are on a board or part, you will need to tell Fritzing where those connectors are.

Name and Description for Connector Pins

For the Breadboard view, the Connectors window will be on the right side of the Fritzing (New) Parts Editor. Select a pin to change the name of the pin and to add a description.

Select Pin

Choose any of the connector pins to edit

Change Connector Pin Name

Select the Connector Pin’s Graphic

Click on the Select graphic button on the right of your connector pin’s name. Then, click on the connector pin’s graphic. This will set the Anchor point. The Anchor point is the location where the wire connects to that connector. By default the Terminal point will show up in the middle of the selected graphic. If you want to move the Terminal point, you are able to click on the Terminal point and hold to move. You can also change the Terminal point by clicking on either “Center”, “W”, “N”, “S”, or “E” in the Connectors window.

Example Terminal Placement

You can see the difference in the placement of the wire when you change the Terminal point

Change Connector Type

Change the type of connector in the Connectors window. You can choose from male, female, or pad. For the SparkFun T5403 Barometer Breakout, all the connector pins are female.

Set Connector Type

In the image below, you can see the differences between setting the connector type as male vs female.

Different Connector Type

Top board has the connector type set at male. Bottom board has the connector type correctly set at female.

Repeat for All Connector Pins

Name, select the appropriate graphic, and change the connector type for all your connector pins. You can also set Internal Connections in the Connectors window.

Schematic View

Custom Schematic SVG

Go back to either Illustrator, Inkscape, or the vector graphic editor you are using. Open up the Fritzing’s SchematicViewGraphic_Template.svg in the downloaded Fonts and Templates folder. You can also open the example SparkFun T5403 Barometer Breakout schematic SVG template file from the SparkFun Fritzing Parts Github repo.

When editing the schematic to match your board, you will want to make sure each connector pin is shown. You will want to change the pin labels to match the connector pin names. Depending on your part, you might have to resize the template schematic. Make sure there is 0.1” space between the main part symbol square and the edge of the outer pins.

Schematic Example

Make sure to delete the 0.1″ dimension helper box, so it doesn’t show up in the final Fritzing schematic graphic

Save SVG

You will want make sure to save as a new SVG. Remember to have a naming convention that will be easy to tell the difference between the other SVG files you are creating for your Fritzing part.

Editing Schematic View in Parts Editor

Load SVG

Go back to the Parts Editor, and click on the Schematic button to go to the Schematic view. Go to File->Load image for view. Next, you will select the schematic SVG you just created, and click Open. The part should be now in the Fritzing (New) Parts Editor.

Set Connector Pins

If you look at the Connectors window on the right side, you will notice that your pin names are already there. When you make a change to the connector pin’s name and description in either Breadboard, Schematic, PCB, or Connectors view, the Parts Editor will automatically change the connector pin’s name and description for the other views. Also, the connector type (male, female, or pad) will still be the same.

Just like you did in Breadboard view, you will still need to select a graphic for each pin. Click on the ‘Select graphic’ button, and choose the appropriate graphic for that pin. For the Schematic view, you are going to want to change the Terminal point, so the connecting wires are connecting at the furthest point.

The easiest way to do this is make sure the connector pin’s graphic is still selected, and change the Terminal point in the Connectors window. For the GND graphic, the Terminal point is moved to the south end by clicking on “S”.

Terminal Point

Repeat for All Connectors

After you update all your connector pins you can move on to Editing in PCB view.

PCB View

Making custom PCB SVG

Go back to either Illustrator, Inkscape, or the vector graphic editor you are using. When making a custom PCB SVG, the main image groups you will need are copper (which will have all your connector pads) and silkscreen.

Create the PCB Graphic

You can either start fresh when creating a PCB SVG, modify your custom breadboard SVG, or edit the Fritzing’s PCBViewGraphic_Template.svg in the downloaded Fonts and Templates folder. For this example, the custom breadboard SVG was modified, and the file was saved as a new SVG called SFE_T5403_Barometer_Breakout_PCB.svg.

Make Sure to have Two Copper Groups

When setting up your layers, make sure to have two copper groups. All of your connector layers should be in the copper groups. When you do this, Fritzing will know that the component has the copper connectors on both sides of the PCB.

Example of PCB Layers

Illustrator example of having two copper groups

Make Sure the Connector Pins’ Spacing is Accurate

It is important to have the PCB connector pins match accurately with your board and to have the appropriate spacing between pins. Fritzing offers a PCB Fab services. If you or other Fritzing users want to use that service with your custom part, you will want to make sure your PCB view is accurate.

Graphic Standards

Instead of the connector pins being a copper/tinned green color, the PCB view connector pins are the “copper” color:

Copper Color

Hex: F7BD13 RGB: 247 189 19

The main changes made from the custom breadboard SVG is that the main groups are copper and silkscreen. The silkscreen will still be white.

Final PCB Graphic

Final PCB Graphic

Editing PCB View in Parts Editor

Go back to the Parts Editor, and click on the PCB button to get to PCB view. Go to File->Load image for view. Next, you will select the PCB SVG you just created, and click Open. The part should be now in the Fritzing (New) Parts Editor.

Update Connector Pins

Select the appropriate graphics for each connector pin, just like you did in Breadboard and Schematic view.

Icon View

Reuse a Past Graphic

Go to the Fritzing (New) Parts Editor, and click on the Icon button to get to Icon view. The great thing about Icon view is that you can reuse your breadboard, schematic, or PCB SVG for the icon image, so there is no need to make a new image! All you need to do is go to File and select what image you want to reuse. For the SparkFun T5403 Barometer Breakout, the Icon view reuses the breadboard image. The breadboard image should show up.

Reuse Past Graphic

Great Scott! You are now done with Icon view!

Metadata

Go to Metadata View

Go to the Parts Editor, and click the Metadata button to go into Metadata view. The Metadata is where you will add all the important information about your part!

Different Sections in the Metadata View

Title: Pretty self-explanatory. This is going to be the name of your part.

Date: The date entry is locked in Fritzing. The date should show the date you are creating the part. If you update the part later down the road, the date will be changed to the current date of the last update.

Author: You will want to put your name in here, so, if you share your part with the Fritzing community, they know who made the part.

Description: Description should included anything that is important about the board, such as operating voltage.

Label: The Label is shown in Schematic view and makes it easier to tell which part you have selected. For the SparkFun T5403 Barometer Breakout, the Label is changed to Part. The reason for that is, because Part is fairly small and the SparkFun T5403 Barometer Breakout name is already on the schematic graphic itself. It is up to you what you want to label your part!

URL: Consider posting the url of the part, so anyone can get more information about your part.

Family: If you have a part that comes in different colors, chip packages, etc, you will want them to be in the same Family. For example if you have a through-hole LED that comes in different colors, all the different colors of the same LED will be in the same family.

Variant: When creating a brand new part, you want to make sure the Variant is 1. When you do revisions in the future, it will change the next revision to Variant 2 if it is in the same family.

Properties: A place to put important details like part numbers, pin spacing, and etc.

Tags: Use tags that can be found easier and best describe your part in as few words as possible.

Metadata

Feel that the info is a little lacking? You can update this content again later when you have more to write.

Connectors View

Go to Connectors view

Go to the Parts Editor, and click the Connectors button to go into Connectors view. In the Connectors view you are able to do the following:

  • Change the number of connectors
  • Set connector type
  • Set the connector pins as Through-hole or SMD
  • Name connector pins
  • Add connector pin descriptions

Connectors view

You shouldn’t need to change anything in the Connectors view, since you already filled out all the information in the other views. If you need to make any last minute changes, now you can. Keep in mind, if you change the number of connectors here, you will need to go back and update Breadboard, Schematic, and PCB views.

Save

Now you can save your part! Go to File>Save

Continue on to exporting part!

Exporting New Part

Quality Check in Fritzing Application

It is time to check out your new Fritzing part in the main Fritzing application. When you Saved As new part in the Fritzing (New) Parts Editor earlier, the part automatically shows under the My Parts label in the MINE tab in the main Fritzing application.

Before exporting your new custom part, you will want to check if each view looks good. Make sure you are in the main Fritzing application and not the Fritzing (New) Parts Editor. Go to Breadboard view by clicking on the Breadboard button at the top. In the Parts window, on the right side, make sure you are in the MINE tab. You should see your new part. Click and drag the board on the Breadboard view.

MINE Tab

Double check if the pins are named correctly and are working properly. Do the same in the Schematic and PCB view. Once you have done a quality check, you can export the part.

Export part

Right click on the new part’s icon in the My Parts window and select Export Part. Save out your Fritzing part.

Export Part

Congratulations, you made your own Fritzing Part!

Resources and Going Further

Contribute to Fritzing

Now that you have your part done, you are able to connect with other Fritzing parts. You can share your part or a project tutorial on the Fritzing site. There are many more ways to contribute to the Fritzing community! Check out the Fritzing Support Us page for even more ways to support Fritzing.

Large Batches of Fritzing Parts?

If you are a developer that uses EAGLE or someone who is investing a lot of time in making Fritzing parts, the Fritzing team has open sourced a toolkit to make the SVG files from EAGLE .brd files. It is highly recommended that you check out if you are creating batches of SVG board files ready for Fritzing. They have the source code on the Fritzing Google code page.

Further Reading

At SparkFun, we use Fritzing at a lot in our Learn tutorials. Check out how we use Fritzing in different tutorials to show how to connect different parts together.

Here are some tutorials that uses Fritzing in the Hook-up section:

If you want to learn more about designing your own PCBs with other software, visit these tutorials:

Serial Peripheral Interface (SPI)

Introduction

Serial Peripheral Interface (SPI) is an interface bus commonly used to send data between microcontrollers and small peripherals such as shift registers, sensors, and SD cards. It uses separate clock and data lines, along with a select line to choose the device you wish to talk to.

Suggested Reading

Stuff that would be helpful to know before reading this tutorial:

What’s Wrong with Serial Ports?

A common serial port, the kind with TX and RX lines, is called “asynchronous” (not synchronous) because there is no control over when data is sent or any guarantee that both sides are running at precisely the same rate. Since computers normally rely on everything being synchronized to a single “clock” (the main crystal attached to a computer that drives everything), this can be a problem when two systems with slightly different clocks try to communicate with each other.

To work around this problem, asynchronous serial connections add extra start and stop bits to each byte help the receiver sync up to data as it arrives. Both sides must also agree on the transmission speed (such as 9600 bits per second) in advance. Slight differences in the transmission rate aren’t a problem because the receiver re-syncs at the start of each byte.

Asynchronous serial waveform

(By the way, if you noticed that “11001010” does not equal 0x53 in the above diagram, kudos to your attention to detail. Serial protocols will often send the least significant bits first, so the smallest bit is on the far left. The lower nybble is actually 0011 = 0x3, and the upper nybble is 0101 = 0x5.)

Asynchronous serial works just fine, but has a lot of overhead in both the extra start and stop bits sent with every byte, and the complex hardware required to send and receive data. And as you’ve probably noticed in your own projects, if both sides aren’t set to the same speed, the received data will be garbage. This is because the receiver is sampling the bits at very specific times (the arrows in the above diagram). If the receiver is looking at the wrong times, it will see the wrong bits.

A Synchronous Solution

SPI works in a slightly different manner. It’s a “synchronous” data bus, which means that it uses separate lines for data and a “clock” that keeps both sides in perfect sync. The clock is an oscillating signal that tells the receiver exactly when to sample the bits on the data line. This could be the rising (low to high) or falling (high to low) edge of the clock signal; the datasheet will specify which one to use. When the receiver detects that edge, it will immediately look at the data line to read the next bit (see the arrows in the below diagram). Because the clock is sent along with the data, specifying the speed isn’t important, although devices will have a top speed at which they can operate (We’ll discuss choosing the proper clock edge and speed in a bit).

alt text

One reason that SPI is so popular is that the receiving hardware can be a simple shift register. This is a much simpler (and cheaper!) piece of hardware than the full-up UART (Universal Asynchronous Receiver / Transmitter) that asynchronous serial requires.

Receiving Data

You might be thinking to yourself, self, that sounds great for one-way communications, but how do you send data back in the opposite direction? Here’s where things get slightly more complicated.

In SPI, only one side generates the clock signal (usually called CLK or SCK for Serial ClocK). The side that generates the clock is called the “master”, and the other side is called the “slave”. There is always only one master (which is almost always your microcontroller), but there can be multiple slaves (more on this in a bit).

When data is sent from the master to a slave, it’s sent on a data line called MOSI, for “Master Out / Slave In”. If the slave needs to send a response back to the master, the master will continue to generate a prearranged number of clock cycles, and the slave will put the data onto a third data line called MISO, for “Master In / Slave Out”.

alt text

Notice we said “prearranged” in the above description. Because the master always generates the clock signal, it must know in advance when a slave needs to return data and how much data will be returned. This is very different than asynchronous serial, where random amounts of data can be sent in either direction at any time. In practice this isn’t a problem, as SPI is generally used to talk to sensors that have a very specific command structure. For example, if you send the command for “read data” to a device, you know that the device will always send you, for example, two bytes in return. (In cases where you might want to return a variable amount of data, you could always return one or two bytes specifying the length of the data and then have the master retrieve the full amount.)

Note that SPI is “full duplex” (has separate send and receive lines), and, thus, in certain situations, you can transmit and receive data at the same time (for example, requesting a new sensor reading while retrieving the data from the previous one). Your device’s datasheet will tell you if this is possible.

Slave Select (SS)

There’s one last line you should be aware of, called SS for Slave Select. This tells the slave that it should wake up and receive / send data and is also used when multiple slaves are present to select the one you’d like to talk to.

alt text

The SS line is normally held high, which disconnects the slave from the SPI bus. (This type of logic is known as “active low,” and you’ll often see used it for enable and reset lines.) Just before data is sent to the slave, the line is brought low, which activates the slave. When you’re done using the slave, the line is made high again. In a shift register, this corresponds to the “latch” input, which transfers the received data to the output lines.

Multiple slaves

There are two ways of connecting multiple slaves to an SPI bus:

  1. In general, each slave will need a separate SS line. To talk to a particular slave, you’ll make that slave’s SS line low and keep the rest of them high (you don’t want two slaves activated at the same time, or they may both try to talk on the same MISO line resulting in garbled data). Lots of slaves will require lots of SS lines; if you’re running low on outputs, there are binary decoder chips that can multiply your SS outputs.

alt text

  1. On the other hand, some parts prefer to be daisy-chained together, with the MISO (output) of one going to the MOSI (input) of the next. In this case, a single SS line goes to all the slaves. Once all the data is sent, the SS line is raised, which causes all the chips to be activated simultaneously. This is often used for daisy-chained shift registers and addressable LED drivers.

alt text

Note that, for this layout, data overflows from one slave to the next, so to send data to any one slave, you’ll need to transmit enough data to reach all of them. Also, keep in mind that the first piece of data you transmit will end up in the last slave.

This type of layout is typically used in output-only situations, such as driving LEDs where you don’t need to receive any data back. In these cases you can leave the master’s MISO line disconnected. However, if data does need to be returned to the master, you can do this by closing the daisy-chain loop (blue wire in the above diagram). Note that if you do this, the return data from slave 1 will need to pass through all the slaves before getting back to the master, so be sure to send enough receive commands to get the data you need.

Programming for SPI

Many microcontrollers have built-in SPI peripherals that handle all the details of sending and receiving data, and can do so at very high speeds. The SPI protocol is also simple enough that you (yes, you!) can write your own routines to manipulate the I/O lines in the proper sequence to transfer data. (A good example is on the Wikipedia SPI page.)

If you’re using an Arduino, there are two ways you can communicate with SPI devices:

  1. You can use the shiftIn() and shiftOut() commands. These are software-based commands that will work on any group of pins, but will be somewhat slow.
  2. Or you can use the SPI Library, which takes advantage of the SPI hardware built into the microcontroller. This is vastly faster than the above commands, but it will only work on certain pins.

You will need to select some options when setting up your interface. These options must match those of the device you’re talking to; check the device’s datasheet to see what it requires.

  • The interface can send data with the most-significant bit (MSB) first, or least-significant bit (LSB) first. In the Arduino SPI library, this is controlled by the setBitOrder() function.
  • The slave will read the data on either the rising edge or the falling edge of the clock pulse. Additionally, the clock can be considered “idle” when it is high or low. In the Arduino SPI library, both of these options are controlled by the setDataMode() function.
  • SPI can operate at extremely high speeds (millions of bytes per second), which may be too fast for some devices. To accommodate such devices, you can adjust the data rate. In the Arduino SPI library, the speed is set by the setClockDivider() function, which divides the master clock (16MHz on most Arduinos) down to a frequency between 8MHz (/2) and 125kHz (/128).
  • If you’re using the SPI Library, you must use the provided SCK, MOSI and MISO pins, as the hardware is hardwired to those pins. There is also a dedicated SS pin that you can use (which must, at least, be set to an output in order for the SPI hardware to function), but note that you can use any other available output pin(s) for SS to your slave device(s) as well.
  • On older Arduinos, you’ll need to control the SS pin(s) yourself, making one of them low before your data transfer and high afterward. Newer Arduinos such as the Due can control each SS pin automatically as part of the data transfer; see the Due SPI documentation page for more information.

Resources and Going Further

Tips and Tricks

  • Because of the high speed signals, SPI should only be used to send data over short distances (up to a few feet). If you need to send data further than that, lower the clock speed, and consider using specialized driver chips.
  • If things aren’t working the way you think they should, a logic analyzer is a very helpful tool. Smart analyzers like the Saleae USB Logic Analyzer can even decode the data bytes for a display or logging.

alt text

Advantages of SPI:

  • It’s faster than asynchronous serial
  • The receive hardware can be a simple shift register
  • It supports multiple slaves

Disadvantages of SPI:

  • It requires more signal lines (wires) than other communications methods
  • The communications must be well-defined in advance (you can’t send random amounts of data whenever you want)
  • The master must control all communications (slaves can’t talk directly to each other)
  • It usually requires separate SS lines to each slave, which can be problematic if numerous slaves are needed.

Further Reading

Check out the Wikipedia page on SPI, which includes lots of good information on SPI and other synchronous interfaces.

This blog post presents a more correct way to set up an SPI network amongst your embedded devices, particularly for use with an Arduino microcontroller.

A number of SparkFun products have SPI interfaces. For example, the Bar Graph Breakout kit has an easy-to-use SPI interface that you can use to turn any of 30 LEDs on or off.

Other communication options:

Now that you’re a pro on SPI, here are some other tutorials to practice your new skills:

Series and Parallel Circuits

Series and Parallel Circuits

Simple circuits (ones with only a few components) are usually fairly straightforward for beginners to understand. But, things can get sticky when other components come to the party. Where’s the current going? What’s the voltage doing? Can this be simplified for easier understanding? Fear not, intrepid reader. Valuable information follows.

In this tutorial, we’ll first discuss the difference between series circuits and parallel circuits, using circuits containing the most basic of components – resistors and batteries – to show the difference between the two configurations. We’ll then explore what happens in series and parallel circuits when you combine different types of components, such as capacitors and inductors.

Covered in this Tutorial

  • What series and parallel circuit configurations look like
  • How passive components act in these configurations
  • How a voltage source will act upon passive components in these configurations

Suggested Reading

You may want to visit these tutorials on the basic components before diving into building the circuits in this tutorial.

Series Circuits

Nodes and Current Flow

Before we get too deep into this, we need to mention what a node is. It’s nothing fancy, just the electrical junction between two or more components. When a circuit is modeled on a schematic, the nodes are the wires between components.

Node example schematic

Example schematic with four uniquely colored nodes.

That’s half the battle towards understanding the difference between series and parallel. We also need to understand how current flows through a circuit. Current flows from a high voltage to a lower voltage in a circuit. Some amount of current will flow through every path it can take to get to the point of lowest voltage (usually called ground). Using the above circuit as an example, here’s how current would flow as it runs from the battery’s positive terminal to the negative:

Example of current flow through circuit

Current (indicated by the blue, orange, and pink lines) flowing through the same example circuit as above. Different currents are indicated by different colors.

Notice that in some nodes (like between R1 and R2) the current is the same going in as at is coming out. At other nodes (specifically the three-way junction between R2, R3, and R4) the main (blue) current splits into two different ones. That’s the key difference between series and parallel!

Series Circuits Defined

Two components are in series if they share a common node and if the same current flows through them. Here’s an example circuit with three series resistors:

Schematic: Three resistors in series

There’s only one way for the current to flow in the above circuit. Starting from the positive terminal of the battery, current flow will first encounter R1. From there the current will flow straight to R2, then to R3, and finally back to the negative terminal of the battery. Note that there is only one path for current to follow. These components are in series.

Parallel Circuits

Parallel Circuits Defined

If components share two common nodes, they are in parallel. Here’s an example schematic of three resistors in parallel with a battery:

Schematic: Three resistors in parallel

From the positive battery terminal, current flows to R1… and R2, and R3. The node that connects the battery to R1 is also connected to the other resistors. The other ends of these resistors are similarly tied together, and then tied back to the negative terminal of the battery. There are three distinct paths that current can take before returning to the battery, and the associated resistors are said to be in parallel.

Where series components all have equal currents running through them, parallel components all have the same voltage drop across them – series:current::parallel:voltage.

Series and Parallel Circuits Working Together

From there we can mix and match. In the next picture, we again see three resistors and a battery. From the positive battery terminal, current first encounters R1. But, at the other side of R1 the node splits, and current can go to both R2and R3. The current paths through R2 and R3 are then tied together again, and current goes back to the negative terminal of the battery.

Schematic: Series and Parallel Resistors

In this example, R2 and R3 are in parallel with each other, and R1 is in series with the parallel combination of R2 and R3.

Calculating Equivalent Resistances in Series Circuits

Here’s some information that may be of some more practical use to you. When we put resistors together like this, in series and parallel, we change the way current flows through them. For example, if we have a 10V supply across a 10kΩ resistor, Ohm’s law says we’ve got 1mA of current flowing.

Schematic: Single Resistor in series with battery

If we then put another 10kΩ resistor in series with the first and leave the supply unchanged, we’ve cut the current in half because the resistance is doubled.

Schematic: Two series resistors in series with a battery

In other words, there’s still only one path for current to take and we just made it even harder for current to flow. How much harder? 10kΩ + 10kΩ = 20kΩ. And, that’s how we calculate resistors in series – just add their values.

To put this equation more generally: the total resistance of N – some arbitrary number of – resistors is their total sum.

Schematic snippet: N resistors in series

Equation: Rtot = R1+R2+...+R(N-1)+RN

Calculating Equivalent Resistances in Parallel Circuits

What about parallel resistors? That’s a bit more complicated, but not by much. Consider the last example where we started with a 10V supply and a 10kΩ resistor, but this time we add another 10kΩ in parallel instead of series. Now there are two paths for current to take. Since the supply voltage didn’t change, Ohm’s Law says the first resistor is still going to draw 1mA. But, so is the second resistor, and we now have a total of 2mA coming from the supply, doubling the original 1mA. This implies that we’ve cut the total resistance in half.

Schematic: Two parallel resistors in parallel with a battery

While we can say that 10kΩ || 10kΩ = 5kΩ (“||” roughly translates to “in parallel with”), we’re not always going to have 2 identical resistors. What then?

The equation for adding an arbitrary number of resistors in parallel is:

1/Rtot = 1/R1 + 1/R2 + ... + 1/R(N-1) + 1/RN

If reciprocals aren’t your thing, we can also use a method called “product over sum” when we have two resistors in parallel:

R1||R2 = R1*R2/(R1+R2)

However, this method is only good for two resistors in one calculation. We can combine more than 2 resistors with this method by taking the result of R1 || R2 and calculating that value in parallel with a third resistor (again as product over sum), but the reciprocal method may be less work.

Experiment Time – Part 1

What you’ll need:

Let’s try a simple experiment just to prove that these things work the way we’re saying they do.

First, we’re going to hook up some 10kΩ resistors in series and watch them add in a most un-mysterious way. Using a breadboard, place one 10kΩ resistor as indicated in the figure and measure with a multimeter. Yes, we already know it’s going to say it’s 10kΩ, but this is what we in the biz call a “sanity check”. Once we’ve convinced ourselves that the world hasn’t changed significantly since we last looked at it, place another one in similar fashion but with a lead from each resistor connecting electrically through the breadboard and measure again. The meter should now say something close to 20kΩ.

You may notice that the resistance you measure might not be exactly what the resistor says it should be. Resistors have a certain amount of tolerance, which means they can be off by a certain percentage in either direction. Thus, you may read 9.99kΩ or 10.01kΩ. As long as it’s close to the correct value, everything should work fine.

Multimeter Fritzing Diagram

The reader should continue this exercise until convincing themselves that they know what the outcome will be before doing it again, or they run out of resistors to stick in the breadboard, whichever comes first.

Experiment Time – Part 2

Now let’s try it with resistors in a parallel configuration. Place one 10kΩ resistor in the breadboard as before (we’ll trust that the reader already believes that a single 10kΩ resistor is going to measure something close to 10kΩ on the multimeter). Now place a second 10kΩ resistor next to the first, taking care that the leads of each resistor are in electrically connected rows. But before measuring the combination, calculate by either product-over-sum or reciprocal methods what the new value should be (hint: it’s going to be 5kΩ). Then measure. Is it something close to 5kΩ? If it’s not, double check the holes into which the resistors are plugged.

Experiment: Measure parallel resistors with a multimeter

Repeat the exercise now with 3, 4 and 5 resistors. The calculated/measured values should be 3.33kΩ, 2.5kΩ and 2kΩ, respectively. Did everything come out as planned? If not, go back and check your connections. If it did, EXCELSIOR! Go have a milkshake before we continue. You’ve earned it.

Rules of Thumb for Series and Parallel Resistors

There are a few situations that may call for some creative resistor combinations. For example, if we’re trying to set up a very specific reference voltage you’ll almost always need a very specific ratio of resistors whose values are unlikely to be “standard” values. And while we can get a very high degree of precision in resistor values, we may not want to wait the X number of days it takes to ship something, or pay the price for non-stocked, non-standard values. So in a pinch, we can always build our own resistor values.

Tip #1: Equal Resistors in Parallel

Adding N like-valued resistors R in parallel gives us R/N ohms. Let’s say we need a 2.5kΩ resistor, but all we’ve got is a drawer full of 10kΩ’s. Combining four of them in parallel gives us 10kΩ/4 = 2.5kΩ.

Four 10kΩ Resistors in parallel can be used to create a 2.5kΩ one!

Tip #2: Tolerance

Know what kind of tolerance you can tolerate. For example, if you needed a 3.2kΩ resistor, you could put 3 10kΩ resistors in parallel. That would give you 3.3kΩ, which is about a 4% tolerance from the value you need. But, if the circuit you’re building needs to be closer than 4% tolerance, we can measure our stash of 10kΩ’s to see which are lowest values because they have a tolerance, too. In theory, if the stash of 10kΩ resistors are all 1% tolerance, we can only get to 3.3kΩ. But part manufacturers are known to make just these sorts of mistakes, so it pays to poke around a bit.

Tip #3: Power Ratings in Series/Parallel

This sort of series and parallel combination of resistors works for power ratings, too. Let’s say that we need a 100Ω resistor rated for 2 watts (W), but all we’ve got is a bunch of 1kΩ quarter-watt (¼W) resistors (and it’s 3am, all the Mountain Dew is gone, and the coffee’s cold). You can combine 10 of the 1kΩ’s to get 100Ω (1kΩ/10 = 100Ω), and the power rating will be 10×0.25W, or 2.5W. Not pretty, but it will get us through a final project, and might even get us extra points for being able to think on our feet.

We need to be a little more careful when we combine resistors of dissimilar values in parallel where total equivalent resistance and power ratings are concerned. It should be completely obvious to the reader, but…

Tip #4: Different Resistors in Parallel

The combined resistance of two resistors of different values is always less than the smallest value resistor. The reader would be amazed at how many times someone combines values in their head and arrives at a value that’s halfway between the two resistors (1kΩ || 10kΩ does NOT equal anything around 5kΩ!). The total parallel resistance will always be dragged closer to the lowest value resistor. Do yourself a favor and read tip #4 10 times over.

Tip #5: Power Dissipation in Parallel

The power dissipated in a parallel combination of dissimilar resistor values is not split evenly between the resistors because the currents are not equal. Using the previous example of (1kΩ || 10kΩ), we can see that the 1kΩ will be drawing 10X the current of the 10kΩ. Since Ohm’s Law says power = voltage x current, it follows that the 1kΩ resistor will dissipate 10X the power of the 10kΩ.

Ultimately, the lessons of tips 4 and 5 are that we have to pay closer attention to what we’re doing when combining resistors of dissimilar values in parallel. But tips 1 and 3 offer some handy shortcuts when the values are the same.

Series and Parallel Capacitors

Combining capacitors is just like combining resistors…only the opposite. As odd as that sounds, it’s absolutely true. Why would this be?

A capacitor is just two plates spaced very close together, and it’s basic function is to hold a whole bunch of electrons. The greater the value of capacitance, the more electrons it can hold. If the size of the plates is increased, the capacitance goes up because there’s physically more space for electrons to hang out. And if the plates are moved farther apart, the capacitance goes down, because the electric field strength between them goes down as the distance goes up.

Now let’s say we’ve got two 10µF capacitors wired together in series, and let’s say they’re both charged up and ready discharge into the friend sitting next to you.

Capacitors in series

Remember that in a series circuit there’s only one path for current to flow. It follows that the number of electrons that are discharging from the cap on the bottom is going to be the same number of electrons coming out of the cap on the top. So the capacitance hasn’t increased, has it?

In fact, it’s even worse than that. By placing the capacitors in series, we’ve effectively spaced the plates farther apart because the spacing between the plates of the two capacitors adds together. So we don’t have 20µF, or even 10µF. We’ve got 5µF. The upshot of this is that we add series capacitor values the same way we add parallel resistor values. Both the product-over-sum and reciprocal methods are valid for adding capacitors in series.

Capacitors in series schematic/equation

It may seem that there’s no point to adding capacitors in series. But it should be pointed out that one thing we did get is twice as much voltage (or voltage ratings). Just like batteries, when we put capacitors together in series the voltages add up.

Adding capacitors in parallel is like adding resistors in series: the values just add up, no tricks. Why is this? Putting them in parallel effectively increases the size of the plates without increasing the distance between them. More area equals more capacitance. Simple.

Capacitors in parallel schematic/equation

Experiment Time – Part 3

What you’ll need:

Let’s see some series and parallel connected capacitors in action. This will be a little trickier than the resistor examples, because it’s harder to measure capacitance directly with a multimeter.

Let’s first talk about what happens when a capacitor charges up from zero volts. When current starts to go in one of the leads, an equal amount of current comes out the other. And if there’s no resistance in series with the capacitor, it can be quite a lot of current. In any case, the current flows until the capacitor starts to charge up to the value of the applied voltage, more slowly trickling off until the voltages are equal, when the current flow stops entirely.

As stated above, the current draw can be quite large if there’s no resistance in series with the capacitor, and the time to charge can be very short (like milliseconds or less). For this experiment, we want to be able to watch a capacitor charge up, so we’re going to use a 10kΩ resistor in series to slow the action down to a point where we can see it easily. But first we need to talk about what an RC time constant is.

Tau = R*C

What the above equation says is that one time constant in seconds (called tau) is equal to the resistance in ohms times the capacitance in farads. Simple? No? We shall demonstrate on the next page.

Experiment Time – Part 3, Continued…

For the first part of this experiment, we’re going to use one 10K resistor and one 100µF (which equals 0.0001 farads). These two parts create a time constant of 1 second:

Tau = 10kOhm * 100uF = 1 second

When charging our 100µF capacitor through a 10kΩ resistor, we can expect the voltage on the cap to rise to about 63% of the supply voltage in 1 time constant, which is 1 second. After 5 time constants (5 seconds in this case) the cap is about 99% charged up to the supply voltage, and it will follow a charge curve something like the plot below.

Capacitor charge time graph

Now that we know that stuff, we’re going to connect the circuit in the diagram (make sure to get the polarity right on that capacitor!).

Fritzing diagram, power off, cap in series with resistor, battery

With our multimeter set to measure volts, check the output voltage of the pack with the switch turned on. That’s our supply voltage, and it should be something around 4.5V (it’ll be a bit more if the batteries are new). Now connect the circuit, taking care that the switch on the battery pack is in the “OFF” position before plugging it into the breadboard. Also, take care that the red and black leads are going to the right places. If it’s more convenient, you can use alligator clips to attach the meter probes to the legs of the capacitor for measurement (you can also spread those legs out a bit to make it easier).

Once we’re satisfied that the circuit looks right and our meter’s on and set to read volts, flip the switch on the battery pack to “ON”. After about 5 seconds, the meter should read pretty close to the battery pack voltage, which demonstrates that the equation is right and we know what we’re doing. Now turn the switch off. It’s still holding that voltage pretty well, isn’t it? That’s because there’s no path for current to discharge the capacitor; we’ve got an open circuit. To discharge the cap, you can use another 10K resistor in parallel. After about 5 seconds, it will be back to pretty close to zero.

Experiment Time – Part 3, Even More…

Now we’re on to the interesting parts, starting with connecting two capacitors in series. Remember that we said the result of which would be similar to connecting two resistors in parallel. If this is true, we can expect (using product-over-sum)

C = 100uF*100uF/(100uF+100uF) = 50uF

What’s that going to do to our time constant?

Tau = 0.5 seconds

Experiment 3.2 fritzing diagram

With that in mind, plug in another capacitor in series with the first, make sure the meter is reading zero volts (or there-abouts) and flip the switch to “ON”. Did it take about half as much time to charge up to the battery pack voltage? That’s because there’s half as much capacitance. The electron gas tank got smaller, so it takes less time to charge it up. A third capacitor is suggested for this experiment just to prove the point, but we’re betting the reader can see the writing on the wall.

Now we’ll try capacitors in parallel, remembering that we said earlier that this would be like adding resistors in series. If that’s true, then we can expect 200µF, right? Then our time constant becomes

Tau = 2 seconds

This means that it will now take about 10 seconds to see the parallel capacitors charge up to the supply voltage of 4.5V.

Frizing diagram: caps in parallel

For the proof, start with our original circuit of one 10kΩ resistor and one 100µF capacitor in series, as hooked up in the first diagram for this experiment. We already know that the capacitor is going to charge up in about 5 seconds. Now add a second capacitor in parallel. Make sure the meter is reading close to zero volts (discharge through a resistor if it isn’t reading zero), and flip the switch on the battery pack to “ON”. Takes a long time, doesn’t it? Sure enough, we made the electron gas tank bigger and now it takes longer to fill it up. To prove it to yourself, try adding the third 100µF capacitor, and watch it charge for a good, long time.

Series and Parallel Inductors

Series and Parallel Inductors

Cases where inductors need to be added either in series or in parallel are rather rare, but not unheard of. In any case, let’s address them just to be complete.

In a nutshell they add just like resistors do, which is to say they add with a plus sign when in series, and with product-over-sum when in parallel. The tricky part comes when they are placed close together so as to have interacting magnetic fields, whether intentionally or not. For this reason, it is preferable to have a single component rather than two or more, though most inductors are shielded to prevent interacting magnetic fields.

In any case, suffice it to say that they add like resistors do. More information than that regarding inductors is well beyond the scope of this tutorial.

Resources and Going Further

Now that you’re familiar with the basics of serial and parallel circuits, why not check out some of these tutorials?

  • Voltage Dividers – One of the most basic, and recurring circuits is the voltage divider. This is a circuit which really builds upon the concepts explored in this tutorial.
  • What is an Arduino? – Now that you’ve got the basics of circuits under your belt, you could head directly to learning about microcontrollers with one of the most popular platforms out there: Arduino.
  • Switch Basics – We’ve talked about some of the more basic circuit elements in this tutorial, but this wasn’t one of them. Switches are a critical component in just about every electronics project out there. Learn all about switches in this tutorial
  • Sewing with Conductive Thread – Circuits don’t have to be all breadboards and wire. E-textiles uses conductive thread to sew lights and other electronics into clothing or other fabric.

Resistors

Take a Stance, The Resist Stance

Resistors – the most ubiquitous of electronic components. They are a critical piece in just about every circuit. And they play a major role in our favorite equation, Ohm’s Law.

resistors

In this, our pièce de résistance, we’ll cover:

  • What is a resistor?!
  • Resistor units
  • Resistor circuit symbol(s)
  • Resistors in series and parallel
  • Different variations of resistors
  • Color coding decoding
  • Surface mount resistor decoding
  • Example resistor applications

Consider reading…

Some of the concepts in this tutorial build on previous electronics knowledge. Before jumping into this tutorial, consider reading (at least skimming) these first:


Resistor Basics

Resistors are electronic components which have a specific, never-changing electrical resistance. The resistor’s resistance limits the flow of electrons through a circuit.

They are passive components, meaning they only consume power (and can’t generate it). Resistors are usually added to circuits where they complement active components like op-amps, microcontrollers, and other integrated circuits. Commonly resistors are used to limit current, divide voltages, and pull-up I/O lines.

Resistor units

The electrical resistance of a resistor is measured in ohms. The symbol for an ohm is the greek capital-omega: Ω. The (somewhat roundabout) definition of 1Ω is the resistance between two points where 1 volt (1V) of applied potential energy will push 1 ampere (1A) of current.

As SI units go, larger or smaller values of ohms can be matched with a prefix like kilo-, mega-, or giga-, to make large values easier to read. It’s very common to see resistors in the kilohm (kΩ) and megaohm (MΩ) range (much less common to see miliohm (mΩ) resistors). For example, a 4,700Ω resistor is equivalent to a 4.7kΩ resistor, and a 5,600,000Ω resistor can be written as 5,600kΩ or (more commonly as) 5.6MΩ.

Schematic symbol

All resistors have two terminals, one connection on each end of the resistor. When modeled on a schematic, a resistor will show up as one of these two symbols:

Resistor schematic symbols

Two common resistor schematic symbols. R1 is an American-style 1kΩ resistor, and R2 is an international-style 47kΩ resistor.

The terminals of the resistor are each of the lines extending from the squiggle (or rectangle). Those are what connect to the rest of the circuit.

The resistor circuit symbols are usually enhanced with both a resistance value and a name. The value, displayed in ohms, is obviously critical for both evaluating and actually constructing the circuit. The name of the resistor is usually an R preceding a number. Each resistor in a circuit should have a unique name/number. For example, here’s a few resistors in action on a 555 timer circuit:

Example schematic with resistors - a 555 timer

In this circuit, resistors play a key role in setting the frequency of the 555 timer’s output. Another resistor (R3) limits the current through an LED.


Types of Resistors

Resistors come in a variety of shapes and sizes. They might be through-hole or surface-mount. They might be a standard, static resistor, a pack of resistors, or a special variable resistor.

Termination and mounting

Resistors will come in one of two termination-types: through-hole or surface-mount. These types of resistors are usually abbreviated as either PTH (plated through-hole) or SMD/SMT (surface-mount technology or device).

Through-hole resistors come with long, pliable leads which can be stuck into a breadboard or hand-soldered into a prototyping board or printed circuit board (PCB). These resistors are usually more useful in breadboarding, prototyping, or in any case where you’d rather not solder tiny, little 0.6mm-long SMD resistors. The long leads usually require trimming, and these resistors are bound to take up much more space than their surface-mount counterparts.

The most common through-hole resistors come in an axial package. The size of an axial resistor is relative to its power rating. A common ½W resistor measures about 9.2mm across, while a smaller ¼W resistor is about 6.3mm long.

1/4 and 1/2 watt resistors

A half-watt (½W) resistor (above) sized up to a quarter-watt (¼W).

Surface-mount resistors are usually tiny black rectangles, terminated on either side with even smaller, shiny, silver, conductive edges. These resistors are intended to sit on top of PCBs, where they’re soldered onto mating landing pads. Because these resistors are so small, they’re usually set into place by a robot, and sent through an oven where solder melts and holds them in place.

SMD resistor on a quarter

A tiny 0603 330Ω resistor hovering over shiny George Washington’s nose on top of a U.S. quarter.

SMD resistors come in standardized sizes; usually either 0805 (0.8mm long by 0.5mm wide), 0603, or 0402. They’re great for mass circuit-board-production, or in designs where space is a precious commodity. They take a steady, precise hand to manually solder, though!

Resistor composition

Resistors can be constructed out of a variety of materials. Most common, modern resistors are made out of either a carbon, metal, or metal-oxide film. In these resistors, a thin film of conductive (though still resistive) material is wrapped in a helix around and covered by an insulating material. Most of the standard, no-frills, through-hole resistors will come in a carbon-film or metal-film composition.

Peeled away view of carbon-film resistors

Peek inside the guts of a few carbon-film resistors. Resistance values from top to bottom: 27Ω, 330Ω and a 3.3MΩ. Inside the resistor, a carbon film is wrapped around an insulator. More wraps means a higher resistance. Pretty neat!

Other through-hole resistors might be wirewound or made of super-thin metallic foil. These resistors are usually more expensive, higher-end components specifically chosen for their unique characteristics like a higher power-rating, or maximum temperature range.

Surface-mount resistors are usually either thick or thin-film variety. Thick-film is usually cheaper but less precise than thin. In both resistor types, a small film of resistive metal alloy is sandwiched between a ceramic base and glass/epoxy coating, and then connected to the terminating conductive edges.

Special resistor packages

There are a variety of other, special-purpose resistors out there. Resistors may come in pre-wired packs of five-or-so resistor arrays. Resistors in these arrays may share a common pin, or be set up as voltage dividers.

Resistor Network

An array of five 330Ω resistors, all tied together at one end.

Resistors don’t have to be static either. Variable resistors, known as rheostats, are resistors which can be adjusted between a specific range of values. Similar to the rheostat is the potentiometer. Pots connect two resistors internally, in series, and adjust a center tap between them creating an adjustable voltage divider. These variable resistors are often used for inputs, like volume knobs, which need to be adjustable.

A smattering of potentiometers

A smattering of potentiometers. From top-left, clockwise: a standard 10k trimpot, 2-axis joystick, softpot, slide pot, classic right-angle, and a breadboard friendly 10k trimpot.


Decoding Resistor Markings

Though they may not display their value outright, most resistors are marked to show what their resistance is. PTH resistors use a color-coding system (which really adds some flair to circuits), and SMD resistors have their own value-marking system.

Decoding the color bands

Through-hole, axial resistors usually use the color-band system to display their value. Most of these resistors will have four bands of color circling the resistor.

Resistors showing their stripes

The first two bands indicate the two most-significant digits of the resistor’s value. The third band is a weight value, which multiplies the two significant digits by a power of ten.

The final band indicates the tolerance of the resistor. The tolerance explains how much more or less the actual resistance of the resistor can be compared to what its nominal value is. No resistor is made to perfection, and different manufacturing processes will result in better or worse tolerances. For example, a 1kΩ resistor with 5% tolerance could actually be anywhere between 0.95kΩ and 1.05kΩ.

How do you tell which band is first and last? The last, tolerance band is often clearly separated from the value bands, and usually it’ll either be silver or gold.

Here’s a table of each of the colors and which value, multiplier or tolerance they represent:

Color Digit value Multiplier Multiplied Out Tolerance
Black 0 100 1
Brown 1 101 10
Red 2 102 100
Orange 3 103 1,000
Yellow 4 104 10000
Green 5 105 100,000
Blue 6 106 1,000,000
Violet 7 107 10,000,000
Gray 8 108 100,000,000
White 9 109 1,000,000,000
Gold ±5%
Silver ±10%

Here’s an example of a 4.7kΩ resistor with four color bands:

Close-up of a 4.7kOhm resistor

When decoding the resistor color bands, consult a resistor color code table like the one above. For the first two bands, find that color’s corresponding digit value. The 4.7kΩ resistor has color bands of yellow and violet to begin – which have digit values of 4 and 7 (47). The third band of the 4.7kΩ is red, which indicates that the 47 should be multiplied by 102 (or 100). 47 times 100 is 4,700!

If you’re trying to commit the color band code to memory, a mnemonic device might help. There are a handful of (sometimes unsavory) mnemonics out there, to help remember the resistor color code. A good one, which spells out the difference between black and brown is:

Big brown rabbits often yield great big vocal groans when gingerly snapped.”

Or, if you remember “ROY G. BIV”, subtract the indigo (poor indigo, no one remembers indigo), and add black and brown to the front and gray and white to the back of the classic rainbow color-order.

Color Code Calculator

If you’d rather skip the math (we won’t judge :), and just use a handy calculator, give this a try!

 

Band 1 Band 2 Band 3 Band 4
Value 1 (MSV) Value 2 Weight Tolerance

Resistance:

1,000 Ω ±5%

Decoding surface-mount markings

SMD resistors, like those in 0603 or 0805 packages, have their own way of displaying their value. There are a few common marking methods you’ll see on these resistors. They’ll usually have three to four characters – numbers or letters – printed on top of the case.

If the three characters you’re seeing are all numbers, you’re probably looking at an E24 marked resistor. These markings actually share some similarity with the color-band system used on the PTH resistors. The first two numbers represent the first two most-significant digits of the value, the last number represents a magnitude.

Examples of E-24 marked SMD resistors

In the above example picture, resistors are marked 104, 105, 205, 751, and 754. The resistor marked with 104 should be 100kΩ (10×104), 105 would be 1MΩ (10×105), and 205 is 2MΩ (20×105). 751 is 750Ω (75×101), and 754 is 750kΩ (75×104).

Another common coding system is E96, and it’s the most cryptic of the bunch. E96 resistors will be marked with three characters – two numbers at the beginning and a letter at the end. The two numbers tell you the first three digits of the value, by corresponding to one of the not-so-obvious values on this lookup table.

Code Value Code Value Code Value Code Value Code Value Code Value
01 100 17 147 33 215 49 316 65 464 81 681
02 102 18 150 34 221 50 324 66 475 82 698
03 105 19 154 35 226 51 332 67 487 83 715
04 107 20 158 36 232 52 340 68 499 84 732
05 110 21 162 37 237 53 348 69 511 85 750
06 113 22 165 38 243 54 357 70 523 86 768
07 115 23 169 39 249 55 365 71 536 87 787
08 118 24 174 40 255 56 374 72 549 88 806
09 121 25 178 41 261 57 383 73 562 89 825
10 124 26 182 42 267 58 392 74 576 90 845
11 127 27 187 43 274 59 402 75 590 91 866
12 130 28 191 44 280 60 412 76 604 92 887
13 133 29 196 45 287 61 422 77 619 93 909
14 137 30 200 46 294 62 432 78 634 94 931
15 140 31 205 47 301 63 442 79 649 95 953
16 143 32 210 48 309 64 453 80 665 96 976

The letter at the end represents a multiplier, matching up to something on this table:

Letter Multiplier Letter Multiplier Letter Multiplier
Z 0.001 A 1 D 1000
Y or R 0.01 B or H 10 E 10000
X or S 0.1 C 100 F 100000

Resistors marked with E-96 codes

So a 01C resistor is our good friend, 10kΩ (100×100), 01B is 1kΩ (100×10), and 01D is 100kΩ. Those are easy, other codes may not be. 85A from the picture above is 750Ω (750×1) and 30C is actually 20kΩ.


Power Rating

The power rating of a resistor is one of the more hidden values. Nevertheless it can be important, and it’s a topic that’ll come up when selecting a resistor type.

Power is the rate at which energy is transformed into something else. It’s calculated by multiplying the voltage difference across two points by the current running between them, and is measured in units of a watt (W). Light bulbs, for example, power electricity into light. But a resistor can only turn electrical energy running through it into heat. Heat isn’t usually a nice playmate with electronics; too much heat leads to smoke, sparks, and fire!

Every resistor has a specific maximum power rating. In order to keep the resistor from heating up too much, it’s important to make sure the power across a resistor is kept under it’s maximum rating. The power rating of a resistor is measured in watts, and it’s usually somewhere between ⅛W (0.125W) and 1W. Resistors with power ratings of more than 1W are usually referred to as power resistors, and are used specifically for their power dissipating abilities.

Finding a resistor’s power rating

A resistor’s power rating can usually be deduced by observing its package size. Standard through-hole resistors usually come with ¼W or ½W ratings. More special purpose, power resistors might actually list their power rating on the resistor.

Some examples of power resistors

These power resistors can handle a lot more power before they blow. From top-right to bottom-left there are examples of 25W, 5W and 3W resistors, with values of 2Ω, 3Ω 0.1Ω and 22kΩ. Smaller power-resistors are often used to sense current.

The power ratings of surface mount resistors can usually be judged by their size as well. Both 0402 and 0603-size resistors are usually rated for 1/16W, and 0805’s can take 1/10W.

Measuring power across a resistor

Power is usually calculated by multiplying voltage and current (P = IV). But, by applying Ohm’s law, we can also use the resistance value in calculating power. If we know the current running through a resistor, we can calculate the power as:

P=I^2*R

Or, if we know the voltage across a resistor, the power can be calculated as:

P=V^2/R


Series and Parallel Resistors

Resistors are paired together all the time in electronics, usually in either a series or parallel circuit. When resistors are combined in series or parallel, they create a total resistance, which can be calculated using one of two equations. Knowing how resistor values combine comes in handy if you need to create a specific resistor value.

Series resistors

When connected in series resistor values simply add up.

Schematic of resistors in series

Equation for adding resistors in series

N resistors in series. The total resistance is the sum of all series resistors.

So, for example, if you just have to have a 12.33kΩ resistor, seek out some of the more common resistor values of 12kΩ and 330Ω, and butt them up together in series.

Parallel resistors

Finding the resistance of resistors in parallel isn’t quite so easy. The total resistance of N resistors in parallel is the inverse of the sum of all inverse resistances. This equation might make more sense than that last sentence:

Schematic of resistors in parallel

Equation for adding resistors in parallel

N resistors in parallel. To find the total resistance, invert each resistance value, add them up, and then invert that.

(The inverse of resistance is actually called conductance, so put more succinctly: the conductance of parallel resistors is the sum of each of their conductances).

As a special case of this equation: if you have just two resistors in parallel, their total resistance can be calculated with this slightly-less-inverted equation:

Equation for calculating two resistors in parallel

As an even more special case of that equation, if you have two parallel resistors of equal value the total resistance is half of their value. For example, if two 10kΩ resistors are in parallel, their total resistance is 5kΩ.

A shorthand way of saying two resistors are in parallel is by using the parallel operator: ||. For example, if R1 is in parallel with R2, the conceptual equation could be written as R1||R2. Much cleaner, and hides all those nasty fractions!

Resistor networks

As a special introduction to calculating total resistances, electronics teachers just love to subject their students to finding that of crazy, convoluted resistor networks.

A tame resistor network question might be something like: “what’s the resistance from terminals A to B in this circuit?”

An example of a resistor network

To solve such a problem, start at the back-end of the circuit and simplify towards the two terminals. In this case R7, R8and R9 are all in series and can be added together. Those three resistors are in parallel with R6, so those four resistors could be turned into one with a resistance of R6||(R7+R8+R9). Making our circuit:

Resistor network simplified

Now the four right-most resistors can be simplified even further. R4, R5 and our conglomeration of R6 – R9 are all in series and can be added. Then those series resistors are all in parallel with R3.

Resistor network further simplified

And that’s just three series resistors between the A and B terminals. Add ‘em on up! So the total resistance of that circuit is: R1+R2+R3||(R4+R5+R6||(R7+R8+R9)).


Example Applications

Resistors exist in just about every electronic circuit ever. Here are a few examples of circuits, which heavily depend on our resistor friends.

LED Current Limiting

Resistors are key in making sure LEDs don’t blow up when power is applied. By connecting a resistor in series with an LED, current flowing through the two components can be limited to a safe value.

Current limiting resistor schematic

When sizing out a current-limiting resistor, look for two characteristic values of the LED: the typical forward voltage, and the maximum forward current. The typical forward voltage is the voltage which is required to make an LED light up, and it varies (usually somewhere between 1.7V and 3.4V) depending upon the color of the LED. The maximum forward current is usually around 20mA for basic LEDs; continuous current through the LED should always be equal to or less than that current rating.

Once you’ve gotten ahold of those two values, you can size up a current-limiting resistor with this equation:

Current limiting resistor = (Vs-Vf)/If

VS is the source voltage – usually a battery or power supply voltage. VF and IF are the LED’s forward voltage and the desired current that runs through it.

For example, assume you have a 9V battery to power an LED. If your LED is red, it might have a forward voltage around 1.8V. If you want to limit the current to 10mA, use a series resistor of about 720Ω.

Current limiting example equation R=(9-1.8)/.010

Voltage Dividers

A voltage divider is a resistor circuit which turns a large voltage into a smaller one. Using just two resistors in series, an output voltage can be created that’s a fraction of the input voltage.

Here’s the voltage divider circuit:

Voltage divider circuit

Two resistors, R1 and R2, are connected in series and a voltage source (Vin) is connected across them. The voltage from Vout to GND can be calculated as:

Voltage divider equation

For example, if R1 was 1.7kΩ and R2 was 3.3kΩ, a 5V input voltage could be turned into 3.3V at the Vout terminal.

Voltage dividers are very handy for reading resistive sensors, like photocells, flex sensors, and force-sensitive resistors. One half of the voltage divider is the sensor, and the part is a static resistor. The output voltage between the two components is connected to an analog-to-digital converter on a microcontroller (MCU) to read the sensor’s value.

A photocell and resistor make a light sensor

Here a resistor R1 and a photocell create a voltage divider to create a variable voltage output.

Pull-up Resistors

A pull-up resistor is used when you need to bias a microcontroller’s input pin to a known state. One end of the resistor is connected to the MCU’s pin, and the other end is connected to a high voltage (usually 5V or 3.3V).

Without a pull-up resistor, inputs on the MCU could be left floating. There’s no guarantee that a floating pin is either high (5V) or low (0V).

Pull-up resistors are often used when interfacing with a button or switch input. The pull-up resistor can bias the input-pin when the switch is open. And it will protect the circuit from a short when the switch is closed.

A resistor pulling up a button input

In the circuit above, when the switch is open the MCU’s input pin is connected through the resistor to 5V. When the switch closes, the input pin is connected directly to GND.

The value of a pull-up resistor doesn’t usually need to be anything specific. But it should be high enough that not too much power is lost if 5V or so is applied across it. Usually values around 10kΩ work well.


Resources and Going Further

Now that you’re a budding expert on all things resistor, how ‘bout exploring some more fundamental electronics concepts! Resistors certainly aren’t the only basic component we use in electronics, there’s also:

Or maybe you’d like to further explore resistor applications?

Capacitors

Introduction

A capacitor is a two-terminal, electrical component. Along with resistors and inductors, they are one of the most fundamental passive components we use. You would have to look very hard to find a circuit which didn’t have a capacitor in it.

Capacitor variety hour

What makes capacitors special is their ability to store energy; they’re like a fully charged electric battery. Caps, as we usually refer to them, have all sorts of critical applications in circuits. Common applications include local energy storage, voltage spike suppression, and complex signal filtering.

Covered in this Tutorial

In this tutorial, we’ll be examining all sorts of capacitor-related topics, including:

  • How a capacitor is made
  • How a capacitor works
  • Units of capacitance
  • Types of capacitors
  • How to recognize capacitors
  • How capacitance combines in series and parallel
  • Common capacitor applications

Suggested Reading

Some of the concepts in this tutorial build on previous electronics knowledge. Before jumping into this tutorial, consider reading (at least skimming) these first:


Symbols and Units

Circuit Symbols

There are two common ways to draw a capacitor in a schematic. They always have two terminals, which go on to connect to the rest of the circuit. The capacitors symbol consists of two parallel lines, which are either flat or curved; both lines should be parallel to each other, close, but not touching (this is actually representative of how the capacitor is made. Hard to describe, easier to just show:

Capacitor circuit symbols

(1) and (2) are standard capacitor circuit symbols. (3) is an example of capacitors symbols in action in a voltage regulator circuit.

The symbol with the curved line (#2 in the photo above) indicates that the capacitor is polarized, meaning it’s probably an electrolytic capacitor. More on that in the types of capacitors section of this tutorial.

Each capacitor should be accompanied by a name – C1, C2, etc.. – and a value. The value should indicate the capacitance of the capacitor; how many farads it has. Speaking of farads…

Capacitance Units

Not all capacitors are created equal. Each capacitor is built to have a specific amount of capacitance. The capacitance of a capacitor tells you how much charge it can store, more capacitance means more capacity to store charge. The standard unit of capacitance is called the farad, which is abbreviated F.

It turns out that a farad is a lot of capacitance, even 0.001F (1 milifarad – 1mF) is a big capacitor. Usually you’ll see capacitors rated in the pico- (10-12) to microfarad (10-6) range.

 

Prefix Name Abbreviation Weight Equivalent Farads
Picofarad pF 10-12 0.000000000001 F
Nanofarad nF 10-9 0.000000001 F
Microfarad µF 10-6 0.000001 F
Milifarad mF 10-3 0.001 F
Kilofarad kF 103 1000 F

When you get into the farad to kilofarad range of capacitance, you start talking about special caps called super or ultra-capacitors.


Capacitor Theory

Note: The stuff on this page isn’t completely critical for electronics beginners to understand…and it gets a little complicated towards the end. We recommend reading the How a Capacitor is Made section, the others could probably be skipped if they give you a headache.

How a Capacitor Is Made

The schematic symbol for a capacitor actually closely resembles how it’s made. A capacitor is created out of two metal plates and an insulating material called a dielectric. The metal plates are placed very close to each other, in parallel, but the dielectric sits between them to make sure they don’t touch.

Internal capacitor view

Your standard capacitor sandwich: two metal plates separated by an insulating dielectric.

The dielectric can be made out of all sorts of insulating materials: paper, glass, rubber, ceramic, plastic, or anything that will impede the flow of current.

The plates are made of a conductive material: aluminum, tantalum, silver, or other metals. They’re each connected to a terminal wire, which is what eventually connects to the rest of the circuit.

The capacitance of a capacitor – how many farads it has – depends on how it’s constructed. More capacitance requires a larger capacitor. Plates with more overlapping surface area provide more capacitance, while more distance between the plates means less capacitance. The material of the dielectric even has an effect on how many farads a cap has. The total capacitance of a capacitor can be calculated with the equation:

C=er*A/(4*pi*d)

Where εr is the dielectric’s relative permittivity (a constant value determined by the dielectric material), A is the amount of area the plates overlap each other, and d is the distance between the plates.

How a Capacitor Works

Electric current is the flow of electric charge, which is what electrical components harness to light up, or spin, or do whatever they do. When current flows into a capacitor, the charges get “stuck” on the plates because they can’t get past the insulating dielectric. Electrons – negatively charged particles – are sucked into one of the plates, and it becomes overall negatively charged. The large mass of negative charges on one plate pushes away like charges on the other plate, making it positively charged.

Charged Cap Drawing

The positive and negative charges on each of these plates attract each other, because that’s what opposite charges do. But, with the dielectric sitting between them, as much as they want to come together, the charges will forever be stuck on the plate (until they have somewhere else to go). The stationary charges on these plates create an electric field, which influence electric potential energy and voltage. When charges group together on a capacitor like this, the cap is storing electric energy just as a battery might store chemical energy.

Charging and Discharging

When positive and negative charges coalesce on the capacitor plates, the capacitor becomes charged. A capacitor can retain its electric field – hold its charge – because the positive and negative charges on each of the plates attract each other but never reach each other.

At some point the capacitor plates will be so full of charges that they just can’t accept any more. There are enough negative charges on one plate that they can repel any others that try to join. This is where the capacitance (farads) of a capacitor comes into play, which tells you the maximum amount of charge the cap can store.

If a path in the circuit is created, which allows the charges to find another path to each other, they’ll leave the capacitor, and it will discharge.

For example, in the circuit below, a battery can be used to induce an electric potential across the capacitor. This will cause equal but opposite charges to build up on each of the plates, until they’re so full they repel any more current from flowing. An LED placed in series with the cap could provide a path for the current, and the energy stored in the capacitor could be used to briefly illuminate the LED.

capacitor charge/discharge example

Calculating Charge, Voltage, and Current

A capacitor’s capacitance – how many farads it has – tells you how much charge it can store. How much charge a capacitor is currently storing depends on the potential difference (voltage) between its plates. This relationship between charge, capacitance, and voltage can be modeled with this equation:

Q=CV

Charge (Q) stored in a capacitor is the product of its capacitance (C) and the voltage (V) applied to it.

The capacitance of a capacitor should always be a constant, known value. So we can adjust voltage to increase or decrease the cap’s charge. More voltage means more charge, less voltage…less charge.

That equation also gives us a good way to define the value of one farad. One farad (F) is the capacity to store one unit of energy (coulombs) per every one volt.

Calculating Current

We can take the charge/voltage/capacitance equation a step further to find out how capacitance and voltage affect current, because current is the rate of flow of charge. The gist of a capacitor’s relationship to voltage and current is this: the amount of current through a capacitor depends on both the capacitance and how quickly the voltage is rising or falling. If the voltage across a capacitor swiftly rises, a large positive current will be induced through the capacitor. A slower rise in voltage across a capacitor equates to a smaller current through it. If the voltage across a capacitor is steady and unchanging, no current will go through it.

(This is ugly, and gets into calculus. It’s not all that necessary until you get into time-domain analysis, filter-design, and other gnarly stuff, so skip ahead to the next page if you’re not comfortable with this equation.) The equation for calculating current through a capacitor is:

i=Cdv/dt

The dV/dt part of that equation is a derivative (a fancy way of saying instantaneous rate) of voltage over time, it’s equivalent to saying “how fast is voltage going up or down at this very moment”. The big takeaway from this equation is that if voltage is steady, the derivative is zero, which means current is also zero. This is why current cannot flow through a capacitor holding a steady, DC voltage.


Types of Capacitors

There are all sorts of capacitor types out there, each with certain features and drawbacks which make it better for some applications than others.

When deciding on capacitor types there are a handful of factors to consider:

  • Size – Size both in terms of physical volume and capacitance. It’s not uncommon for a capacitor to be the largest component in a circuit. They can also be very tiny. More capacitance typically requires a larger capacitor.
  • Maximum voltage – Each capacitor is rated for a maximum voltage that can be dropped across it. Some capacitors might be rated for 1.5V, others might be rated for 100V. Exceeding the maximum voltage will usually result in destroying the capacitor.
  • Leakage current – Capacitors aren’t perfect. Every cap is prone to leaking some tiny amount of current through the dielectric, from one terminal to the other. This tiny current loss (usually nanoamps or less) is called leakage. Leakage causes energy stored in the capacitor to slowly, but surely drain away.
  • Equivalent series resistance (ESR) – The terminals of a capacitor aren’t 100% conductive, they’ll always have a tiny amount of resistance (usually less than 0.01Ω) to them. This resistance becomes a problem when a lot of current runs through the cap, producing heat and power loss.
  • Tolerance – Capacitors also can’t be made to have an exact, precise capacitance. Each cap will be rated for their nominal capacitance, but, depending on the type, the exact value might vary anywhere from ±1% to ±20% of the desired value.

Ceramic Capacitors

The most commonly used and produced capacitor out there is the ceramic capacitor. The name comes from the material from which their dielectric is made.

Ceramic capacitors are usually both physically and capacitance-wise small. It’s hard to find a ceramic capacitor much larger than 10µF. A surface-mount ceramic cap is commonly found in a tiny 0402 (0.4mm x 0.2mm), 0603 (0.6mm x 0.3mm) or 0805 package. Through-hole ceramic caps usually look like small (commonly yellow or red) bulbs, with two protruding terminals.

Ceramic Capacitors

Two caps in a through-hole, radial package; a 22pF cap on the left, and a 0.1µF on the right. In the middle, a tiny 0.1µF 0603 surface-mount cap.

Compared to the equally popular electrolytic caps, ceramics are a more near-ideal capacitor (much lower ESR and leakage currents), but their small capacitance can be limiting. They are usually the least expensive option too. These caps are well-suited for high-frequency coupling and decoupling applications.

Aluminum and Tantalum Electrolytic

Electrolytics are great because they can pack a lot of capacitance into a relatively small volume. If you need a capacitor in the range of 1µF-1mF, you’re most likely to find it in an electrolytic form. They’re especially well suited to high-voltage applications because of their relatively high maximum voltage ratings.

Aluminum electrolytic capacitors, the most popular of the electrolytic family, usually look like little tin cans, with both leads extending from the bottom.

Electrolytic caps

An assortment of through-hole and surface-mount electrolytic capacitors. Notice each has some method for marking the cathode (negative lead).

Unfortunately, electrolytic caps are usually polarized. They have a positive pin – the anode – and a negative pin called the cathode. When voltage is applied to an electrolytic cap, the anode must be at a higher voltage than the cathode. The cathode of an electrolytic capacitor is usually identified with a ‘-’ marking, and a colored strip on the case. The leg of the anode might also be slightly longer as another indication. If voltage is applied in reverse on an electrolytic cap, they’ll fail spectacularly (making a pop and bursting open), and permanently. After popping an electrolytic will behave like a short circuit.

These caps also notorious for leakage – allowing small amounts of current (on the order of nA) to run through the dielectric from one terminal to the other. This makes electrolytic caps less-than-ideal for energy storage, which is unfortunate given their high capacity and voltage rating.

Supercapacitors

If you’re looking for a capacitor made to store energy, look no further than supercapacitors. These caps are uniquely designed to have very high capacitances, in the range of farads.

Supercapacitor

A 1F (!) supercapacitor. High capacitance, but only rated for 2.5V. Notice these are also polarized.

While they can store a huge amount of charge, supercaps can’t deal with very high voltages. This 10F supercap is only rated for 2.5V max. Any more than that will destroy it. Super caps are commonly placed in series to achieve a higher voltage rating (while reducing total capacitance).

The main application for supercapacitors is in storing and releasing energy, like batteries, which are their main competition. While supercaps can’t hold as much energy as an equally sized battery, they can release it much faster, and they usually have a much longer lifespan.

Others

Electrolytic and ceramic caps cover about 80% of the capacitor types out there (and supercaps only about 2%, but they’re super!). Another common capacitor type is the film capacitor, which features very low parasitic losses (ESR), making them great for dealing with very high currents.

There’s plenty of other less common capacitors. Variable capacitors can produce a range of capacitances, which makes them a good alternative to variable resistors in tuning circuits. Twisted wires or PCBs can create capacitance (sometimes undesired) because each consists of two conductors separated by an insulator. Leyden Jars – a glass jar filled with and surrounded by conductors – are the O.G. of the capacitor family. Finally, of course, flux capacitors (a strange combination of inductor and capacitor) are critical if you ever plan on traveling back to the glory days.


Capacitors in Series/Parallel

Much like resistors, multiple capacitors can be combined in series or parallel to create a combined equivalent capacitance. Capacitors, however, add together in a way that’s completely the opposite of resistors.

Capacitors in Parallel

When capacitors are placed in parallel with one another the total capacitance is simply the sum of all capacitances. This is analogous to the way resistors add when in series.

Capacitors in parallel add

So, for example, if you had three capacitors of values 10µF, 1µF, and 0.1µF in parallel, the total capacitance would be 11.1µF (10+1+0.1).

Capacitors in Series

Much like resistors are a pain to add in parallel, capacitors get funky when placed in series. The total capacitance of N capacitors in series is the inverse of the sum of all inverse capacitances.

Capacitors in series are the inverse of the sum of their inverses

If you only have two capacitors in series, you can use the “product-over-sum” method to calculate the total capacitance:

Equation for 2 capacitors in series Ctot=C1*C2/(C1+C2)

Taking that equation even further, if you have two equal-valued capacitors in series, the total capacitance is half of their value. For example two 10F supercapacitors in series will produce a total capacitance of 5F (it’ll also have the benefit of doubling the voltage rating of the total capacitor, from 2.5V to 5V).


Application Examples

There are tons of applications for this nifty little (actually they’re usually pretty large) passive component. To give you an idea of their wide range of uses, here are a few examples:

Decoupling (Bypass) Capacitors

A lot of the capacitors you see in circuits, especially those featuring an integrated circuit, are decoupling. A decoupling capacitor’s job is to supress high-frequency noise in power supply signals. They take tiny voltage ripples, which could otherwise be harmful to delicate ICs, out of the voltage supply.

In a way, decoupling capacitors act as a very small, local power supply for ICs (almost like an uninterupptable power supply is to computers). If the power supply very temporarily drops its voltage (which is actually pretty common, especially when the circuit it’s powering is constantly switching its load requirements), a decoupling capacitor can briefly supply power at the correct voltage. This is why these capacitors are also called bypass caps; they can temporarily act as a power source, bypassing the power supply.

Decoupling capacitors connect between the power source (5V, 3.3V, etc.) and ground. It’s not uncommon to use two or more different-valued, even different types of capacitors to bypass the power supply, because some capacitor values will be better than others at filtering out certain frequencies of noise.

Decoupling capacitor schematic

In this schematic, three decoupling capacitors are used to help reduce the noise in an accelerometer’s voltage supply. Two ceramic 0.1µF and one tantalum electrolytic 10µF split decoupling duties.

While it seems like this might create a short from power to ground, only high-frequency signals can run through the capacitor to ground. The DC signal will go to the IC, just as desired. Another reason these are called bypass capacitors is because the high frequencies (in the kHz-MHz range) bypass the IC, instead running through the capacitor to get to ground.

When physically placing decoupling capacitors, they should always be located as close as possible to an IC. The further away they are, they less effective they’ll be.

ADXL345 breakout decoupling caps

Here’s the physical circuit layout from the schematic above. The tiny, black IC is surrounded by two 0.1µF capacitors (the brown caps) and one 10µF electrolytic tantalum capacitor (the tall, black/grey rectangular cap).

To follow good engineering practice, always add at least one decoupling capacitor to every IC. Usually 0.1µF is a good choice, or even add some 1µF or 10µF caps. They’re a cheap addition, and they help make sure the chip isn’t subjected to big dips or spikes in voltage.

Power Supply Filtering

Diode rectifiers can be used to turn the AC voltage coming out of your wall into the DC voltage required by most electronics. But diodes alone can’t turn an AC signal into a clean DC signal, they need the help of capacitors! By adding a parallel capacitor to a bridge rectifier, a rectified signal like this:

Rectification pre-Cap

Can be turned into a near-level DC signal like this:

Rectification post-cap

Capacitors are stubborn components, they’ll always try to resist sudden changes in voltage. The filter capacitor will charge up as the rectified voltage increases. When the rectified voltage coming into the cap starts its rapid decline, the capacitor will access its bank of stored energy, and it’ll discharge very slowly, supplying energy to the load. The capacitor shouldn’t fully discharge before the input rectified signal starts to increase again, recharging the cap. This dance plays out many times a second, over-and-over as long as the power supply is in use.

Power supply circuit

An AC-to-DC power supply circuit. The filter cap (C1) is critical in smoothing out the DC signal sent to the load circuit.

If you tear apart any AC-to-DC power supply, you’re bound to find at least one rather large capacitor. Below are the guts of a 9V DC wall adapter. Notice any capacitors in there?

alt text

There might be more capacitors than you think! There are four electrolytic, tin-can-looking caps ranging from 47µF to 1000µF. The big, yellow rectangle in the foreground is a high-voltage 0.1µF polypropylene film cap. The blue disc-shaped cap and the little green one in the middle are both ceramics.

Energy Storage and Supply

It seems obvious that if a capacitor stores energy, one of it’s many applications would be supplying that energy to a circuit, just like a battery. The problem is capacitors have a much lower energy density than batteries; they just can’t pack as much energy as an equally sized chemical battery (but that gap is narrowing!).

The upside of capacitors is they usually lead longer lives than batteries, which makes them a better choice environmentally. They’re also capable of delivering energy much faster than a battery, which makes them good for applications which need a short, but high burst of power. A camera flash might get its power from a capacitor (which, in turn, was probably charged by a battery).

Battery or Capacitor?

Battery Capacitor
Capacity
Energy Density
Charge/Discharge Rate
Life Span

 

Signal Filtering

Capacitors have a unique response to signals of varying frequencies. They can block out low-frequency or DC signal-components while allowing higher frequencies to pass right through. They’re like a bouncer at a very exclusive club for high frequencies only.

Filtering signals can be useful in all sorts of signal processing applications. Radio receivers might use a capacitor (among other components) to tune out undesired frequencies.

Another example of capacitor signal filtering is passive crossover circuits inside speakers, which separate a single audio signal into many. A series capacitor will block out low frequencies, so the remaining high-frequency parts of the signal can go to the speaker’s tweeter. In the low-frequency passing, subwoofer circuit, high-frequencies can mostly be shunted to ground through the parallel capacitor.

Crossover schematic

A very simple example of an audio crossover circuit. The capacitor will block out low frequencies, while the inductor blocks out high frequencies. Each can be used to deliver the proper signal to tuned audio drivers.

De-rating

When working with capacitors, it’s important to design your circuits with capacitors that have a much higher tolerance than the potentially highest voltage spike in your system.

Here’s an excellent video from SparkFun Engineer Shawn about what happens to different types of capacitors when you fail to de-rate your capacitors and exceed their maximum voltage specs. You can read more about his experiments here.


Purchasing Capacitors

Store up on these little energy storage components or put them to work a beginning power supply kit.

Our recommendations:


Resources and Going Further

Whew. Feel like a capacitor expert?! Want to keep learning more about the fundamentals of electronics? If you haven’t already, consider reading about some of the other common electronics components:

Or maybe some of these tutorials will catch your attention?

How to Use a Breadboard

Introduction

Breadboards are one of the most fundamental pieces when learning how to build circuits. In this tutorial, you will learn a little bit about what breadboards are, why they are called breadboards, and how to use one. Once you are done you should have a basic understanding of how breadboards work and be able to build a basic circuit on a breadboard.

A Breadboard

Suggested Reading

Here are some tutorials and concepts you may want to explore before learning about breadboards:


History

If you wanted to build a circuit prior to the 1960s, chances are you would have used a technique called wire-wrap. Wire wrap is a process that involves wrapping wires around conductive posts attached to a perfboard (a.k.a. a protoboard). As you can see, the process can get rather complex very quickly.Although this method is still used today, there is something that makes prototyping much easier, breadboards!

wire-wrap circuit

A wire-wrap circuit (image courtesy of Wikipedia user Wikinaut)

What’s in a Name?

When you picture a breadboard in your head, you may envision a big piece of wood and a large loaf of freshly baked bread. You wouldn’t be too far off either.

A literal breadboard

Bread on a breadboard

So why do we call this electronic “circuit builder” a breadboard? Many years ago, when electronics were big and bulky, people would grab their mom’s breadboard, a few nails or thumbtacks, and start connecting wires onto the board to give themselves a platform on which to build their circuits.

Circuit built on literal breadboard

Circuit on an “original” breadboard (image courtesy of mischka and their awesome literal breadboard tutorial)

Since then, electronic components have gotten a lot smaller, and we’ve come up with better ways to connect circuits, making moms all over the world happy to have their breadboards back. However, we are stuck with the confusing name. Technically, these are still breadboards, but this discussion is going to be on modern, “solderless” breadboards.


Why Use Breadboards?

An electronics breadboard (as opposed to the type on which sandwiches are made) is actually referring to a solderless breadboard. These are great units for making temporary circuits and prototyping, and they require absolutely no soldering.

Prototyping is the process of testing out an idea by creating a preliminary model from which other forms are developed or copied, and it is one of the most common uses for breadboards. If you aren’t sure how a circuit will react under a given set of parameters, it’s best to build a prototype and test it out.

For those new to electronics and circuits, breadboards are often the best place to start. That is the real beauty of breadboards–they can house both the simplest circuit as well as very complex circuits. As you’ll see later in this tutorial, if your circuit outgrows its current breadboard, others can be be attached to accommodate circuits of all sizes and complexities.

Another common use of breadboards is testing out new parts, such as Integrated circuits (ICs). When you are trying to figure out how a part works and constantly rewiring things, you don’t want to have to solder your connections each time.

As mentioned, you don’t always want the circuit you build to be permanent. When trying to duplicate a customer’s problem, SparkFun’s Technical Support team will often use breadboards to build, test, and analyze the circuit. They can connect the parts the customer has, and once they’ve gotten the circuit setup and figured out the problem, they can take everything apart and put it aside for the next time they need to do some troubleshooting.

A circuit built on a solderless breadboard

A circuit built on a solderless breadboard


Anatomy of a Breadboard

The major features of a Breadboard

The major features of a Breadboard

The best way to explain how a breadboard works is to take it apart and see what’s inside. Using a smaller breadboard it’s easier to see just how they function.

Terminal Strips

Here we have a breadboard where the adhesive backing has been removed. You can see lots of horizontal rows of metal strips on the bottom of the breadboard.

SparkFun Mini Breadboard

A SparkFun Mini Breadboard from the top (left) and the same breadboard flipped over with the adhesive back removed (right).

The tops of the metal rows have little clips that hide under the plastic holes. These clips allow you to stick a wire or the leg of a component into the exposed holes on a breadboard, which then hold it in place.

Clip

A single strip of conductive metal removed from the above breadboard.

Once inserted that component will be electrically connected to anything else placed in that row. This is because the metal rows are conductive and allow current to flow from any point in that strip.

Notice that there are only five clips on this strip. This is typical on almost all breadboards. Thus, you can only have up to five components connected in one particular section of the breadboard. The row has ten holes, so why can you only connect five components? You’ll also notice that each horizontal row is separated by a ravine, or crevasse, in the middle of the breadboard. This ravine isolates both sides of a given row from one another, and they are not electrically connected. We’ll discuss the purpose of this in just a bit, but, for now, just know that each side of a given row is disconnected from the other, leaving you with five spots for components on either side.

LED in Breadboard

An LED inserted into a breadboard. Notice how each leg of the LED is placed on either side of the ravine. This prevents the connections to the LED from being shorted.

Power Rails

Now that we’ve seen how the connections in a breadboard are made, let’s look at a larger, more typical breadboard. Aside from horizontal rows, breadboards usually have what are called power rails that run vertically along the sides.

Front and back, medium breadboard with power rails exposed

A medium-size breadboard with the adhesive back removed to expose the power rails.

These power rails are metal strips that are identical to the ones that run horizontally, except they are, typically*, all connected. When building a circuit, you tend to need power in lots of different places. The power rails give you lots of easy access to power wherever you need it in your circuit. Usually they will be labeled with a ‘+’ and a ‘-’ and have a red and blue or black stripe, to indicate the positive and negative side.

It is important to be aware that the power rails on either side are not connected, so if you want the same power source on both sides, you will need to connect the two sides with some jumper wires. Keep in mind that the markings are there just as a reference. There is no rule that says you have to plug power into the ‘+’ rail and ground into the ‘-‘rail, though it’s good practice to keep everything in order.

Jumper wires connecting both sides of the power rails

Two jumper wires used to connect the power rails on both sides. Always attach the ‘+’ to ‘+’ and the ‘-’ to ‘-’.

DIP Support

Earlier we mentioned the ravine that isolates the two sides of a breadboard. This ravine serves a very important purpose. Many integrated circuits, often referred to as ICs or, simply, chips, are manufactured specifically to fit onto breadboards. In order to minimize the amount of space they take up on the breadboard, they come in what is known as a Dual in-line Package, or DIP.

These DIP chips (salsa anyone?) have legs that come out of both sides and fit perfectly over that ravine. Since each leg on the IC is unique, we don’t want both sides to be connected to each other. That is where the separation in the middle of the board comes in handy. Thus, we can connect components to each side of the IC without interfering with the functionality of the leg on the opposite side.

alt text

Two DIP ICs, the LM358 (top), a very common op-amp, and the ever-popular ATmega328 microcontroller (bottom).

Rows and Columns

You may have noticed that many breadboards have numbers and letters marked on various rows and columns. These don’t serve any purpose other than to help guide you when building your circuit. Circuits can get complicated quickly, and all it takes is one misplaced leg of a component to make the entire circuit malfunction or not work at all. If you know the row number of the connection you are trying to make, it makes it much simpler to plug a wire into that number rather than eyeballing it.

These are also helpful when using instruction booklets, such as the one found in the SparkFun Inventor’s Kit. Many books and guides have circuit diagrams for you to follow along while building your circuit. Just remember that the circuit you’re building doesn’t have to be in the exact same location on the breadboard as the one in the book. In fact, it doesn’t even have to look similar. As long as all the electrical connections are being made, you can build your circuit any way you’d like!

Binding Posts

Some breadboards come on a platform that has binding posts attached to it. These posts allow you to connect all kinds of different power sources to your breadboard. We’ll cover these more in the next section.

Other Features

When building your circuit, you are not confined to stay on just one breadboard. Some circuits will require a lot more space. Many breadboards have little nubbins and slots on the sides, and some even have them on the tops and bottoms. These allow you to connect multiple breadboards together to form the ultimate prototyping surface.

Four SparkFun mini breadboards connected togethe

Four SparkFun mini breadboards connected together.

Some breadboards also have an adhesive backing that allow you to stick them to many different surfaces. These can come in handy if you want to attach your breadboard to the inside on an enclosure or other project case.

*Some larger breadboards will often isolate one half of the breadboard’s power rails form the other half (think top and bottom half, not the sides). This is convenient if you have two different voltages with which you need to power your circuit, such as 3.3V and 5V. However, if you’re unaware whether the power rials are or aren’t isolated, it can often lead to issues while building your circuit. It’s always a good idea to use a multimeter to check for the absence or presence of continuity in your breadboard’s power rails.

Providing Power to a Breadboard

When it comes to providing power to you breadboard, there are numerous options.

Borrowing from Other Power Sources

If you are working with a development board such as an Arduino, then you can simply pull power from the Arduino’s female headers. The Arduino has multiple power and ground pins that you can connect to the power rails or other rows on a breadboard.

Sharing power with an Arduino

Connecting the Ground (GND) pin from an Arduino to a row on a mini breadboard. Now any leg or wire connected to that row will also be connected to Ground.

The Arduino usually gets its power from the USB port on a computer or an external power supply such as a battery pack or a wall wart.

Binding Posts

As mentioned in the previous section, some breadboards have binding posts that allow you to connect external power sources.

The first step to using the binding posts is to connect them to the breadboard using some jumper wires. Although it would seem that the posts are connected to the breadboard, they are not. If they were, you would be limited to where you could and couldn’t provide power. As we’ve seen, breadboards are meant to be totally customizable, so it would make sense that the binding posts are no different.

With that, we have to connect wires to the posts in order to connect them to the breadboard. To do that, unscrew the post until the hole going through it is exposed. Slide the stripped end of your jumper wire through the hole, and screw the post back down until the wire is firmly connected.

Conneting wire to the binding posts

Typically, you only need to connect a power and ground wire from the posts to the breadboard. If you need an alternate power source, you can use the third post.

Now your posts are connected to the the breadboard, but there is still no power. You can use many different methods to connect power to the posts, and, thus, to the breadboard.

Benchtop Power Supplies

Many electronics labs have benchtop power supplies that allow you to provide a wide range of voltage and current to your circuit. Using a banana connector you can provide power from the supply to the binding posts.

A breadboard being powered through the binding posts from banana cables

A breadboard being powered through the binding posts from banana cables.

Alternatively, you could use alligator clips, IC hooks, or any other cables with a banana connection to hook your breadboard up to a number of different supplies.

Another method of using the binding posts is to solder a barrel jack to some wires, and then connect them to the binding posts. This is a more advanced technique, and it requires some intermediate soldering skills.

A breadboard being powered through the binding posts with a barrel jack

The barrel jack is soldered to two wires that share the same holes on the binding posts as the wires going to the breadboard. If your breadboard doesn’t have binding posts, you could just plug the wires from the barrel jack directly into the power rails.

Breadboard Power Supplies

Yet another method for powering your breadboard is to use one of the many breadboard power supplies available. SparkFun carries a number of kits and boards that you can use to plug power directly into your breadboard. Some allow you to plug a wall wart directly into the breadboard. Others allow you to pull power directly from your computer via the USB connections. And, almost all of them have the capability to adjust the voltage, giving you a full range of the common voltages needed when building circuits.

A SparkFun USB Breadboard Power Supply

A SparkFun USB Breadboard Power Supply that pulls power from your computer’s USB and has the option to choose between 3.3V and 5V.


Building Your First Breadboard Circuit

Now that we’re familiar with the internals of a breadboard and how to provide power to them, what do we do with them? We are going to start with a simple circuit.

What You’ll Need

Here is a parts list to follow along with this circuit. If you have other electronic bits and pieces, feel free to use them and change the circuit up. Remember, there is often more ways than one to build any given circuit. Some even have dozens of different ways that you can build them.

This wish list assumes you don’t have any parts/tools and is generous with quantities etc. For example, you only need one LED for this project, but the pack listed has 20 LEDs in it. The same is true with the hook-up wire. You don’t need that much (or all those colors), but if you keep playing with circuits, it could come in handy. If you don’t want the higher quantities check the bottom of the product pages in the section called “Related Products” and you should be able to find smaller quantities. Also, the breadboard power supply doesn’t have headers, if you know how to solder and have the tools, solder the headers on yourself. If not, solderless headers have been included in the wishlist as well.

Build the Circuit

Here is a small circuit on a breadboard.

Picture of Circuit

A simple circuit, involving a button, an LED, and a resistor, built two different ways.

The red board you see a Breadboard Power Supply, which supplies 5V to the power rails when it is connected to a 9V wall wart.

The circuit goes as follows:

  • There is a wire connecting the 5V power rail to the positive, anode leg of an LED.
  • The negative, cathode leg of the LED is connected to a 330Ω resistor.
  • The resistor is then connected to a button.
  • When the button is pushed, it connects the circuit to ground completing the circuit and turning on the LED.

Circuit Schematics

We cover how to read a schematic in another tutorial. However, it is a very important part of building circuits, so it will be covered here in short.

Schematics are universal pictograms that allow people all over the world to understand and build electronics. Every electronic component has a very unique schematic symbol. These symbols are then assembled into circuits using a variety of programs. You could also draw them out by hand. If you want to dive deeper in the world of electronics and circuit building, learning to read schematics is a very important step in doing so.

Here we have a schematic for the above circuit. Power (5V) is represented by the arrow at the top. It then goes to the LED (the triangle and line with arrows emitting out of it). The LED is then connected to the resistor (the squiggly line). That is connected to the button (the latch-looking symbol). Last the button is connect to ground (the horizontal line at the bottom).

Schematic

This may seem like a funny way to draw a circuit, but it is a fundamental process that has been around for decades. Schematics allow people from different nationalities and languages to build and collaborate on circuits designed by anyone. As mentioned, you can build a circuit in many different ways, but, as this schematic shows, there are certain connections that must be made. Diverging from this schematic will give you an entirely different circuit.

Practice Makes Perfect

The last bit of knowledge to leave you with is that there are tons of resources and programs you can use to build circuits without having to actually use your breadboard. One very common program used by SparkFun is Fritzing. Fritzing is a free program that allows you to build your own circuits on a virtual breadboard. It also provides schematic views for all the circuits you build. Here we can see the same circuits as above built using Fritzing.

Fritzing Diagram

Notice that the green lines indicate to which rows and columns each component is connected.

There are many other programs like Fritzing. Some are free, and some are paid. Some will even allow you to build a circuit and test its functionality through simulations. Go explore the internet, and find the tools that work best for you.


Purchasing a Breadboard

A great way to start using breadboards is to purchase one as part of a kit. The Sparkfun Inventor’s Kit includes everything you need to complete 16 different circuits. We’ve also listed a few basic stand-alone breadboards in different sizes for your projects.

Our recommendations:


Resources and Going Further

Hopefully you now have a better understanding of what a breadboard is and how it works. Now the real fun begins. We’ve barely scratched the surface of building circuits on breadboards. Here are some other tutorials you can check out to learn more about components and how to integrate them into your breadboard circuits.

Educators may be interested in these links.

Or, if you have mastered your circuit building skills and want to move to the next level, check out these tutorials.