Success story · Winery · ESP32 PLC
It started with one sensor. It became the data of the whole line.
One ESP32 PLC: reject, line speed, lots and reports to Google Sheets.
"Since we're already counting bottles, why not do something more?"
That question turned a cap detector into Care4.0, the digital view of a whole bottling line.
This success story comes from Bodegas Care and its Care4.0 project, as Industrial Shields published it in 2026. The bottling rate, the three parts of the system, the second counter, the web page, Google Sheets and the two photos come from that story. The PLC model, sensor types, lot sizes and panel values on this page are examples of a typical way to do it.
From the project
The line and its screen.
Two images from the original story: the bottling line with the detector, and the Care4.0 page that runs inside the PLC.


The challenge
A small fix that asked for more.
Bodegas Care, a Spanish winery, runs a bottling line at 3,000 bottles per hour. The starting point was modest: improve the detector that rejects bottles without a cap. The fix replaced old timers and relays with an Industrial Shields ESP32 based PLC. Once it was counting bottles, the team saw it could do much more on the same hardware.
Reject every uncapped bottle
A reliable detector and reject, run by the PLC instead of timers and relays.
Know the speed of the line
Line speed and cycle times in real time, calculated by the same PLC.
Never overproduce a lot
A second counter at the start of the line, on spare I/O, tracks the exact labelling of each lot.
Data for everyone, history for later
Live data on any PC of the company network, and every lot recorded automatically.
Built step by step
Care4.0 grew in three parts on top of the same hardware: control and metrics, a web page inside the PLC, and automatic reports to Google Sheets.
How it works
Three parts of Care4.0: reject and measure, run the lot, report.
Each panel shows one part of the system. Press the buttons. The panels are illustrative simulations: speeds, lots and counts are examples. The 12,091 correct and 33 defects come from the screen in the photo.
One sensor rejects, the same counts give the speed.
The cap detector checks each bottle. A bottle without a cap is taken out of the line. The PLC counts the good bottles and the defects, and from the time between bottles it calculates the line speed and the cycle time. Send an uncapped bottle, then slow the line down.
- Reject of uncapped bottles
- Correct and defect counters
- Line speed and cycle time in real time
PLC events (example)
- Line running.
Illustrative simulation. Example values, not live data from the line. Example values, except the counters: 12,091 correct and 33 defects are on the screen in the photo. At 3,000 bottles per hour, a bottle passes every 1.2 s.
Try the same counts, speed and stops: machine monitor simulator
A target per lot, and a second counter at the start of the line.
From the web page, the operator sets the product and the target of the lot and starts production. The second counter, at the start of the line, counts the bottles that enter the lot, so the line does not label more than the target. Stops longer than a few seconds ask for a reason. Start a lot and follow it.
- Product and target set from any PC
- Second counter on spare I/O
- Stops logged with a reason
Lot events (example)
- No lot running.
Illustrative simulation. Example values, not live data from the line. Example lot of 5,000 bottles. The screen in the photo asks to justify stops longer than 10 s.
Every lot ends up in Google Sheets.
When a lot ends, the PLC sends the data to Google Sheets: date, product and quantity. The history by lot and by product builds itself, with no extra server. Close a lot and look at the day.
- Automatic report by lot and date
- History by product
- No additional servers
Google Sheets (example)
- Pick a moment of the day.
Illustrative simulation. Example values, not live data from the line. Example lots. The two first quantities are the ones on the screen in the photo. The story does not describe network losses: keeping the row until the link is back is a typical way.
System architecture
How does one ESP32 PLC digitalise a bottling line?
An ESP32 based PLC reads the cap detector and two bottle counters, one at the reject point and one at the start of the line, and drives the reject. It serves the Care4.0 web page to any PC on the company network, and sends the data of each lot to Google Sheets.
| Signal | Between | Type | Purpose |
|---|---|---|---|
| Cap present | BetweenCap detector → ESP32 PLC | TypeDigital in | PurposeFind uncapped bottles |
| Bottle passing | BetweenSensor at the reject point → PLC | TypeDigital in | PurposeCounters, line speed, cycle time |
| Bottle entering | BetweenSecond counter at the start of the line → PLC | TypeDigital in | PurposeLot tracking, no overproduction |
| Reject | BetweenPLC → relay or valve driver → reject actuator (typical way) | TypeDigital out | PurposeTake the uncapped bottle out |
| Live data, targets, stops | BetweenPLC web page ↔ PCs | TypeCompany network | PurposeOperators see and set the production |
| Lot report | BetweenPLC → Google Sheets | TypeInternet | PurposeHistory by lot, product and date |
Why it works
One controller, three layers, no extra servers.
Timers and relays become a program
The reject logic moved into the PLC. Changing it is a change in the code, not in the wiring.
The counts were already there
The bottles counted for the reject also give the line speed and the cycle time.
Spare I/O, new value
A second counter on free inputs at the start of the line closed the gap between lots and labelling.
A page instead of a panel
The web page runs inside the PLC: no industrial touchscreen and no external software on the PCs.
History with no server
Google Sheets keeps every lot by date and product, ready to share.
Built in steps
Each part was added on the same hardware when the previous one worked.
Hardware
An ESP32 based PLC at the heart of Care4.0.
One model that fitsESP32 PLC 21 FLEX
The story names an Industrial Shields ESP32 based PLC and does not publish the model. One model with the I/O and the network for this line is the ESP32 PLC 21 FLEX: it reads the sensors, drives the reject, serves the web page and sends the reports.
- Role in this design
- Reject, counters, speed, lot targets, web page, reports
- Processor
- ESP32 dual core, up to 240 MHz
- Inputs
- 13: 6 analog/digital (0-10 V, 11-bit), 7 digital optoisolated (5 to 24 Vdc), 2 of them with interrupt
- Outputs
- 8: 3 analog/digital/PWM (0-10 V, 12-bit), 5 digital optoisolated (5 to 24 Vdc)
- Communications
- Ethernet, Wi-Fi, Bluetooth LE, RS-485, RS-232
- Programming
- Arduino IDE
- Power supply
- 12 to 24 Vdc
- Mounting
- DIN rail TS35, IP20, inside a cabinet
At 3,000 bottles per hour a bottle passes every 1.2 s, well within what an optoisolated input reads; the two interrupt inputs suit faster lines. The whole ESP32 PLC family shares the same programming, so the model depends on the I/O of your line.
Questions about this story
How do you reject uncapped bottles with a PLC?
A sensor checks for the cap as each bottle passes, and the PLC drives a reject that takes the bottle out of the line. At Bodegas Care this logic replaced old timers and relays. A typical way: the PLC counts the bottles between the detector and the reject, or uses a fixed delay at constant speed, so it fires the reject on the right bottle. The story does not publish the sensor or the reject model.
How does a PLC calculate line speed and cycle time?
From the time between bottles. If a bottle passes every 1.2 s, the line runs at 3,000 bottles per hour. The PLC measures that time on each pulse and averages it, for the current speed and for the lot. See a production pulse counter on an ESP32 PLC, and try the same counts, speed and stops in the machine monitor simulator.
Can the PLC serve a web page to the operators?
Yes. At Bodegas Care a web page programmed inside the PLC shows live data and lets operators set targets and log stoppages from any PC on the company network, with no touchscreen and no external software. Keep it on the internal network. See a web server with OTA updates on an ESP32 PLC.
How do production data reach Google Sheets?
The PLC sends one row per lot over the internet, with the date, the product and the quantity, and the sheet keeps the history with no extra server. A typical way is an HTTPS request to a small script published from the sheet. Keep the rows in the PLC until they are sent, so a network loss does not lose a lot: see MQTT datalogging with an offline buffer on SD.
How does a second counter prevent overproduction?
It counts the bottles that enter the line for a lot. When the count reaches the target set on the web page, the PLC knows the lot is complete and the labelling stays exact. Keep the counters in non-volatile memory so a restart does not lose them: see persistent counters on an ESP32 PLC.
Does the same design work on a faster line?
At 3,000 bottles per hour a bottle passes every 1.2 s, well within what an optoisolated input reads. For faster lines, the ESP32 PLC 21 FLEX has two inputs with interrupt. The story does not publish other line speeds.
Download the success story
4-page PDF with the challenge, the logic, the architecture and the hardware. No form required.
Similar project?
Tell us about your line. An engineer will answer.
Tell us what your line makes, how fast it runs, what you want to detect or count, and where the data must go. We will tell you which controller and which signals fit.
- You get an answer from our technical team
- Sensors, counters, rejects and reports
- Arduino, ESP32 or Raspberry Pi based PLCs