How to avoid catching things on fire. Electronics 101 How to avoid catching things on fire.
Bread Boards
Connect a Blue LED to pin D7 and a Red LED to pin D0
Your Photon's Pins Voltage Input (also USB power) ground serial communication wake up Digital - Analog Conversion Analog Input and Output 3.3 Volts output reset (when grounded) battery input ground built-in LED digital input and output
Voltage, Current, Resistance amount of electrons moving through the circuit Measured in Amps (A) Represented by “I” in equations Voltage Amount of push Measured in Volts (V) Resistance Amount of resistance Measured in Ohms (Ω) V = I * R Ohm’s Law
Voltage, Current, Resistance Particle Photon Input Voltage micro USB – 4.8 Volts or the VIN pin – between 3.3 and 5.8 VDC (VDC = volts direct current) Current Consumption 80mA when WiFi is on ( 80mA = 80 milli Amps = 80/1000 of an Amp) Output Voltage 3.3 Volts (3V3) Output Current 25mA per pin 250mA total
Voltage, Current, Resistance Short Circuits Remember : Current = Voltage / Resistance What happens to Current if Voltage remains 3.3, but Resistance goes very low? Amps = 3.3V / Ohms
LEDs -- Light Emitting Diode LEDs create almost no resistance, so you must use a resistor with an LED Without a resistor, the current would spike and burnout the LED and perhaps damage the controller unit The resistor can be placed before or after the LED Long wire goes to positive Short wire to negative or ground LED Varieties: 5mm, 8mm Diffuse, not diffuse IR RGB
Resistors
Pull Up Resistor Bad Bad Design: Everyone will use this. Bad Bad Design: When the button is pressed, the pin will go low. But when the button is not pressed, the pin floats. We need to "pull" the pin high when the button is open. We need a resistor to prevent a short. The standard is 10kΩ So commonly used that your Photon has Pull Up resistors built in on all input pins. Good pinMode(D5, INPUT_PULLUP); // Enable internal pull-up resistor on pin D5
Pull Up Resistor Example These break sensors and door sensors are "normally open" switches. they work just like buttons To get reliable input, we must use a pull-up resistor. Opening the door opens the switch, which causes the pin to go to HIGH. Closing the door closes the switch, so power goes LOW. Closed = Low Open = High
Pull Up Resistor Example Turn on an LED when the door is open. Breadboard: connect one sensor wire to ground other sensor wire to an input pin, like A4 Code: void setup() { pinMode (D7, OUTPUT); // built-in LED pinMode (A4, INPUT_PULLUP); // input pin } void loop() int value; // value from sensor value = digitalRead(A4); // read input pin digitalWrite (D7, value); // turn LED on or off
DAC and ADC Digital to Analog Analog to Digital Example: Probably not necessary, because your Photon has both Digital and Analog inputs and outputs. Digital to Analog Example: Control the speed of a motor. You send the DAC chip a number from 0 to 255 and it outputs a voltage from 0 to 9 volts to make the motor speed up or slow down. Analog to Digital Input voltage from a light dimmer switch and convert the value into a number.
Not many projects will use this. N Channel MOSFET Problem : Suppose you need to turn 12 Volts on and off for a fan motor or a long string of LEDs Your Photon only outputs 3.3 volts 12V would fry your Photon Solution : Use a MOSFET as a switch one pin on the MOSFET (gate or base pin) connects to an output pin on your Photon turn the Photon pin on and off to turn the 12V on and off two other pins on MOSFET (drain and source) go in your 12V circuit Be Careful : Read a tutorial before wiring. Size determines Voltage and Amps. They get hot! The 12V ground and the Photon ground must be connected.
Capacitors Electric Storage Device Measured in Micro Farads Uses: A few projects will use this. Electric Storage Device Measured in Micro Farads Uses: Smooth out a power supply Smooth signal noise
Digital Display Boards Necessary when using Digital Display Boards I2C
De-Multiplexer Multiplexer is the opposite. Extremely unlikely you will need this. Suppose you want to turn on 1 of 8 different LEDs, but don’t want to use 8 different Output Pins. Sending 000 to the chip turns on its output pin 0. Sending 001 turns on its pin 1. … Sending 111 turns on pin 7. Multiplexer is the opposite. 8 input pins and 3 output pins.
Questions?