Prof. Andy Khong Rachel Fong Li Xuan Law Cai Jin Shilpa ... · Prof. Andy Khong Rachel Fong Li Xuan...

Post on 16-Feb-2020

2 views 0 download

Transcript of Prof. Andy Khong Rachel Fong Li Xuan Law Cai Jin Shilpa ... · Prof. Andy Khong Rachel Fong Li Xuan...

1

Prof. Andy Khong Rachel Fong Li Xuan Law Cai Jin Shilpa Manandhar Soumyabrata Dev Assistant Chair (Outreach) Assistant Manager (Outreach) Sr. Assistant Manager (Outreach) PhD Student PhD Student

2

2014 Nobel Prize for Physics

Nobel prize is meant to reward inventions of greatest benefit to mankind

A trio of scientist was awarded for their invention of efficient blue light-emitting diodes (LEDs)

1. Highly energy-efficient white LED lamps contributes to saving the earth’s resources

2. Without blue LEDs, our smart devices wouldn’t have backlit liquid crystal display screens (LCD), which are built with LEDs.

3. Providing light to people without electricity by using solar-powered LEDs

4. Sterilizing polluted water using ultraviolet LEDs, made possibly by blue LEDs

3

Significance

4

Incandescent Bulb Compact Fluorescent LED

60 watts 14 watts 10 watts

1,200 hours 10,000 hours 50,000 hours

Advantages of LED • No warm up period required : Light up instantly in nanoseconds • Controllable: Brightness and colour • Environmental Friendly: Does not contain mercury or other hazardous

substances • Long lifetime : 50,000 hours

5

LED Cube

3D Animation: INFORMATION

ENG. & MEDIA

Transistors:

ELECTRONICS

Micro-controller:

COMPUTER ENG.

LEDs:

PHOTONICS

Electrical Circuit:

CIRCUIT DESIGN

Programming:

SOFTWARE ENG.

6

Analogy

Programming Codes

Upload

Arduino Microcontroller

= =

Conductor Music Score =

LED Animation

Direct

Performance

7

3

2

1

BUILD LED CUBE Hardware testing

LED ANIMATIONS Programming on Arduino

BUILD LED CUBE Soldering of LED panels Solder panels to PCB

INTRODUCTION Components Circuit design

HANDS-ON Set up Arduino board Breadboard

8

Components

LED Resistor Transistor

Arduino Breadboard

9

Diodes

Forward Bias: Allows current to flow from Anode to Cathode Reverse Bias: Current is blocked which results in no flow of electricity in the circuit When current is flowing through a diode,

Vanode > V cathode

A diode with arrows representing light emitted. Conditions for LED to work: 1. Has to be oriented properly ( this is called polarity) 2. Vanode > V cathode typically between 1.4 to 3.5 V.

10

Light-Emitting Diode (LED)

Typical current of 10 to 20 mA. The higher the current, the brighter the LED.

11

Top view Side view

Anode or Cathode?

Test your LED

Diode Test

12

Anode Cathode

13

Resistor

Do not directly connect an LED to power source LEDs can be damaged by high current. Resistor is added in the circuit to limit current flowing through the LED.

An electrical component that limits or regulates the flow of electrical current in an electronic circuit.

14

How to get resistance value?

Colour Coding Table

Measure Resistance

How much is the resistance value?

Digital Multimeter

100Ω with ± 5% tolerance

How to light up the LED?

If Vcc = 5 V, what should be the resistance R for a LED current of I = 10 mA?

15

Vcc=5V

I=10mA

+

-

How to light up the LED?

Ohm’s Law: V=IR

Vcc=VLED+IR

R=(Vcc-VLED)/I

16

Calculate R for LED Color VLED(V) R (Ω)

2.00 300

1.98 302

3.24 176

3.06 194

Vcc=5V

I=10mA

+

-

In our LED cube, the BJTs are acting as switches, either enabling or disabling the corresponding layers of LEDs to be lighted up.

Bipolar Junction Transistors (BJT)

17

3 Pins Collector (C) Base (B) Emitter (E)

Microcontroller

1x USB port to talk to the computer, double as power supply; 1x dedicated power port, for use without computer; 14x digital input/output pins (D0 - D13) 6x analog input pins (A0 - A5, double as digital outputs if needed) Power and Reference pins 18

19

How LED cube works

Only 20 usable pins to control LEDs We have 4x4x4=64 LEDs in the cube

How to control 64 LEDs with only 20 output pins?

A0-A5

D0-D13

20

Anode

Layer 1

Layer 2

Layer 3

Layer 4

Cathode

21

Anode

Layer 1

Layer 2

Layer 3

Layer 4

Cathode

22

Layer 1

Layer 2

Layer 3

Layer 4

Cathode

Anode

23

Anode

Layer 1

Layer 2

Layer 3

Layer 4

Cathode

24

Main Concepts

Persistence of vision (POV) Optical illusion that tricks our human eyes By flashing a LED really fast, the image will remain

on the retina for a short time(approx. 0.04s) E.g. Flipbook

Temporal Multiplexing Time Division Multiplexing (TDM) Transmit and receive independent signals over a

common signal path Use transistors to turn on each layer at a different

time frame By flashing each layer of the LED one after another

real fast, it gives a optical illusion of a 3D image

Steps:

1. Build circuit

2. Connect A2 pin(5V) or GND(0V) to Vin

How does it work?

1. To turn on LED, Vin = 5V

2. Set Pin x at 0 or 5V to turn off or on the respective LED

(100-400 ohm)

25

Vin Vin=5V, Close

Vin=0V, Open C E

C E

26 Electrical connections of a breadboard

Breadboard To build and test circuits before finalizing any circuit design

27

- Cathode + Anode

Vin

Vin=5V, Close

Vin=0V, Open

C E

C E

28

Hands on for Breadboard

Setting up Arduino Board

1. Connect board to PC via USB cable

2. Check COM port number

Control PanelSystemDevice Manager

Ports

Note down COM #

3. Select your board

Double-click Arduino app

ToolsBoardArduino Uno

ToolsSerial PortCom #

29

Open the Arduino code: AllOn.ino

How do we get this value?

30

Verify Upload

Turn ON all LEDs

Computer talks in Binary (0’s or 1’s)

What is computer language?

31

0V (Ground)

5V (Supply voltage)

0 (Low)

1 (High)

1 1 1 1

Binary Decimal

1x23 +1x22 + 1x21 + 1x20 = 15

Speaking the Computer Language

32

1x23 +0x22 + 1x21 + 0x20 = 10

1 0 1 0

33

Lighting Sequence

Frame 1:

Frame 2:

Frame 3:

Frame 4:

Frame 5:

Add comma before adding next frame

No comma for last frame

Change frame rate here

Open the Arduino code: Sequence.ino

Can you generate these LED patterns?

Frame rate per second =1

Frame 6:

3 2 1 0 Pin

Frame 7:

Frame 8:

Frame 9:

Frame 10:

Frame 1:

3 2 1 0 Pin

Frame 2:

Frame 5:

Frame 3:

Frame 4:

1. Open Sequence.ino 2. Save as MyPattern.ino 3. Modify code

4. Save file 5. Click to verify code 6. Click to upload

STEPS:

34

Effect of Frame Rate

Blinking Pattern

Vary the frame rate from 1 fps to 300 fps.

When does the blinking disappear?

Why does it happen?

Frame 1:

Frame 2:

3 2 1 0 Pin

35

36

3

2

1

BUILD LED CUBE Hardware testing

LED ANIMATIONS Programming on Arduino

BUILD LED CUBE Soldering of LED panels Solder panels to PCB

INTRODUCTION Components Circuit design

HANDS-ON Set up Arduino board Breadboard

37

Building LED Cube Printed Circuit Board (PCB) is a plastic board with copper tracks that link up fixed components to form a circuit.

Front Back

Soldering joins two pieces of metal, such as electrical wires, by melting them together with another metal to form a strong bond.

Soldering iron is very HOT!

> 300C!

Soldering Tips

Secure the LED panels with Blu-Tack.

Hold the soldering iron firmly.

Do not catch if soldering iron drops!

Put the iron back securely whenever you are not soldering.

Keep the iron tip clean by wiping on the damp sponge.

Apply solder to the joint by heating it with the soldering iron.

Solder should appear to flow onto wires to be connected.

Note that joint remains hot after soldering!

Wash your hands after soldering! (Excessive LEAD is harmful to your health)

38

Soldering

39

40

41

LED Cube 4 MAIN STEPS

Cathode

Anode

Solder a row of 4

LEDs

Solder 4 row of 4

LEDs into a panel

Solder panels

onto PCB

Solder cathode in

a layer together

LED Panel

42

LED Panels

Components Quantity (1 panel) Quantity (LED cube = 3 panels)

LED 16 16 x 3 = 48

Tinned copper wire

8 8 x 3 = 24

Here are the components needed:

43

Anode Cathode

NOTE: Test 4 LEDs at a time before soldering

44 44

Placement of wires connecting anodes

Trim horizontal wires Orientation of LED Cathode (below) Anode (top), bend CCW 90°

Pla

cem

ent

of

wir

es

con

ne

ctin

g ca

tho

de

s

Alignment Sheet

Position of PCB (Do not Trim)

45

46

LED Panels

Check connections Seek for assistance if the LED does not light up

Is the LED working?

Horizontal Plane: Cathode (-ve)

Vertical lines: Anode (+ve)

47

Solder 4 panels onto PCB Connect up cathodes of each layer Connect cathodes to BJTs

48

Solder 4 panels onto PCB

1. LEDs facing front 2. Anode lead(Bended 90°)facing down 3. Align 4 panels to form a cube 4. Solder 5. Trim off excess vertical wires Note: Seek for assistance before trimming the wires

Solder cathodes together

Refer to display sets

STEPS

BJT

PCB

Align PCB surface with this line

BJT

PCB

Align PCB surface with this line

BJT

PCB

Align PCB surface with this line

49

Panels

50 NOTE: Solder each layer of common cathode to the PCB

51

1. Seek assistance to install Arduino Board on PCB

2. Upload DebugCube.ino to lights up one LED in sequence from bottom to top layer

3. Identify LEDs that are not lit up

4. Identify poor connection & re-solder the joint

5. Inform instructor when testing completed

Hardware Testing

52

3

1

BUILD LED CUBE Hardware testing

LED ANIMATIONS Programming on Arduino

BUILD LED CUBE Soldering of LED panels Solder panels to PCBs

INTRODUCTION Components Circuit design

HANDS-ON Set up Arduino board Breadboard

2

53

1. Open AnimationTemplate.ino

2. Save file as yourname01.ino in “Student” folder

e.g. kengying01.ino, kengying02.ino etc

Remember to save your file after editing!

Feel free to copy the file for future use

STEPS:

Make your animation

54

3. Create own animation at : http://www3.ntu.edu.sg/home2012/SOUMYABR001/ledcube.html

Copy this segment

55

Paste your codes here

{0, 0, 0, 65535}

Layer 1 (bottom)

Layer 2

Layer 4 (Top)

Layer 3

56

4. Run animation at different speed

Set initial frame rate

Change frame rate

57

5. Verify () & Upload ()

Error messages shown if mistakes found.

Verify

Code verified.

Upload

58

Take Away

1. LED only lights up with the correct polarity 2. Solder likes HEAT 3. Motion is seen when static images are presented in quick sequences 4. Persistence of vision (POV) 5. Temporal Multiplexing Official website of Arduino with tutorials, references and fun projects: https://www.arduino.cc/

59

Join our Facebook group @ NTUEEE Share your hands-on experience with us

Thank you for coming &

exploring