Anda di halaman 1dari 20

INTRODUCTION TO

RASPBERRY PI
LEARN ABOUT RASPBERRY PI
• INTRESTING TO LEARN RASPBERRY PI
• IT IS A MICROPROCESSOR
• IT IS A MINI COMPUTER
Arduino and Raspberry Pi
RASPBERRY PI
STEP 1
INSTALL ALL SOFTWARE FOR RUN THE
RASPBERRY PI DETECT THE IP
ADDRESS FOR
RASPBERRY
CONNECT THE IP
ADDRESS TO ENABLE
THE SSH TO OPEN
THE VNC VIEWER

TO FORMAT THE SD
CARD
FOLDER FOR OPEN
THE VNC VIEWER
FOR OPEN THE
RASPBERRY PI
FORMAT SD CARD
AND WRITE THE
SD CARD
STEP 2

TO RESET THE SD CARD AND FORMAT IT


STEP 3
WRITE THE IMAGE FILE(RASPBIAN) TO SD
CARD.
STEP 4

Click Change Adapter Settings


- Right click on Ethernet, Click Right click on Ethernet again -> Click
Properties Properties-> Double Click Internet
- Double Click Internet Protocol Protocol Version 4 (TCP/IPv4)->Copy
Version 4 (TCP/IPv4) the IP address
STEP 5
- Paste the IP address->
Example : 192.168.137.1
- - Wait until Raspberry Pi
Comes out.
- Copy the IP address for the
Raspberry Pi
STEP 6
At Host Name->Enter Raspberry Pi IP address and for
port leave it at 22
Make sure Connection Type is SSH, then press OPEN
Click Yes if there is any security alert
Username: pi Password: raspberry
Type “sudo raspi-config” without “
Click Interfacing Options
Click on VNC
Press Enter and Enable
Open VNC VIEWER

Right-click and click New connection

Enter the Raspberry Pi IP address in VNC

Server

Give any name and then press OK

Click on the IP address and enter username

and password

Then press continue


PRACTICAL 1 – BLINKING LED
LED BLINKING USING RASPBERRY PI
click on your Menu > Programming >
Python 3 (IDLE),

Python 3 will open up, so click on File and


then New File for this project and give a
name to this New File, as I have give it
Blink.py , .py is the extension for python files
•In this Blink.py, write code, which will
blink the LED, here’s code:
• When you run this Blink.py File by pressing F5, then your LED will
start blinking. Here’s the screenshot of LED in ON state:
CODE
Importing the module. To import the RPi.GPIO module: import
RPi.GPIO as GPIO.
DISTANCE FROM ULTRASONIC SENSOR
import RPi.GPIO as GPIO Importing the module.

import time
while GPIO.input(ECHO) == False:
start = time.time(1)
GPIO.setmode(GPIO.BCM)
while GPIO.input(ECHO) == True:
TRIG = 4 end = time.time(0)

ECHO = 18
sig_time = end-start

GPIO.setup(TRIG, GPIO.OUT)
#cm:
GPIO.setup(ECHO, GPIO.IN) distance = sig_time /0.000058

GPIO.output(TRIG, True) print('Distance: {}


cm'.format(distance))
time.sleep(0.0001)
GPIO.output(TRIG, False)
GPIO.cleanup()