Embedded Systems Ning Wang Dept of Biosysems and Agricultural Engineering Oklahoma State University Naiqian Zhang Dept of Biological and Agricultural Engineering Kansas State University At South China Agricultural University November, 2014 What are “embedded systems”? An An embedded embedded system is a computer system with a dedicated function within within aa larger larger mechanical mechanical or or electrical electrical system, system, often often with with real-time real-time computing computing constraints. constraints. ItIt isis embedded embedded as as part part of of aa complete complete device device often including hardware and mechanical parts. often including hardware and mechanical parts. - Wikipedia - Wikipedia 嵌入式系统(Embedded system),是一种「嵌入机械或电气系统内部、 嵌入式系统(Embedded system),是一种「嵌入机械或电气系统内部、 具有专属功能的计算机系统」,通常要求实时计算性能。被嵌入的系统通 具有专属功能的计算机系统」,通常要求实时计算性能。被嵌入的系统通 常是包含硬件和机械部件的完整设备。相反,通用计算机如个人计算机则 常是包含硬件和机械部件的完整设备。相反,通用计算机如个人计算机则 设计灵活,以满足广大终端用户的需求。现在常见的很多设备都采用嵌入 设计灵活,以满足广大终端用户的需求。现在常见的很多设备都采用嵌入 式系统控制。 式系统控制。 Examples: Embedded system IMPACT The global embedded systems market was valued at USD 140.32 billion in 2013, expected to grow at a rate of 8.1% from 2014 to 2020, to reach USD 214.39 Billion. Many more embedded processors per person are used than general purpose processors ◦ A cell phone may up to eight core processors. ◦ Value of embedded electronics in Automobiles: 25% of total cost, to rise to 35% by 2015 ◦ Embedded market is 50 times the desktop market. Application Domains: ◦ Automotive, Avionics, Industrial Automation, Telecommunication, Consumer Electronics, Medical, IT hardware Cutting edge: ◦ Multicore processors, Network-on-Chip, System-on-chip Embedded Systems An Embedded System is an information processing system that is: • application domain specific (not general purpose) • tightly coupled to its environment Application domains: e.g. automotive, cellphone, multimedia. Environment: type and properties of input/output information. Tightly coupled: The environment dictated what the system’s response behavior must be. Constrains: real-time, speed, resource, power consumption, cost, efficiency Embedded Systems An embedded system performs computation that is subject to physical constraints, interaction with a physical environment, and execution on a physical (implementation) platform. In summary, an embedded system - Is a “special purpose” unit. - Is a computer device which has a CPU, memory and programs that control mainly physical devices. The program is preinstalled and may not be changed easily. - Has limited processing power and limited electrical power and limited data storage. - Has “intelligence”, thus can be configured, personalized, “programmed”. Schematic Embedded Systems Embedded systems design is not a straightforward extension of either hardware (computer/electrical engineering) or software (computer science) design. They have functional requirements (expected services), and extrafunctional requirements (performance/cost, robustness). Computer Science provides (software) functionality for Instruction Set Architectures (ISA) which are characterized by an instruction set and an organization (program counter, register file). Computer/Electrical Engineering deals with logical implementation and physical realization. An Embedded Systems design discipline needs to combine these two approaches from the beginning of the design. Embedded System Engineers “Embedded systems engineer is a relatively new job classification that merges electrical engineering and computer science. These computer engineers work on hardware and software designs for electronic medical equipment, industrial and military control systems, mobile communications devices, appliances, and remote controls. They need at least a bachelor's degree in a relevant field, and some schools now offer certificate and undergraduate and graduate degree programs in embedded systems engineering.” - A job recruiting company (2014) Skills: Strong software coding and debugging skills, some hardware integration knowledge, and strong problem solving skills As you have learned “embedded system”, let us do some real tests! Schematic MP3 player – simple system Function: Large “flash” memory to store songs ◦ Songs (audio) stored in digital form, then compressed to a set of numbers that are of the “MP3” format Processing: CPU runs program in main memory ◦ Decompresses audio and generates “raw digital audio” ◦ Gets user input from button ◦ Displays information on screen Input/Output: Digital-Analog converter generates audible sound waves and sends to speaker/headphones Interfaces: touch screen, buttons, … GPS Navigator – more complicated Components ◦ ◦ ◦ ◦ GPS Radio GPS signal processor Map database Processor to control display and compute routes, locations, points of interest ◦ Video image processor to control actual screen May contain several different CPUs in one package GPS Radio Receives data from several satellites, converts RF to digital signals ◦ Separate for each satellite A set of at least 24 Medium Earth Orbit satellites that transmit precise microwave signals, A GPS receiver can determine its location, speed, direction, and time. Radio receiver circuitry Digital signals GPS Signal Processor Correlates satellite signals ◦ Computes timing differences ◦ “triangulates” location Digital Signals GPS data processor Current location in latitude and longitude GPS Navigator The user interface – show location on map and provide useful other information GPS signals GPS Processor Display Processor MAP database Touch Sensor Automobile Computers Engine control computer Advanced diagnostics Simplification of the manufacture and design of cars Reduction of the amount of wiring in cars New safety features: collision avoidance, blind-spot detection, back up camera,… New comfort and convenience features “It would be easy to say the modern car is a computer on wheels, but it’s more like 30 or more computers on wheels,” said Bruce Emaus, the chairman of SAE International’s embedded software standards committee. - NY Times Engine Control Computer (ECU) Read sensors (temp, pedal position, exhaust) and control fuel injector timing and spark timing Control engine fan and other actuators Handle the CAN (Control Area Network) that is becoming common in cars. • • Interface with climate and other passenger controls Provide diagnostics Other computers in car There are more processors in the car other than ECU ◦ ◦ ◦ ◦ ◦ ◦ ABS system Climate control Cruise control Radio Dashboard Automatic doors, lights and such Cars also have networks for “simplified wiring” as well as automotive control networks – CAN Bus! Simplified Wiring OLD S W I T C H E S Many connecting wires NEW L A M P S Switches + signal encoders One wire runs all over the vehicle and carries power and signal Lamps + signal decoders Automobile Networking As multiple computing units get into cars, a networking standard is being used ◦ CAN 2.0 is predominant Functions: ◦ ◦ ◦ ◦ ◦ Communicate between subsystems Reduce wires Multiplexing standard Network addressing “multiple networks” coming in the future Design approach Phase 1: Product specification Phase 2: HW/SW partitioning Phase 3: Detailed HW/SW design Phase 4: HW/SW Integration Phase 1: Design flow of embedded system begins with design specifications and constraints, including both cost and processing time. Phase 5: Acceptance testing Phase 6: Maintenance and Upgrade http://arxiv.org/ftp/arxiv/papers/1005/1005.0931.pdf What are “Specifications”? “A design specification provides explicit information about the requirements for a product and how the product is to be put together.” - Wikipedia Leikr GPS Watch What are “Specifications”? Develop specifications (“specs”) for every component in the embedded system. Specs for sensors Specs for controls Specs for computer systems (speed, memory, channels….) Specs of sensors, controllers, and computer many include: ◦ Desired measurement accuracy, resolution, sensitivity, linearity, dynamic performance, consistency, reliability, etc. ◦ Environment condition: temperature, humidity, pressure, external fields (radiation, electric, magnetic,…) ◦ Compatibility with existing instruments ◦ Cost: Closely related with the performance ◦ Durability: Life of an instrument ◦ Maintenance requirements Sensor Specifications (datasheet) Example 1: Infrared Temperature Sensor Example 2: Soil Sensor (Conductivity, temperature, and moisture) Example 3: Distance Sensor Find Out Information on a Sensor Telaire 7001 CO2 Sensor Read specifications! Questions to be answered: 1. 2. 3. 4. 5. 6. 7. 8. 9. Parameters to be measured Range Accuracy Resolution Time response Output signal Other information Working environment Power supply Measurement Range: 0 to 2500 ppm when using the CABLE-CO2 and a U12 or ZW Operating Range: 32°F to 122°F (0°C to 50°C), 0 to 95% RH, Display Resolution: ±1 ppm Accuracy: ±50 ppm or 5% of reading, whichever is greater Repeatability: ±20 ppm Temperature Dependence: ±0.1% of reading per °C or ±2 ppm per °C, whichever is greater, referenced at 25°C. Pressure Dependence: 0.13% of reading per mmHg (corrected via user input for elevation) Response Time: <60 seconds for 90% of step change Warm-Up Time: <60 seconds at 72°F (22°C) Calibration Interval: 12 months Full factory calibration available Battery Type: Four AA batteries (not included) Battery Operation: 80 hours (alkaline) External Power Supply Specifications: AC/DC adapter (included) Output: 6 VDC, 500mA output. Power Connector: Round barrel with 2.5mm ID , 5.5mm OD, 12mm long, center positive (+6 VDC), outer shell ground. Performance Parameters Range ◦ Input range: The limits between which input can vary. ◦ ◦ Input Range = Inputmax - Inputmin Output range: The limits between which output can vary. ◦ Output Range = Outputmax – Outputmin Example: A load cell can measure a force within the range of 0-50kN; a thermocouple can measure temperatures within the range of 0-100°C. Performance Parameters Errors ◦ Absolute error = measured value – true value ◦ Relative error = measured value true value true value ◦ Example: A sensor might give a resistance change of 10.2 Ω when the true change is 10.5 Ω. The error is 0.3 Ω; the relative error is 2.9%. Performance Parameters Accuracy ◦ An accuracy of a sensor is an indication of the possible measurement error. A temperature sensor specified as having an accuracy of ±2C means that the reading given by the system may lie within plus or minus 2 C of the true value. ◦ An accuracy is often expressed as a percentage of the full range output or full-scale deflection. Example: A temperature sensor Range: 0 to 200 C Accuracy: ±5% of full-range output Error = ±5% x 200 C = ± 10 C Performance Parameters Sensitivity ◦ Sensitivity indicates the change in output per unit change in input. ◦ The static sensitivity is a measure relating the change in the output associated with a given change in a static input. dy K K ( x1 ) ( ) x x1 dx Slope! Example: a resistive thermometer has a sensitivity of 0.5 Ω/C. Performance Parameters Resolution: ◦ The smallest scale increment or the least count (least significant digit) of the measured value. ◦ Example: Hobo Temperature Data logger Resolution U10-001: 0.1 C at 25 C Resolution: 1/10 of a second Image Resolution: Resolution: 1/100 of a second Performance Parameters Precision: the fineness to which an instrument can be read repeatedly and reliably. Accuracy vs. Precision: Low Accuracy, Low Precision Low Accuracy, High Precision Accuracy: actual vs. True value High Accuracy, Low Precision High Accuracy, High Precision Precision: Repeatability Performance Parameters Hysteresis error ◦ A sensor/transducer may give different readings between an upscale sequential test and a downscale sequential test. eh = (y)upscale – (y)downscale ◦ Maximum hysteresis error: %ehmax ehmax ro 100% where r0 is the full output range. Performance Parameters Non-linear error ◦ Most transducers have a linear relationship between the input and the output over the working range. ◦ An error occurs when this linear relationship can not be maintained. Non-linearity error using: (a) end-range values, (b) best-fit straight line for all values, (c) best-fit straight line through zero point Performance Parameters Repeatability ◦ Describe the sensor’s capability to give the same output for repeated measurements of the same input value. ◦ The error resulting from the same output not being given with repeated measurements is expressed as a percentage of the full range output: Output max Output min repeatability full range Example: A transducer for the measurement of angular velocity typically quoted as having a repeatability of ±0.01% of the full range at a particular angular velocity. Performance Parameters Overall Instrument Error: Combining all known errors uc e12 e22 eM2 Performance Parameters Working conditions ◦ ◦ ◦ ◦ Temperature range Humidity Dust Climate Maintenance ◦ Warranty ◦ Life cycle ◦ Tech support Static and Dynamic Characteristics A calibration applies known input values to a measurement system to observe the system output values. The goal of calibration process is to establish the relationship between the input and output values. Static Calibration: ◦ Values of the variables involved do not vary with time and space. ◦ Only magnitudes of the known input and measured output are important. ◦ By applying a range of known input values and observing the system output values, a direct calibration curve can be developed for the measurement system. Static and Dynamic Characteristics The static calibration curve describes the static input-output relationship for a measurement system and indicates how the output can be interpreted by a measurement. Static and Dynamic Characteristics Dynamic Behavior: ◦ Response time ◦ The time which elapses after a step input is applied to a sensor up to the point at which the sensor gives output to some specified percentage, e.g. 95%, of the value of the input. Specifications (datasheet) Re-catch: Campbell Scientific Datalloger – CR3000 Design approach Phase 2-4: Design and development Functions by HW Functions by SW Integration Considerations: - Application needs - Cost - Speed/throughput - User-friendliness A considerable amount of iteration and optimization occurs within phases and between phases. Phase 1: Product specification Phase 2: HW/SW partitioning Phase 3: Detailed HW/SW design Phase 4: HW/SW Integration Phase 5: Acceptance testing Phase 6: Maintenance and Upgrade http://arxiv.org/ftp/arxiv/papers/1005/1005.0931.pdf Design approach Phase 5: Testing Calibration Lab/indoor testing Practical testing Phase 1: Product specification Phase 2: HW/SW partitioning Evaluation criteria: - Specifications - Modifications Phase 6: Maintenance and Upgrade Plan for maintenance and upgrade Tech support Phase 3: Detailed HW/SW design Phase 4: HW/SW Integration Phase 5: Acceptance testing Phase 6: Maintenance and Upgrade http://arxiv.org/ftp/arxiv/papers/1005/1005.0931.pdf Design Project eXploration Habitat (X-Hab) 2015 Academic Innovation Challenge: Deployable Greenhouse for food production on long-duration exploration missions Design tasks Deployable mechanism Architecture design Greenhouse controls Environment control Water management Plant management Waste management Power system Design an Embedded system for greenhouse control – a class project Select one of the five “Greenhouse controls” tasks. Phase 1: Define system specifications and constraints System specifications need to be clearly defined: System functions Performance parameters Goals Design constraints need to be clearly identified: Payload (<5 kg) Environment (temperature, relative humidity, ambient light…) Cost Processing speed (throughput, dynamic response) Oral Presentation - Wednesday - Use Powerpoint 10 min/team In Chinese Design an Embedded system for greenhouse control – a class project Phase 2-4: System design (HW & SW) Hardware microcontroller sensors actuators power supply harness Off-the-shelf products need to be selected based on specifications. A “Block diagram” is required. Software control flow algorithms user interface A “flow chart” is required. Integration possible networking communications Communications (protocols and directions) need to be shown in the “block diagram”. Design an Embedded system for greenhouse control – a class project Phase 5: Testing sensor calibrations system laboratory tests system field tests Procedures for the tests are required. Phase 6: Maintenance and Upgrade sensor calibrations A system maintenance schedule is required (Think about the maintenance schedule for cars.) Possible future system upgrading needs to be discussed. Oral Presentation - Wednesday - Use Powerpoint 10 min/team In Chinese