![Page 1: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/1.jpg)
introduction to Digital ElectronicsInstall the Arduino IDE 1.8.5 on your laptop if you haven’t already!
![Page 2: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/2.jpg)
Electronics can add interactivity!
Any sufficiently advanced technology is indistinguishable from magic- Arthur Clark.
![Page 3: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/3.jpg)
Electronics can add interactivity!
Any sufficiently well executed technology is indistinguishable from magic- in the eyes of kids!
![Page 4: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/4.jpg)
Electronics can be complex
![Page 5: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/5.jpg)
Electronics can be complex
![Page 6: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/6.jpg)
Avoid unnecessary complexity!
![Page 7: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/7.jpg)
Let’s look at a circuit!
Light BulbBattery+
-
![Page 8: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/8.jpg)
Let’s look at a circuit!
Light BulbBattery+
- LoadPower Source
![Page 9: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/9.jpg)
Let’s look at a circuit!
ResistorBattery+
- LoadPower Source
![Page 10: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/10.jpg)
Let’s look at a circuit!
ResistorBattery+
- LoadPower Source
5v330Ω
V = IRVoltage = Current × Resistance
5 = I • 330Current ≈0.015A
Volts Amps Ohms
![Page 11: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/11.jpg)
Let’s look at a circuit!
+
-
5v330Ω
![Page 12: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/12.jpg)
Let’s look at a circuit!
+
-
5v330Ω0v
![Page 13: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/13.jpg)
Let’s look at a circuit!
+
-
5v330Ω0v
![Page 14: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/14.jpg)
Let’s look at a circuit!
+
-
5v
330Ω 0v
V1
Vref
V1 - Vref = IR
![Page 15: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/15.jpg)
Let’s look at a circuit!
+
-
5v330Ω0v
![Page 16: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/16.jpg)
Let’s look at a circuit!
+
-330Ω
5v
0v
330Ω5v
0v
![Page 17: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/17.jpg)
Let’s look at a circuit!5v
0v
330Ω
![Page 18: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/18.jpg)
Time for some LIGHT!5v
0v
330ΩLED
Light Emitting Diode
![Page 19: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/19.jpg)
5v
0v
330Ω
Time for some LIGHT!
LEDLight Emitting Diode+ -
Longer is positive!
+
-
Diodes conducts current primarily in one directionNeeds resistor!
![Page 20: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/20.jpg)
5v
0v
330Ω
Time for some LIGHT!
LEDLight Emitting Diode+ -
Longer is positive!
![Page 21: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/21.jpg)
5v
0v
330Ω
Now in real life!Power Rails
![Page 22: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/22.jpg)
5v
0v
330Ω
Now in real life!Power Rails
![Page 23: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/23.jpg)
5v
0v
330Ω
Now in real life!Power Rails
![Page 24: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/24.jpg)
5v
0v
330Ω
Now in real life!
![Page 25: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/25.jpg)
5v
0v
330Ω
Now in real life!
![Page 26: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/26.jpg)
5v
0v
330Ω
Now in real life!
Momentary Switch
![Page 27: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/27.jpg)
5v
0v
330Ω
Modify your circuit
![Page 28: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/28.jpg)
5v
0v
330Ω
A closer look…
V2
≈1.4VLED Forward Voltage Drop
V2 - VGND = 1.4V
VGND
VCC (also Vdd, Vhigh)
Voltage Common Collector(usually your power supply!)
Components have rules!≈0Ω
![Page 29: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/29.jpg)
5v
0v
330Ω
A closer look…
V2
≈1.4VLED Forward Voltage Drop
V2 = 1.4VVCC - V2 = I • R
VGND
VCC (also Vdd, Vhigh)
Voltage Common Collector(usually your power supply!)
5 - 1.4 = I • 330I ≈ 10 mA
Components have rules!≈0Ω
![Page 30: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/30.jpg)
5v
0v
330Ω
A closer look…
I ≈ 10 mA
VGND
VCC
V2
![Page 31: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/31.jpg)
5v
0v
330Ω
A closer look…
I ≈ 10 mA
5v
0v
I ≈ BIG NUMBER
VGND
VCC
VGND
VCC
V2
≈20mALED Max Current
V = IR
![Page 32: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/32.jpg)
Digital vs Analog CircuitsAnalog CircuitsRange of voltagesUsually requires math!
Digital CircuitsUsually 2 distinct voltages (high & low)5v and 0v (roughly)0110100001101001…
![Page 33: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/33.jpg)
Using your Arduino!
A Microcontroller.. or a small computer!Has inputs and outputs you can control
Teensy
Arduino NanoArduino Uno
![Page 34: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/34.jpg)
Using your Arduino!
+-
![Page 35: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/35.jpg)
Blink!
+-
![Page 36: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/36.jpg)
Blink!
+-
+R
G B
Try making the colors alternate!
-- -
![Page 37: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/37.jpg)
Pulse Width Modulation
PWM!
Digital is only 0v or 5v, so how do we get values in between?
LEDs can only be in 2 states- on or off!
PWM to make the LED seem ‘dimmer’
50% Duty Cycle
50% of the time on, 50% of the time off
5v
0v
90% Duty Cycle
90% of the time on, 10% of the time off
5v
0v
![Page 38: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/38.jpg)
PWM
Pins marked ~ can use PWM
![Page 39: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/39.jpg)
Servo and Moving Parts
Rotary actuator that allows for precise control of linear position
Arduino friendly!
Built-in Library
GND
SIGNAL (Pin 6)POWER (5V)
![Page 40: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/40.jpg)
Button Inputs
Arduino
Digital Pin 8
Big resistor!> 1kΩ
What does the Arduino sense when it’s not connected to GND?
Value is floating!
Pull up resistor!
5v
![Page 41: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/41.jpg)
Button Inputs
Arduino
Digital Pin 8
5v
![Page 42: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/42.jpg)
Button Inputs
Arduino
Digital Pin 8
![Page 43: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/43.jpg)
Button Inputs
Arduino
Digital Pin 8
![Page 44: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/44.jpg)
LED stripsA strip of LEDs
![Page 45: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/45.jpg)
Individually Addressable LED strips!Objectively pretty neat!
Integrated Circuit & I2C communication
ws2812 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
![Page 46: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/46.jpg)
Projects for you to tryMedium:Easy:
Servo Steering
One button turns the servo 90 clockwise, the other turns the servo 90 counterclockwise!
Light Switch
Pressing a button turns the light on. Pressing the button again turns the light off!
Color Mixer
Have 3 buttons that control the colors of a single RGB LED. Depends on which button is pressed, the light shows a different color!
Random Traffic Lights
Have a RGB LED change to a random color every couple of seconds!
Challenging
Night Light
Using a photodiode, make a light turn on only when it’s dark!
Reflex Game
Make a simple reflex game out of 1 LED and 1 Button. When the light turns on, see how fast you can press the button. Make a simple scoreboard using the WS2812 Lights!
![Page 47: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/47.jpg)
To be Continued…Electronics Part II!
Communication
Wireless
Perf boards
Soldering
And more!
Take anything you’d like to keep with you (you can use these on your toys/sketch models)
![Page 48: introduction to Digital Electronicsweb.mit.edu/2.00b/www/lectures/2018_electronics1_handout.pdfIndividually Addressable LED strips! Objectively pretty neat! Integrated Circuit & I2C](https://reader036.vdocuments.site/reader036/viewer/2022081521/5b254c3f7f8b9a554c8b5afd/html5/thumbnails/48.jpg)
introduction to Digital Electronics