Skip to content
Early access openRev 0.1Robots in the lab 0001Local --:--:--
//Follow one carton

PLC packaging line

A short packaging line in a food plant. Cartons come in on a conveyor, a filler drops a measured amount into each one, a taper closes and tapes it, and a checkweigher weighs it and swings off any carton outside the limits. A PLC (programmable logic controller) in the control cabinet runs all of it, and a small computer beside the cabinet reads the PLC's registers and carries them out to the plant network.

Step 1 of 7: Fill

Step 01 of 07, on the machine

Fill

An empty carton stops under the filler, and a photo-eye tells the PLC it is there. The PLC starts the dosing head, which drops the amount the recipe asks for, here 5 kg, into the carton, and the conveyor moves on.

What it costs

About 3 seconds for each carton if the line runs at about 20 cartons a minute, and the dose has to fit inside that along with the carton moving in and out.

Estimate

Why it is hard, and what is at work

The filler measures a volume, and the customer is promised a weight. The two drift apart as the product changes, and a volumetric filler cannot weigh what it drops, so the first sign of a drift is at the checkweigher, several cartons later.

Parts working at this step
  • Infeed and outfeed conveyors

    Belt conveyors carry cartons in to the filler and the taper and out past the checkweigher, each driven by a geared motor on a variable-speed drive in the cabinet. Photo-eyes along the rail tell the PLC where each carton is.

  • Filler

    A hopper feeds a volumetric dosing head, an auger that doses by the turn, which drops a measured amount of product into each open carton while the carton stands under it. The PLC tells the head when to start, and the recipe sets how much.

Step 02 of 07, on the machine

Seal

The filled carton runs into the case taper. The folder closes the top flaps, the side belts carry the carton under the tape head, and the head lays tape along the seam and a short way down each end.

What it costs

About 0.55 m of tape for each carton, a 400 mm strip along the seam and 75 mm down each end: about 11 m a minute at 20 cartons a minute.

Estimate

Why it is hard, and what is at work

A carton that tips, or arrives too close behind the one ahead, jams inside the guarding. Opening the guard to clear it stops the line through the safety relay, and the line waits until someone resets it.

Parts working at this step
  • Case taper

    A folder closes the carton's top flaps as it comes in, side belts carry it under the tape head, and the head lays tape along the seam and a short way down each end, then cuts it.

  • Guarding and light curtain

    Mesh panels close off the filler and the taper. The taper's access door carries an interlock switch, and the opening where an operator reaches in to clear the filler is watched by a light curtain, a column of infrared beams between two posts; both are wired to the safety relay.

Step 03 of 07, on the machine

Check

The carton crosses the weigh belt. For the moment it is wholly on the belt, the load cell under it weighs it: 5.02 kg, inside the recipe's limits. The checkweigher tells the PLC the carton passed, and the reject arm stays back. A carton outside the limits is swung off into the locked bin.

What it costs

About 0.4 s to weigh each carton: a 400 mm carton is wholly on a 600 mm weigh belt for 200 mm of its travel, at about 0.5 m/s.

Estimate

Why it is hard, and what is at work

The weight is taken on a moving belt, among the line's vibration, in a fraction of a second. The limits come from the recipe: a wrong limit either rejects good cartons or sends light ones to a customer. An arm that fires a moment late knocks off the next carton instead.

Parts working at this step
  • Checkweigher and reject arm

    A short belt on a load cell weighs each carton as it passes, and the checkweigher's own controller compares the weight with the limits in the recipe. A carton outside them is swung off the line into a locked bin by an arm on an air cylinder, and the result goes to the PLC.

Step 04 of 07, on the machine

Count

The PLC adds one to its count of good cartons, and keeps the reject count, the belt speed, and the dose setpoint beside it, each in a numbered holding register. On this line, the PLC's documentation puts the good count in register 40010 and the dose setpoint in 40001, and nothing in either register says what it holds or in what unit: the setpoint reads 500, meaning 5.00 kg.

What it costs

About 55 hours before a 16-bit good count wraps round to 0, at about 20 cartons a minute: 65,535 cartons.

Estimate

Why it is hard, and what is at work

A holding register holds one 16-bit number, 0 to 65,535. A count that runs past that wraps round to 0 or is split across two registers, and a reader that takes the two halves at different moments gets a number the PLC did not hold at any moment. The reference Modbus driver reads and writes one register at a time.

Parts working at this step
  • Control cabinet: PLC, drives, and safety relay

    The PLC runs the line's program. It reads every photo-eye and the checkweigher's result through its input modules, sets the conveyor drives' speeds, times the filler and the reject arm, and keeps its counts and setpoints in numbered holding registers. A safety relay beside it cuts power to the motors when the light curtain is broken or an emergency stop button is pressed, through its own wiring.

Step 05 of 07, across the fleet

Read

Across 1,000 lines in 50 plants, each line's gateway reads its PLC's registers and reports them to your server. In Device to Cloud Flywheel, the gateway is an enrolled device running the Modbus driver as a plugin, and the register map, each name and its address, is that device's desired state: deploying the map is what installing means for this device type. On every poll, about every 2 seconds by default, the driver reads each mapped register over Modbus TCP, one request at a time. A register with a deployed setpoint is compared with it. The rest, such as the counts, go to the server with the drift report as readings listed by address, with nothing to compare them against. The server keeps them only while the line is drifted: while it is in sync, the server stores no register values, and the console shows none.

What it costs

About 130 bytes on the line's network for each register read, the request and its answer with their headers: about 2 kbit/s for 4 registers every 2 seconds.

Estimate

Device to Cloud Flywheel solution: PLC and Modbus machines

A second product, Device to Cloud Engineer, is an engineer agent that writes the device code a machine like this runs. It is in development, and there is nothing to try yet.

The fleet view shows 1,000 packaging lines to show the problem at that size; Device to Cloud Flywheel has been run on fleets of single digits to low tens of devices.

Why it is hard, and what is at work

The register map is the part of the line that lives in someone's head or a spreadsheet, and two lines built a year apart differ. Writing it down for 1,000 lines, and keeping it right when a PLC program changes, is the work. The gateway also sits on two networks: it has to read the machine network and connect out to the server without becoming a way in to the PLC. The device agent dials out, so the plant network needs no inbound port. The map takes each address as it goes on the wire. Most PLC documentation numbers holding registers from 40001, which is wire address 0, so an entry copied as 40010 reads a different register or none at all; it has to be written as 9. The demo's simulator puts its registers at 40001 and up on the wire, so its map uses those numbers unchanged.

Parts working at this step
  • Control cabinet: PLC, drives, and safety relay

    The PLC runs the line's program. It reads every photo-eye and the checkweigher's result through its input modules, sets the conveyor drives' speeds, times the filler and the reject arm, and keeps its counts and setpoints in numbered holding registers. A safety relay beside it cuts power to the motors when the light curtain is broken or an emergency stop button is pressed, through its own wiring.

  • Gateway computer

    A fanless computer on the column beside the cabinet. One network port is on the line's own network, where it speaks Modbus TCP to the PLC; the other is on the plant network, where it connects out to the server. It runs Device to Cloud Flywheel's device agent with the Modbus driver as a plugin, on 24 V from the cabinet.

Where Device to Cloud Flywheel fits: PLC and Modbus machines

Industrial machines speaking Modbus behind a small computer. The meaning of a register is knowledge that currently lives in someone's head.

Demo

embodiments/modbus-machine/demo.sh

Needs a running stack, Go, uv, jq, curl, and the driver's Modbus extra (uv sync --extra modbus in its folder), which installs pymodbus.

The demo script starts a Modbus TCP server (pymodbus) on a real socket to stand in for the PLC: a block of holding registers with no machine behind them, so nothing moves. It registers the device type from its schema, enrolls a gateway whose driver talks to that server over Modbus TCP, shows a setpoint name refused before the register map is deployed and written after, runs e-stop, reads the drift, and ends with a real Modbus exception for an address the server does not hold and a real timeout when it stops answering. The solution catalogue says the demo drives the Modbus mock, and the solution page says the driver has no Modbus TCP connection; the code has one, and this page follows the code. The driver reaches a real PLC or gateway through DCF_MODBUS_TCP, or MODBUS_HOST and MODBUS_PORT (502 when unset). The operation the solution calls e-stop writes 0 to every register the driver has written since it started. That is a network command the PLC program can act on or ignore; the line's emergency stop buttons and light curtain act through the safety relay's own wiring, and the schema's safety-critical mark on e-stop is read by no code.

The repository is private while the first release lands, so this demo cannot be run from this page. Write to hello@devicetocloud.ai and we will tell you when it opens.

From the solution page. What the demo needs is read from its script.

Step 06 of 07, across the fleet

Alarm

At one plant, the reject count on this line has doubled since the morning shift. Your monitoring software, which reads the counts from the PLC by its own route, sees the reject count climb and tells the line's engineer. Device to Cloud Flywheel shows why: someone lowered the dose setpoint on the HMI, the register no longer holds the value that was deployed, and the gateway's next poll marks the line as drifted, with the deployed value and the value read side by side.

What it costs

About 480 cartons to the reject bin in an 8-hour shift if the doubled rate is 1 in 20, at about 20 cartons a minute: 240 more than before.

Estimate

Device to Cloud Flywheel solution: PLC and Modbus machines

The fleet view shows 1,000 packaging lines to show the problem at that size; Device to Cloud Flywheel has been run on fleets of single digits to low tens of devices.

Why it is hard, and what is at work

Device to Cloud Flywheel sets no limits and sends no alarms. It marks a line drifted when a register with a deployed setpoint reads differently, and reports the other readings without judging them, and only while the line is drifted. Which counts matter and when a person is called are your team's decisions. A PLC that stops answering shows as drifted only if one of its registers has a deployed setpoint.

Parts working at this step
  • HMI panel

    A touch panel (a human-machine interface, HMI) on an arm beside the cabinet shows the line's state, counts, and alarms, and lets the shift change a recipe or a setpoint, which the panel writes into the PLC.

Where Device to Cloud Flywheel fits: PLC and Modbus machines

Industrial machines speaking Modbus behind a small computer. The meaning of a register is knowledge that currently lives in someone's head.

Demo

embodiments/modbus-machine/demo.sh

Needs a running stack, Go, uv, jq, curl, and the driver's Modbus extra (uv sync --extra modbus in its folder), which installs pymodbus.

The demo script starts a Modbus TCP server (pymodbus) on a real socket to stand in for the PLC: a block of holding registers with no machine behind them, so nothing moves. It registers the device type from its schema, enrolls a gateway whose driver talks to that server over Modbus TCP, shows a setpoint name refused before the register map is deployed and written after, runs e-stop, reads the drift, and ends with a real Modbus exception for an address the server does not hold and a real timeout when it stops answering. The solution catalogue says the demo drives the Modbus mock, and the solution page says the driver has no Modbus TCP connection; the code has one, and this page follows the code. The driver reaches a real PLC or gateway through DCF_MODBUS_TCP, or MODBUS_HOST and MODBUS_PORT (502 when unset). The operation the solution calls e-stop writes 0 to every register the driver has written since it started. That is a network command the PLC program can act on or ignore; the line's emergency stop buttons and light curtain act through the safety relay's own wiring, and the schema's safety-critical mark on e-stop is read by no code.

The repository is private while the first release lands, so this demo cannot be run from this page. Write to hello@devicetocloud.ai and we will tell you when it opens.

From the solution page. What the demo needs is read from its script.

Step 07 of 07, across the fleet

Change

The operator lowered the dose because the product now runs finer, and every plant receives the same product, so the team works out the right dose for the finer product and sets it for all 1,000 lines. The change goes out as desired state: the same register map with the new setpoint in it. A staged rollout sends it to one group of lines first, here 20 lines, nearly all of them in this one plant, and releases the next group only when someone advances it and every line already released has the change in its desired state, with none failed. When a gateway takes the change, its driver writes the setpoint into the PLC's register straight away, and refuses a setpoint whose name is not in the map. A rollout can be paused, resumed, and rolled back; a rollback restores the earlier desired state, and the gateway writes the earlier setpoint.

What it costs

About 50 shift changes to reach all 1,000 lines at 20 lines a shift: about 17 days at three shifts a day.

Estimate

Device to Cloud Flywheel solution: PLC and Modbus machines

The fleet view shows 1,000 packaging lines to show the problem at that size; Device to Cloud Flywheel has been run on fleets of single digits to low tens of devices.

Why it is hard, and what is at work

A wrong setpoint on 1,000 lines can mean a recall, so the change goes out in small groups. Downtime costs money, so the team advances each group at a shift change: the rollout has no clock of its own and does not wait for a line to finish a batch. Whether a PLC takes a new value mid-batch is decided in its program, and many are written to accept a recipe only between batches. The rollout cuts a group's lines into equal batches in order of device ID, so a batch is one plant only if the gateways' IDs sort plant by plant.

Parts working at this step
  • Gateway computer

    A fanless computer on the column beside the cabinet. One network port is on the line's own network, where it speaks Modbus TCP to the PLC; the other is on the plant network, where it connects out to the server. It runs Device to Cloud Flywheel's device agent with the Modbus driver as a plugin, on 24 V from the cabinet.

  • Control cabinet: PLC, drives, and safety relay

    The PLC runs the line's program. It reads every photo-eye and the checkweigher's result through its input modules, sets the conveyor drives' speeds, times the filler and the reject arm, and keeps its counts and setpoints in numbered holding registers. A safety relay beside it cuts power to the motors when the light curtain is broken or an emergency stop button is pressed, through its own wiring.

Where Device to Cloud Flywheel fits: PLC and Modbus machines

Industrial machines speaking Modbus behind a small computer. The meaning of a register is knowledge that currently lives in someone's head.

Demo

embodiments/modbus-machine/demo.sh

Needs a running stack, Go, uv, jq, curl, and the driver's Modbus extra (uv sync --extra modbus in its folder), which installs pymodbus.

The demo script starts a Modbus TCP server (pymodbus) on a real socket to stand in for the PLC: a block of holding registers with no machine behind them, so nothing moves. It registers the device type from its schema, enrolls a gateway whose driver talks to that server over Modbus TCP, shows a setpoint name refused before the register map is deployed and written after, runs e-stop, reads the drift, and ends with a real Modbus exception for an address the server does not hold and a real timeout when it stops answering. The solution catalogue says the demo drives the Modbus mock, and the solution page says the driver has no Modbus TCP connection; the code has one, and this page follows the code. The driver reaches a real PLC or gateway through DCF_MODBUS_TCP, or MODBUS_HOST and MODBUS_PORT (502 when unset). The operation the solution calls e-stop writes 0 to every register the driver has written since it started. That is a network command the PLC program can act on or ignore; the line's emergency stop buttons and light curtain act through the safety relay's own wiring, and the schema's safety-critical mark on e-stop is read by no code.

The repository is private while the first release lands, so this demo cannot be run from this page. Write to hello@devicetocloud.ai and we will tell you when it opens.

From the solution page. What the demo needs is read from its script.

And back

Back to 01 Fill, with the new setpoint

The next carton stops under the filler and goes through the same steps, this time dosed to the new setpoint. The reject count on this line shows whether the change worked, and the gateway's next reads show whether the PLC still holds what was deployed.

On the machine
Across the fleet
And back
//Every part in the cycle

Each subsystem has its own way to fail.

The catalogue examples are representative parts taken from vendor datasheets and product pages, each linked to its source. They show the kind of component each subsystem uses and the numbers that matter for it. They are not a bill of materials, and nobody has checked that they work together.

PartWhat it doesWhy it is hardCatalogue examples
Infeed and outfeed conveyorsWorking at 01 fillWhat it does. Belt conveyors carry cartons in to the filler and the taper and out past the checkweigher, each driven by a geared motor on a variable-speed drive in the cabinet. Photo-eyes along the rail tell the PLC where each carton is.Why it is hard. Every station times its work from where the PLC believes a carton is. A belt that slips, dust on a photo-eye, or a carton that arrives crooked puts the dose, the tape, or the reject on the wrong carton, and the line either jams or runs on with nobody noticing.Catalogue examples

The catalogue has no conveyor, geared motor, or photo-eye row.

FillerWorking at 01 fillWhat it does. A hopper feeds a volumetric dosing head, an auger that doses by the turn, which drops a measured amount of product into each open carton while the carton stands under it. The PLC tells the head when to start, and the recipe sets how much.Why it is hard. The dose is set as a volume and meant as a weight, and the two drift apart as the product changes: finer, damper, or lower in the hopper. A volumetric filler cannot weigh what it drops, so the first sign of a drift is at the checkweigher, several cartons later.Catalogue examples

The catalogue has no filler or dosing row.

Case taperWorking at 02 sealWhat it does. A folder closes the carton's top flaps as it comes in, side belts carry it under the tape head, and the head lays tape along the seam and a short way down each end, then cuts it.Why it is hard. Tape that does not stick to a dusty or cold carton lets go in the warehouse. A carton that tips, or arrives too close behind the one ahead, jams under the head, and clearing it means opening the guarding, which stops the line.Catalogue examples

The catalogue has no sealing or taping row.

Checkweigher and reject armWorking at 03 checkWhat it does. A short belt on a load cell weighs each carton as it passes, and the checkweigher's own controller compares the weight with the limits in the recipe. A carton outside them is swung off the line into a locked bin by an arm on an air cylinder, and the result goes to the PLC.Why it is hard. The carton is weighed while it moves, in the fraction of a second it is wholly on the weigh belt, and the belt shakes with the rest of the line. The arm has to hit the right carton, so its timing depends on the belt speed and the photo-eye before it. The bin is locked so that nobody can put a rejected carton back on the line.Catalogue examples
piston diameter 25 mm · stroke 100 mm · operating pressure 1 to 10 bar

The Festo cylinder shows the size of air cylinder that swings a reject arm: its 294.5 N at 6 bar is about six times the weight of a 5 kg carton. It needs an air valve and a supply, and the catalogue has no load cell or air valve row.

Control cabinet: PLC, drives, and safety relayWorking at 04 count, 05 read, 07 changeWhat it does. The PLC runs the line's program. It reads every photo-eye and the checkweigher's result through its input modules, sets the conveyor drives' speeds, times the filler and the reject arm, and keeps its counts and setpoints in numbered holding registers. A safety relay beside it cuts power to the motors when the light curtain is broken or an emergency stop button is pressed, through its own wiring.Why it is hard. The PLC owns the line: nothing that arrives over the network may make it do what its program does not allow. The safety relay is kept apart on purpose, so that no program fault or network command can hold off a safety stop or reset one. A register's number says nothing about what it holds; the meaning lives in the PLC program and with whoever wrote it.Catalogue examples
ports 5 · data rate max 100 Mbit/s · operating temp −10 to 60 °C

The Moxa switch joins the PLC, the HMI, and the gateway on the line's own network. Its range of -10 to 60 °C is a standard one, and a hot cabinet needs the wide-temperature model. The catalogue has no PLC, input or output module, drive, or safety relay row.

HMI panelWorking at 06 alarmWhat it does. A touch panel (a human-machine interface, HMI) on an arm beside the cabinet shows the line's state, counts, and alarms, and lets the shift change a recipe or a setpoint, which the panel writes into the PLC.Why it is hard. The HMI is a second way in to the same registers. A setpoint changed on the panel during a shift is a real change that nothing off the line sees unless something reads the register back. Operators also learn which screen clears which fault, and a change made from elsewhere that they cannot see on the panel confuses them.Catalogue examples

The catalogue has no HMI row.

Gateway computerWorking at 05 read, 07 changeWhat it does. A fanless computer on the column beside the cabinet. One network port is on the line's own network, where it speaks Modbus TCP to the PLC; the other is on the plant network, where it connects out to the server. It runs Device to Cloud Flywheel's device agent with the Modbus driver as a plugin, on 24 V from the cabinet.Why it is hard. Plant networks are split into zones on purpose, and the machine network is the zone IT protects most. The gateway is often the one thing allowed to cross, and only outward: no inbound port, and no remote desktop through it to the PLC. It has to run unattended for years in a cabinet's heat and a plant's dust.Catalogue examples
length 242 mm · width 240 mm · height 82 mm
core 4 · core clock 2,400 MHz · memory 8 GB

The Karbon is built for this place: it runs from 9 to 48 V, so from the cabinet's 24 V supply, and holds -40 to 70 °C with its 35 W processor. A Raspberry Pi 5 does the same job on a bench, and needs its own 5 V supply and an enclosure on a plant floor.

Guarding and light curtainWorking at 02 sealWhat it does. Mesh panels close off the filler and the taper. The taper's access door carries an interlock switch, and the opening where an operator reaches in to clear the filler is watched by a light curtain, a column of infrared beams between two posts; both are wired to the safety relay.Why it is hard. Guarding that slows the operator down gets propped open, so it has to let them clear a jam quickly and still stop the machine before a hand reaches a moving part. The light curtain has to stand far enough from the moving parts that they have stopped by the time a hand gets there, so a change that makes a motor take longer to stop also changes where the curtain belongs.Catalogue examples

The catalogue has no guarding or safety light curtain row.

The drawing is illustrative, not a validated design. Costs marked estimate are estimates; the others are worked out from the catalogue part named under them.

//Where to start

The fleet half of this machine, as Device to Cloud Flywheel solutions.

  • PLC and Modbus machines

    Industrial machines speaking Modbus behind a small computer. The meaning of a register is knowledge that currently lives in someone's head.

    docs/solutions/industrial-machines.md (opens when the code is published)

    In the cycle at 05 read, 06 alarm, 07 change.

The solution page has no section that separates measured results from claims, so nothing on this page is quoted as measured.

These pages live in the Device to Cloud Flywheel repository, which is private while the first release lands. Write to hello@devicetocloud.ai for access, and we will tell you when it opens.

//Where we help

Building one? Device to Cloud Flywheel is the software for the fleet half of this loop, from the first packaging line on.

Read, Alarm, and Change: the steps after the machine works. The flywheel moves the data and the releases for every machine you have; what to train on and when to ship stay your team's call.