Each part (such as LED, etc.) that you connect to your Photon device must have a complete electrical circuit. A circuit is a continuous path that conducts electricity from the positive (+) end of the power supply through a part (such as LED, etc.) back to the negative (-) end of the power supply. The Input/Output (I/O) pins, jumper wires, and breadboard are used to help make a separate circuit for each part.
This is why each part needs at least 2 wires (one for positive and one for negative). In many cases, an I/O pin acts as the voltage source (positive end) for a particular part's circuit. All parts will connect back (directly or indirectly) to one of the GND (-) pins on the Photon board. Parts that require more than 2 wires use the extra wires for power or data.
The Photon board has a number of I/O pins used for connecting inputs and outputs. Some of these are labeled as "analog" pins, while others are labeled as "digital" pins. However, in practice, the analog pins can act as digital pins, and some of the digital pins can act as analog pins.
The Photon board has 6 analog I/O pins labeled as: A0, A1, A2, A3, A4, A5.
Several of these analog pins are duplicated on the Photon board. A2, A3, A4, and A5 are each represented by two pins. The duplicate pins are located in the 10-pin digital header and labeled as: SS/A2, SCK/A3, MISO/A4, MOSI/A5. You can use either the primary analog pin or its duplicate. However, if you use one, then you should not use the other. For example, you could connect a part to either A2 or SS/A2 (choose one), but you cannot connect two different parts to these two pins and try to control them separately.
The Photon board has 8 digital I/O pins labeled as: D0, D1, D2, D3, D4, D5, D6, D7.
The D7 pin is also connected to a small, built-in blue LED light on the Photon board. Sending a digital output signal of HIGH to D7 will turn on the built-in D7 LED (and sending a signal of LOW turns it off). You can connect another part to the D7 pin, but just be aware that your Photon code might also turn the D7 LED on or off (only if you're using the D7 pin as a digital output for your other part).
The Photon board has several I/O pins with "special" labels, indicating they have special uses.
There are several analog and digital pins with special uses: SDA/D0, SCL/D1, SS/A2, SCK/A3, MISO/A4, MOSI/A5. However, all of these pins can be used as regular I/O pins. In your Photon code, you can just refer to these pins by their "regular" labels (D0, D1, A2, A3, A4, A5).
There are two pins labeled as RX and TX, which are normally used for receiving data (RX) or sending data (TX) data over a serial connection to a part. If needed, these pins can instead be used as regular I/O pins. In your Photon code, you would simply refer to these pins as RX and TX.
There are two pins labeled as WKP and DAC, which have special uses. If needed, these pins can instead be used as regular I/O pins. In your Photon code, you would refer to WKP as A6 and DAC as A7.
Some of the I/O pins are capable of PWM output. PWM stands for pulse-width modulation, which is how a digital output signal (which has only two values: HIGH or LOW) can act like an analog output signal (which has a range of values).
Certain parts (such as: speaker, servo motor, etc.) require a connection to a PWM output pin.
Only the following pins can act as PWM outputs: D0, D1, D2, D3, A4, A5, WKP, RX, TX.
The Photon board operates at 3.3 volts. Therefore, the voltage source from the I/O pins is 3.3 volts (regardless of whether the Photon is being powered by USB or battery). Again, many parts are powered directly from their I/O pin. However, some parts need a separate power source.
The 3.3V pin (+) on the Photon board can be used as a power source.
The V-USB pin (+) on the Photon board supplies 5 volts (which comes directly from the USB connection). This pin won't supply power if the USB is not connected.
The VIN pin (+) on the Photon board supplies power directly from the battery connected to the barrel jack. So connecting a 9V battery would provide 9 volts to the VIN pin (but still only supply 3.3V to the regular I/O pins). This pin won't supply power if a battery is not connected.
CAUTION: Some parts (such as OLED display, accelerometer, etc.) can only handle 3.3V and can be damaged if connected to a higher voltage. Check the power requirements of each part before connecting a part to either V-USB or VIN.
NOTE: Some parts (such as servo motor, motion sensor, etc.) require 5V in order to operate properly. These parts will have to be connected to either V-USB or VIN.
GROUND PINS
There are 3 separate ground pins on the Photon board, each labeled as GND. These act as the negative end of a circuit. All parts have to connect to a GND pin (either directly or through the breadboard).
The breadboard is an important part used to help make your circuits. The left and right halves of the breadboard are actually separate (which means they will not conduct electricity between each other). Within each half, the holes within the same row are connected to each other electrically, but each row is separate from the other rows. The rows are numbered (1-30), and holes within the same row are lettered (a-e for left-hand rows, f-j for right-hand rows).
In addition, each half of the breadboard has a power rail as its two outer columns (positive column and negative column). The power rails are not connected to the rows. The purpose of a power rail is to allow multiple parts (which will be attached to the breadboard rows) to share access to the positive and negative ends of your Photon device's power supply. Think of each power rail as a power strip.
The best way to try to understand how the breadboard conducts electricity is this image (on the right) that shows the metal strips embedded inside the breadboard:
When a jumper wire is inserted into a breadboard hole, it makes contact with the metal strip underneath. Any wires or parts that are connected to the same metal strip are therefore connected electrically to each other. As the picture above shows, there are separate rows of metal strips on the left side and the right side.
The red arrows in the image are pointing to the metal strips under the power rails. Again, think of these two power rails as two power strips. Once you plug a power rail into a power supply (by connecting it to the Photon board), you can plug other parts into the power rail.
In order to "plug in" a power rail, you have to connect a jumper wire from a voltage source (+) on the Photon board (such as the 3.3V pin) to any hole in the positive (+) column of the power rail. Then connect a second jumper wire from any hole in the negative (-) column of the power rail back to one of the GND (-) pins on the Photon board. Now if a part on the breadboard needs access to voltage (+) or GND (-), you can connect a jumper wire between a hole in that part's corresponding row and any hole in the appropriate power rail column (either + or -).
Depending on which parts are being connected, it may be necessary to only activate and use the negative (-) power rail. This is because every part needs to connect back to GND on the Photon board (and there are only 3 GND pins available). Since many parts use a digital or analog pin as their voltage source (+), sometimes it might not be necessary to activate and use a positive (+) power rail.
The fact that there are two power rails can be helpful if you have certain parts that need a lower voltage (such as 3.3V) while other parts need a higher voltage (such as 5V). You can supply these different parts with their appropriate voltage by connecting them to the correct power rail.
If necessary, you can even "plug in" one power rail to the Photon board, and then connect the second power rail to the first power rail.
Here's how you can determine whether you need to connect one or more power rails on the breadboard:
If you have only have 1-3 parts to connect, then you can choose to connect each part to a separate GND pin using a jumper wire. However, it's actually a good habit to instead connect the negative power rail because it makes it easier if you decide later to add more parts to your device.
Otherwise, use a jumper wire to connect one of the negative power rails on the breadboard to a GND pin on the Photon board. Then connect each part’s GND wire (or resistor) into this negative power rail.
If there is one (and only one) part requiring 3.3V, then connect that part directly to the 3.3V pin on the Photon board.
If there are multiple parts requiring 3.3V, then use a jumper wire to connect one of the positive power rails on the breadboard to the 3.3V pin on the Photon board. Then connect each part’s 3.3V wire into this positive power rail.
If there is one (and only one) part requiring 5V, then connect that part directly to the V-USB pin (5V) on the Photon board.
If there are multiple parts requiring 5V, then use a jumper wire to connect one of the positive power rails on the breadboard to the V-USB pin (5V) on the Photon board. (If you already connected one positive power rail to 3.3V, then connect the second positive power rail to V-USB). Then connect each part’s 5V wire into this positive power rail.
If there are no parts requiring 3.3V or 5V, then do not connect a positive power rail (because all the parts will receive power from their I/O pins). However, you will still use the negative power rail for the GND wires.
Parts have to be arranged so their pins are in their own breadboard rows (which are numbered):
Pins from different parts should not be in the same row. For example, a push button and LED would not share the same rows.
Different pins from the same part should not be in the same row. For example, the Micro OLED display has 8 pins, and each of these pins must be in a different row on the breadboard.
Resistors are the only exception to this rule: a resistor is supposed to share a row with a pin of another part (such as LED, etc.).
Parts should be arranged in a logical layout that makes it easy to understand and use the device:
Place as many of the jumper wires as possible on the side of the breadboard closest to the Photon board, so the wires don't block parts that need to be seen or interacted with.