Вы находитесь на странице: 1из 29

2 - BUILDING CIRCUITS

WITH LEDS
ELX 312 MICROCONTROLLER FOR INDUSTRIAL AND HOME
AUTOMATION

LIGHT-EMITTING DIODE (LED)


Building

circuits with LEDs is a great way to learn about


electronics and the Arduino.

LEDs

let the current through in one direction only, so be


careful when making circuits with them because they wont
flash if wired the wrong way.

If the legs have been cut off and need to find out the polarity

of the legs, find the negative leg by looking at a flat edge


near the leg (on the outer casing of the LED).

FIGURE 16: VARIOUS COLOR LEDS

FIGURE 17: DETERMINING THE POSITIVE AND


NEGATIVE LEAD ON A LED

LIGHT-EMITTING DIODE (LED)


LEDs have a bit of a self-destructive nature: they will draw as
much current as possible until they burn out.

To

prevent this behavior, use a resistor. This will limit the


amount of current available to the LED and it will prevent the
LED from self-destruction.

With the Arduino, its always either 3.3 or 5 volts.


For safety, use 100-Ohms resistor for 3.3-volt LEDs
220-Ohms resistor for 5-volt LEDs

and a

LIGHT-EMITTING DIODE (LED)


To start with an actual LED, you dont need any kind of
resistor at all.

To begin, all you need is just an ordinary LED.


Now, pin 13 already has a built-in resistor, so you dont need
an additional one. And right next to pin 13, there is a Ground
pin.

Put the longer leg into pin 13 and the shorter pin into GND.

FIGURE 18: AN ARDUINO UNO BOARD VIEWED


SIDEWAYS

LIGHT-EMITTING DIODE (LED)


If you properly inserted the LED, you should see it blinking in
the same rhythm as the onboard LED.

ARDUINO TRAFFIC LIGHT


Arduino Uno
USB Cable
3x 100-Ohms resistor
Breadboard
1x 5mm Red LED
1x 5mm Yellow LED
1x 5mm Green LED
4x Breadboard jumper wire

FIGURE 19: ARDUINO UNO TRAFFIC LIGHT


WIRING

ARDUINO TRAFFIC LIGHT


While you upload the code to the Arduino board, the red LED
will be blinking. This is intentional so that you know that pin 13
goes randomly up and down while the program is uploading.

This way, dont attach some moving or sensitive component to


it in the future.

The breadboard is a useful component because a person does

not have to know much about soldering to get started with the
electronics.

One other advantage of using a prototyping board is that it


doesnt take long to build basic circuits, and you can rearrange
components quickly if something is wrong.

FIGURE 20: PROTOTYPING BOARD WIRING

ARDUINO TRAFFIC LIGHT


The

downside of a prototyping board is that it cant


accommodate a lot of components and that, with soldering,
our circuits will be a lot smaller.

Some

bugs are harder to find because, aside from the


software component, there is a possibility of wrong wiring.

Some

of
the
wrong
wiring
might
come
from
misunderstanding how the lead wires are connected in the
prototyping board.

FIGURE 21: UN-BRIDGED GAP BETWEEN THE POWER


LINES IN THE MIDDLE OF A BIGGER BREADBOARD

ARDUINO CYLON EYE


Arduino Uno
USB cable
10x 100-Ohms resistor
Breadboard
10x 5mm red LED
1x Breadboard jumper wire; up to 11 wires if your resistors have
short leads

ARDUINO CYLON EYE


Cylon eye effect is a red light going constantly from left to
right.

FIGURE 22: CYLON EYE VERSION WITH A


SINGLE JUMPER WIRE

FIGURE 23: CYLON EYE WIRING


SCHEMATICS

COUNTDOWN
Arduino Uno
USB cable
13x 100-Ohms resistor
Breadboard
13x 5mm LED
18x Breadboard jumper wire

FIGURE 24: 13 LEDS IN A SINGLE-DIGIT


DISPLAY

FIGURE 25: 13 LEDS COUNTDOWN IN


ACTION

FIGURE 26: COUNTDOWN EXAMPLE WIRING


SCHEMA

Вам также может понравиться