Top Banner
Embedded systems Exercise session 1 Introduction and project presentation
34

Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

May 14, 2018

Download

Documents

vuphuc
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

Embedded systems

Exercise session 1

Introduction and project presentation

Page 2: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

2

Introduction

Contact● Mail : [email protected]● Office : 1.82a, Montefiore● Website for the exercise sessions and the project :

http://www.montefiore.ulg.ac.be/~mfonder/INFO0064/

Today● Project presentation● Overview of technologies available for your project● Basic reminders in electricity

Page 3: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

3

Embedded Systems ProjectAimDesign, realisation and programming of an embedded circuit. The precise subject (the type of circuit, its purpose,...) is left as a choice for each group but some requirements have to be fulfilled. Those requirements are :● The necessity to have real-time constraints and concurrent tasks;● The necessity to design and implement the electronic circuit needed to make your

project meets its goal in practice;● The necessity to use a real-time computing platform (e.g. a microcontroller) to

implement the logical part of the project.

Concretely● Group of 3 or 4 students● Several intermediate mandatory deadlines (see website for detailed schedule)● 3 preparation labs

Page 4: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

4

Embedded Systems ProjectFirst DeadlinesGroups formation:

● For the embedded systems project 3-4 students/group● For the major project in electronics 4-5 students/group● Ideally today at the end of the session● Or before next week after the exercise session by mail

Project ideas presentation● For the embedded systems project Fri Oct 13 after the theoretical course● For the major project in electronics Wed Oct 11 9am

Present a few slides which describe your project and how you plan to implement it. The aim of this presentation is to assess the feasibility of your idea based on our experience and to guide you toward something more adapted to the awaited level if necessary.

Page 5: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

5

Embedded Systems ProjectTypical Workflow

1) System specification and constraints⚫ What your circuit should achieve⚫ Your project definition

2) Define a global solution⚫ Find ways to achieve the specifications⚫ Choice of sensors, actuators and other important components

3) Conceive an electronic schematic which meets specifications⚫ Find all the components required for your circuit to work and interconnect them properly

4) Test and validate each critical component individually5) Complete circuit prototype realisation and tests (return to step 2 if needed)6) Design and realisation of a printed of a Printed Circuit Board (PCB) (not

mandatory)

Page 6: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

6

Practical Notes for the ProjectMaterial● We will lend you a toolbox containing the cables needed to use the devices of the

r100 lab and some basic components required to start the project immediately. All the content of this toolbox will have to be handled back at the end of the year for your project to be evaluated. Missing parts will have to be repaid!

● You will have a small budget to buy additional components to complete your circuit.

Advice● The project combines electronics, informatics and a small part of signal processing.

All of those parts are important for the good completion of your project. So take care of each of them.

● Practical advice will be given during the exercises sessions and in feedbacks. Ignoring them will certainly make you lose time and maybe points at the end of your project. So, for your own good, pay attention and listen to what is said!

Page 7: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

7

Microcontrollers : First insight“So, the project revolves around microcontrollers… But what are they?”Microcontrollers (MCU) are small on-chip computers with a series of input and output pins. They contain at least all the components required to run a basic embedded program. They often include additional modules which ease their interfacing with the outer world.

Page 8: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

8

Microcontroller example : PIC16F1789 Microchip PIC16F1789 Core Features● 8-bit words, 16-bit instructions● Only 49 instructions set● Up to 8 MIPS (Millions of Instruction Per Second)● Free programming tool● Program memory : 16ko● Data EEPROM : 256 Bytes● RAM : 2048 Bytes● Clock frequency up to 32MHz● 36 general purpose Input/Output pins

Note● The program memory holds the binary data to be executed by the microcontroller.● The EEPROM can be used to write and store data between different power cycles.● The RAM can be used to write and store data during a single power cycle.

Page 9: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

9

Microcontroller Peripheral Modules I

Additionally to the core computing unit and its digital IO pins, microcontrollers generally embed several independent peripheral modules which ease the interfacing of the MCU with the external world.

Example of Analog Peripherals● Analog to Digital Converters (ADC)

ADC are used to convert an analog voltage into binary data● Digital to Analog Converters (DAC)

DAC are used to generate an analog voltage from digital data● Comparator Modules

Comparators are used to interface analog circuits by comparing two analog voltages and providing a digital indication of their relative magnitude.

● Operational AmplifiersOperational amplifiers are use to process (e.g. amplify and or filter) analog signals.

Page 10: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

10

Microcontroller Peripheral Modules II

Additionally to the core computing unit and its digital IO pins, microcontrollers generally embed several independent peripheral modules which ease the interfacing of the MC with the external world.

Example of Digital Peripherals● Timers

Timers are used to precisely measure elapsed time.● Pulse Width Modulation (PWM) Signal Generators

PWM signals are periodic binary signals which stay high during a given proportion of their period and are low everywhere else.

● Digital busses and communication lines interfaces (e.g. I2C, EUSART, ...)Digital busses and communication lines are used to transfer binary data between two digital devices according to some given protocols.

Page 11: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

11

General considerations

Microcontrollers are computers. In order to interact with the outer world, they need both inputs (e.g. sensors) and outputs (e.g. actuators).● Inputs capture information from the world (e.g. microphones, cameras, ...)● Outputs interact with the world (e.g. motors, pumps, LEDs, ...)

Analog vs digitalMicrocontrollers are digital devices which means they work with binary data (0s and 1s).The interface between the microcontroller and the sensors or the actuators is either analog or digital:● Analog devices transmit or receive their information thanks to a continuous current

or voltage modulation => need to translate this information from or to binary data● The microcontroller communicates with other digital devices via busses or

communication lines

Page 12: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

12

Sensor ideas

Distance● Ultrasound● Infra-red

Input● Push button● Keyboard● Joystick

Positioning● Accelerometers● Gyroscopes● GPS

Other● Microphones● Pressure● Serial bus

Note Each sensor measures a particular information with one particular design=> 2 sensors measuring the same information will have a different behaviour depending on the design and the techniques they use

Page 13: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

13

Output ideas

Actuators● DC motor● Servo motor● Valve

Visual information● LED or laser● LCD screen● VGA signal

Note Microcontrollers are designed to process and transmit signals, not power=> NEVER draw the power required for an output directly on a pin the MCU if their power requirements excess the power limit of the pin

Page 14: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

14

Example : Turret of Doom

AimDetect movement within a given range and point at the moving points with a laser

Real-time constraints● Periodic mapping of the room by using a distance sensor mounted on a servo-motor● Coordination between head and laser

Embedded components● 1 IR distance sensor● 2 Servo-motors● 1 laser● 2 LEDs● 1 reset buttonOther examples : LED cube Ball BalancingNow you have all the bricks required for finding your own project subject.

Page 15: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

15

About Exercise Sessions

The exercise session will have two main objectives:● Providing you with practical knowledges to achieve your project● Making exercises about notions seen during the theoretical course

Sessions about the projectDuring the sessions about the project, we will cover the following points:● Detailed review of all the important modules of the PIC16F1789;● Presentation of useful common electronic components;● Presentation of useful simple circuits blocks;● Introduction to the rules of electronic circuit design.

Page 16: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

16

Conclusion for Today’s First Part

Project● Be creative!● Keep it simple!● Begin now!● Send me an e-mail with your group

NoteComments and critics on the exercise sessions are welcome

Page 17: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

17

Conclusion for Today’s First Part

Project● Be creative!● Keep it simple!● Begin now!● Send me an e-mail with your group

NoteComments and critics on the exercise sessions are welcome

!

Page 18: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

18

Basic Electricity RemindersIn order to build consistent circuits, some fundamental principles have to be understood.

Basic Intuitive IdeaThe basic principle in electricity is to move charges trough electrical loads in order to perform a work. The work to perform can take various forms such as mechanical movement (e.g. motors), electromagnetic waves emission (e.g. antennas, light bulbs),…To formalize this, we need to introduce five fundamental notions which are:● Voltage● Amperage● Impedance● Power● Energy

Page 19: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

19

Basic Electricity Reminders

VoltageVoltage, electric potential difference, electric pressure or electric tension (formally denoted V or U, but more often simply as V or U) is the ∆ ∆ difference in electric potential energy between two points of an electric circuit per unit electric charge.● Unit : Volt [V]● Measuring a voltage is done in parallel of a load with a voltmeter or an oscilloscope

Note:● Some points of the circuit have to be chosen as a reference for measuring voltages

around the circuit. All points which have a higher (resp. lower) potential than this reference have a positive (resp. negative) voltage.

● This reference is referred as the ground and is highlighted by the following symbols on schematics:

Page 20: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

20

Basic Electricity Reminders

Kirchhoff’s Voltage Law The principle of conservation of energy implies that the directed sum of the electrical potential differences (voltage) around any closed network is zero.

Example:

Loop 1 : V1 + V2 + V3 = 0

Loop 2 : V3 + V4 + V5 = 0

Page 21: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

21

Basic Electricity Reminders

AmperageAmperage or electric current (formally noted I) is a flow of electric charges through a medium. In electric circuits this charge is often carried by moving electrons in a wire.● Unit : Ampere [A]● Measuring an electric current is done in series with a load with an ammeter

Note:● Flow of electric charges means the number of electric charges which pass through a

given area per unit of time.

Page 22: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

22

Basic Electricity Reminders

Kirchhoff’s Current Law The principle of conservation of electric charge implies that at any node (junction) in an electrical circuit, the sum of currents flowing into that node is equal to the sum of currents flowing out of that node .

Example:

At node : I1 + I2 - I3 = 0 => I3 = I1 + I2

Page 23: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

23

Basic Electricity Reminders

AC vs DC When voltages and currents remain constant over time we talk about a “direct current” (DC) circuit. At the opposite when they vary over time, the circuit is said to work with “alternative current” (AC). The difference between both situations is critical since AC circuits can develop some dynamic behaviours which depend on the frequency of the signals passing through it.

Power and EnergyPower is the amount of work produced (resp. consumed) by unit of time and is expressed in Watt [W]. In electricity the power produced or consumed by a component is given by : P = I V

The energy produced (resp. consumed) by a component is simply the integration of the power produced (resp. consumed) over time. The energy can be expressed in Joule [J] or Watt-hour [Wh].

Page 24: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

24

Basic Electricity Reminders

ImpedanceElectrical impedance (formally denoted Z) is the measure of the opposition that a circuit presents to a current when a voltage is applied. Impedance possesses both magnitude and phase (it’s a complex number). When a circuit is driven with direct current, there is no distinction between impedance and resistance; the latter can be thought of as impedance with zero phase angle.● Unit : Ohm [Ω]

Note:● Impedance extends the concept of resistance to AC circuits● The notion of impedance is useful for performing AC analysis of electrical networks,

because it allows relating sinusoidal voltages and currents by a simple linear law; Ohm’s Law.

Page 25: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

25

Basic Electricity Reminders

Equivalent ImpedanceCircuits often contain complex networks of impedances. In order to understand it behaviour, it is often useful to simplify those networks into a simple equivalent impedance. This can be easily done with two simple rules:

For impedances in series For impedances in parallel

Zeq = Z1 + Z2 1/Zeq = 1/Z1 + 1/Z2

Page 26: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

26

Basic Electricity Reminders

The three notions introduced previously are obviously linked together. The relation between each of them is given by Ohm’s law.

Ohm’s LawOhm's law states that the current through a conductor between two points is directly proportional to the voltage across the two points:

U Z I=

If we only consider the magnitudes, we have:U Z I| | = | | | |

Note:● When Z is real, U Z I| | = | |

Page 27: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

27

Common Basic Components

ResistorA resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. In electronic circuits, resistors are used to reduce current flow, adjust signal levels, divide voltages, bias active elements and terminate transmission lines, among other uses. A resistor is characterized by its resistance (R).● Resistance unit : Ohm [Ω]● Impedance : Z R = => independent of fSymbol

Note:● Inductors have values that typically range from 1 Ω to 10 MΩ.

Page 28: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

28

Common Basic Components

CapacitorA capacitor is a passive two-terminal electrical component that stores electrical energy in an electric field. This is done by creating a difference in charges between two conductors. The typical physical form and construction contains at least two electrical conductors often in the form of metallic plates or surfaces separated by a dielectric medium. A capacitor is characterized by its capacitance (C), which is the ratio of the electric charge on each conductor to the potential difference between them.● Capacitance unit : Farad [F]● Impedance : Z j = 1/( 2πf C ) => when f⋘ , Z| |⋙ and when f⋙ , Z| |⋘Symbol

Fixed Capacitor Polarized Capacitor

Note:● Inductors have values that typically range from 1 pF to 1 mF.

Page 29: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

29

Common Basic Components

InductorAn inductor, also called a coil, is a passive two-terminal electrical component that stores electrical energy in a magnetic field when electric current flows through it. An inductor typically consists of an electric conductor, such as a wire, that is wound into a coil around a core. An inductor is characterized by its inductance (L), which is the ratio of the voltage to the rate of change of current.● Inductance unit : Henry [H]● Impedance : Z j = 2πf L => when f⋘ , Z| |⋘ and when f⋙ , Z| |⋙Symbol

Note:● Inductors have values that typically range from 1 µH (10−6H) to 1 H.

Page 30: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

30

Common Basic ComponentsDiodeDiodes are two terminal components which have the two following properties:● They let the current almost freely flow when the voltage between its cathode and

its anode is positive (forward biased) and reach an given threshold VF;● When reverse biased, they let only a very small amount of current flow (~high

resistance) until the voltage reach a given threshold VBR at which the diode enters the breakdown mode.

Symbol

Note:● Normal diodes usually get destroyed when entering the breakdown mode.

Page 31: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

31

Common Basic Components

Particular Types of DiodesSome diodes are designed in a way which exacerbate one of the particular properties of the semiconductors used in the diode. Among those special diodes, we can find:● Zener diodes which are able to withstand high reverse currents in breakdown mode

without burning;● Light emitting diodes (LED) which emit light with a given wavelength;● Photodiodes which create an non-negligeable reverse current when exposed to light.

Symbols

Zener diode LED Photodiode

Page 32: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

32

Concrete Application Examples

Low Pass FilterIn the following circuit, we define Vin as a voltage applied to the circuit and Vout a voltage we want to measure.Express Vout as a function of Vin for the circuit below. What do you observe?Assuming that the cutoff frequency of a filter is the frequency at which the input voltage gets attenuated by a factor √2, what is the cutoff frequency of this filter?

Note: This circuit is meant to carry signals only, not power!

Page 33: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

33

Concrete Application Examples

Voltage dividerIn the following circuit, we define Vin as a voltage applied to the circuit and Vout a voltage we want to measure.Express Vout as a function of Vin for the circuit below. What do you observe?

Note: This circuit is meant to carry signals only, not power!

Page 34: Embedded systems - Montefiore Institute ULgmfonder/INFO0064/session1.pdf · 4 Embedded Systems Project First Deadlines Groups formation: For the embedded systems project 3-4 students/group

34

Concrete Application Examples

Current LimitationWe want to plug a LED on 5V. In order to limit the current which flows through it, we connect a resistor in series. Assuming the LED has no internal resistance and a VF of 0.7V, what should be the value of the resistance to limit the current passing through the LED to 3.5mA?