Embedded Systems and Microcontrollers
In questa pagina 5
What an embedded system is
- An embedded system is a computing system designed to perform a specific function within a larger mechanical or electronic system.
- Hardware and software architecture are closely linked.
- It is integrated with mechanical, electrical or electronic structures that interact with it.
- Acquisition, digitisation and processing of information about the surrounding environment are of considerable importance: very often embedded platforms integrate sensors and measurement tools of various kinds (see Data Acquisition SystemsA DAQ module multiplexes several analog inputs through a programmable gain amplifier into one ADC, stores the samples in a buffer and hands them to a PC, with sampling timing, trigger modes (digital, analog level, window, pre-trigger) and input configuration (differential or referred to ground) that the user must know.Data Acquisition Systems → for the acquisition chain).
- Development and diffusion of embedded systems have grown dramatically in recent decades.
Ubiquitous computing
- Human-machine interaction model proposed in 1988 by Mark Weiser, chief engineer of Xerox's Palo Alto Research Center.
- It is a post-desktop model: users use computing systems unconsciously, without the direct interaction typical of desktop workstations.
- It contrasts with the Mainframe model (one computer for many users) and the Personal Computer model (one computer for one user): the ubiquitous model is many computers for one user.
- It is a Pervasive Computing system, which involves placing processing tools inside commonly used objects. It is now widely present, adopted by everyone even unconsciously.
- Extremely simple example: a home air freshener that activates when a user passes in front of it.
Moore's law and the evolution of computing tools
Moore's law (as stated on the slide): the complexity of microcircuits (for example measured as the number of transistors per chip or per unit area) doubles every 18 months.
Three plots accompany it:
- Transistors per die versus year (1960 to 2010, logarithmic vertical axis from to , source Intel): memories (1K, 4K, 16K, 64K, 256K, 1M, 4M, 16M, 64M, 128M, 256M, 512M, 1G, 2G, 4G) and microprocessors (4004, 8080, 8086, 80286, i386, i486, Pentium, Pentium II, III, 4, Itanium) follow a straight line on the log scale, that is, exponential growth.
- Transistor count versus year of introduction for many named processors (1970 to 2016), from the Intel 4004 (a few thousand transistors) to chips with several billion transistors, again a straight trend on a logarithmic axis.
- "Microprocessor cost per transistor cycle" (logarithmic plot, in dollars per transistor per hertz): a straight decreasing line from 1975 to about 2016, annotated halving time: 1.1 years.
Commodore 64 (1982) against modern platforms
| Feature | Commodore 64 (1982) | Arduino UNO (2005) | Raspberry Pi 4 (2019) |
|---|---|---|---|
| Clock frequency | 0.985 MHz | 16 MHz | 1.5 GHz |
| RAM | 64 kByte | 2 kByte | 1, 2, 4 or 8 GByte |
| ROM | 20 kByte | 1 kByte | 32 GByte microSD |
| Price | 973.5 US dollars | 20 euro | 50 euro |
Reading (ratios computed from the table): the Arduino UNO has a clock about 16 times higher than the Commodore 64 but 32 times less RAM; the Raspberry Pi 4 has a clock about 1500 times higher and gigabytes of RAM; both cost far less. On the Arduino platform see Arduino PlatformArduino is a family of open single-board microcontroller boards built on Atmel AVR chips (UNO, Mega, Micro), extended with stackable shields and programmed through its own IDE.Arduino Platform →.
The processing unit
- It is the brain of the embedded system, usually equipped with memories, communication modules, analog interfaces (ADCs) and input/output ports.
- Embedded systems carry out operations of increasing complexity, but still less than those of a PC, and are generally customised for a specific task.
- Two types of calculation tools are generally used:
- Microcontrollers, on which single-board microcontrollers such as Arduino are based;
- System-on-chips (SoC), on which single-board computers such as Raspberry Pi are based.
- Above these, in terms of power, are microprocessors, on which PCs and smartphones are based.
PLCs
Programmable Logic Controllers (PLCs) are relatively simple devices designed to work in industrial automation systems.
- They are computation tools that process analog or digital signals coming from sensors and directed to actuators, to automate industrial processes.
- On the market for decades, low cost, simple to use, widely used in industrial applications.
- Programmed with ad hoc languages, both textual ("literal") and graphic.
- The slides show two examples: a compact PLC with terminal rows and a serial connector, and a modular unit with a small display and navigation keys, relay outputs and a LAN port.
Microprocessor versus microcontroller
| Aspect | Microprocessor | Microcontroller |
|---|---|---|
| Integration | only the computation logic on the chip; needs external memories and peripherals | completely autonomous system, works even without other components |
| Purpose | general-purpose | customised for a single task |
| Software | typically an operating system manages the applications | a firmware stored in flash memory |
| Clock | GHz | MHz |
The microcontroller
Integrates on a single chip:
- the controller (8, 16 or 32 bits; clock typically in the MHz or tens of MHz range);
- the oscillator that generates the clock;
- RAM and EEPROM data memories, usually a few kBytes;
- a FLASH memory for the firmware, usually a few tens of kBytes;
- some I/O and/or GPIO ports.
It can also integrate analog-to-digital or digital-to-analog converters, various communication modules, and input (for example buttons) and output (for example screens) interaction tools.
The System-on-Chip (SoC)
Integrates on a single chip:
- the microprocessor (generally 32 or 64 bits, clock of hundreds of MHz or GHz);
- the oscillator;
- RAM in the order of hundreds of MBytes or GBytes;
- connectors for interfaces such as USB and Ethernet;
- analog-to-digital or digital-to-analog converters;
- other components such as meters (timers), clocks.
Flash memory is usually external, through an SD slot. It needs an operating system to run.
Architecture of an embedded system
The slides compare an embedded system with a living being, which must do four things: eat, think, remember, interact with the environment. The corresponding functions are:
- be powered (mains, battery or other energy sources);
- be equipped with a processing tool;
- be equipped with memory;
- be equipped with sensors, actuators, connectivity and interaction tools.
Fundamental components: powering system, computation system, memory, sensors and actuators, transceivers. Optional sub-systems: visual output (LCD screens), input systems (keyboards, buttons), storage memories (SD cards). The slide photo shows a real node in a plastic box: a board with a microcontroller, a radio module with an external antenna, two AA batteries, an ultrasonic sensor and other components.
Powering system
- Simplest way: connect to a PC via USB or to the mains through a power supply.
- In most cases the system is not connected to a computer; sometimes it can be connected to the electricity grid through a transformer.
- Otherwise batteries or renewable energy sources (for example solar panels) are needed. Then the architecture must be studied carefully to reduce consumption to a minimum, also through duty-cycling policies.
- The slides show photos of solar panels, AA and D cells, a lead battery, and a prototype of a small water-driven generator (a paddle wheel).
Sensors and actuators
They allow the system to interact with the environment. They include user interaction systems (Human Machine Interaction, HMI) treated separately.
- Sensors: input instruments; they measure a parameter from the environment and transform it into an electrical signal.
- Actuators: output instruments; they transform an electrical signal into an action.
- Both are transducers: instruments that convert one physical quantity into another.
Sensors, general properties
- Sensors exist for almost all physical parameters; cost from a few cents to thousands of euros.
- Output can be analog (continuous), digital (discrete) or binary (ON/OFF).
- Active or passive depending on whether they need power to function.
- Static characteristic: the function linking the input stimulus to the output electrical signal.
- Dynamic characteristic: the behaviour of the sensor when the input varies with appreciable speed.
Sensor specifications (definitions as on the slide; see also Non-Idealities in a Control Loopmodels and control consequences of the main non-idealities of a feedback loop, namely sensor bias, noise, quantization and limited bandwidth, actuator saturation and limited bandwidth, time delays with Pade approximations, disturbances and parameter or model uncertainties.Non-Idealities in a Control Loop →):
- Sensitivity: the ratio between the input variation and the output variation (as worded on the slide).
- Accuracy: the maximum deviation between the measurement given by the sensor and the real value of the measured quantity.
- Range: the range of measurable values.
- Resolution: the minimum variation of the input that produces an appreciable variation of the output.
- Stability: the ability to keep conditions unchanged for a certain time span.
- Reliability: the ability to perform its function successfully for a certain time span under certain conditions.
- Repeatability: the reproducibility of the measurement.
Some sensor families (with the technologies named on the slides)
| Family | Technologies |
|---|---|
| Presence and movement detectors | ultrasonic, optical, capacitive, pressure |
| Position, displacement and level | capacitive, magnetic, optical, ultrasonic, radar |
| Speed and acceleration | accelerometers, gyroscopes |
| Force, deformation and tactile | strain gauges, piezoelectric, piezoresistive, capacitive |
| Pressure | piezoelectric, piezoresistive, capacitive |
| Flux | (no technologies listed; the photos show two flow meters) |
| Acoustic | microphones |
| Moisture and humidity | hygrometers, soil conductivity sensors, capacitive |
| Light detectors | photodiodes, photoresistors, phototransistors, thermal detectors, CCDs |
| Radiation | scintillators, Geiger counters |
| Temperature | thermistors, thermoelectric sensors, optical sensors, thermocouples |
| Chemical | (no technologies listed; the photos show an MQ-7 module and a probe) |
Actuators: devices that perform actions following commands from the sensor node.
- Light actuators: LEDs, infrared emitters.
- Sound actuators: speakers or piezoelectric devices.
- Switches: the most common are relays.
- Motors: stepper, DC, servo.
Human Machine Interaction (HMI) systems
- Input tools: switches (rotary, ON/OFF, selectors), potentiometers, buttons, joysticks, touch sensors, touch screens, trackballs.
- Output tools: LEDs, LED arrays, 7-segment displays, LCD screens, TFT displays, buzzers, speakers.
Data transmission
- Any embedded system may also communicate over the Internet, with wired or wireless tools.
- Wired: USB, Serial, Ethernet, CANbus, I2C, SPI.
- Wireless: WiFi, GPRS, UMTS, LTE, 5G, ZigBee, RFID, LoRa.
- Data can be sent directly over the Internet or inside a local network through a gateway (an intermediate device that collects the data and transfers it to the Internet).
- A system can have several data transmission channels.
- Treated in depth in Data Transmission Technologies - Wired, Wireless, LAN and WANSurvey of the data transmission technologies used to connect measurement and IoT nodes, from local ones (RFID, NFC, Bluetooth, WiFi, ZigBee) to wide-area ones (LoRa, SigFox, GSM/GPRS, UMTS, LTE, LTE-M, NB-IoT, 5G), with frequencies, ranges and bit rates.Data Transmission Technologies - Wired, Wireless, LAN and WAN → and applied in Internet of Things and Application ScenariosThe Internet of Things joins ubiquitous computing (objects that sense, decide and act) with Internet connectivity (objects that transmit, use cloud computing and network information); an IoT system has nodes, a network and a back-end, and is applied in smart city, home, mobility, health, industry, farming and grid scenarios.Internet of Things and Application Scenarios →.
Versione ripasso
- Embedded system: computing system built for a specific function inside a larger mechanical or electronic system; hardware and software architecture are tightly linked; very often it integrates sensors and measurement tools (see Data Acquisition SystemsA DAQ module multiplexes several analog inputs through a programmable gain amplifier into one ADC, stores the samples in a buffer and hands them to a PC, with sampling timing, trigger modes (digital, analog level, window, pre-trigger) and input configuration (differential or referred to ground) that the user must know.Data Acquisition Systems →).
- Ubiquitous computing (Mark Weiser, 1988): post-desktop model, many computers for one user (mainframe: one computer for many users; PC: one for one). A pervasive system places processing inside everyday objects.
- Moore's law (as worded on the slide): complexity of microcircuits doubles every 18 months. Cost per transistor per hertz halves in 1.1 years.
- Commodore 64 (1982) against modern boards:
| Feature | Commodore 64 (1982) | Arduino UNO (2005) | Raspberry Pi 4 (2019) |
|---|---|---|---|
| Clock | 0.985 MHz | 16 MHz | 1.5 GHz |
| RAM | 64 kByte | 2 kByte | 1, 2, 4 or 8 GByte |
| ROM | 20 kByte | 1 kByte | 32 GByte microSD |
| Price | 973.5 US dollars | 20 euro | 50 euro |
- Processing units:
- microcontroller: single-board microcontrollers such as Arduino (Arduino PlatformArduino is a family of open single-board microcontroller boards built on Atmel AVR chips (UNO, Mega, Micro), extended with stackable shields and programmed through its own IDE.Arduino Platform →);
- SoC (system-on-chip): single-board computers such as Raspberry Pi;
- microprocessor: PCs and smartphones.
- PLC (Programmable Logic Controller): industrial automation, analog or digital signals from sensors to actuators, programmed in textual or graphic languages.
- Microprocessor vs microcontroller:
- microprocessor: only the computation logic, needs external memory and peripherals, general purpose, operating system, GHz;
- microcontroller: autonomous single-chip system, customised for one task, firmware in flash, MHz.
- Microcontroller chip: controller (8, 16 or 32 bit), oscillator, RAM and EEPROM (a few kB), flash for firmware (a few tens of kB), I/O and GPIO ports; optionally ADC/DAC and communication modules.
- SoC: 32 or 64-bit processor at hundreds of MHz or GHz, RAM in hundreds of MB or GB, USB and Ethernet connectors, ADC/DAC, timers; flash is external (SD slot); it needs an operating system.
- Architecture: powering system, computation system, memory, sensors and actuators, transceivers. Optional: LCD, keyboards, SD cards.
- Battery or solar power: reduce consumption to the minimum, also with duty-cycling.
- Sensor = input transducer (measures and gives an electrical signal). Actuator = output transducer (turns the signal into an action). Output: analog, digital or binary; active (needs power) or passive. Characteristics: static (input to output function) and dynamic (behaviour at fast input variations).
- Sensor specifications:
- sensitivity: input variation over output variation;
- accuracy: maximum deviation from the real value;
- range; resolution: minimum input variation giving an appreciable output variation;
- stability, reliability, repeatability.
- Sensor families (examples): presence and movement (ultrasonic, optical, capacitive); position (magnetic, radar); speed and acceleration (accelerometers, gyroscopes); force and pressure (strain gauges, piezoelectric, piezoresistive); temperature (thermistors, thermocouples); light (photodiodes, photoresistors); humidity (capacitive).
- Actuators: LEDs and infrared emitters; speakers and piezo buzzers; relays (most common switches); stepper, DC and servo motors.
- HMI: inputs are switches, potentiometers, buttons, joysticks, touch sensors and screens; outputs are LEDs, 7-segment displays, LCD and TFT screens, buzzers, speakers.
- Connectivity:
- wired: USB, serial, Ethernet, CANbus, I2C, SPI;
- wireless: WiFi, GPRS, UMTS, LTE, 5G, ZigBee, RFID, LoRa.
- Data go directly to the Internet or through a gateway that collects them; see Data Transmission Technologies - Wired, Wireless, LAN and WANSurvey of the data transmission technologies used to connect measurement and IoT nodes, from local ones (RFID, NFC, Bluetooth, WiFi, ZigBee) to wide-area ones (LoRa, SigFox, GSM/GPRS, UMTS, LTE, LTE-M, NB-IoT, 5G), with frequencies, ranges and bit rates.Data Transmission Technologies - Wired, Wireless, LAN and WAN → and Internet of Things and Application ScenariosThe Internet of Things joins ubiquitous computing (objects that sense, decide and act) with Internet connectivity (objects that transmit, use cloud computing and network information); an IoT system has nodes, a network and a back-end, and is applied in smart city, home, mobility, health, industry, farming and grid scenarios.Internet of Things and Application Scenarios →.
- Typical error: confusing the microprocessor (external memory, OS) with the microcontroller (self-contained, firmware).