CS代写 Embedded Computer Systems

Embedded Computer Systems
Sensor and Actuator in Embedded System
Dr. Sanghyuk Lee
Email: Dept. Mechatronics and Robotics

Copyright By PowCoder代写 加微信 powcoder

• Sensor is a device that measures a physical quantity.
• Actuator is a device that alters a physical quantity.
• Sensors often produce a voltage that is proportional to the physical quantity being measured.
• The voltage may then be converted to a number by an analog-to-digital converter (ADC).
• A sensor that is packaged with an ADC is called a digital sensor, whereas a sensor without an ADC is called an analog sensor.
• A digital sensor will have a limited precision, determined by the number of bits used to represent the number.
• Conversely, an actuator is commonly driven by a voltage that may be converted from a number by a digital-to-analog converter (DAC). An actuator that is packaged with a DAC is called a digital actuator.

• Today, sensors and actuators are often packaged with microprocessors and network interfaces, enabling them to appear on the Internet as services.
• The trend is towards a technology that deeply connects our physical world with our information world through such smart sensors and actuators.
• This integrated world is variously called the Internet of Things (IoT), Industry 4.0, the Industrial Internet, Machine-to-Machine (M2M), the Internet of Everything, the Smarter Planet, TSensors (Trillion Sensors), or The Fog
• Some technologies for interfacing to sensors and actuators have emerged; For example, a sensor or actuator may be accessible via a web server using the so-called Representational State Transfer (REST) architectural, data may be retrieved from a sensor or commands may be issued to an actuator by constructing a URL as if you were accessing an ordinary web page from a browser, and then transmitting the URL directly to the sensor or actuator device, or to a web server that serves as an intermediary.

Sensor and Actuator Model
• Suppose that a physical quantity 𝑥𝑥(𝑡𝑡) at time 𝑡𝑡 is reported by the sensor to have value 𝑓𝑓(𝑥𝑥 𝑡𝑡 ), where 𝑓𝑓: 𝑅𝑅 → 𝑅𝑅 is a function. The function 𝑓𝑓 is linear if there exists a proportionality constant 𝑎𝑎 ∈ 𝑅𝑅 such that for all 𝑥𝑥(𝑡𝑡) ∈ 𝑅𝑅
𝑓𝑓𝑥𝑥𝑡𝑡 =𝑎𝑎𝑥𝑥(𝑡𝑡).
• It is an affine function if there exists a proportionality constant 𝑎𝑎 ∈ 𝑅𝑅
and a bias 𝑏𝑏 ∈ 𝑅𝑅 such that
𝑓𝑓𝑥𝑥𝑡𝑡 =𝑎𝑎𝑥𝑥𝑡𝑡+𝑏𝑏

Sensor and Actuator Model; range
• Range of sensor is always limited: ex. −20°~50°𝐶𝐶 • There are operating range (𝐿𝐿, 𝐻𝐻)
𝐷𝐷 = (𝐻𝐻−𝐿𝐿) : dynamic range 𝑝𝑝
• 𝑝𝑝 is the precision of a sensor; smallest absolute difference between two values of 𝐿𝐿 and 𝐻𝐻.

Sensor Model; Quantification
• 𝑛𝑛 -bit sensor 2𝑛𝑛 distinct number (in continuous, it becomes infinite)
• Ex). 3 -bit sensor measure from 0 V to 1 V. It can be modelled as the function
f : R → {0, 1, … , 7}, L=0 and H=1, then 𝑝𝑝 = 1/8 • Dynamic range of decibel is
𝐷𝐷 =20log 𝐻𝐻−𝐿𝐿 ≅18𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑 10𝑝𝑝

Sensor Model: Quantification
• Precision is given;
𝑝𝑝 = (𝐻𝐻−𝐿𝐿). 2𝑛𝑛
• And dynamic range with decibel
𝐷𝐷 =20log 𝐻𝐻−𝐿𝐿 =20log (𝐻𝐻−𝐿𝐿) =20log 2𝑛𝑛 ≅6𝑛𝑛𝑑𝑑𝑑𝑑 𝑑𝑑𝑑𝑑 10 𝑝𝑝 10 (𝐻𝐻 − 𝐿𝐿) 10
• Digitization has invoked distortion error(one bit is highest), but it can be avoided by fast sampling

Sensor Model: Noise and SNB
• Relation with actual measurement and pure information
𝑥𝑥′ 𝑡𝑡 =𝑥𝑥𝑡𝑡 +𝑛𝑛(𝑡𝑡)
𝑥𝑥′ 𝑡𝑡 is actual measurement, 𝑥𝑥 𝑡𝑡 is pure information.
Weget 𝑓𝑓 𝑥𝑥 𝑡𝑡 =𝑥𝑥 𝑡𝑡 +𝑛𝑛(𝑡𝑡)afterthroughsensor • Noise power 𝑁𝑁 = lim 1 ∫𝑇𝑇 𝑛𝑛(𝜏𝜏)2𝑑𝑑𝜏𝜏
𝑇𝑇→∞ 2𝑇𝑇 −𝑇𝑇
• Signal to Noise (SNR) definition in term of RMS 𝑆𝑆𝑁𝑁𝑅𝑅𝑑𝑑𝑑𝑑 = 20 log10

Sensor Model: Sampling
• In Uniform sampling, fixed time interval 𝑇𝑇 (sampling interval), between samples
∀𝑛𝑛 ∈ 𝒁𝒁, 𝑠𝑠 𝑛𝑛 = 𝑓𝑓(𝑥𝑥 𝑛𝑛𝑇𝑇 ) Physical quantity 𝑥𝑥 𝑡𝑡 is observed only at 𝑡𝑡 = 𝑛𝑛𝑇𝑇
• Sample rate 1/𝑇𝑇, samples per second as Hertz, Hz
• The smaller 𝑇𝑇, the more costly it becomes to provide more bits in a ADC • Faster ADC produce fewer bits, higher quantification error

Sensor Model: Sampling
• The ATSC digital video coding standard includes a format where the frame rate is 30 frames per second and each frame contains 1080 X 1920 = 2,073,600 pixels.
• An ADC that is converting one color channel to a digital representation must therefore perform 2,073,600 X 30 = 62,208,000 conversions per second, which yields a sampling interval T of approximately 16 nsec.
• With such a short sampling interval, increasing the number of bits in the ADC becomes ex-pensive. For video, a choice of b = 8 bits is generally adequate to yield good visual fidelity and can be realized at reasonable cost.

Sensor Model: Sampling example
• signal 𝑥𝑥 𝑡𝑡 = cos(2000𝜋𝜋𝑡𝑡)
Frequency is 1 kHz sinusoidal signal, (thousands of cycles per second),
• When we sample 8000 sample/second, then T = interval
1 sampling 8000
The sample
= cos(2000𝜋𝜋8000) = cos(4𝑛𝑛)
• For the signal 𝑥𝑥′ 𝑡𝑡 = cos(18000𝜋𝜋𝑡𝑡), 9 kHz sinusoidal signal
𝑠𝑠 𝑛𝑛 = 𝑓𝑓 𝑥𝑥 𝑛𝑛𝑇𝑇
When we sample 8000 sample/second again,
𝑠𝑠′ 𝑛𝑛 =cos(18000𝜋𝜋 𝑛𝑛 )=cos(9𝜋𝜋𝑛𝑛)=cos(2𝜋𝜋𝑛𝑛+𝜋𝜋𝑛𝑛)=cos(𝜋𝜋𝑛𝑛) 8000 4 4 4

Sensor Model: Sampling
Illustration of aliasing, where samples of a 9 kHz sinusoid taken at 8,000 samples per second are the same as samples of a 1 kHz sinusoid taken at 8,000 samples per second.

Sensor Model: Sampling
• 1 kHz and 9 kHz signals yield exactly the same sample. In this case, two signals are aliases as one another. They cannot be distinguished.
• Nyquist-Shannon sampling theorem. Informally, this theorem states that a set of samples at sample rate R = 1/T uniquely defines a continuous-time signal that is a sum of sinusoidal components with frequencies less than R/2. That is, among all continuous-time signals that are sums of sinusoids with frequencies less than R/2, there is only one that matches any given set of samples taken at rate R.
• Sample a signal where the most rapid expected variation occurs at frequency R/2, then sampling the signal at a rate at least R will result in samples that uniquely represent the signal.

Sensor Model: Sampling (example)
• In traditional telephony, engineers have determined that intelligible human speech signals do not require frequencies higher than 4 kHz. Hence, removing the frequencies above 4 kHz and sampling an audio signal with human speech at 8kHz is sufficient to enable reconstruction of an intelligible audio signal from the samples. The removal of the high frequencies is accomplished by a frequency selective filter called an anti-aliasing filter, because it prevents frequency components above 4 kHz from masquerading as frequency components below 4 kHz.
• The human ear, it can easily discern frequencies up to about 15 kHz, or 20 kHz in young people. Digital audio signals intended for music, therefore, are sampled at frequencies above 40 kHz; 44.1 kHz is a common choice, a rate defined originally for use in compact discs.

Sensor Models
• Measuring Tilt and Acceleration • Measuring Position and Velocity
– global positioning system (GPS) is a sophisticated satellite-based navigation system using triangulation. A GPS receiver listens for signals from four or more GPS satellites that carry extremely precise clocks.
• Measuring Rotation
– An inertial measurement unit (IMU) or inertial navigation system (INS) uses a gyroscope to measure changes in orientation and an accelerometer to measure changes in velocity.
• Measuring Sound
– Microphones for human audio are designed to give low distortion and low noise within the human hearing frequency range, about 20 to 20,000 Hz.

Actuators:
• Light-Emitting Diodes
Very few actuators can be driven directly from the digital I/O pins (GPIO pins) of a micro-controller. These pins can source or sink a limited amount of current, and any attempt to exceed this amount risks damaging the circuits.
• One exception is light-emitting diodes (LEDs), which when put in series with a resistor, can often be connected directly to a GPIO pin.
• This provides a convenient way for an embedded system to provide a visual indication of some activity. The calculations in the previous example are typical of what you need to do to connect any device to a micro controller.

Actuators: example
Consider a microcontroller that operates at 3 volts from a coin-cell battery and specifies that its GPIO pins can sink up to 18 mA.
Suppose that you wish to turn on and off an LED under software control. Suppose you use an LED that, when forward biased (turned on), has a voltage drop of 2 volts. Then what is the smallest resistor you can put in series with the LED to safely keep the current within the 18 mA limit ? Ohm’s law states
𝑉𝑉𝑅𝑅 = 𝐼𝐼𝑅𝑅
The resistor will have a voltage drop of 𝑉𝑉𝑅𝑅 = 3 − 2 = 1 volt across it, so the current flowing through it will be
To limit this current to 18 mA, we require a resistance 𝑅𝑅 ≥ 1/0.018 ≅ 56Ω

Actuators: example
If you choose a 100 Ω resistor, then the current flowing through the resistor and the LED is
𝐼𝐼=𝑉𝑉𝑅𝑅 =10𝑚𝑚𝑚𝑚 100
If the battery capacity is 200 mAh (milliamp-hours), then driving the LED for 20 hours will completely deplete the battery, not counting any power dissipation in the microcontroller or other circuits. The power dissipated in the resistor will be 𝑃𝑃𝑅𝑅 = 𝑉𝑉𝑅𝑅𝐼𝐼 = 10 𝑚𝑚𝑚𝑚.
The power dissipated in the LED will be
𝑃𝑃𝐿𝐿 = 2𝐼𝐼 = 20 𝑚𝑚𝑚𝑚.
These numbers give an indication of the heat generated by the LED circuit.

Actuators: Motor Control
A motor applies a torque (angular force) to a load proportional to the current through the motor windings. So, it needs to apply a voltage to the motor proportional to the desired torque.
• Most DACs cannot deliver much power, and require a power amplifier between the DAC and the device being powered.
• The input to a power amplifier has high impedance, so it can usually be connected directly to a DAC.
• Driving a motor, we do not usually need such a power amplifier. It is sufficient to use a switch that we can turn on and off with a digital signal from a microcontroller. Making a switch that tolerates high currents is much easier than making a power amplifier.

Actuators: Motor Control
Pulse width modulation (PWM) efficiently deliver large amounts of power under digital control, as long as the device to which the power is being delivered can tolerate rapidly switching on and off its power source.
• A PWM signal switches between a high level and a low level at a specified frequency. It holds the signal high for a fraction of the cycle period. This fraction is called the duty cycle is 0.1, or 10%.
• A DC motor consists of an electromagnet made by winding wires around a core placed in a magnetic field made with permanent magnets or electromagnets. A motor has both inertia and inductance that smooth its response when the current is abruptly turned on and off, so such motors tolerate PWM signals well.

Actuators:
Let ω : R → R represent the angular velocity of the motor as a function of time. Assume we apply a voltage v to the motor, we expect the current through the motor statisfy the following balance equation,
vt =Rit +Ldit +kbω(t) dt
Idω(t)=kTi t −ηω t −τ(t) dt
kb: back electromagnetic force constant
kT: motor torque constant, η: kinetic friction of the motor, and τ : torque applied by the load

Actuators: Motor Control
• In a typical use of a PWM controller to drive a motor, we will use the feedback control techniques to set the speed of the motor to a desired RPM.
• To do this, we require a measurement of the speed of the motor. We can use a sensor called a rotary encoder, or just encoder, which reports either the angular position or velocity (or both) of a rotary shaft. There are many different designs for such encoders.
• A very simple one provides an electrical pulse each time the shaft rotates by a certain angle, so that counting pulses per unit time will provide a measurement of the angular velocity.

End of Lecture
Sensor and Actuator in Embedded System

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com