# Differences

This shows you the differences between two versions of the page.

iot:res:electronics [2015/06/21 23:15]
iot:res:electronics [2015/06/22 01:50] (current)
Line 1: Line 1:
===== Electronics ===== ===== Electronics =====
+You are going to build IoT projects Edison. However, the board is only a part of the projects, it does all the computing, but you also need I/O devices that you will connect to them. The devices are mainly sensors, LEDs and LCDs. In order to correctly connect the peripherals,​ you need to be acquainted to basic electronics notions, otherwise, you risk to burn the I/O devices and even the boards.
+==== Ohm's Law ====
+The Ohm's law states that in a circuit the current (I) is directly proportional to the applied voltage (U) and inversely proportional to the resistance (R) of the circuit.\\
+**I=U/R**\\
+==== Kirchhoff'​s Circuit Laws ====
+Before you state the two laws, you need to understand the following notions:
+  *  junction/​node - the place where at least three conducting branches meet
+  *  loop - a closed path, including at least two nodes
+==== Kirchhoff'​s First Law====
+Kirchhoff'​s First Law states that in a node, the sum of the currents is 0.
+{{ :​iot:​res:​k1.png?​100 |}}
+Please keep in mind that currents have directions. Currents incoming have negative values, while currents outgoing have positive values.
+====Kirchhoff'​s Second Law====
+Kirchhoff'​s Second Law states that the sum of the voltage in a circuit loop is equal to the power source voltage.
+{{ :​iot:​res:​k2.png?​100 |}}
+Example:
+{{ :​iot:​res:​second_law.png?​300 |}}
+
+You have a 3V source and three resistors of different resistance. The sum of voltage drops on each of them is equal to the source voltage.
+R1 + R2 + R3 = VCC1 => 0.25v + 1.25v + 1.5v = 3v
+==== LED ====
+This chapter explains how to correctly connect an LED to a board.
+First of all, you need to know what a diode is.
+//A diode// is an electronic component that has a positive and a negative side and it basically allows the current to flow only in one direction, from positive to negative.
+//The LED// is also a diode. When current is flowing through the LED, it lights up. So in order to light up an LED you need to put the high voltage at the anode and the low voltage at the cathode.\par
+=== Schematics ===
+
+Taking into account the theory stated previously, you would build a circuit like the one in figure \ref{fig:​led_circuit-short} to light up an LED.
+{{ :​iot:​res:​led_circuit-short.png?​300 |}}
+
+You must take into account that the power source depicted will be replaced in the projects you are going to build with the Edison.
+
+There is only one tiny problem with the schematics in the figure it is a short circuit. That means there is no resistance to limit the current because the diode does not have any resistance at all. It just allows the current to flow. That can cause big problems (you can damage your board, for example). To fix this, you need a resistor to limit the current flow.
+{{ :​iot:​res:​led_circuit.png?​300 |}}
+====Button ====
+
+This chapter explains how to correctly connect a button to a board.
+A button, also called a switch, is an electric component that can break an electrical circuit by interrupting the current.
+When used in schematics, there are multiple possible symbols to depict it.
+{{ :​iot:​res:​button_depict.png?​100 |}}
+{{ :​iot:​res:​toggle_switch.jpg?​200 |}}
+Also, the figure depicts an example of circuit that uses a switch.
+{{ :​iot:​res:​button_example.png?​300 |}}
+
+When the button is pressed, it acts like a wire and it will let the current flow through the circuit. If the button is not pressed, the circuit is interrupted.
+When a button is connected to a board, you can tell if the button was pressed by looking at the pin's value.
+Let's see how you can connect a button to the Edison board. The first possibility would be the one in the next figure, but it is //wrong//.
+{{ :​iot:​res:​button_first_wrong.png?​300 |}}
+
+Why is it wrong? If the button is pressed, everything works fine. The value of pin would be HIGH and you can say “Yes, the button is definitely pressed”. But what happens when the button is off? It is important to know that a logic level can be: LOW (or 0), HIGH (or 1) and also UNKNOWN (or high impedance). When the button is not pressed you cannot say for sure what logical level the pin has: it could be 0 as well as 1 because the wire is not connected neither to Ground nor to a power supply.
+Let's give it another try.
+{{ :​iot:​res:​button_second_wrong.png?​300 |}}
+This figure is also incorrect. When the switch is off the button'​s pin value is HIGH. The big problem appears when the button is pressed. It will create a short circuit: the ground is directly connected to VCC which is very bad because you do not have any resistor and the electric current is not limited.
+The correct way to connect a button to a board is presented in the next figure.
+{{ :​iot:​res:​button_correct.png?​300 |}}
+
+This time you will not have a short circuit because if the button is pressed there is the R resistor. The R resistor is called a //pull up resistor// and the whole system is called a //voltage divider//. If the button is pressed our pin's value will be LOW.
+
+You can also connect the resistor to the Ground. Now you have a pull-down resistor and the pin's value will be HIGH when the button is pressed and low otherwise.
+
+====Safety Instructions ====
+
+Whenever you connect anything to your board you must assure that the it is not powered up. Otherwise you might accidentally create a short-circuit and burn the board.
+Only after you assured that everything is correctly connected, you may safely power it up.