Catto / Topic Map · Digital Electronics IV Year 7
Digital Electronics IV · 120 h · Topic 4 of 6

Control applications

Three applications that come up again and again in industry, and that force you to bring together everything covered so far: weighing and dosing, elevator control and automatic verification and test systems. In all three, the microcontroller is the easy part; the hard part is the real problem.

Load cell Dosing Elevators Test bench

Where we start from

Temperature and lighting control is covered in control with devices, sensors and actuators in sensors and actuators, and the internal peripherals in microcontroller peripherals. Here they are applied to three concrete problems.

01Weighing with a load cell

+ exc- excS+S-50 kg cell · 2 mV/VAmplifiergain 128Converter24 bitsMicrocontrollerweight0 kgCell output0.0 mVConverter reading0Displayed weight0.00 kg10 kgCell output2.0 mVConverter reading838,861Displayed weight10.00 kg25 kgCell output5.0 mVConverter reading2,097,152Displayed weight25.00 kg50 kgCell output10.0 mVConverter reading4,194,304Displayed weight50.00 kg2 mV/V with 5 V of excitation gives 10 mV at full scale: 0.2 mV per kilogram, 200 nanovolts per gram.That is why the cable is shielded and kept away from power wiring, and the excitation must be clean and stable.The converter’s 24 bits are not the real resolution: noise leaves between 17 and 19 useful bits.
Figure 1. Load cell and measurement chain, animated. Four strain gauges in a Wheatstone bridge deliver a few millivolts, which an instrumentation amplifier and a high-resolution converter turn into a number.
Load cell parameterWhat it means
Rated capacityThe maximum weight it can take without damage: 5, 50, 500 kg. Choose it with a margin over the actual load, including the weight of the container.
SensitivityTypically 2 mV/V: with 5 V of excitation it delivers 10 mV at full scale. It is a tiny signal.
Bridge resistance350 Ω is the usual value. It determines the excitation current and the heating.
Accuracy classDefines linearity, hysteresis and drift. It is what separates a commercial scale from just any force sensor.
Temperature compensationThe range over which the cell keeps its accuracy. Outside it, the reading drifts.
Worked example · What resolution can be achieved?

50 kg cell, sensitivity 2 mV/V, excitation 5 V, 24-bit converter with a gain of 128 and a ±20 mV input.

  1. Full-scale output: 2 mV/V × 5 V = 10 mV for 50 kg.
  2. That means 0.2 mV per kilogram, or 200 nV per gram.
  3. The converter has 24 bits over ±20 mV, that is, a step of about 2.4 nV. In theory that would be enough to resolve hundredths of a gram.
  4. In practice noise leaves about 17 to 19 useful bits: the real resolution is around 1 to 5 grams, and only with good filtering and averaging.

The conclusion matters: the converter’s bits are not the resolution. What rules is the noise of the whole chain, which is why the wiring, the power supply and the averaging decide the result.

What ruins a scale
  • Load cell cable near power wiring: 200 nanovolts per gram forgive nothing. The cable must be shielded, kept apart and as short as possible.
  • Noisy power supply: the cell’s excitation must be clean and stable. Any variation translates directly into weight.
  • Poor mechanical mounting: the cell has to work in the direction it was made for. Loading it from the side, seating it crooked or letting the container rub against something introduces errors far larger than any electronic detail.
  • Temperature: thermal drift is real. Let the equipment stabilize before calibrating.
Calibration: two points and nothing more

First do the zeroing with the container empty —that reading is the tare— and then place a known reference weight. These two points define the line weight = (reading − zero) × slope. If the cell is good, two points are enough; if more are needed, the problem is mechanical or the cell is no good.

02Batch dosing

weighttimetargetcutoffcoarse shut-offTareZero is taken with the container empty and at rest. The whole batch is measured from there.Fast fillHigh flow up to 90 to 95% of the target. This stage sets the cycle time.Slow fillLow flow only: accuracy is gained at the cost of seconds.Cutoff and in-flight materialIt closes before the target: whatever has already left the hopper will still fall.Settling and correctionWait for the scale to settle, record the batch and adjust the cutoff for the next one.At 2 kg/s coarse flow and 270 ms from command to last grain, cutting at coarse flow leaves 540 g of overweight.
Figure 2. Dosing cycle, animated. The system fills quickly up to the coarse shut-off point, continues slowly up to the fine shut-off and cuts off before the target, because the material already in the air will still fall.
StageWhat the control does
TareWith the container empty and at rest, it takes the zero. The whole batch is measured from there.
Fast fillOpens the high flow until the coarse shut-off point is reached, typically 90 to 95% of the target.
Slow fillLow flow only. Accuracy is gained at the cost of time.
Early cutoffCloses before the target, allowing for the in-flight material. That value is learned from the previous batches.
Settling and final weighingWaits for the scale to settle and records the actual weight of the batch.
CorrectionAdjusts the early cutoff according to the error of the previous batch. This is what makes the system improve on its own.
Example · How much material is in the air

A hopper discharges 2 kg/s at coarse flow and 0.2 kg/s at fine flow. The valve takes 150 ms to close and the material takes 120 ms to reach the scale.

  • Cutting off at coarse flow: 2 kg/s × 0.27 s = 540 g of overweight. Unacceptable.
  • Cutting off at fine flow: 0.2 kg/s × 0.27 s = 54 g. Can be compensated by cutting early.
  • With automatic correction, the final error settles at a few grams.

That is why every serious doser has two speeds. With only one, it is either accurate and extremely slow, or fast and out of tolerance.

03Elevator control

The operating logic
  • Calls: car calls and floor calls are stored in two tables of flags.
  • Selection: while going up, it serves the calls that are above and in the same direction; when they run out, it reverses. This is the selective collective control, and it is what keeps the elevator from making absurd trips.
  • Position: it is known from floor sensors and leveling-zone sensors, and is checked continuously. If the system loses the position, it makes a recovery trip to one end.
  • Speed: starting and braking with ramps, and a slow approach to the floor. An elevator that brakes abruptly is a poorly controlled elevator.
The safety chain

It is a series circuit of contacts that, if opened at any point, cuts off the operation: landing door contacts, car door contacts, end-of-travel limit switches, overspeed governor, safety gear and emergency stop buttons.

This circuit is independent of the program and acts directly on the power. An elevator does not stop because the software decides so: it stops because the chain opened. The microcontroller reads the state of the chain to report and log, but it is not what protects.

The general rule of functional safety

It applies to the elevator and to any machine: safety is not implemented in software. It is implemented with physical interlocks, positively driven (forced-opening) contacts and safety relays, and the program takes care of comfort and service logic. A program can hang; a contact open in series with the coil cannot. We return to this in health and safety.

04Automatic verification and test systems

An automatic test bench subjects every manufactured unit to a sequence of tests, decides whether it passes or not, and stores the result. It is what allows a production run to have measurable quality instead of declared quality.

PartFunction
FixtureA device that positions the part the same way every time and makes contact with the test points. It is the part that most defines repeatability.
StimulusPower supplies, generators and input signals that put the unit under the test conditions.
MeasurementMultimeter, converters, counters. Each quantity with its instrument and its stated accuracy.
SequenceThe program that orders the tests, applies the limits and decides. It stops at the first failure or runs them all, as appropriate.
LogSerial number, date, measured values and verdict. Without a log, the bench can sort units but cannot improve the process.
Limits and the gray zone

A test has a specification limit —what the product must meet— and it is advisable to have in addition a stricter process limit. Units that fall between the two pass, but are flagged: they are the early sign that the process is drifting. When the whole production run starts to pile up near the limit, there is a problem even though nothing fails yet.

And something that is always forgotten: the test bench must also be verified. Periodically run a known good reference unit and another deliberately bad one, to confirm that the bench still detects what it should.

05In the lab

Lab 1 · Scale

Build a scale with a load cell, an amplifier and a microcontroller. Calibrate with two points, measure the repeatability by weighing the same weight ten times and calculate the deviation. Repeat with the load cell cable near a running motor and compare.

Lab 2 · Doser

With a simple hopper and a valve or a vibrator, dose a target quantity of granular material. Implement coarse and fine shut-off and automatic correction of the cutoff point. Plot the error of the first twenty batches: you can see how the system learns.

Lab 3 · Teaching elevator

On a model with three or four floors, program the selective collective control with car and floor calls. Add a physical safety chain in series with the contactor and verify that opening any contact stops the movement, even if the program insists.

Lab 4 · Test bench

Build a bench that automatically verifies a simple board made in the workshop: supply voltages, current consumption, response of the outputs. Define limits, generate a verdict and store a log for each unit. Test the bench with a good board and with one deliberately sabotaged.

06Common mistakes

MistakeConsequence
Confusing converter bits with real resolutionAn accuracy is promised that the noise of the chain does not allow to be reached.
Load cell cable next to power wiringThe weight reading jumps every time a motor starts.
Careless mechanical mountingRubbing and side loads produce errors far larger than any electronic detail.
Dosing with a single speedIt is either accurate and extremely slow, or fast and always overshoots.
Not allowing for the in-flight materialSystematic overweight in every batch.
Putting safety in the programIf the program hangs, there is no protection. Interlocks are physical and in series.
Test bench that is never verifiedIt may be passing bad units for months without anyone noticing.
Testing without loggingProduct is sorted, but the process cannot be improved nor a batch traced.

07Self-assessment

How much voltage does a 2 mV/V cell deliver with 5 V of excitation, at full scale?

10 mV. That is why an instrumentation amplifier and a high-resolution converter are needed.

Why don’t 24 bits mean resolving micrograms?

Because the noise of the whole chain leaves quite a few fewer useful bits, generally between 17 and 19. The real resolution is set by the noise, not by the converter.

How is a scale calibrated?

With two points: zero with the container empty —the tare— and a known reference weight. From these come the intercept and the slope.

What is in-flight material and why does it matter?

The material that has already left the hopper and has not yet reached the scale when the close command is given. You must cut off early by that amount, or every batch comes out overweight.

Why does a doser use two speeds?

Because the high flow gives speed but a lot of in-flight material, and the low flow gives accuracy but is slow. Combining them gives a batch that is both fast and accurate.

What is selective collective control?

The logic by which the elevator, while going up, serves only the calls that are above and in the same direction, and reverses only when it has used them up.

What is the safety chain of an elevator?

A circuit of contacts in series —doors, limit switches, overspeed governor, safety gear, emergency stops— that cuts off the operation if it opens at any point, independently of the program.

Why is safety not implemented in software?

Because a program can hang, become corrupted or have a bug; a contact open in series with the contactor coil cannot. Software takes care of service, not of protection.

What is the difference between the specification limit and the process limit?

The specification limit is what the product must meet; the process limit is stricter and serves as an early warning: if production approaches it, something is drifting even though nothing fails yet.

How do you verify that a test bench is still working?

By periodically running a good reference unit and another deliberately bad one through it, and confirming that it classifies them correctly.

Development of the topic “Control applications” of Digital Electronics IV (Year 7), based on the “Curriculum Proposal – Second Cycle of the Technical-Vocational Track, Secondary Education – Electronics,” Ministry of Education of the Province of Córdoba, DGETyFP. Back to the Topic Map · catto.ar