Basic Electronics


By Prof. Seungchul Lee
http://iai.postech.ac.kr/
Industrial AI Lab at POSTECH

Table of Contents

1. Basic Circuit Theory

1.1. Ohm's Law

Ohm's law states that the current through a conductor between two points is directly proportional to the voltage across the two points. Introducing the constant of proportionality, the resistance, one arrives at the usual mathematical equation that describes this relationship

$$I = \frac{V}{R} \ \ \ \ \text{or} \ \ \ \ V = IR$$

where $V$ is the voltage, $I$ is the current, and $R$ is the resistance.

  • Resistor power rating

    • The larger the power rating, the greater the physical size of the resistor to dissipate the heat
    • All resistors have a maximum power rating and if exceeded will result in the resistor overheating and becoming damaged
    • The power rating of resistors can be calculated using the formula

      $$\text{Power} \ (P) \ = \ V \cdot I \ = \ I^2R \ = \ \frac{V^2}{R}$$


  • Resistors in series

    • The total resistance $R_{tot}$ of the resistors in series is

      $$R_{tot} = R_{1} + R_{2} + R_{3} + \cdot \cdot \cdot + R_{n}$$

    • Series connected resistors have a common current flowing through them

    • The total resistance of a series connected circuit will always be greater than the highest value resistor
    • Total circuit voltage is equal to the sum of all the individual voltage drops


  • Resistors in parallel

    • The total resistance $R_{tot}$ of the resistors in parallel is

      $$\frac{1}{R_{tot}} = \frac{1}{R_{1}} + \frac{1}{R_{2}} + \frac{1}{R_{3}} + \cdot \cdot \cdot + \frac{1}{R_{n}}$$

    • Parallel resistors have a common voltage across them

    • The total resistance of a parallel circuit will always be less than the value of the smallest resistor
    • Total circuit current flow is equal to the sum of all the individual branch currents added together


1.2. Voltage Divider

For voltage dividers, the output voltage can be expressed as the following

$$V_{out} = \frac{R_{2}}{R_{1}+R_{2}}\cdot V_{in}$$


2. Electronic Components

Reference: https://itp.nyu.edu/physcomp/labs/labs-electronics/components/

2.1. Breadboard

  • Breadboards are reusable prototyping tools for electronics that allow you to build and experiment
  • For columns 'a' to 'j', each row is connected
    • The numbers indicate that each row is connected
    • The line in the middle indicates that the left and right side of the board are not connected with each other
  • Each column is connected for the columns denoted by '+' and '-'

2.2. LED

<img src = "./image_files/leds1.jpg" style="border:1px solid black", width =400>

  • LEDs are diodes that emit light when given the correct voltage
  • Most common LEDs run at 5 volts, thus a resistor between 220 and 1K ohms is sufficient
  • Only operate when oriented correctly in the circuit, due to the fact that they are polarized
    • Anode of the LED connects to voltage (Longer leg)
    • Cathode connects to ground (Shorter leg)

2.3. Resistor

  • Resistors resist the flow of electrical current
  • When placed in series, they reduce the voltage, and limit the current
  • The bands on a resistor indicate the resistor’s value
    • 4 Band Resistor Color Code

https://physics.ucsd.edu/neurophysics/courses/physics_120/resistorcharts.pdf

  • Graphical Resistor Calculator

http://www.dannyg.com/examples/res2/resistor.htm

2.4. Potentiometer

  • The potentiometer is a three-terminal mechanically operated rotary analogue device which can be found and used in a large variety of electrical and electronic circuits
  • Potentiometers are devices that function in exactly the same way in that their output resistance value can be changed or varied by the movement of a mechanical contact or wiper given by some external action
  • The two outside terminals act as a fixed resistor, while the moveable contact moves across the resistor
  • Example 1: Potentiometer

2.5. Switches (Buttons)

  • Switches are one form of digital input
  • Momentary switches, also known as buttons, remain closed only when you press them
  • Closing the switch completes the circuit
  • Voltage on both terminals is identical when switch is closed

2.6. Photocell

  • Photocells are variable resistors whose resistance changes as the light hitting them changes
  • Can measure light by measureing the resistance change

2.7. Thermistors

  • Thermistors are variable resistors whose resistance changes as the temperature changes
  • Inexpensive, and accurate components that make it easy to get temperature readings

2.8. Capacitors

  • Capacitors store electrical energy while there’s energy coming in, and release it when the incoming energy stops
  • Out of its many usages, one common use is to smooth out the dips and spikes in an electrical supply

2.9. Transistors

  • Transistors act as electronic switches
  • When a small voltage is applied across the base and emitter, the transistor allows a larger current and voltage to flow from the collector to the emitter

2.10. DC Motor

  • DC motors utilize induction (an electromagnetic field generated by current flowing through a wire coil) to rotate a central shaft
  • The direction that the shaft rotates can be reversed by reversing the leads powering it

2.11. Servo Motor

  • A servo motor is paired with an encoder (e.g. an Arduino) to provide position/speed readings and control messages in a feedback loop
  • This loop is used to precisely control of the servo’s degree of rotation

2.12. H-Bridge

  • An H bridge is an electronic circuit that enables a voltage to be applied across a load in either direction
  • They are often used to control the direction of DC motors

3. Arduino Basics

https://learn.sparkfun.com/tutorials/what-is-an-arduino


What is an Arduino

  • Arduino is an open-source platform used for building electronics projects
  • Arduino consists of both a physical programmable circuit board (often referred to as a microcontroller) and a piece of software, or IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board


What can it do

  • Arduino can interact with buttons, LEDs, motors, speakers, GPS units, cameras, the internet, smart-phones, or TVs
  • This flexibility combined with the fact that the Arduino software is free, the hardware boards are pretty cheap, and both the software and hardware are easy to learn has led to a large community of users who have contributed code and released instructions for a huge variety of Arduino-based projects

  • For everything from robots and a heating pad hand warming blanket to honest fortune-telling machines, and even a Dungeons and Dragons dice-throwing gauntlet, the Arduino can be used as the brains behind almost any electronics project


What is on the board

  • The Arduino Uno will be used for practice in class
    • The image above shows a general description of the Arduino Uno module


Getting Started

  • Go to www.arduino.cc to download the latest version of the Arduino software (Direct link: http://arduino.cc/en/Main/Software and select your operating system; in this case we are using Windows)

  • Download either the installer version or ZIP version for non admin install

  • Launch the Arduino software by double-clicking the Arduino icon


Arduino Software Interface

After the installation process is finished and the Arduino is running, you will find a white screen with different shades of green.



The main headings are “File” “Edit” “Sketch” “Tools” “Help” and several shortcut icons beneath “Verify”, “Upload”, “New”, “Open”, “Save”, and at the far right, the “Serial Monitor”. Note that all these icons are also available from the main menus.



In the software, select “Tools” $\rightarrow$ “Board” $\rightarrow$ You will get a list of possible boards. If you have a different board, select it from the drop-down list; Arduino/Genuino Uno should be selected.



In the software, select “Tools” -> “Serial Port” -> COM # (note that if you have several COM ports, you will need to go to Device Manager to see which COM port is assigned to your board. Once the whole process is finished, you’re now ready to start coding!

In [1]:
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')