Skip to Content
All case studies

Case study · Smart city · ESP32 PLC

Compact in the street. Empty it only when it is full.

A solar compacting litter bin run by one ESP32 PLC: press, safety, weight, battery and alerts.

7requirements in the brief of the customer
1ESP32 PLC for the press, the sensors and the alerts
0press strokes allowed with the emptying door open
4Gboard on today's ESP32 PLC 21 FLEX, in place of GPRS

A bin in the street has no operator next to it.

So the PLC compacts, counts, weighs and watches the battery, and tells the control centre when to come.

This case comes from a real project of an Industrial Shields customer, documented in 2023. The customer is not named. The goals, the sensors, the press, the solar roof, the LED, the flap and the photos come from the original case. Thresholds, times, weights, battery values, messages and routes on this page are examples of a typical way to do it.

From the project

The real bin, inside.

Photos from the original case: the control cabinet, the press, the flap and the status panel.

Control cabinet under the lid of the compacting litter bin, with an Industrial Shields ESP32 PLC, contactors, breakers and a battery
The cabinet under the lid: the Industrial Shields ESP32 PLC with contactors, breakers and a battery.
Press of the compacting litter bin over the trolley, and the stainless steel flap with its handle under the status panel
Left: the press over the trolley. Right: the stainless steel flap with its handle, under the status panel.
Status panel of the compacting litter bin with a green bin pictogram and the word OK
The status panel shows OK when the bin can be used. With an incident, the LED shows that the bin is not available and the flap is blocked.

The challenge

A machine in the street, on its own.

Waste management is one of the challenges that cities work on. The customer's project is a solar compacting litter bin for the street, a solution that is already spreading in some countries. In the street it faces intensive use and the risk of vandalism, so the bin is made entirely of metal. Inside there is a press and a trolley with wheels to make emptying easier, and a solar roof keeps it running on its own.

01

Compact at the right time

Capacity control: a presence sensor tells the PLC when the waste is high enough to start a compaction cycle.

02

Never press with the door open

The press must stop when the emptying door is open, to avoid accidents when the operator handles the trolley.

03

Count, weigh, measure

The system counts the compactions, weighs the waste and monitors the state of the batteries and their total charge.

04

Tell the control centre

Warnings, incidents and alarms go out by wireless remote communication, so an operator comes to empty the bin when it is needed.

Open, or clearly closed

When there is no incident, people can use the bin at will. Otherwise, the LED shows that the bin is not available and the waste flap is blocked.

How it works

Three parts of one program: press, power, alerts.

Each part shows one job of the PLC. Press the buttons. The panels are illustrative simulations: levels, times, weights, battery values and messages are examples, not data from the real bin.

Part 1 · Compact

The sensor sees the waste. The press does the rest.

When the presence sensor detects that a compaction cycle is needed, the PLC runs the press down and back up and adds one to the compaction counter. In this example it also blocks the flap during the stroke. If the emptying door opens, the press stops at once and the LED shows that the bin is not available. Throw some bags, then open the door during a stroke.

  • The presence sensor starts the cycle
  • The door switch stops the press
  • Flap blocked and LED during an incident
OKCompactions0sensor
Waste level·
Compactions·
Press·
Bin·
WASTE AT SENSORFLAP BLOCKEDPRESS MOVINGCOUNT +1DOOR OPENFULL: EMPTY ME

PLC events (example)

  • Throw a bag to fill the bin.

Illustrative simulation. Example values, no data from the real bin. A typical way: stroke switches on the press, and a door switch that also cuts the press power through a safety relay, because a door interlock should not depend on the program alone. The case does not publish the press drive, the stroke time or the compaction ratio.

Part 2 · Power and weight

The sun charges, the press spends, the PLC keeps the count.

The solar roof charges the batteries, and the press is the big consumer. The PLC monitors the battery and weighs the waste. A typical way: the battery voltage and a load cell on analog inputs, and if the charge gets too low, the PLC blocks the bin before a stroke can stop halfway and sends a warning. Change the weather and the traffic of the street.

  • Battery voltage on an analog input
  • A load cell transmitter for the weight
  • Low charge blocks the bin and sends a warning
warning 40 %block 25 %1000last 72 h
Battery charge·
Solar today·
Press today·
Waste weighed today·
CHARGINGPRESS CYCLELOW CHARGE WARNINGBIN BLOCKED

Power events (example)

    Illustrative simulation. Example values, no data from the real bin. Example values: a 600 Wh battery, 4 W for the PLC and the sensors, 6 Wh per press cycle and 3 kg of waste weighed per cycle. Warning at 40 %, block at 25 %, back in service at 45 %. The case does not publish the battery, the panel or the press power. Time runs fast: one second is one hour.

    Part 3 · Alerts and routes

    Only the bins that need it get a visit.

    Each bin sends its events over the mobile network: full, door open, low battery. In the control centre, the messages become a list of bins to empty and a route. Pick a day, then add an incident.

    • Events, not a constant stream
    • One message per warning, incident or alarm
    • Fill and weight per bin for the route
    empty at 80 %B1B2B3B4B5B6B7B8
    Bins to empty·
    Waste to collect·
    Open incidents·
    Messages today·
    FILL REPORTSINCIDENTROUTE READY

    Messages to the control centre (example)

      Illustrative simulation. Example values, no data from the real bin. Example data for 8 bins, not from a real city. A typical way: each bin sends an event when it changes state, and a short daily report with fill, compactions and weight. The control centre visits the bins above 80 % and the bins with an incident.

      System architecture

      How does a PLC control a solar compacting litter bin?

      An ESP32 PLC 21 FLEX with a 4G board reads the presence sensor, the door, the press position, the weight and the battery. It drives the press through contactors, sets the LED and, in a typical way, blocks the flap. Warnings, incidents and alarms go to the control centre over the mobile network. The solar roof charges the battery that powers the PLC and the press.

      Presence sensorcompaction heightDoor switchemptying doorStroke switchespress up and down, typical wayLoad cell transmittertrolley weight, typical wayBattery voltagestate and chargeESP32 PLC 21FLEX · 4G board · programContactorspress motorFlap lock and LEDavailable or blockedMobile network4G (GPRS in the case)Control centrewarnings, alarms, routesSolar roofcharges the batteryBatterypowers PLC and pressOne possible layout. The case names the presence sensor, the press, the door, the weight, the batteries, the LED, the flap and the remote link. The rest is a typical way.Presence sensorDigital in · compaction heightDoor switchDigital in · emptying doorStroke switchesDigital in · typical wayLoad cell transmitterAnalog in · trolley weightBattery voltageAnalog in · state and chargeESP32 PLC 21FLEX · 4G board · programContactorsDigital out · press motorFlap lock and LEDDigital out · available or blockedMobile network4G (GPRS in the case)Control centrewarnings, alarms, routesSolar roof + batterypowers PLC and pressOne possible layout. The case names the sensor,press, door, weight, batteries, LED, flap andremote link. The rest is a typical way.
      Inputs to the PLCOutputs and safetyPowerMobile network
      Signals
      SignalBetweenTypePurpose
      Waste at compaction heightBetweenPresence sensor → ESP32 PLC 21TypeDigital inPurposeStarts the compaction cycle
      Emptying door openBetweenDoor switch → PLC (and safety relay, typical way)TypeDigital inPurposeStops the press and blocks the bin
      Press up, press downBetweenStroke switches → PLC (typical way)TypeDigital inPurposeEnds each stroke
      Press motorBetweenPLC → contactorsTypeDigital outPurposeMoves the press down and up
      Flap lock and LEDBetweenPLC → lock and status panelTypeDigital outPurposeBin available or blocked
      Weight of the wasteBetweenLoad cell transmitter → PLC (typical way)TypeAnalog inPurposeKilograms in the trolley
      Battery voltageBetweenBattery → divider → PLC (typical way)TypeAnalog inPurposeState and charge of the battery
      Warnings, incidents, alarmsBetweenPLC → control centreType4GPurposeEmpty, check or repair the bin

      Why it works

      One controller for a whole street machine.

      Sensors decide, not the calendar

      The press runs when the presence sensor sees waste at the compaction height, and the operator comes when the bin reports that it is full.

      Safety before the cycle

      The door switch stops the press and blocks the bin. A typical way adds a safety relay, so the interlock does not depend on the program alone.

      Clear state for the public

      The LED and the blocked flap tell people at once that the bin is not available. Nobody forces a full or open bin.

      Power managed by the PLC

      The PLC monitors the battery state and its total charge, as the case asks. A typical way uses that value to block the bin in time and send a warning.

      Data for the routes

      Compactions, weight and fill per bin let the control centre plan visits. The case says it means fewer trips and more efficient routes.

      Open and modular

      The customer chose an open controller with no licence fees, programmed with the Arduino IDE. More sensors or Smart City functions are changes in the same program.

      Hardware

      One ESP32 PLC with a 4G board inside the bin.

      ESP32 PLC 21 FLEX, industrial controller based on ESP32 with 13 inputs, 8 outputs and an optional 4G board, for DIN rail

      ESP32 PLC 21 FLEX

      An industrial controller built on the dual-core ESP32, for DIN rail, programmed with the Arduino IDE. The FLEX version takes one communication board: here, 4G (M1)-NB1 IoT LTE, for the alerts to the control centre. In this case it runs the press, reads the sensors, the weight and the battery, and sends the warnings.

      Role
      Press, interlocks, counts, weight, battery and alerts
      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)
      Option board
      One: 4G (M1)-NB1 IoT LTE (Ublox), LoRa or CAN
      Communications
      Ethernet, Wi-Fi, Bluetooth LE, RS-485, RS-232
      Clock
      DS3231 real-time clock with backup battery
      Programming
      Arduino IDE
      Power supply
      12 to 24 Vdc
      Mounting
      DIN rail TS35, IP20, inside a cabinet

      The case used an ESP32 PLC with GPRS and does not publish the exact model. GPRS runs on 2G networks, which some operators have already switched off. Today, the equivalent is the ESP32 PLC 21 FLEX with the 4G (M1)-NB1 IoT LTE (Ublox) board, for LTE-M and NB-IoT networks. A typical I/O budget for this bin: 5 of the 7 isolated digital inputs (presence sensor, door switch, two stroke switches, flap closed), 2 of the 6 analog inputs (weight and battery), and 4 of the 8 outputs (press down, press up, flap lock, LED). The outputs are transistor outputs, so the press motor switches through contactors, as in the cabinet photo. The PLC goes in a cabinet (IP20, no condensation) inside the metal body of the bin.

      Questions about this case

      How does a compacting litter bin know when to compact?

      A presence sensor looks across the chamber at the compaction height. When the waste reaches it, the PLC runs the press down and back up and counts one compaction. A typical way also blocks the flap during the stroke. On this page, an ESP32 PLC 21 FLEX does it with stroke switches to end each stroke, as a typical way. The case does not publish the sensor model or the stroke time.

      How do you stop the press when the emptying door is open?

      Wire a door switch to a digital input, so the program stops the press and blocks the bin as soon as the door opens. For the safety function, a typical way is a safety rated door switch and a safety relay that also cuts the power of the press, so the interlock does not depend on the program alone. ISO 14119 covers interlocking devices on guards, and ISO 13849-1 sets the performance level of the safety function.

      Can a solar compacting bin run on its battery all year?

      Only if the solar roof and the battery are sized for the worst month at that site and for the traffic of the street. The press is the big consumer. A typical way: the PLC measures the battery voltage, sends a warning at a low charge and blocks the bin before a stroke can stop halfway. The case does not publish the battery, the panel or the press power; the values in the panel are examples.

      GPRS or 4G for a new smart bin?

      The original case, published in 2023, used GPRS. GPRS runs on 2G networks, and some operators have switched them off or plan to. For a new project, check the coverage and the 2G end dates in your city. LTE-M and NB-IoT are made for devices that send little data and need little power, which fits a bin that sends events. The ESP32 PLC 21 FLEX takes a 4G (M1)-NB1 IoT LTE board.

      What data should a smart bin send to the control centre?

      Events when the state changes: full, door open, low battery, a fault. A typical way adds a short daily report with the fill, the compaction count and the weight. Keep the counters in non-volatile memory, so a restart does not lose them: see persistent counters on an ESP32 PLC. A machine with no one next to it also benefits from a hardware watchdog.

      How do fill alerts make collection routes more efficient?

      The operators visit the bins that report full or an incident, not every bin on a fixed round. The case says that this reduces the trips and the costs of operators and vehicles, and lets the operators organise their time. It does not publish figures. Compaction adds to it: the same trolley holds more waste before it is full.

      Download the case study

      4-page PDF with the challenge, the logic, the architecture and the hardware. No form required.

      Similar project?

      Tell us about your machine. An engineer will answer.

      Tell us what your machine does, which sensors and actuators it has, how it is powered and where the alerts must go. We will tell you which controller and which link fit, and how to wire the safety part.

      • You get an answer from our technical team
      • I/O count, safety wiring and the mobile link
      • Arduino, ESP32 or Raspberry Pi based PLCs