**What is Measurement and Control?**

Evaluating possible values (such as sensor input) to determine what the system should do (control).

- Evaluating temperature sensor data and turning on/off the heater to have the temperature stable on a value set by the user.
- Evaluating pressure readings on a controller to determine the grip strength of a robotic arm.
- Motion detector for a power-saving lighting system (uses vision processing with a low-res camera)
- Maximum power-point system for solar battery charging
- Washing machine (measures water, controls water and spin, stops if the load is too unbalanced)
- Sonar sensor (measures the time for an ultrasonic ping to return)
- Servo motor
- Automation (a timer or clock to turn on/off water sprinklers, chargers, inactive technology)
- ABS (anti-lock braking system) prevents the wheels from locking up during braking.
- Evaluating data from a light sensor to shift the tilt of a solar panel depending on where the highest concentration of light is throughout the day.
- Evaluating data from a motion sensor in front of a car to determine when to accelerate, decelerate, or brake for an automatic cruise control system.

**How does Measurement and Control relate to Embedded Systems?**

Embedded systems are designed to interact with the real world, and most of the time for a specific measure and control purpose. Designers strive to create systems that are independent of human controls, and operate solely from external stimulus. In fact, signals from the environment get translated by sensors into analog and digital signals that the microprocessor can respond with appropriate control signals. This process can be either done by periodically checking the input (polling) or respond whenever an input is received (interrupts). For example, microcontrollers use analog-to-digital converters (ADCs) to capture input, and then respond with PWM signals to actuate motors and light. In larger systems one microcontroller may be used solely for measurement and signal processing while another is used for feedback control.

**What challenges does Measurement and Control face today?**

**Safety:** Microcontrollers are always constrained by power, size, and cost. With increasing complexity, however, it is getting more difficult to prove the performance of a critical system.

**Accuracy:** ADC peripherals usually have 12 bits or fewer and use the successive approximation technique. Often several least-significant bits are very noisy, limiting the data that can be obtained by the system. Inexpensive cost-optimized microcontrollers like the ESP32 sacrifice the linearity, precision, and range of their ADC in order to fit other features like WiFi and loads of flash memory.

**Sampling rate:** Microcontrollers are generally limited to sampling rates below 200kHz. This makes them unsuitable for digitizing high-frequency signals.

**Power:** Wearables are requiring long battery life while wanting to measure things like steps, where there may be long pauses in between data

**Types of Control Systems**

Control systems are used in embedded systems to determine input and output execution. Most control systems involve reading a certain input and giving out an output based on the value of the input and the target goals for the system (i.e reading a temperature, and turning on a heater).

Systems that can be implemented on microcontrollers:

- On-Off – One of the most basic methods, turning on or off an output based on a certain value.
- PID (Proportion-Integration-Derivative) Controller – This method of control determines the error between the input and the expected input of a system. By determining the rate of change and the system’s oscillations, the outputs from this system will converge to the expected input. There are other variations of this system, such as only P or PI.
- Fuzzy Logic – This logic uses binary values and the gray area in between to assume conditions. These conditions are sets of if-then statements, but these statements are flexible and will eventually converge on the set values needed for the system.

**Advantages and methods of different kinds of control systems****On-Off**: Very simple to implement, least costly option. Only allows for an abrupt changing of state at a measured point. An example may be an oven heating element being on any time the temperature is below the target, and being turned off any time it exceeds the target.**Proportional**: More complex than On-Off, but a simpler version of PID. Calculates the difference between a target value, and measured value . A function is applied to that difference to determine control behavior. Allows for finer control in areas where simple on-off may not achieve best results, but requires both more precise measuring and the ability to vary response strength. **Proportional & Integral**: Introduces an integral component to proportional control. While proportional control only corresponds to the immediate error, integral control accounts for accumulated error. It’s possible for proportional to reach steady state without causing the measured value reaching the target, resulting in offset. The integral term accounts for this offset, pushing the value towards its target. Increases control system complexity.**Proportional, Integral, & Derivative**: The derivative term accounts for the rate at which the measured value is approaching the target value. If the measured value is changing rapidly as it nears the target it is likely to overshoot the target, and the response needs to be lowered. Conversely, if the measured value is very quickly moving away from the target value the response should be strengthened to bring it back. Also increases control system complexity.**Fuzzy Logic**: Take ‘crisp’ inputs, which correspond to discrete measurements. These measurements are converted to ‘fuzzy’ sets, which have a degree of membership from 0 to 1, as opposed to a discrete truth value. For example, in a discrete sense we might define ‘hot’ to be any temperature over 80 degrees, so a measurement of 85 degrees would be a 1 (True) for hot, and 75 degrees would be a 0 (False). Fuzzy logic may say that a temperature of 75 has a .8 degree of membership with the set hot. The measurement is run through a set of if-then statements or rules, giving fuzzy outputs, which are then converted back to ‘crisp’ values or actions. Fuzzy logic corresponds more closely to intuitive thinking, where categories are often not fully discrete and there isn’t always a sharp boundary between two categories. It can be easier to implement and understand, especially in situations with some uncertainty, but the results are not always accurate.

References:

https://www.guru99.com/what-is-fuzzy-logic.html

https://controlstation.com/using-the-integral-term/

**What are some useful resources to learn more about Measurement and Control?**

- Systems Dynamics and Control class (ECE 451)
- Lecture notes on Oversampled Delta-Sigma Data Converters
- Book: Norman S. Nise, Control Systems Engineering.
- Measurement and Control Basics, 5th Edition by Thomas A. Hughes
- Embedded Control Systems in C/C++by Jim Ledin
- System Stability: Designing High-Quality Embedded Control Systems with Guaranteed Stability
- Sensor Calibration: A Primer of a Sensor Calibration Procedure for Embedded Applications
- Paper: Experiment of Measurement and Control using Embedded System for Undergraduate Students
- Web Article: https://www.embedded.com/basics-of-real-time-measurement-control-and-communication-using-ieee-1588/
- Conference papers: Towards a specification technique for component-based measurement and control software for embedded systems