Professional Documents
Culture Documents
IOT Lab Manual
IOT Lab Manual
IOT Lab Manual
Anode (+)
Cathod(
The longest lead is the anode and the shortest is the cathode
LED Working: In simple terms here's how an LED works, AnLE
is basic semiconductor device which is a p-type semiconulat
a
IS released in the
form of a photon or unit of light, colorot
|photon energy released determines the frequeney
light.
The type of material and process of
materials dictate the color of the
creating the n-type and p-type
and other performance
photons as well as the efficiency
characteristics of the LED. After processing
the material into an LED chip, the chip is installed in a
allows electrical connection and directs as package that
much light as possible in
the desired direction
Circuit Diagram
LED
k Ohm
RESET
DIGTTAL Put-
eO(UNO) ON
Arduino
ANAL OG IN
OWto choose Resistor for | In simple context Resistor is chosen using Ohm's Law i.e R=V/|
a circuit wnere R-Value of the Resistance required. V-Voltage cross tne
Tesistor and
1-The current that is flown through the resistor. For
Cnple consider an LED require a voltage of 3V which is trom
a V
power source, for a current of 0.02Amps. Then the equatOn
results in R
(9V-3V/0.02-300 KQ.
Description In this program LED is connected to digital pin 13 as shown in
Circuit diagram above. An infinite loop runs over the loopl) tunction
to toggle the state of LED to blink and incurring the state switch
void setup0
l/pin 13 is set as an OUTPUT pin
pinMode(13, OUTPUT);
loop function iterates forever
void loop0
I/Sets LED to HIGH voltage
digitalWrite(13, HIGH);
I/delay by a second
delay(1000);
/Sets LED to LOW voltage
digitalWrite(13, LOW);
/delay by a second
delay(1000); // wait for a second
Program #2
Toggle the state of LED using Swith
Components 1-LED, -K 2 resistor, 1-push
required button, Jumper wires, Breadbuu
How a push button works wwww
Here an
open push button Normal.statea
mechanism is used. in
pushed) of the button current doesn't flow, only wh button
pushed flow of current is allowed 1t
n in ahove figure
C i r c u i td i a g r a m
LED
k Ohm
Switch
RESET
DIGITAL CPu
IESPP
OOUNO.
Arduino"
ON
ANALOG IN
Description In this program LED is connected to digital pin 13 via switch and
shown in circuit diagram above. An infinite loop runs over the loop()
function to toggle the state of LED to blink, when an input is given
through a switch button press/release and incurring the state switch
mechanism by constantly usingthe delay() function.
Code /*The Function setup runs only once when Arduino board is first
powered up or a rest button the board is pressed */
void setup()
pinMode(13, OUTPUT):
lorever
itcrates
luncton
loop
void loop)
/Scts LED to
HIGH voltage when a button is oressed oielse it rem
pressed
LOW
digitalWrite(13, HIGH);
second
//delay by a
delay(1000):
terminal
Program #1 Printing toa
Monitor t HDMI Cable, Kevho
Components | Raspberry Pi
t SD card,
8MOow
required Power supply
messa
Description Now let us start with a basic example of printing a
essage "Hello, h
Box shows hoW to printa
uSing Python Programming.
console.
to the
reeng message
Find your customized Raspberry Pi.
Key points
Mount the SD card.
import glob
import time
#initialize the device
os.system('modprobe wl-gpio')
os.system('modprobe w1-therm')
if equals_pos l= -1:
temp_string = lines[][equals_pos+2:]
while True:
print(read_temp())
time.sleep(1)
Output Current Room Temperature is recorded.