0% found this document useful (0 votes)
27 views125 pages

IAC Unit III

The document discusses a unit on microprocessor and microcontroller instrumentation and control. It is taught by Prof. Praveen P. Rathod at Vishwakarma Institute of Information Technology, Pune. The objectives are to understand applications of electronics, electrical, mechanical and computer systems for control of mechanical and electronic systems and to interface sensors and actuators using data acquisition and microcontrollers. It covers topics like types of signal communication, elements of instrumentation and control systems, number systems, data acquisition components and steps, analog and digital signals, digital signal processing, sampling, and sampling rate.

Uploaded by

Sayam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views125 pages

IAC Unit III

The document discusses a unit on microprocessor and microcontroller instrumentation and control. It is taught by Prof. Praveen P. Rathod at Vishwakarma Institute of Information Technology, Pune. The objectives are to understand applications of electronics, electrical, mechanical and computer systems for control of mechanical and electronic systems and to interface sensors and actuators using data acquisition and microcontrollers. It covers topics like types of signal communication, elements of instrumentation and control systems, number systems, data acquisition components and steps, analog and digital signals, digital signal processing, sampling, and sampling rate.

Uploaded by

Sayam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 125

Unit 3 Microprocessor and

Microcontroller
Instrumentation and Control

Prof. Praveen P. Rathod


[email protected]
Department of Mechanical Engineering

BRACT’S, Vishwakarma Institute of Information Technology, Pune-48

(An Autonomous Institute affiliated to Savitribai Phule Pune University)


(NBA and NAAC accredited, ISO 9001:2015 certified)
Department of Mechanical Engineering, VIIT , Pune-48
2
Department of Mechanical Engineering, VIIT , Pune-48
Objective`

1. To understand the interdisciplinary applications of Electronics,


Electrical, Mechanical and Computer Systems for the Control of
Mechanical and Electronic Systems.

Learning Outcome/Course Outcome

1. To Know the Interfacing of Sensors, Actuators using appropriate


DAQ/micro-controller

Department of Mechanical Engineering, VIIT , Pune-48 3


Types of signal communications

Department of Mechanical Engineering, VIIT , Pune-48


Parallel Signal Communication

Department of Mechanical Engineering, VIIT , Pune-48


Serial Communication

Department of Mechanical Engineering, VIIT , Pune-48


Asynchronous
• A type of communication that sends the data using flow control rather
then a clock to synchronize the data between the sender and receiver.
• It also called as start stop transmission.
• Here each character is surrounded by start stop signals.
• A start bit is send before sending the data. The start bit has value zero
called state space.

Department of Mechanical Engineering, VIIT , Pune-48


• When line switches from 1 to 0, the receiver is alerted the data is
coming.
• An idle line is identified with the value 1 also called mark state.
• Data is transmitted character by character at regular intervals.

Department of Mechanical Engineering, VIIT , Pune-48


Department of Mechanical Engineering, VIIT , Pune-48
synchronous

• A type of transmission that uses a clock to control the timing of the


bits.
• Large volume of information can be transmitted at single time.
• Data transmitted block by block.
• Synchronized clock is necessary for synchronous transmission.

Department of Mechanical Engineering, VIIT , Pune-48


Department of Mechanical Engineering, VIIT , Pune-48
Elements of I & C System

Mechanical Amplifying
Sensors
System Electronics

Data Acquisition
Actuators System

Amplifying Data Acquisition Control System


Electronics System Micro-controller or
Computer

Department of Mechanical Engineering, VIIT , Pune-48


Number System

Department of Mechanical Engineering, VIIT , Pune-48


Binary numbers

Department of Mechanical Engineering, VIIT , Pune-48


DAQ (Construction)

Transducer Filter ADC Computer DAC Amplification Actuator

Department of Mechanical Engineering, VIIT , Pune-48


Steps in DAQ
1. The input transducers measure some property of the environment.
2. The output from the transducers is conditioned (amplified, filtered, etc.).
3. The conditioned analog signal is digitized using an analog-to-digital
converter (ADC).
4. The digital information is acquired, processed and recorded by the
computer.
5. The computer may then modify the environment by outputting control
signals. The digital control signals are converted to analog signals using a
digital-to-analog converter (DAC).
6. The analog signals are conditioned (e.g. amplified and filtered)
appropriately for an output transducer.
7. The output transducer interacts with the environment.

Department of Mechanical Engineering, VIIT , Pune-48


Why Signal Conditioning ?
To measure signals from transducers, you must convert them into a
form a measurement device can accept.
Common types of signal conditioning include amplification,
linearization, transducer excitation, and isolation.

Department of Mechanical Engineering, VIIT , Pune-48


Example : Components of PCM encoder
(Pulse Code Modulation)

PCM consists of three steps to digitize an analog signal:


1. Sampling
2. Quantization
3. Binary encoding

Department of Mechanical Engineering, VIIT , Pune-48


What is Analog / Digital Signal ?

Analog Control System

Digital Control
System

Department of Mechanical Engineering, VIIT , Pune-48


What is DSP (Digital Signal Processing) ?
• Converting a continuously changing waveform (analog) into a
series of discrete levels (digital)

Department of Mechanical Engineering, VIIT , Pune-48


What is DSP ?
• The analog waveform is sliced into equal segments and the waveform
amplitude is measured in the middle of each segment
• The collection of measurements make up the digital representation of
the waveform
2
1.27
1.5
1.24

1.24
1.2

1.2
1.11

1.11
0.98

0.98
0.82

0.82
1
0.64

0.64
0.44

0.44
0.5
0.22

0.22
1 0

19 0

37 0
0
3

11

13

15

17

-0.44 21

23

25

27

29

31

33

-0.44 35
-0.22

-0.22
-0.5
-0.64

-0.64
-0.82

-0.82
-1
-0.98

-0.98
-1.11

-1.11
-1.2

-1.2
-1.26

-1.26
-1.28
-1.5
-2

Department of Mechanical Engineering, VIIT , Pune-48


Sampling Rate
• The data is acquired by an ADC using a process called sampling.
• Sampling an analog signal occurs at discrete time intervals.
• The rate at which the signal is sampled is known as the sampling
frequency.

Sampling

Department of Mechanical Engineering, VIIT , Pune-48


Sampling Frequency / Rate

Department of Mechanical Engineering, VIIT , Pune-48


Sampling of analog signal
It is usual to specify a sampling rate
or frequency fs rather than the
sampling period. The frequency is
given by

fs= 1/Ts, where fs is in Hertz.


Continuous Signal

If the sampling rate is high enough,


then the signal x(t) can be
constructed from x[n] by simply
joining the points by small linear
portions, thus approximating to the
Sampled Signal
analog signal.

9/23/2020 24
Department of Mechanical Engineering, VIIT , Pune-48
Sampling Theorem
The sampling theorem, or more correctly Shannon's
sampling theorem, states that we need to sample a
signal at a rate at least twice the maximum frequency
component in order to retain all frequency components in
the signal.
fs > 2 fmax
where fs is the sampling rate (frequency),
fmax is the highest frequency in the input signal,

and the minimum required rate (2/fmax) is called the


Nyquist frequency.
9/23/2020 25
Department of Mechanical Engineering, VIIT , Pune-48
Quantization theory
• Analog to digital conversion is a two-step process, which changes a sampled
analog voltage into digital form.
• Quantization (Quantization is the transformation of a continuous analog
input into a set of data represented by discrete output states.)
• Coding (Coding is the assignment of a digital code word or number to each
output state)

26
Department of Mechanical Engineering, VIIT , Pune-48
Quantization theory
• The analog quantization size (or resolution) Q is defined as the full scale
range of the ADC divided by the number of output states:

Vmax  Vmin
Q
2 1
n

• (Vmax – Vmin) is range of ADC


• n is bit of ADC

27
Department of Mechanical Engineering, VIIT , Pune-48
Resolution in DAQ ?

• Resolution (bits) & Code Width


• Sampling rate (samples/second)
• Number of channels, and data transfer rate (usually limited
by “bus” type: USB, PCI, PXI, etc.)).

• Precision of ANALOG to DIGITAL conversion process is


dependent upon the number (n) of bits the ADC of DAQ is
used.
• The higher the resolution, the higher the number of division
the voltage range is broken into (2n), and therefore, the
smaller detectable voltage changes.

Department of Mechanical Engineering, VIIT , Pune-48


Resolution

Department of Mechanical Engineering, VIIT , Pune-48


Department of Mechanical Engineering, VIIT , Pune-48
Effect of Sampling Frequency in signal reconstruction
Sampling the waveform cos(60t)

1000 Hz 100 Hz

20 Hz 10 Hz

9/23/2020 31
Department of Mechanical Engineering, VIIT , Pune-48
A/D Converter: Sampling Rate

• Aliasing
• Acquired signal gets distorted if sampling rate is too small.

Department of Mechanical Engineering, VIIT , Pune-48


Aliasing (Time Domain) Actual Signal

Reconstructed
Signal
33
Department of Mechanical Engineering, VIIT , Pune-48
Methods of avoiding Aliasing

To avoid aliasing, there are two approaches:


One is to raise the sampling frequency to satisfy the sampling
theorem.

The other is to filter off the unnecessary high-frequency components


from the continuous-time signal.

We limit the signal frequency by an effective low-pass filter, called


anti-aliasing prefilter, so that the highest frequency left in the signal
is less than half of the intended sampling rate.

34
Department of Mechanical Engineering, VIIT , Pune-48
Examples

9/23/2020 35
Department of Mechanical Engineering, VIIT , Pune-48
Examples

• Knowing the resolution, Q, and range, R, of an ADC, we can


determine the number of bits required as follows:

9/23/2020 36
Department of Mechanical Engineering, VIIT , Pune-48
Microprocessors
Microprocessor developments

• 4-Bit Microprocessors
• 8-Bit Microprocessors
• 16-Bit Microprocessors
• 32-Bit Microprocessors
• 64-Bit Microprocessors

Department of Mechanical Engineering, VIIT , Pune-48


4-BIT MICROPROCESSORS
INTEL • 1971. INTEL 4040
4004 • It was the first
• microprocessor by
Intel.
• It was a 4-bit μP.
• Its clock speed was
• 740KHz.
• It had 2,300
transistors.
• It could execute
 Introduced in 1974.
around  It was also 4-bit μP.
• 60,000 instructions
per second.
Department of Mechanical Engineering, VIIT , Pune-48
8-BIT MICROPROCESSORS
INTEL 8080
INTEL
8008

• Introduced in 1974.
• It was also 8-bit μP.
• Its clock speed was 2 MHz.
• Introduced in 1972. • It had 6,000 transistors.
• It was first 8-bit μP. • Was 10 times faster than
• Its clock speed was 500 8008.
KHz.
• Could execute 50,000 • Could execute 5,00,000
• instructions per second. instructions per second

Department of Mechanical Engineering, VIIT , Pune-48


8-BIT MICROPROCESSORS
INTEL
8085 INTEL 8080

It was also 8-bit μP. • Introduced in 1974.


Its clock speed was 3 MHz.1976. • It was also 8-bit μP.
Its data bus is 8-bit and address • Its clock speed was 2 MHz.
bus is 16-bit. • It had 6,000 transistors.
It had 6,500 transistors. • Was 10 times faster than
Could execute 7,69,230 8008.
instructions per second. • Could execute 5,00,000
It could access 64 KB of memory. instructions per second
It had 246 instructions.
Department of Mechanical Engineering, VIIT , Pune-48
16-BIT MICROPROCESSORS
INTEL INTEL 8088
8086
1978. 1979.

• Its clock speed is 4.77 MHz, 8 • It was created as a cheaper


MHz and 10 MHz, depending version of Intel’s 8086.
on the version.
• Its data bus is 16-bit and
• It was a 16-bit processor with
address bus is 20-bit. an 8-bit external bus.
• It had 29,000 transistors. • Could execute 2.5 million
• Could execute 2.5 million instructions per second.
instructions per second. • This chip became the most
• It could access 1 MB of
memory.
popular in the computer
• It had 22,000 instructions. • industry when IBM used it for
• It had Multiply and Divide its first PC.
instructions.
Department of Mechanical Engineering, VIIT , Pune-48
16-BIT MICROPROCESSORS INTEL 80286
INTEL 80186
& 80188 1982.
1982.

• Clock speed was 6 MHz.


• 80188 was a cheaper
version of 80186 with an 8- • Its clock speed was 8 MHz.
bit external data bus. • Its data bus is 16-bit and
• They had additional address bus is 24-bit.
components like: • It could address 16 MB of
• Interrupt Controller memory.
• Clock Generator • It had 1,34,000 transistors.
• Local Bus Controller • It could execute 4 million
• Counters instructions per second.
Department of Mechanical Engineering, VIIT , Pune-48
16-BIT MICROPROCESSORS INTEL 80486
INTEL 80386
1986. 1989.

• Its data bus is 32-bit and


address bus is 32-bit.
• It could address 4 GB of • It had 1.2 million
memory. transistors.
• It had 2,75,000 transistors. • Its clock speed varied from
• Its clock speed varied from 16 MHz to 100 MHz
16 MHz to 33 MHz depending upon the
depending upon the various various versions.
versions. • Versions: 80486 DX, 80486
• Versions: 80386 DX, 80386 SX, 80486 DX2, 80486 SL,
SX, 80386 SL, 80486 DX4
16-BIT MICROPROCESSORS INTEL PENTIUM PRO
INTEL
PENTIUM 1993. 1995.

• It was originally named 80586. • It had L2 cache of 256 KB.


• Its clock speed was 66 MHz. • It had 21 million
• Its data bus is 32-bit and address transistors.
• It was primarily used in
bus is 32-bit. server systems.
• It could address 4 GB of memory. • Cache memory: 8 KB for
• Could execute 110 million instructions, 8 KB for
instructions per second. data.
• Cache memory: 8 KB for • It had L2 cache of 256 KB.
instructions, 8 KB for data.
Department of Mechanical Engineering, VIIT , Pune-48
16-BIT MICROPROCESSORS INTEL PENTIUM II XEO
INTEL
PENTIUM II 1998.
1997.

• It was also 32-bit μP. • It was also 32-bit μP.


• Its clock speed was 233 • It was designed for servers.
MHz to 500 MHz. • Its clock speed was 400
• Could execute 333 million MHz to 450 MHz.
instructions per second. • L1 cache of 32 KB & L2
• MMX technology was cache of 512 KB, 1MB or 2
supported. MB.
• L2 cache & processor were • It could work with 4 Xeons
on one circuit. in same system
Department of Mechanical Engineering, VIIT , Pune-48
16-BIT MICROPROCESSORS INTEL DUAL CORE
INTEL
PENTIUM IV 2006
2000

• It was also 32-bit μP. • It is 32-bit or 64-bit μP.


• Its clock speed was 1.3 GHz to • It has two cores. Both the cores
3.8 GHz. have there own internal bus and
• L1 cache was of 32 KB & L2 L1 cache, but share then external
cache of 256 KB. bus and L2 cache
• It had 42 million transistors. • It supported SMT technology.
• All internal connections were • SMT: Simultaneously Multi-
made from aluminium to Threading
copper. • E.g.: Adobe Photoshop supported
SMT.

Department of Mechanical Engineering, VIIT , Pune-48


64-BIT MICROPROCESSORS INTEL CORE I7
INTEL CORE
2 2008
2006

• It was also 64-bit μP.


• Its clock speed was 1.2 • It is 64-bit μP.
GHz to 3 GHz. • It has 4 physical cores.
• L1 cache was of 64 KB & L2 • Its clock speed is from 2.66
cache of 256 KB. GHz to 3.33 GHz.
• It had 291 million • It has 781 million
transistors. transistors.
• It is launched in three • It has 64 KB of L1 cache per
different versions: Intel core, 256 KB of L2 cache
Core 2 Duo, Intel Core 2 and 8 MB of L3 cache.
64-BIT MICROPROCESSORS INTEL CORE i5
INTEL CORE
i7 2008
2009

• It was also 64-bit μP. • It is 64-bit μP.


• It has 4 physical cores. • It has 4 physical cores.
• Its clock speed is from 2.66 • Its clock speed is from 2.4
GHz to 3.33 GHz. GHz to 3.6 GHz.
• It has 781 million • It has 781 million
transistors. transistors.
• It has 64 KB of L1 cache • It has 64 KB of L1 cache per
per core, 256 KB of L2 core, 256 KB of L2 cache
cache and 8 MB of L3 and 8 MB of L3 cache.
Outline

•Microprocessor systems
• Buses
• Microprocessor components
• Memory and input / output
•Microcontrollers
• Difference with microprocessor
• Motorola M68HC11
• Intel 8051
• Programming

Department of Mechanical Engineering, VIIT , Pune-48


Microprocessor (MPU)
Memory

• Storage Device
• Addresses
• Registers
• Major
Categories
• Read/Write
Memory
(R/W)
• Read-only-
Memory
(ROM)
• MPU (CPU)
• Read instructions
• Process binary
data
330_01 51
Department of Mechanical Engineering, VIIT , Pune-48
Microprocessor-Based
Systems
Input Devices
Switches and
Keypads
Provide binary
information to the
MPU
Output devices
LEDs and LCDs
Receive binary
information from the
MPU
MPU communicates with Memory and I/O using the
System Bus
Address bus
Unidirectional
Memory and I/O Addresses
Data bus
Bidirectional
Transfers Binary Data and Instructions
Control lines
52
Read and Write timing signals
The Bus

• The bus provides the communication infrastructure among the


various components of the system
• Data bus carries the information being transmitted/received.
• Address bus tells where the information is being transferred
to/from.
• Control bus specifies when the information transfer take place
by coordinating the access to the data bus and the address
bus, and directs the data from/to the specific components.

53
Department of Mechanical Engineering, VIIT , Pune-48
Microprocessor-Based System

330_01 54
Department of Mechanical Engineering, VIIT , Pune-48
8085 Architecture

Department of Mechanical Engineering, VIIT , Pune-48


Software
• Machine Language
• Binary Instructions
• Difficult to write
• Error-prone
• All programs converted into machine language for
execution

56
Department of Mechanical Engineering, VIIT , Pune-48
Software

•Assembly Language
• Machine instructions represented in mnemonics
• One-to-one correspondence
• Efficient execution and use of memory
• Machine-specific

57
Department of Mechanical Engineering, VIIT , Pune-48
Software

•High-Level Languages
• BASIC, C, and C++
• Written in statements of spoken languages
• Machine independent
• Easy to write and troubleshoot
• Larger memory and less efficient execution

58
Department of Mechanical Engineering, VIIT , Pune-48
59
Department of Mechanical Engineering, VIIT , Pune-48
Microcontroller

• Integrated system designed to operate as an embedded computing system (=


a computer which is part of a larger system)
• Microprocessor, memory, I/O ports, and support devices on a single chip
• Buses generally not available to a system designer
• I/O ports generally multiplexed and can be programmed to perform different
functions

• It is composed by:
• microprocessor (CPU),
• ROM (for the program),
• RAM (for the data)
• I/O ports (to communicate/interface with external resources),
• Peripheral devices (to make easier the interfacing and implementation of
the desired functionalities),

60
Department of Mechanical Engineering, VIIT , Pune-48
Microcontroller System

• The buffers and converters condition I/O signal levels if necessary


• The bus is a group of signals (data, address, control signal) with a common
purpose.
• The clock circuit generates a fixed-frequency, timing signal for the entire
system.
• The power supply converts a raw power source into the DC voltage
(nominally 5V) required by the system.

61
Department of Mechanical Engineering, VIIT , Pune-48
MCU-Based System

62
Department of Mechanical Engineering, VIIT , Pune-48
8051 Microcontroller Architecture

Department of Mechanical Engineering, VIIT , Pune-48


Applications
• Consumer:
• Washing machine,
• Remote controls
• Clocks and watches
• Games and Toys
• Audio/video

• Communication:
• Telephone systems,
• Answering machines
• Cell phones and pagers
• Networking (ATM, credit cards, Ethernet)

• Automotive:
• Safety devices (Automatic Braking System, Airbag)
• Motor control (ignition, exhausts)
• Power windows and seats
• Instrumentation

64
Department of Mechanical Engineering, VIIT , Pune-48
• Military:
• Guidance systems
• Global positioning systems
• Target recognition systems

• Industrial:
• Traffic control
• Robotics
• Production plants
• Inventory and stock management

• Medical:
• Cardiac monitors
• Renal Monitors
• Pacemakers
• Dialysis machines

65
Department of Mechanical Engineering, VIIT , Pune-48
Microprocessor vs. Microcontroller
Microprocessor Microcontroller
Microprocessor is the heart of Computer Micro Controller is the heart of an embedded
system. system.
It is only a processor, so memory and I/O Micro Controller has a processor along with
components need to be connected externally internal memory and I/O components.
Memory and I/O has to be connected externally, Memory and I/O are already present, and the
so the circuit becomes large. internal circuit is small.
You can't use it in compact systems You can use it in compact systems.
Cost of the entire system is high Cost of the entire system is low
Due to external components, the total power As external components are low, total power
consumption is high. Therefore, it is not ideal consumption is less. So it can be used with devices
for the devices running on stored power like running on stored power like batteries.
batteries.
Most of the microprocessors do not have power Most of the microcontrollers offer power-saving
saving features. mode.
It is mainly used in personal computers. It is used mainly in a washing machine, MP3
players, and embedded systems.
Microprocessor has a smaller number of Microcontroller has more register. Hence the
registers, so more operations are memory- programs are easier to write.
based.

Department of Mechanical Engineering, VIIT , Pune-48


Microprocessors are based on Von Neumann Micro controllers arc based on Harvard
model architecture
It is a central processing unit on a single silicon- It is a byproduct of the development of
based integrated chip. microprocessors with a CPU along with other
peripherals.
It has no RAM, ROM, Input-Output units, timers, It has a CPU along with RAM, ROM, and other
and other peripherals on the chip. peripherals embedded on a single chip.
It uses an external bus to interface to RAM, ROM, It uses an internal controlling bus.
and other peripherals.
Microprocessor-based systems can run at a very Microcontroller based systems run up to 200MHz
high speed because of the technology involved. or more depending on the architecture.

It's used for general purpose applications that It's used for application-specific systems.
allow you to handle loads of data.
It's complex and expensive, with a large number It's simple and inexpensive with less number of
of instructions to process. instructions to process.

Department of Mechanical Engineering, VIIT , Pune-48


Arduino

Department of Mechanical Engineering, VIIT , Pune-48


What is an Arduino ?

• Open Source electronic prototyping platform based on flexible easy


to use hardware and software.

Department of Mechanical Engineering, VIIT , Pune-48


What is a Microcontroller

• A small computer on a single chip


• containing a processor, memory, and input/output
• Typically "embedded" inside some device that they control
• A microcontroller is often small and low cost
Department of Mechanical Engineering, VIIT , Pune-48
What is a Development Board

• A printed circuit board designed


to facilitate work with a particular
microcontroller.

• Typical components include:


• power circuit
• programming interface
• basic input; usually buttons and LEDs
• I/O pins
Department of Mechanical Engineering, VIIT , Pune-48
The Arduino Development Board

Department of Mechanical Engineering, VIIT , Pune-48


What is the Arduino

Department of Mechanical Engineering, VIIT , Pune-48


Getting Started
• Check out: http://arduino.cc/en/Guide/HomePage
1. Download & install the Arduino environment (IDE)
2. Connect the board to your computer via the UBS
cable
3. If needed, install the drivers (not needed in lab)
4. Launch the Arduino IDE
5. Select your board
6. Select your serial port
7. Open the blink example
8. Upload the program

Department of Mechanical Engineering, VIIT , Pune-48


Try It: Connect the USB Cable

todbot.com/blog/bionicarduino
Department of Mechanical Engineering, VIIT , Pune-48
Arduino IDE

See: http://arduino.cc/en/Guide/Environment for more information


Department of Mechanical Engineering, VIIT , Pune-48
Select Serial Port and Board

Department of Mechanical Engineering, VIIT , Pune-48


Status Messages

Department of Mechanical Engineering, VIIT , Pune-48


Department of Mechanical Engineering, VIIT , Pune-48
Add an External LED to pin 13

• File > Examples > Digital > Blink


• LED’s have polarity
– Negative indicated by flat side of the housing
and a short leg
A Little Bit About Programming

• Code is case sensitive


• Statements are commands and
must end with a semi-colon
• Comments follow a // or begin
with /* and end with */
• loop and setup

Department of Mechanical Engineering, VIIT , Pune-48


Our First Program

Department of Mechanical Engineering, VIIT , Pune-48


Terminology

Department of Mechanical Engineering, VIIT , Pune-48


Digital I/0

pinMode(pin, mode)
Sets pin to either INPUT or OUTPUT

digitalRead(pin)
Reads HIGH or LOW from a pin

digitalWrite(pin, value)
Writes HIGH or LOW to a pin

Electronic stuff
Output pins can provide 40 mA of current
Writing HIGH to an input pin installs a 20KΩ pullup

Department of Mechanical Engineering, VIIT , Pune-48


Digital? Analog?

• Digital has two values: on and off


• Analog has many (infinite) values
• Computers don’t really do analog, they
quantize
• Remember the 6 analog input pins---here’s
how they work

Department of Mechanical Engineering, VIIT , Pune-48


todbot.com/blog/bionicarduino
RaspberryPi

Department of Mechanical Engineering, VIIT , Pune-48


Outline

•Introduction to Raspberry Pi
•Python
•Electronics
•Linux

Department of Mechanical Engineering, VIIT , Pune-48


What is a Raspberry Pi?

• University of Cambridge’s Computer Laboratory


• Decline in skill level
• Designed for education
• A credit card sized PC
• Plugs into a TV or monitor
• Inexpensive
• Capability:
• Programming
• Interdisciplinary Projects
• Office
• Play HD Videos

Department of Mechanical Engineering, VIIT , Pune-48


Variations of Raspberry Pi
• Hardware platform
• Raspberry Pi Zero
• Raspberry Pi
• Raspberry Pi 2
• Raspberry Pi 3 (with Wifi + Bluetooth)
• Software platform
• Noobs
• Raspbian
• 3rd OS
• https://www.raspberrypi.org/downloads/

Department of Mechanical Engineering, VIIT , Pune-48


Kit Components
• Essential:
• Raspberry Pi board
• Prepared Operating System SD Card
• USB keyboard
• Display (with HDMI, DVI, or Composite input)
• Power Supply
• Highly suggested extras include:
• USB mouse
• Internet connectivity - LAN cable
• Powered USB Hub
• Case

Department of Mechanical Engineering, VIIT , Pune-48


Programming Languages

• The Raspberry Pi Foundation recommends Python


• Any language which will compile for ARMv6 can be
used
• Installed by default on the Raspberry Pi:
•C
• C++
• Java
• Scratch
• Ruby

Department of Mechanical Engineering, VIIT , Pune-48


Challenges and Opportunities
• New operating system: linux
• Open-source, all almost tools/software are free
• Rich resources on the web due to its popularity
• Resources link: www.raspberrypi.org
• Pi Educational Document (resources above link)
• Pinet: Centralised user accounts and file storage system for a
Raspberry Pi classroom. http://pinet.org.uk/

Department of Mechanical Engineering, VIIT , Pune-48


Linux
• Interesting, powerful
• Variations (Ubuntu, debian, feroda, redhat)
• Command line
• Raspberry Pi: Raspian (Debian-based)
• Pinet: Ubuntu server + Raspberry Pis
• Linux: robust, secure, easy to use, powerful

Department of Mechanical Engineering, VIIT , Pune-48


Setup

Department of Mechanical Engineering, VIIT , Pune-48


Department of Mechanical Engineering, VIIT , Pune-48
Power

5v micro
USB connector

(Similar to the one on a lot of mobile


phones!)
Department of Mechanical Engineering, VIIT , Pune-48
3.5mm Audio
Standard
A/V (Audio/Video) headphone
socket
RCA Video
(works with most
older TVs)

HDMI Audio & Video


(works with modern TVs and DVI monitors)
Department of Mechanical Engineering, VIIT , Pune-48
Connectivity

2 x USB 2.0
ports
GPIO
(General
Purpose
Input &
Output)

10/100Mb
Ethernet
Department of Mechanical Engineering, VIIT , Pune-48
Internals
LAN Controller

DSI
(display
interface) CSI
(camera
interface)
SOC (System On a Chip)
Broadcom BCM2835 700Mhz
Department of Mechanical Engineering, VIIT , Pune-48
Storage

SD Card Slot
(supports SD cards up to 32GB)
Department of Mechanical Engineering, VIIT , Pune-48
10 Uses for
a Raspberry Pi

Department of Mechanical Engineering, VIIT , Pune-48


10 Office

9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Office

10 9 8 7 6 5 4 3 2 1
9 Programming

10 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Programming

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Operating System
• Linux on a bootable SD card
•Fedora
•Debian
•ArchLinux

Department of Mechanical Engineering, VIIT , Pune-48


Programming

•By default, supporting Python as


the educational language.
• Any language which will compile
for ARMv6 can be used with the
Raspberry Pi, though; so you’re not
limited to using Python.
•For primary age SCRATCH game
maker is bundled

Department of Mechanical Engineering, VIIT , Pune-48


Scratch

Department of Mechanical Engineering, VIIT , Pune-48


Scratch

Department of Mechanical Engineering, VIIT , Pune-48


Game
8
Console

10 9 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Game
Console

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
7 Web Server

10 9 8 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Web Server

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
6 Tor Router

10 9 8 7 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Tor Router

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
5 HTPC

10 9 8 7 6 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
HTPC

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
4 Bird House

10 9 8 7 6 5 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Bird House

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Super
3
Computer

10 9 8 7 6 5 4 2 1
Department of Mechanical Engineering, VIIT , Pune-48
Supercomputer

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
2 Clock

10 9 8 7 6 5 4 3
Department of Mechanical Engineering, VIIT , Pune-48
1
Clock

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48
1 PiBot!

10 9 8 7 6 5 4 3 2
Department of Mechanical Engineering, VIIT , Pune-48
PiBot!

10 9 8 7 6 5 4 3 2 1
Department of Mechanical Engineering, VIIT , Pune-48

You might also like