Book 2
Book 2
~.,. ...;-i.
AO= dict(zip(('a','b','c','d','e'),(1,2,3,4,5)))
A I = range(] 0)
A2 = sortcd([i for i in AI if i in AO))
A3 = sortcd((AO(s] for s in AO))
A4 = [i for i in Al ifi in A3)
A5 = {i :i*i for i in Al} ··~~j:~{:;~;, . ··.. . ·.· .. ·.. _ . ' ,,
AG= [[i,i'i] for i in Al] t: : IoT Physical Devices and Endpoint_s:·
,Jqf' .... , ~ 1• . " • " ' . ' : ' ' . • ·- . . .. .. ' · ' . •
•--m~.t8l
•~zr~.n-=' ArduirioUNO ' ' ,Y !.-• -
,.J;': •·
:r;; ·:
1tf!i~ ~~'. apter Col'erS ·.
~t'❖ · .. Introduction to Ardumo
7
:,.~,~,._
;_
L: '.
;_:,; :.: :;·: ::·. •· . ~ ~~:·~ c:~;~:~n ~?
.-,,,
~~
-~
; _::,! ••;.;'.,'. ~s.t~~~:~:::ifn°;:;;:i~~~i~:~~~r~!ng Board
;,•
•
Fundame_ntals of Arduino Progranuning
1
;,·. : ✓ Dlfferencri between Analog, Digital and PWM Pins
f::• Introduction ,to Communications
:,. ✓ SPI commu~ic~tlons .
ft Example Mo,dtilcs on Arduino.
[.·
s";c
✓, ; ,.Programs to interface,LED switch ~nd P,otentiometer
rt, ✓
r ✓
Prog~ams.:to intera~t ,vith.Serial Monitor of our,.Computer Screen •.
Interfacing Sensors to the Arduino
t~
~4;: · ·· •:;
✓ Interfacing Display, GSM, GPS to Arduino
fi:: · I~lerf;ci~g· Motors
19}
190 Intcmct ofT/1i11gs /oT Physirnl /J,,viccs 11111/ E111l110/11ts: Ar,luiuo l/N~ == ======== ====--==-
❖ PWM pins: These arc digital pins marked with a - (pins 11, 10, 9, 6, 5 and 3). PWM ~lands ql3. · 1_1Nfr.r1 i.~1NC TJ/E SomvARE (ARourNo IDE) .
for "pulse width modulation" and allows to make digital pins output "fokc" varying amounts r: • ) · r~ v , rk•·c1(ln 'il'l" r,wur:nn; 1111'.
·h
1s \\ , c ~ 1 0 · 1 , • ' r - -_-· , . -
of voltage. You'll learn more about P\VM btcr. nic Arduino IIJE (lntcgralcd IJc.·clopmcn! r.n,1ronmcnt ·. h
·- ·
,r.- \f ~·~1tJJ ' ~"
will tell your Mduinu what to do, You c.rn lo:id new progr.1rns or.to Ihc rn.u_n c ,ip. __'" ' ;, ~'.~::..• 1~~ ~ '.
❖ TX and RX pins: digital pins 0 and I. TI1c T stands for "transmit" and the R for "receive". · USB using the ,\rduino !DE. To do" nlcr.id y011 r Arc!mno IDE. brcm ,c (ln th . f(,,. ,_· t, .,, •1'- ' ·
Arduino uses these pins to communicate with the computer. Avoid using these pins, unless via · - · u, ·n" ~r. 1'-'o' \ nlo:id
hllps://www.arduino.cc/cnf,\lain/SoftwJ;c . Select "hich O;icra11ng ~ystcm ~\JU _re_ · 1 : • ' ,. · :
you're running out of pins. it. We won 't go into much dct3 iJ rm her,: 10 instJII tn i5 softwJr~. since the r>thcul ,\ rdtnnG ,., c:; ,!l-~
❖ LED attached to digital pin 13: This is useful for an easy debugging of the Arduino docs a great job explaining bow lo dD it in Jll th:cc O;;crJt ing
sketches. Systems_ Windows, Mac and Linu.x. \\~1cn you first open ihe Arduini> ID F.. you , h,>:;:d sec
❖ TX and RX pins: these pins blink when there arc infonmation being sent between the computer something similar to the Figure 7-2 lx:lo·,\';
and the Arduino.
❖ Analog pins: the analog pins are labeled from AO to A5 and are most often used to read analog
sensors. They can read different amounts of voltage between 0 and 5V. Additionally, they can
also be used as digital output/input pins like the digital pins.
❖ Power pins: The Arduino has 3.3V or 5V supply, which is really useful since most components
require 3.3V or 5V. The pins labelled as "GND" are the ground pins.
❖ Reset button : when you press that button, the program that is currently being run in your VJi '.i ,~tup () [
/ / i:ut you:' ,et'Jp cc:ie ?:e:-4!, .... - ...] ---- r
Arduino will start from the beginning. You also have a Reset pin next to the power pins that
acts as reset button. When you apply a small voltage to that pin, it will reset the Arduino.
❖ Power ON LED: will be on since power is applied to the Arduino.
·-: :1'.i l:cp ()
❖ USB jack: Connecting a male USB A to male USB B cable is how you upload programs from
/ / :t:Ut you: :r.ain cede ?'1-::=, .. _ - · - - - - - -- --- .
your computer to your Arduino board. This also powers your Arduino.
❖ Power jack: The power jack is where you connect a component to power up your Arduino
(recommended voltage is 5V). There are several ways to power up your Arduino: rechargeable
batteries, disposable batteries, wall-warts and solar panel.
l
•1
-Get Board Info I ~r ~ ~':ino!G: nuino Uno _
Prn~••mm,r. "AVRl~ ml·Tr i Ardu,no Duem,lanove or Diecimila
Bum Bootloade, Arduino Nano r.
Arduino/Genuino M09a or Mega 2560 I;
...~, Arduino Mega ADK
Arduino Leonardo
?-~:_yiJfi:f;;JtI~b-:;~~--~~-rrr~r~:tJ?z
Arduino Leonardo ETH Board Serfa·r Port
Arduino/Genuino Micro -. . •,,.""'·
Arduino Esplora 1 • _. " _· . . • _'. _-;.~~~JAT.,.-~::·co~~ '. ·
I Arduino Mini
...(' Arduino Ethernet
'
Figure i-5: Layout of Arduino Uno IDE
.,,., Arduino Fio
'l' Arduino BT The Toolbar buttons and functions of each buuon :m:: ;15 ,hown in Tobit: 7- 1 as !ol!(m s:
'-.. Table i-1 : Toolbar options in .-\rd:iino IDE
Figure 7-3: Selecting the right Board
Verify/Compile Checks the code for errors
Stop Stop the serial monitor,or un-highligh t otht:r bultons
New Creates a new blank sketch. cntcr :! nJmc 3nJ ;i loc:Hio n for your skdch.
Auto Format Ctrl+T
Open Shows a list ol' Sketches in your s.kctchbook
Aichr.re Sl:ctch Upload Uploads the cum:nl Sketch to the ArJuino. Yuu ned to m:ikc su;c !h.~t
sketch_sep1 sl' Frx Encoding & R~oad you have the current bo:ird and pon selected (i n the Tools menu ) c.:fi,rc
;•,: id ,~tup () Serial Monitor Uploading.
Ctrl+-Shift+M
I I put ycu1, ---- - - Serial Monitor Display Serial data being sent fwm the Arduino
Board: "Arduino/Gcnuino Uno' Verify/Compile Bullon is used to check thJt your code is correct. bcfon: you wp!o:itl it tn
'. ~<-.·~-.~~-P?J.:;:~J,::;~1-~~/2f~1~· .f> :;:~~~-~~:~r►7~·~:t.-·:~-~:::::~ 1. ·: Se.rial por:-: your Arduino.
·::::i :. ::~ () Programmfr. "AVRl5P mkll" ;[:~\~~~-.w~0Jt~~t~~ Stop button Will stop the Serial Monitor from ope rating. If you need t,) oht: in a sr.:ip, h11t
of the scri~I data so far examined.
Bum Bootloadfr
Breadboard for prototvfil!lg :\rcluino ll.no Circuits
ln order lo keep your circuit organizt·d you need to use a brca,lbcwd. pictured hdnw in
10 selecting the right port Figure 7-6. The breadboard allows you to ,0nncc1 c,nnponcn:s tngcthcr hy plugging 1h~m inw th~
Figure 7-4: showing the layout of Arduino IDE liltle holes. The k~y is to umkrstand how the holes :ire cnrmcctcd . .-\, you cJn sec in the di~gr:1111,
196 /11lt'l'lll'I nf'l11i11gs /oT 1'l1yslc,1/ Drvim 11111/ l.'111ll'oi11t.,: Arifoi110 UNO !9i
the holes in a column (when oriented as shown in the picture) arc connected together, So to connect i t '. Y~~-~A~rir:ir~.is _C?P.:ARo~~N_Q_·'rR~9c.~~~,1Nc
compone~ts together you need to plug the leads you want connected i1ito the same column, Note
that the columns are not connected across the "trench" in the center of the board. Also notice that This section in Table 7-3 explains the basic structure of Arduino programming with respect to usage
as the long rows at the top and bottom arc connected together. These arc typically used to create of variables, constants, control flow statement and finally the predefined functions used to reJd
"rails". These are typically used for grounds and supply voltages you might need to connect many analog and digital inputs,
components to. Notice some rows arc marked (+) and some(-). These are just markings. The row Table 7-3: Fundamentals of Arduino Programming
will be set at whatever voltage YOU connect to it. The structure of Arduino programming contains of two parts as shown
Structure
-.,,.
,~:~·.'·CH
';i~s's;tw~e~i.
I N
,·;.~.:~{ :·~:·:'; ,-;:·'Holes Along 'I·/:.~:·:
1tt,,1 ·•··••i••·······
I'
below
void setup() //Preparation function used to declare vari:!bles
- ! i_; .- :.. ·.-~'...·.-~----, Columns Are 1; :•·u i, '.,
oumns ot .,~:n:- I • : • • •. • · '
.:-.·~ ·~.~~:
·.t~.,
A:~-~~~~'/ .:. '..~:~ Rows are NOT :~
;>_:;:,.~{i~y_~~;~Connected :;·.These Holes Are' i;•j .. . . . .~-~c~,~~~-~~s--~~--L§::~~~-·.: Statement(s);
program
//used to set pins for serial communication
. :. ••··~·••·•··•··••·•·•••••; ~• d ••••• ,. )
•. ; '. ·,_!.\/ •_'. :_; ·! '. • '.i' 1'f -,•~lffI~f;·,_.,~-';_T~f - _ '. :All Connecte t<",, j,
_' !T~
_ 1
void loop() //Execution block where instructions arc executed
.'?~~,:'.(1:/·:_<. .:
i. ,
: I I I f f t f l . t I I YI I I I I . I 1 · 1 I f f t· 1· t It' t I t , f " I I . l" t t ··t I I 1
?j·~t0It16e~:·{;}~,r;:~t1.Y~~;;~~,~:--~
.'.:,•.·•:.~;jf~-~Y-:::'.:~-~ repeatedly
201
..: rPlrysicnl Devices 1111rl E11rlpoi11ts: Arrluino UNO
Internet of T1tings 10
200
- :,.,,,,-
~
It
q,
{
Constants Constants Usage //sets pin 13 ON
digita1Write(13,HIGH);
TRUE/FALSE Boolean constants true=2 and false=0 define d .....,,
•
t, // pauses for¼ second
' ~:· delay(250);
in logic levels. ,11: //sets pin 13 OFF
j digital Write( 13,LOW);
if(b=TRUE) //pause for 1/4 second
Ii':~-7, delay(250);
{
}
//do something expression inside parenthesis becomes
...
while While loop executes until the
false.
INPUT/OUTPUT Used with pinMode O function to define while(some_variable ?? value)
levels.
{
pinMode (13,OUTPUT): //Evaluated till comparison results in a false value
Statement(s);
HIGH!l.OW Used to define pin levels
}
HIGH-1,ON,5 volts Bottom evaluated loop, works same way as while loop but condition is
do ...while
LOW -0,OFF, 0 volts tested at the end of loop.
Digital Write (13,HIGH);
do
{
flow control Statements
Dosomething;
if if(some_variable = value)
}while(somevalue);
(
Digital and Analog input output pins and their usage
Statemem(s); //Evaluated only if comparison results in a true value Methods Usage
Digital i/o
pinMode (pin, mode) Used in setup () method to configure pin to
if...else if(input=HIGH) behave as INPUT/OUTPUT
{ pinMode(pin, INPUT) //pin set to INPUT
Statement(s); //Evaluated only if comparison results in a true value pinMode(pin, OUTPUT) II pin set to
OUTPUT
{ Mcth!ld,
' rnalh
pin MODE(x, OUTPUT): II sets 'x' as min(x,y) w kul.ircs minimum n( cw,, number,
OUTPUT vJ l"min (v:11.l O): li,cl, 'v:1l' ro ,mJH ·r ;i;,m
} lfl or cqu.il to IO but ncv~r gets :ib<W: IO.
void loop() v-.1f=m:-t'( (,-a!. TO): /isc.t, \·:11.' to :~trgcr
mn(x,y)
{ ti-.1:-i 100 or rn1J
val=digital Read (p); //sets 'value' to 0
random i\lcthods
digital Write (x,val); //sets 'x' to button
value Random Seed (\'aluc) &t., a vJlu~ / s~cd as , tJrt ini,: point for
ta:".il!O;i.
Serial. println (data) . Serial communkates on digi ral pins Rx(pi n 0) and Tx(pi n I) with the computer via USB. pin
Prints data to the serial port
0 and pin ) cannot be used for digiral input or output. The built in serial m~nitor can be us,_d lo
Serial println (value); //sends the communicate with an Arduino board by sclccring same baud rate tha r 15 used in th~ call to begm 0
'value'; //sends the ' value ' to serial which will come across in the later part of the chaprcr.
monitor.
.7.5.t SPI communications
'·serial communication Interface (SPI) is a synchronous dara protocol used by brge microcont~ol!:.-~,
7.4.1 Difference behreen Analog, Digital and PWM Pins
for communicating with one or more peripheral dcYiccs for a shorter chst:incc and . also t:_,cd . fo r
In analog pins, you have unlimited possible states between O and 1023. This allows you to read communication between two devices. With SP! there will be al ways one master device wh ich is J
sen~or values. For cxa~ple, \:ith a light sensor, ifit is very dark, you'll read 1023, ifit is very bright microcontroller like Arduino which controls the functionalitic:; of other peripheral devices. Devi:es
you II read O If there 1s a brightness between dark and very bright you'll read a value between o ·have three lines in common which arc as follows
and 1023.
❖ MISO (Master in Slave Out)- Slave line for sending d:ita to the m:isrer.
In digital pins, you have just two possible states, which arc on or off. These can also be
❖ MOS! (Master Out Slave In)- Master sending data to peripherals
referred as High or Low, I or 0 and SV or 0V. For example, if an LED is on, then, its state is High
or I or SV. If it is off, you'll have Low, or 0 or 0V. ❖ SCK Serial clock) - clock pulses which synchronize data transmission gcn::rated by the
master
PWM pins are digital pins, so they output either O or SV. However these pins can output
"fake" intcnnediatc voltage values between O and SV, because they can perform "Pulse Width And one of the specific line for every device is
Modulation" (PWM). PWM allows to "simulate" varying levels of power by oscillating the output ,❖ SS (slave select) - pin on each device that the master can use to enable and disable specific
voltage of the Arduino. devices.
Figure 7-7 shows the representations of Analog, Digital and P\VM pins of Arduino. When device SS pin is low, communication happens with the master, ifSS pin is high dC'\·ice
ignores the maser. This allows multiple SP! devices sharing the the same MISO, MOS! and CLK
lines.
❖
Maximum SPI speed of the device used?
How data is shirted like MSB/LSB?
Data clock is idle when high/low.
~~ . ¾ .· .
/~fr,,1cI nf 111!~1;,
8. Can you think of a way to use the oscilloscope to measure the time it takes to print out the
gr,:::·,', 1hfroduction
1.t ' I • , •,
to Raspbcrrypl°
f ; •: •:- ., '. • ., •
· . ~ , .,. ., • ,. l ~ ; ~ - • - ,_
message in the sketch you are currently running? Possible hint: Digital pin I (TX, a.k.a. i.. ::~. .Ei.ploririg the ~aspbrrrj·pl Lt-:1rning Bolrd
transmit) is the pin over which serial data is sent to the PC. :i· ✓ Description or System on Chip (SoQ
9. What's The Ditrercnce/Relalionship Between AVR And Arduino? F ✓ Raspberry Pi interfaces
JO. How To Unpair Or Delete Paired Bluetooth Device Programmatically On Android? t.£; Raspberrypi Operating Systems
11 How To Convert Int To String On Arduino?
f.,J\. .; ·. . ✓ Operating Systems (not Linux b:utd)
12 Converting An Int Or String To A Char Array On Arduino .• ✓ . 'operating Sustems (Linux bnstd)
13. How Can I Unit Test Arduino Code?
hi .' ✓ :l\ledia cc"riter operat_ing systems
14. In What Language Is The Arduino IDE Written :;:;,:_
✓ A~dio operating systems
15. How Is Programming An Arduino Different Than Standard C?
✓- Recalbox
16. Elicit some points on Arduino Boot loader?
Operating System Setup on RaspberryPi
✓ Formatting SD card
257
256 lutm1cto/T11ihgs ·i ;~ :rrPl~/Jy:,s~ic:al~D~cv:i~cc:s:ai:ul~E:111~lp:o:i11~ts~
,,/D~ : :Ra:s~pb:c:m1~P~i==~=======~==~~-~~
The Foundation provides Raspbian, a Dcbian-bascd Linux distribution for download, Ethernet None 10/I00mb Ethernet RJ45J ack
as well as third party ubuntu, windows 10 loT core, RISC OS, and specialized media center Wireless None 2.4GHz
distributions. Foundation also provides Python and Scratch as the main programming language,
802.1 In
with support for many other languages. The default firmware is closed source, while an unofficial
open source is available. wireless
Bluetooth None Bluetooth
"Why RaspberryPi?" - Inexpensive, Cross-platform , Simple, clear programming
environment, Open source and extensible soltware and Open source and extensible hardware. 4.1 Classic,
Bluetooth Low
Energy
Audio Multi-Channel HD Audio over HDMI , Analog Stereo from 3.5mm Headphone
Jack
-· - -..-. - ,:--;-
0 pc rating Raspbian RaspBMC,Ar
) I
Systems ch Liliux,Risc OS,OpcnEL •
1-----+--------------------------J :
EC Pidora (
•t -l... 1
J. '.' 2-'
'
N .,
0 f) 2 ~ 8 ~~) ~
~ .
: e ~t. ~ [1!] ~ e®e®©©j
Supported 640x350 to 1920x1200,
Resolutions - t')
:.G.
r
:'.! , .~ ::: , :! "' ri ~ ®0®®@8,
-
,..,j N
including l0S0p,PAL & NTSC standards "
N 1.J ""
. ~.,. ..
Power Source Micro USB
i l'
~(l Gf'rO S~l5C L\ Nr,51-1 l;Sfl
s:i:~ :;ixPwrur-fo.THE RAsrBERRYPI LEARNING Bo ARD
•-• - •.J..--~. . - ..."'_. .. ... __. - ~ .. . . - . . . . . .
lk.i6rn Ei~.er.:t-: Conirot!rr
In the Figure 8-2 below you can see an Raspberrypi board labeled. Let's see what each part docs.
❖ Processor: The Broadcom BCM2835 SoC used in the first generation Raspberrypi is 1X-2 t;$iJ•.\
P~ns re, PC
somewhat equivalent to the chip used in first generation smart phones (its CPU is an older
Broadcom 00.12835
ARMv6 architecture), which includes a 700 MHz ARM l 176JZF-S processor, Video Core IV
graphics processing unit (GPU) and RAM . This has a level I (LI) cache of 16KB and a level
2 (L2) cache of 128 KB. The level 2 cache is used primarily by the GPU. The SoC is stacked
underneath the Ram chip, so only its edge is visible. The Raspberrypi 2 uses a Broadcom
DSI Display Conncclo
BCM2836 SoC with a 900 MHz 32-bit quad-core ARM cortex A7 processor (as do many
current smart phones), with 256KB shared L2 cache. The Raspberrypi3 uses a Broadcom
E1hrn1ct OUI !'o!l
BCM2837 SoC with a 1.2GHz 64-bit quad core ARM Cortex A53 processor, with a 512KB ·
shared L2 cache.
❖ Power Source: The recommended and easiest way to power the Raspberrypi is via the Micro ' 3.5 r:::n :\t;<lio :mt.!
USB port on the side of the unit. The recommended input voltage is SY, and the recommended power cor.1pl,siti.: hck
input current is 2A. the Raspberrypi can function on lower current power supplies e.g. SV@
IA. However, any excessive use of the USB ports or even heavy CPU/GPU loading can cause
Figure 8-1: Raspberl)' Pi:? Model Band its CPIO
the voltage to drop, and instability during use. The latest versions of the Raspberrypi B+/A+/2
have a "low voltage indicator icon" to notify the user if there is a problem with the power. ✓ Input values arc meaningful (normally high=l , low=O)
❖ SD Card: The Raspberry Pi does not have any locally available storage accessible. The ✓ Yield values arc writable/meaningful
working framework is stacked on a SD card which is embedded on the SD card space on the
Raspberry Pi. ✓ Input values can frequently be utilized as IRQs (regularly for w:ikeup OCL':lSions)
❖ GPIO (General Purpose Input Output): General-purpose input/output (GPIO) is a non I~ programming environment The GPIO.BOr\RD alternative .illudc:s to the pins by the number
specific pins on a coordinated circuit to know is an input or output pin which can be controlled of the pm (e.g. Pl) and amidst the outlines beneath. The GPIO.BCM choice alludes to the pins bv
by the client at run time. GP/O pins have no exceptional reason characterized, and go unused the "Broadcom SOC channel" number; these arc the numbm after ''GPIO" in the green rectangl;s
as a matter of course. GPIO capabilities may include: around the outside of the underneath graphs:
✓ GPIO pins can be designed to be input or output ❖ DSI Display X: the Rasphcrrypi Connector S2 is J di splay serial interface (DSI} for
✓ GPIO pins can be empowered/crippled connecting a liquid crystal display (LCD) panel using a 15-pin ribbon cabk The mobile
industry processor interface (MIPI) inside the Broadcom BCi'vl2S35 IC feeds graphics data
260
directly to the display panel through this connector. This article looks nt the conncclnr pin out the portable i;,1dgcts nd vcrti ,c in ,i cw of thei r low p.·,·., er u;d:r.iti(1n. ,\ n~, nf the n•ili .ippfa:a1i1:r.
and some of the display panels compatible with the port. js in the range of irnplan!cd framcworh.
❖ Audio Jack: A standard 3.5 mm TRS connector is accessible on the Rl'i for stereo sound An SoC cornprisci of:
yield. Any earphone or 3.5mm sound link can be associated straightforwardly. In spite of the ✓ 1\ microcontmllcr, chip or DSP corc(, i Some SnC';- c:1lktl r.,\1ltipro, c:;sN frJmc·.~ork
fact that this jack can't be utilized for taking sound inforn1ation, USB mies or USB sound on chip (Ml'SoC}- inc0l'J1{1ratc more th,m one proa .m:r center.
cards can be utilized.
✓ memory pims including :i choice of' RO~!. R,\ ~.r. EEPRO \! and ,tl"\'.1k rwr.orf
❖ Status LEDs: There arc 5 status LEDs on the RPi that demonstrate the status of different
✓ timing sources including o, ci l!ator, and st.i:?,: r:olr~d circk..~
exercises as takes after:
✓ peripherals including countcr-cloch. o;igo:r;; docb ,ind powct-on r~sct !;~r:cr:1r,,r_;
- OK - SDCard Access (by means of GPIOl6) - named as "OK" on Model B Revl.0
✓ outer interfaces, including industry :-;orr;-., . fo~ :rn-:1;,lc. liS fl, Fin:\%·::. ~:~t::1~:.
sheets and "ACT" on i\fodel B Rev2.0 and Model A sheets
USART, SPI
- POWER - 3.3 V Power - named as "PWR" on all the boards
✓ simple intcrfoces including ,\DCs and DACs
- FDX - Full Duplex (LAN) (Model B) - marked as "FOX" on all the boards
✓ voltage controllers and power admi:1istr.i1ion circ\:i:S
- LNK - Link/Activity (LAN) (Model B) - marked as "LNK" on all the boards
Accessories
- IOM/100 - 10/I0OMbit (LAN) (Model B)- named (erroneously) as "!OM" on Model B
Numerous embellishments and peripherals for tl:c R:tipC1.7rf Pi go- frcm USA ccnt(.1' points.
Revl.O boards and "IOO" on Model B Rev2.0 and Model A boardsUSB Ports.
engine controllers to temperature sensors. There arc ~om: officd =bd l1shmcnts for the R.Pi :ts
There is I port on Model A, 2 on Model B and 4 on Model B+ operates at a current upto takes after:
IOOmA, An external USB powered hub is required to draw current more than I00mA.
❖ Camera -On 14 May 2013, the establishment and tb: ms:r.ha:its RS Components and Pr1.-mi::r
❖ Ethernet port: Ethernet port is accessible on Model B and B+. It can be associated with Farnell/Element 14 propelled the Raspberry Pi c.im= i:oard with a firrnww: redesign to
a system or web utilizing a standard LAN link on the Ethernet port. The Ethernet ports are bolster it.The Raspberry Pi camera board contains :i 5 MPi., d smsor. and interface$ throug.h
controlled by Microchip LAN95 l 2 LAN controller chip. a strip link to the CS! connector on the Raspberry Pi. In Raspc:i;m support can be empowem!
❖ CSI connector (CSI)- Camera Serial Interface is a serial interface outlined by MIPI (Mobile by the introducing or moving up to the most recent \·:i.riant of the OS and after that nmnini;
Industry Processor Interface) organization together went for interfacing computerized cameras Raspi-config.
with a portable processor. The RPi establishment gives a camera uncommonly made to the Pi Abus - either exclusive or industry-standard. for exampk. th-;: :\MB:\ bus from ARM Holdings
which can be associated with the Pi utilizing the CS! connector. - interfaces these squares. OMA controllers course informJtion str-.iightforw:mlly between oul,i<le
❖ JTAG headers: JTAG is an acronym for Joint Test Action Group', an association that began interfaces and memory, bypassing the processor center and am:mlingly c.,pan<ling the i:1form.1tion
back in the mid l 980's to address test point get to issues on PCB with surface mount gadgets. throughput of the SoC. also, selecting the camera choice. The cost of the cam.:ra module is 20 EUR
The association formulated a technique for access to gadget pins by means of a serial port that in Europe (9 September 2013). what's more, backings IOSOp. 720p. 640.\~SOp vidt:o. The impression
got to be distinctly known as the TAP (Test Access Port). In 1990 the strategy turned into a measurements are 25 mm x 20 mm x 9 mm.
perceived universal standard (IEEE Std I 149.1), A large number of gadgets now incorporate ❖ Gcrtboard -A Raspberry Pi Foundation authorized gadget intended for instructive purposes.
this institutionalized port as a component to pem1it test and configuration architects to get to and grows the Raspberry Pi's GPIO pins to pem1it interface with and control of LEDs,
pins. switches, simple signs, sensors and di ffcrent g:1dgcts. It likewise incorporat<:s a discwion:iry
❖ HDMI: High Definition Multimedia Interface to give both video and sound yield. Arduino perfect controller to interface with the Pi.
:. r
❖ USB Hub -In spite of the fact that not an otlicial embellishment, it is :m exceptionally
8.1 .1 Description of System on Chip (SoC) suggested extra for the Pi. A ti1ckd USl3 Hub with 7 additional ports is accessibk at all
A System on a chip (SoC ) is an integrated circuit (IC) that coordinates all parts of a PC or other online stores. II is mandatory to utilize a USB Hub 10 associate outer hard plates or different
electronic framework into a solitary chip. It might contain advanced, simple, blended flag, and adornments thal draw control from thl' USl3 pons. as the Pi can't otfrr energy t(1 them.
regularly radio-recurrence works-all on a solitary chip substrate. SoCs are exceptionally regular in
Iii!(_....,. "--'• ' _ _ . . _ . . , ._. ... . , --
:,,.
262 ,~r 1'1,y.1/r,1/ /Jn•lm nm/ l:n,lpoi11t.•: lr1HJ'l''")tl'i
I. Download SD fom1at1er 4.0 from SD A$soci:1tion website for either Windows or MJc.
2. Follow the instructions to imtall the software.
3. Insert the SD card into the computer or laptops SD card reader and make a note of the
drive letter allocated to it •
,,,,.
....,.,.. ....,,-;.,,.•:
4. In SD fonnatter, select the drive lcller the SD card is and fonnat it.
8.4.2 OS installation:
Follow the steps lo install operating system in the SD card.
I. Go to raspberry pi foundation website and click on DOWNLOAD section. ~-,~a.
,,.,,....
2. Click on NOOBS, then click on the "Download ZIP" bullon under NOOBS(olTiinc and
network install) and select a folder to save this ZIP file
3. Extract all the files from ZIP.
4. Once SD card has been fomiatted, drag all the files in the extracted NOOBS folder and
drop them onto the SD card drive. Figure S-3: R~pbi.ln d~:Ctop
5. The necessary files will then be transferred to the SD card.
6. When this process has finished, safely remove the SD card and insert it into the Raspberry
Pi.
- ~ - -- -·
"',~1;
I
,I
·.
1
'•.' loT 1'/1ysiwl Devices n11,I [111l110i11ts: T<ns11brrn;l'i 267
266 l11tcr11cl o/ TI1i11gs
- ii•:figure 8-3 shows Raspbian pi desktop and Figure 8-4 shows File explorer on Ra_spbcrry Pi. Figure
., ;;lS-5shows console on Raspberry Pi, Figure 8-6 shows browser on Raspberry_:'• rasp,-config tool
;:: ~bown in Figure 8-7 is used to configure Raspberry Pi to expand root part1t10n to fill SD card,
t J hange password, setting time zone, enable SSH(Sccure shell) server and change root behavior.
,.,,-----------.--------------------,
c. nmap: Scans the network and lists connected devices, protocol, port number and other while roll_again"'="ycs" or roll_again= 'Y
information. print("rolling the dices")
f. iwlist wl:m0 scan: list of currently available wireless networks. prin1("1hc values arc")
System information commands: print(random.randomint(min,max)
a. cat /proc/meminfo: shows details about memory print(ran<lom.randint(min,max}
b. cat /proc/version: shows which version of rsapberrypi we are using. program to find the ip import urllib
c. df -h: shows information about available disk space. address of raspberrypi import re
d. df /: shows how much free disk space is available. print("wc will try to open this url. in order 10 get ip address")
e. free: shows how much free memory is available. url=http:1/checkip.dyndns.org
f. hostname -1: shows th ip address of the raspberrypi . print(url)
g. lsusb; lists the usb hardware connected to raspberrypi. program to generate import string
h. vcgencmd measure_temp: shows the temperature of the cpu. password from random import•
i. vcgcncmd get_mem arm && vcgencmd get_mem gpu: shows the memory split between characters=string.ascii_lettcrs+string.punctuation+string.digits
the cpu and gpu. password="".join(choice(charcters) for x in range(randint(8, 16)))
print(password)
program to print fibonacci a,b=0,I
series while b<200:
In this section you will learn how to get started with developing python programs on Raspberry Pi.
Raspberry Pi runs Linux and supports python out of the box. Henceforth you can run any python print(b)
program that runs on a normal computer. However it is the general purpose input/output capability a,b=b,a+b
provided by the GPIO pins on Raspberry Pi that makes it useful device for Internet of Things. program to check for num=int(input("enter a number:"))
Raspberry pi can be interfaced with variety of sensors, actuators using GPIO pins and also SPI, 12C
armstrong number initial_sum=0
and serial interfaces. Input from the Raspberry Pi can be processed and actions can be taken, for
instance, sending data to server, sending an email, triggering a relay switch. The Table 8-3 below temp--irnm
gives out the simple python programs that can be executed on Raspberrypi while temp>0:
Table 8-3: Simple python programs on Raspberry Pi digit=temp¾ I0
initial_sum+=digit**3
Program Code
Print hello world print("hello world") temp//=10
Key points GPIO pin 17 and 27 mpccfr,cl;. ,,., hich i.; r.,1t 1a lim1 as LlUt'p11 t pi n, Tb.: ~Ut e ,,t
I. Find your customized Raspberry Pi.
the LED is toggled by th:: c~ccuting the t·.,o prog.Jms gi,cn m tl:L" Bo, [l()X
2. Mount the SD card.
having the code changes the s~!:: of t.':c LE O r.;,icc 1, hcrc:li Bo, h;1\'in~ th.: co1:<:
3. Plug in the HDMI cable into the Pi and the monitor. runs an infinite loop lo flick er LED; fro:n 0:-./!0 FF sra!~ ~very scrnnJ . Rm~ t~L"
4. Plug in the keyboard into the USB ports code given below and obsm ·c at ti:! ci:sr:cd or.:tput.
5. Plug in the mouse into the USB ports Circuit Diagram
6. Plug in the power cable
7. Type in user name "pi"
8. Type in password "raspberry"
9. Double click on "Tenninal"
10. This will load the "tenninal"
II. Type the follow commands
✓ Change the directory by the command $ cd Desktop
✓ Create a new directory$ mkdir python_code
✓ Change the directory to python_code $ cd python_code
✓ create new file helloworld.py
✓ Now enter the code given in the box below
✓ Run the python code "sudo python helloworld.py
✓ You will see it print "Hello World!" to the screen
Code File:Helloworld.py
#Access the python working environment
#!/usr/bin/python I. Create file "blink.py"
#Print a message Hello world on to the terminal 2. Create fi[c ''blink_C\'~r.py"
print("Hello World!")
I
1 3. Enter the abo\'C code
'
Output A message "Hello world" will prints on the console.
4. Run the python file "sudo python hlink.py" « \\'arch the LEDs blink 2
. times
'
'
' '
l11tr111rtof11,iHx, fol' l'ln1cir,il l!niu , ,mrl l.11,ll't•in!<, R~•r'.·ar,T',
272
5. Run the python file "sudo python blink_cvcr.py" << Watch the LEDs import Hi.Cif'I0 a, (,PIO
blink forever 1/u~c one of the t·.vo numberinf ~y;tcrn either B0 :\RD n:mi!-/:t";/H( :'> I
Code File: blink.py II Hcfcr to th~ chJnr.d nurnb,:r-, or, rhc Bmmkom SOC.
#Access the python working environment Gl'I0.sctrncrdc(GPIO.BO!>
#!/usrtbin/python //Configure pin 17 ;md 27 to be an OUTPUT pin,
#import the time module so as to switch LEDs on/off with the time elapsed GPIO.sctup( 17,Gl'l0.0 UT)
#import the RPI.GPIO library GPIO.sctup(27,GPI0.Ol1T)
import RPi.GPIO as GPIO #Use while: construe! which rJm infi:ii!c number ot' time·; there by bli:ikin;;
#use one of the two numbering system either BOARD numbers/BCM LEDs forever
# Refer to the channel numbers on the Broadcom SOC. whilc I:
GPI0.setmode(GPIO.BCM) #Turn up LEDs on
#Configure Pin 17 as an OUTPUT GPI0.output(l7,GPI0.HIGH)
GPIO.setup( 17,GPIO.0UT) GPIO.output(27,GPIO.HIGH>
#Configure Pin 27 as an OUTPUT
time.sleep( I)
GPIO.setup(27,GPIO.OUT)
#Tum up LEDs off
#Tum up LEDs on pin 17
GPI0.output(l7,GPIO.LOWi
GPIO.output(l 7,GPIO.HIGH)
GPI0.output(27,GPIO.LOW)
#Turn up LEDs on pin 27
time.sleep(!)
GPIO.output(27,GPIO.HIGH)'
Output LEDs turns on/off twice when blink.py fi l:: is e:u:cuted :md LEDs keeps c!1Jnging
#wait for I second their state forever when blink forc\·er.py file is e:1..:cuted.
time.sleep(!)
#Turn up LEDs off on pin 17
GPIO.output( 17,GPIO.LO\V) Program #3 Push button for physical input
#Turn up LEDs off on pin 27 Components Raspberry Pi+ SD card, ,.,fonito: + HD~II Cable. Keyboard & Mouse ::md Po\\Cr
GPIO.output(27,GPJ0.LOW) required supply, I Red LED and Blue LED, 2 IK resistors. push button and jump,:r
wires.
#wait for I second
time.sleep( I) Description Now let us look at an example inrnh·ing LEDs and a ~·witch that is used
File:blink_cvcr.py to control LED. Figure shows the schematic diagram of connecting an
#Access the python working environment LEDs and a switch to Raspberry Pi . Box shows a python progr:im for controlling
an LED with a switch.In the infinite whik loop the value of pin 10 is checked
#!/usrtbin/python
and the state of the LED is toggled if the switch is pressed. This example shows
#import the time module so aJ to switch LEDs on/off with the time elapsed
how to get input from GPI0 pins and process the state of the LEDS. Run the
import time code giwn below and obscm: at the desired output.
#import the RPI.GPIO library
274 · /of Plrysim/ Dc11icrs nm/ E11dl'oi11/s: Rns,,bcrryPi 275
Jntemct of Tiring,
diagram of connecting an LEDs and a switch to Raspberry Pi. Box shows a 3. Run the python file by "sudo python user_input.py" « Run
python program for controlling an LED by reading two input values, one for ; , L-------!------:.:th::.:ro:.:u:::g:.:.h.::th:.:e_:q,::u.::cs:.:.t:.:io:.:ns::..:;an::.:d:._m;;.:::.ak::.:e:._a:...n:...L::.E_D_b_li_nk_._ _ _ _ _ _..,
which LED would user like to blink(option I-for Red, 2- for Blue) and one more · Code File: uscr_input.py
parameter to set the maximum number of times the LED should be flickered. #Access the python working environment
This example shows how to get input from a user and process the state of the #!/usr/bin/python
LEDS. Run the code given below and observe at the desired output. #Import os module to enable intcmipts from a push button
Circuit Diagr:1111 import os
i
l Raspberry Pi 2 #import the time module so as to switch LEDs on/off with the time elapsed
I. import time
\
#import the RPI.GPIO library
import RPi .GPIO as GPIO
#use one of the two numbering system either BOARD numbers/BCM
II Refer to the channel numbers on the Broadcom SOC
LED4 LED3 GPIO.setmode(GPIO.BCM)
Red (660nm)
#configure pin 17 to be OUTPUT pin
GPIO.setup(l 7,GPIO.OUT)
#configure pin 27 to be OUTPUT pin
GPIO.setup(27,GPIO.OUT)
'. i
t ,l
278 1Htrmrl of Tlti11gs /oT l'/iysirnl Dc11ices 11111/ [111fpC1i11ts: Un.<pbrrryPi 2i9
id #clear the python interpreter console diagram of connecting an piczo buzzer to pin 22 and a switch to Ras?bcrry Pi.
·! i ·, Box shows a python program for controlling an piczo buzzer by readmg an
os.systcm('clcar') . . •'t
.. ,
~:.l:· I
print "You picked the Red LED" input value which runs over a loop to beep number of times the user has choose.
:ri f counter= input("How many times would you like it lo blink?: ") ' a::.n:..:d_o_b_sc_rv_e_at_t_hc_·_dc_s_ir_cd_o_ut..;..p_ut_.--------t
({ l-------..1...:R.::u:::n:..:t::,he:..,::co::.:d::e..!:g::..:iv:;c::.n.::b..:.cl:.:o....:1\....:
jr, while counter > 0: ii Circuit Diagram
•!
#on LED on Pin 27
t
~-
I GPIO.output(27,GPIO.HIGH)
i:'1 '' time.sleep( I)
~ \ P.aspoc-rrf Pi 2
J #off LED on pin 27
L
:[ . GP1O.oulput(27,GP1O.LOW)
I' time.sleep(!)
!· #Record the number of counts on LED
l'·
" \I;,;
counter = counter - I
P~
,~.
·' f
if led_ch= 2:
I/clear the python interpreter console
os.systcm('clcar')
~; print "You picked the Red LED"
I counter= input("How many times would you like it lo blink?: ")
t"..ll,.\
"''I
while counter> 0:
#o~ LED Pin 27
GPlO.outpul( 17,GPlO.HIGH)
time.sleep(!)
#off LED on pin 27
GPlO.oulput(l 7,GPIO.LOW)
time.sleep(!)
#Record the number of counts on LED Key points I. Create file "buzzer.py''
count = count - I 2. Enter the code above code
Output LED gets flickered on the inputs given by the user. 3. To run python code "sudo python buzzer.py"«listen to it beep
Code File: buzzer.py
Program #5 Buzzer #!/usr/bin/python
Components Raspberry Pi+ SD card, Monitor+ HOM! Cable, Keyboard & Mouse and Power import os
required supply, I Red LED and Blue LED, 2 IK resistors, push button and jumper wires, import time
Breadboard, buzzer. import RPi.GPIO as GPIO
Description Now let us look at an example involving a Piezo buzzer and a switch that is used GPIO.setmode(GPIO.BCM)
to beep a number of times the user choose. Figure shows the schematic
281
280 llltcnrct o/111i11gs toT J'/,ysir11/ /Jcvircs 111/1I [111l1'0i11l s: l{nsl'bmyl'i
loop_counter = 0 time.sleep(. I)
def morsccode (): GPIO.output(22,GPIO.LOW}
time.sleep(. I) time.sleep(. I)
GPIO.output(22,GPIO.LOW) GPIO.output(22,GPIO.LOW)
timc.slcep(.I) time.sleep(. I)
GPIO.output(22,GPIO.HIGH) GPJO.output(22,GPIO.HIGH)
time.sleep(. I) time.sleep(. I)
GPIO.output(22,GPIO.LOW) GPIO.output(22,GPIO.LOW)
time.sleep(.!) time.sleep(. 7)
GPIO.output(22,GPIO.HIGH) os.system('clear')
time.sleep(.!) print "Morse Code"
#Dash Dash Dah loop_count = input("How many times would you like SOS to loop?: ")
GPJO.output(22,GPIO.HIGH) morsecode ()
Circuit Diagram
return lines
. ...
~
, ·_
;1 ;:1~\~ ·
if equals_pos != - I :
temp_slring = lines[l][cquals_pos+2:]
·.·-·.
I• .. ..
1,11• :•
temp_c = float(temp_string) / 1000.0
while True:
print(rcad_temp())
Code import os time.sleep( I)
import glob Output Current Room Temperature is recorded.
import time
#initialize the device Program #7 Light sensor
os.system('modprobe w 1-gpio') Compon_cnts Raspberry Pi+ SD card, Monitor+ HDMI Cable, Keyboard & Mouse and Power
os.system('modprobe wI-therm') required supply, I Red LED and Blue LED, 2 IK resistors, push button and jumper wires,-
Breadboard, buzzer.LM35 temperature sensor, LDR Light Dependent resistor
base_dir = '/sys/bus/w I/devices/' Description Now let us look at an example involving an LDR sensor which reads the intensity
device_folder = glob.glob(basc_dir + '2S*')[O) of light and records it an text file. Figure shows the schematic diagram of
connecting an LDR sensor to Raspberry Pi board. Box sho\\'s a python program
device_file = device_foldcr + '/wl _slave'
which records the intensity of light to a text fi le. This example sho1\'s how to
get an ana log input from GP IO pins and process the input. An infinite loop runs
def read_temp _rnw(): over the sensor which records intensity of light with date and time stamps
f= open(devicc_filc, 'r') every second Compile the code given below and upload it to Arduino UNO
Board to observe at the desired output.
lines = f.rcadlincs(}
[close()
285
JoT Pl,ysicnl Dc11im 11111/ E111/l'oi11ts: HaspbcrryPi
i/ . 284 lute met o/11,iNgs
DEBUGER = I
Circuit Diagram
GPIO.sctmode(GPIO.13CM)
def RCtimer (RCpins):
readings= 0
GPIO.sctup(RCpins, GPIO.OUT)
GPIO.output(RCpins, GPIO.LO\V)
time.sleep(.!)
GPIO.setup(RCpins, GPIO.IN)
# iterates 1 miliseconds over one cycle
while (GPIO.input(RCpins) = GPIO.LOW):
readings += 1
return readings
while Trne:
GetDateTime = datetimc.datetime.now().strftimc("¾ Y-%m-%d
%H:%M:%S")\
LDRReading = RCtimes(3)
print RCtimes(3)
# Open a rile
fo = opcn("/home/pi/l0xI0/foo.txt", "wb")
fo.writc (GetDateTime)
LDRReading = str(LDRRcading)
fo.writc ("\n")
Key points 1. Create file "ldr.py" then "touch foo.txt"
fa.write (LDRRcading)
2. To nm the python code "sudo python ldr.py" << Sec what the
light levels in the room are.
# Close opend file
3. The check the file "more foo.txt" you can sec your results.
fa.close()
Code File: ldr.py time.sleep(])
#! /usr/bin/cnv python Output Intensity of the Hght in the room is recorded on to a terminal as well as to text
import os file.
import datctimc
Program #8 Passive Inferred Sensor
import time
import Rl'i.GPIO as GPJO
Components Raspberry Pi + SD card, Monitor + HDMI Cable, Keyboard & Mouse and
required Power supply, l Red LED and Blue LED, 2 I K resistors, push button and
...
286 !lltcmct o/111ing 5 JoT Pl1ysic11/ Dt'Viccs 11111/ £111/points: Tlns11bcrryPi 287
Description
Dependent resistor, PIR(Passivc Infrared sensor) sensor.
.., \~ GPIO.sctup(27,GPIO.OUT)
Now let us look at an example involving an PIR sensor which detects the motion
~·· _) GPIO_PIR_scnsor = 7
of an object. Figure shows the schematic diagram of COilllecting an PIR sensor
.,,.;•
to Raspberry Pi board. Box shows a python program which the motion of an J,
object and triggers a message as "Motion detected".This example shows how print "PIR Module Test (CTRL-C to exit)"
lo get an analog input from GPJO pins and process the input. An infinite loop # configure pin to be input
nms over the PIR sensor which waits for any of the movements across its GPJO.sctup(GPIO_PIR _scnsor,GPIO.JN)
boundary. Compile the code given below and upload it to Arduino UNO Board
to observe at the desired output. CurrentState = 0
Circuit Diagram
PrcviousState = 0
Duucr
try:
print "Waiting for PJR to settle ..."
# iterate till PIR outputs the value 0
PIR Sensor while GPIO.input(GPIO_PIR_sensor)= I:
CurrentState = 0
print " Ready"
# Iterate until user types CTRL-C
while True:
# status of the PIR to be read
CurrentStatc = GPIO.input(GPIO_PIR_sensor)
if CurrentState==l and PreviousState==0:
# Trigger action on PJR
print " Motion detected!"
i~---· # Previous status of the PIR to be recorded
GPIO.output(27,GPJO.HIGH)
time.sleep( I)
GPJO.output(27,GPIO.LOW)
Key points I. Create file "touch python pir.py"
PreviousState= I
2. To run the python code "sudo python pir.py" << Move in front of
the PIR to activate it. elif CurrentState=0 and PreviousState== I :
# check if PIR has arrived to the ready state
Code File: PIR.py
print " Ready"
#!/usr/bin/python
PreviousState=0
import RPi.GPIO as GPIO
# stop for 10 milliseconds
import time
l ,,T 1'11~• il>'I I 11n;N 1 <',;l 1,·tl,~i,,f•: '!l.t<l"•l7,..jf"t
2SS -=--=~~-=--...,.....~~--=---=.....,...-e-,...,;,----.-~.....,.....,...--,,-,........,..._,-,__,..........,.,._.,,,
1\ . I r. •
timc.slccp(0.0 I) An,: D. ,;
except Kcyboardlntcm1pt: 8. \\'h~I h lhc rnllai)t' r,n wh/<1'1 R.1'<p h~rty Pi i~ t<> t;,, opmH~d-~
print" Quit" 1\ . 4 fl :> C 6
# GPIO settings to be reset ,\ns: ll. 5
GPIO.clcanupO 9. Uy cltfoull l\h~I 1, Ilic IJttrnarnt or p;plmry pf ~
Output Move in front of the PIR to activate it and sensor generates a message .. A. l'i IL P..,i:rt•ctr;,' C. R.,isph,;;,;r
Ans: A. Pis
~~,yr.~uw4iy 10. Which is the Xll~IC mtdb crntu· rl i;t1 ih,1tir-:o of u~pb~rry Pi".'
In this chapter you learned about Raspberry Pi which is a low cost mini computer. Raspberry Pi A. Pidora 13. i!.up ;.,in C RISC OS n (1pri1El-EC
suppons various flavors of Linux operating system. The omcial recommended operating system Ans: D. OpenELEC
is Raspbian Linux. Raspberry Pi has an ARM processor, 512 Ml3 RAM , two US13 ports, HDMI,
RCA and audio outputs, Ethernet port, SD card slot and DSI and CS! interfaces which depends on
the version of Raspberry Pi used. Raspberry Pi has serial, SP) and 12C interfaces for data transfer.
I. What is a raspberry pi?
Raspberry Pi supports python. You learned how to develop Python Programs that run on the Raspbcry
2. What is the uscrTIJmc and pJSS\\O:d fo-r tt.r 1:l:\j-i:o::;:,:,,- pr,
Pi. You learned how to interface LED, switch, LDR etc
3. Why ~ocs nothing happen when i type in my r...1:.,,-:-., ,xi. cfa! r..y r:ispb:rry pi i'r.:•--1.:;·.,
4. What 1s the difference between model J ;:::tl r.-v,!-d ~.,
5. How do i connect a mouse and kc,•bo;ird?
1. Raspberry Pi supports the concept of cross platform. 6. Where is the on/off switch? - .
A. True B. False 7. Who or what is noobs?
Ans: A. True 8. What soc arc you using?
2. Raspberry Pi is an Open Source and extensible software but not hardware.
9. What is a soc?
A. True B. False
10. Does raspberry pi ovcrclock?
Ans: B. False II. Docs raspberry pi need a hcatsink?
3. Which of the following Raspberry Pi model support wireless connectivity ·12. What hardware interfaces docs raspberry pi !mv-c?
A. Model A+ B. Model B C. Model 3 D. Model B+
13. Why is there no real time clock (rte)?
Ans: C. Model 3 14. What displays can i use with raspberry pi ?
4. How many GPIO pins are there in Raspberry Pi model 3? 15. Docs the hdmi port support cec?
A. 26 B. 30 C. 40 D. 42 16. Why is there no vga support?
Ans: C.40 17. \Vha'. arc the power requirements for rapbcrry pi'?
5. Which of the following programming dialect doesnot come with operating system of
18. Can I power the raspbert)• pi from a usb hub".'
Raspberry Pi? 19. Can i power• the raspb ~•rrv · ~ t, •
A. C B. C++ C. Java D. Python .. , P1 rom :men~ as wdl as from a wall so.:h;r?
20. \\1hat operating system (os) do.:s rJpbcny pi ll',::? .
Ans: D. Python 21.
What is the processing speed of Model A+ of Raspberry Pi? D~es rapbcrry pi have an ollkial prcigramming bngu:i~i..-1
6. 22.
A. 700MHz B. 900MHz C. 1.2GHz D. 1.4GHz :'." rapbcrry p'. nm ll'illl· (nr windows. cir oth:r :xS-6 s~riware)?
23. . '.II rapbcrry p1 run the wi11d1n,·s S ann cuitiun?
Ans: A. 700MHz 24. Will rapbcrry pi run android?
7. How many USB ports arc thcr in Model 3 of Raspberry Pi?