Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!

Page created by Timothy Burgess
 
CONTINUE READING
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
introduction to
Digital
Electronics
Install the Arduino IDE on your
laptop if you haven’t already!
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Electronics can add interactivity!

Any sufficiently advanced technology is indistinguishable from magic
- Arthur Clark.
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Electronics can add interactivity!

Any sufficiently well executed technology is indistinguishable from magic
in the eyes of kids!
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Electronics can be complex
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Avoid unnecessary complexity!
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Let’s look at a circuit!

            +
  Battery                  Light Bulb
            -
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Let’s look at a circuit!

               +
    Battery                  Light Bulb
Power Source   -            Load
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Let’s look at a circuit!

               +
    Battery             Resistor
Power Source   -         Load
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Let’s look at a circuit!

                      +
               5v
    Battery                                Resistor
                                 330Ω
Power Source          -                     Load

V = IR                                  5 = I • 330
 Voltage = Current × Resistance         Current ≈0.015A
   Volts       Amps       Ohms
Digital Electronics introduction to - Install the Arduino IDE on your laptop if you haven't already!
Let’s look at a circuit!

            +
       5v
                 330Ω
            -
Let’s look at a circuit!

            +
       5v

       0v        330Ω
            -
Let’s look at a circuit!

            +
       5v

       0v        330Ω
            -
Let’s look at a circuit!

           +              5v   V1

                  330Ω    0v   Vref
           -

         V1 - Vref = IR
Let’s look at a circuit!

            +
       5v

       0v        330Ω
            -
Let’s look at a circuit!
  5v

             5v
                  +
 330Ω                 330Ω
             0v
                  -

  0v
Let’s look at a circuit!
  5v

 330Ω

  0v
Time for some LIGHT!
  5v

330Ω
                  LED
               Light Emitting Diode

  0v
Time for some LIGHT!
  5v

330Ω

       +
       -
                                         LED
                       +-             Light Emitting Diode
                Longer is positive!

  0v
           Diodes conducts current primarily in one direction
                                              Needs resistor!
Time for some LIGHT!
  5v

330Ω

                                 LED
               +-             Light Emitting Diode
        Longer is positive!
  0v
Now in real life!
  5v
            Power Rails

 330Ω

  0v
Now in real life!
  5v
            Power Rails

 330Ω

  0v
Now in real life!
  5v
            Power Rails

 330Ω

  0v
Now in real life!
  5v

 330Ω

  0v
Now in real life!
  5v

 330Ω

  0v
Add in a switch!
  5v

330Ω

        Bonus Extra Challenge!

  0v
A closer look…
  5v    VCC (also Vdd,Vhigh)
                                         V2 - VGND = 1.4V
        Voltage Common Collector
        (usually your power supply!)
330Ω
       V2

              LED Forward Voltage Drop
              ≈1.4V     ≈0Ω
              Components
              have rules!
  0v   VGND
A closer look…
                                               V2 = 1.4V
  5v    VCC (also Vdd,Vhigh)
        Voltage Common Collector
                                         VCC - V2 = I • R
        (usually your power supply!)      5 - 1.4 = I • 330
330Ω
                                                I ≈ 10 mA
       V2
                                           Datasheets!
              LED Forward Voltage Drop
              ≈1.4V     ≈0Ω
              Components
              have rules!
  0v   VGND
A closer look…
  5v     VCC

330Ω
        V2

  0v    VGND

  I ≈ 10 mA
A closer look…
  5v     VCC      5v    VCC

330Ω
        V2                LED Max Current
                          ≈20mA

                              V = IR
  0v    VGND      0v   VGND

  I ≈ 10 mA    I ≈ BIG NUMBER
Digital vs Analog Circuits
Analog Circuits
Range of voltages
Usually requires math!

Digital Circuits
Usually 2 distinct voltages (high & low)
5v and 0v (roughly)
01100101011011010110000101101001
01101100011101010111001101100010
01101001011101000111001100100001
Using your Arduino!

               A Microcontroller
               .. or a small computer!
               Has inputs and outputs you can control

                                            Teensy

 Arduino Uno           Arduino Nano
Blink!

         - +
Advanced Blink!
                 +
                                Try making
                         R- -   the colors
                           -
                         +GB     alternate!
             -   -   -

                 - +
Pulse Width Modulation
PWM!                        5v

                                                       50% Duty Cycle
Digital is only 0v or 5v,
                            0v
so how do we get
                                 50% of the time on,
values in between?               50% of the time off

LEDs can only be in 2
states- on or off!          5v
                                                       90% Duty Cycle
PWM to make the LED
seem ‘dimmer’               0v

                                 90% of the time on,
                                 10% of the time off
PWM
Pins marked ~ can use PWM
Servo and Moving Parts
Rotary actuator that
allows for precise
control of position
Arduino friendly!
Built-in Library
0-180 Degrees

       SIGNAL (Pin 6)
       POWER (5V)
       GND
Continuous Rotation Servo
Simple ‘motors’
Don’t allow you to specify
the exact location, but can
rotate CCW or CW at
different speeds.
0 -180 Degrees becomes:
CCW full speed,
stationary,
CW full speed
Button Inputs

Arduino
                    What does the Arduino
                    sense when it’s not
                    connected to GND?
 Digital Pin 8      Value is floating!
                    Pull up resistor!
Button Inputs

                 5v
                      Solution to prevent
Arduino               floating input sensor
                      - pull up resistor!

 Digital Pin 8
Button Inputs

                 No longer need the
Arduino          external pull up resistor
                 when specified in code

 Digital Pin 8
Button Inputs

Arduino

 Digital Pin 8
LED strips
A strip of LEDs
Individually Addressable
LED strips!
Objectively pretty neat!
Integrated Circuit & I2C
communication
ws2812b RGB LED
Run on 5v and can be controlled
with an Arduino!
Watch out for current!
Each color ~ 15mA, total 50mA
on ‘white’.
Arduino max current ~1A
Individually Addressable
LED strips!
Can be individually
powered (can consume
a lot of power. Use
rechargeable batteries!)
Connectors to help you
split your LED strips
into multiple lengths!
Wrap-up!
… wrapping up wires!

Use these to tidy up your wire runs!
Wrap-up!
All the parts today actually came
from Amazon. Other places you
can order electronic parts from:
- Adafruit
- Jameco
- Digikey
Take anything you’d like to keep
with you (you can use these on
your toys/sketch models)
Any cables you don’t need/don’t
wish to keep, leave them on the
table and we’ll collect them.
introduction to
Digital
Electronics
You can also read