Case study · Animal feeding · M-Duino 19R+
Weigh every feeder. Dose the right ration.
Load cells, an M-Duino 19R+ and a Panel PC with MQTT and Node-RED.
The load cell knows how much food is left.
The PLC decides what to add, and when.
This case describes the design of an automatic feeding system for cattle, farms, horse stables, poultry and more. It does not name a customer or a farm, and it is a pattern you can adapt. This page is about the feeding line: weigh, dose, distribute, clean and report. Barn climate and ventilation are not part of this case.
The challenge
The right food, in the right amount, at the right time.
The goal is a feeding system that a PLC controls. It tracks the food to set the periods, the quantities and the kinds of food. The animal carers give the orders (kind of food, temperature and more), and the system dispenses the correct amount. The data must be visible on a panel and, if needed, from anywhere through a VPN.
A ration for each batch
Set the periods, the quantities and the kind of food. Adapt the ration to different batches of animals.
Food levels, 24/7
Every feeder has a load cell. The PLC knows how much food is left, all day and all night.
Food, water and medicines
Food, medicines and cleaning liquids are stored in tanks. The system gives the right amount of food, and medicines when they are needed.
Feed and straw move differently
Feed moves well in a gravity pipe. Straw moves better with a piston. The system uses the right one for each kind of food.
Clean the line after feeding
An evacuation section removes the food that is left. Then the system distributes the cleaning products you select, and they leave through a drain.
How it works
Three loops: weigh, dose, then clean and report.
Each loop shows one part of the pattern. Move the sliders and press the buttons. The panels are illustrative simulations: weights, rations, levels, steps and topics are examples, not data from a farm.
A load cell in each feeder sends the food weight.
Each feeder has a load cell. It sends the weight of the food to the PLC, where the data is processed. In the scheme of the case, the load cell goes to an analog input. The PLC compares the weight with the levels set by the carers. A typical way to do it: when a feeder goes under a refill level, the PLC asks for a new dose. In the panel, change how many animals eat.
- Load cell in every feeder, on an analog input
- Food and state levels for each feeder
- Data for the consumption of each batch
Illustrative simulation. Example values, no data from a farm. Example: feeders of 20 kg, refill level 5 kg. The PLC refills a feeder up to 18 kg.
A gate opens, the food moves, the load cell sends the weight.
When the parameters are set, the distribution starts. The tanks give the exact amount through an automated gate. A gravity pipe or a piston moves the food to the animals, depending on the kind of food. In the scheme, both the tanks and the distribution system are on digital outputs of the PLC. Choose a kind of food and a ration, then press Dispense.
- Automated gate on the tanks, on a digital output
- Gravity pipe for feed, piston for straw
- Medicines in the ration when they are needed
Kind of food
Dosing log (example)
Illustrative simulation. Example values, no data from a farm. Example rule: the gate stays open until the load cell of the feeder sees the ration, then it closes.
The line is cleaned, and the data goes to the panel.
An evacuation section removes the food that is left, with pipes or pistons. The cleaning products go through the system and leave through a drain. All the data goes to the Panel PC: an MQTT broker on the Panel PC sends and receives the data, and Node-RED shows it. Through a VPN connected to the MQTT server, you can see it from anywhere. Start a cleaning cycle and open the remote view.
- Evacuation of the remaining food
- Cleaning products and a drain
- MQTT broker and Node-RED on the Panel PC, remote access through a VPN
MQTT messages on the Panel PC (example)
Illustrative simulation. Example values, no data from a farm. Example topics. The case does not publish the topic names or the order of the cleaning steps.
Example: MQTT status LEDs on a Node-RED touchscreen dashboard
System architecture
How does a PLC automate animal feeding?
Load cells in the feeders send the food weight to an analog input of the M-Duino 19R+. With this weight and the parameters of the carers, the PLC uses digital outputs to open the gate of the tanks and to run the pipe or piston system. A Panel PC on Ethernet holds the MQTT broker and Node-RED. A VPN gives remote access.
| Signal | Between | Type | Purpose |
|---|---|---|---|
| Food weight | BetweenLoad cell in each feeder → M-Duino 19R+ | TypeAnalog in | PurposeFood and state levels of each feeder. Signal conditioning not published |
| Dose gate | BetweenM-Duino 19R+ → food and water tanks | TypeDigital out | PurposeThe automated gate gives the exact amount from the tanks |
| Distribution | BetweenM-Duino 19R+ → pipe or piston system | TypeDigital out | PurposeMoves the ration to the animals: gravity pipe for feed, piston for straw |
| Evacuation and cleaning | BetweenM-Duino 19R+ → evacuation section, cleaning products, drain | TypeNot published | PurposeRemoves the food that is left and cleans the line |
| Data and parameters | BetweenM-Duino 19R+ ↔ Panel PC | TypeEthernet, MQTT | PurposeThe broker on the Panel PC sends and receives the data. Node-RED shows it |
| Remote access | BetweenRemote user ↔ MQTT server | TypeVPN | PurposeSee the information from anywhere |
Why it works
One pattern for a feeding line.
Dose by weight
The load cell measures what is in the feeder. The PLC knows how much food the animals ate, and how much to add.
One system for food, medicines and cleaning
Food, water, medicines and cleaning liquids are stored in tanks and go out through the distribution system. You set all of them from the panel.
The right transport for each food
A gravity pipe for feed, a piston for straw. Digital outputs of the PLC run either one.
Open data path
MQTT between the PLC and the Panel PC, and Node-RED on top. You can read the data, keep it and analyse it for continuous improvement.
Relays in the controller
The M-Duino 19R+ has 8 relay outputs and 3 analog/PWM outputs. It can switch gate actuators, pumps or motors through the right contactors.
Remote, with a VPN
The panel can be fixed or remote. A VPN to the MQTT server gives access from anywhere, without opening the broker to the internet.
Hardware used
M-Duino 19R+ to control. Panel PC to see and set.
M-Duino Ethernet PLC Arduino 19R
An industrial PLC built on an original Arduino Mega 2560, with 17 I/O, 8 relays, Ethernet and RS-485, for DIN rail. In the feeding line it reads the load cells, opens the gates, runs the distribution and sends the data to the Panel PC.
- Role
- Load cells, dose gates, distribution, data to the Panel PC
- Inputs
- 6: 4 analog/
digital (0-10 V), 2 digital optoisolated with interrupt - Outputs
- 11: 8 relays, 3 analog/
digital/ PWM (0-10 V) - Comms
- Ethernet (W5500), 2 x RS-485, RS-232, TTL, I2C, SPI
- Extras
- Real-time clock, microSD slot
- Power and mounting
- 12 to 24 Vdc, DIN rail TS35, IP20
The original case names the M-Duino 19R. It is this product, reference IS.MDuino.19R+.
TouchBerry Pi Panel PC 10.1"
The panel of the feeding line. An industrial Panel PC with a Raspberry Pi, Linux and a touch screen. It holds the MQTT broker and the Node-RED dashboard, and the carers set the parameters on it.
- Role
- MQTT broker, Node-RED, parameters, monitoring
- Screen
- 10.1", 1280 x 800, capacitive touch
- Computer
- Raspberry Pi 4, Linux preinstalled
- Link to the PLC
- Gigabit Ethernet
- Reliability
- UPS with supercapacitors for a safe shutdown
The case says "a Panel PC based on Raspberry Pi" and does not publish the exact model. The image and the link show the current TouchBerry Pi Panel PC 10.1" FLEX.
Questions about this case
How do you automate animal feeding with a PLC?
Put a load cell in each feeder, so the PLC knows how much food is left. Store the food in tanks with an automated gate, and move it with a gravity pipe or a piston. The PLC opens the gate and runs the transport until the feeder has the ration that the carers set. A Panel PC shows the levels and lets the carers change the parameters.
How do you connect a load cell to a PLC?
A load cell gives a very small signal, in millivolts. You need a load cell transmitter (amplifier) between the cell and the PLC. A common choice is a transmitter with a 0-10 V or 4-20 mA output to an analog input. In this case the scheme shows the load cell on an analog input. Another option is an HX711 module on digital pins: see how to connect a load cell with an HX711 to an Arduino based PLC. The M-Duino 19R+ has 4 analog inputs (0-10 V). For more feeders, add a PLC with more inputs or use weighing transmitters on RS-485.
Why an MQTT broker and Node-RED on the Panel PC?
In this case the MQTT broker runs on the Panel PC. It sends and receives the data between the PLC and the Panel PC, and Node-RED shows the data on a dashboard. The PLC publishes the weights and states, and the panel publishes the parameters. See the MQTT client library for Arduino based PLCs and a Node-RED touchscreen dashboard with MQTT on a TouchBerry Pi.
How can I see the feeding data from outside the farm?
The case uses a VPN connected to the MQTT server. With a VPN, the broker stays inside the farm network and is not open to the internet. Also use a user and a password on the broker, and TLS if the data leaves the VPN.
Gravity pipe or piston: which one moves the food?
It depends on the food. In this case, feed moves well with a gravity pipe system and straw moves better with a piston system. The evacuation section uses pipes or pistons too. The PLC runs either one from its outputs.
Which parts of this case are facts, and which are examples?
Facts: a load cell in each feeder on an analog input, an Arduino based PLC (M-Duino 19R) with digital outputs to the tanks and to the pipe or piston system, an automated gate on the tanks, medicines and cleaning liquids in tanks, an evacuation section and a drain, a Panel PC based on Raspberry Pi on Ethernet with an MQTT broker and Node-RED, and remote access through a VPN. Examples: feeder sizes, refill levels, rations, the number of feeders, the MQTT topics and the order of the cleaning steps.
Download the case study
4-page PDF with the challenge, the logic, the architecture and the hardware. No form required.
Similar farm?
Tell us your animals and your feeders. An engineer will answer.
Tell us how many feeders you have, the kinds of food (feed, straw, water, medicines), how the food moves today and what the carers need to see. We will tell you which controller fits and how to read the load cells.
- You get an answer from our technical team
- I/O count and controller sizing for your feeding line
- Arduino, ESP32 or Raspberry Pi based PLCs