Load Cell

Automatic Bottle‑Filling Machine Using Arduino: A Step‑by‑Step Guide to Build, Program & Optimize Your DIY Bottling System

Whisk_1921b11fbfd725ca8b24ccb009910c2feg


Introduction

automatic bottle filling machine using Arduino – if you’ve ever struggled with inconsistent fill levels, time‑draining manual bottling, or costly commercial equipment that doesn’t fit a small‑batch operation, you’re not alone. Australian makers, OEM integrators, and lab technicians are turning to DIY automation to gain precise control, reduce waste, and accelerate productivity without breaking the bank. In this guide we break down every mechanical, electrical, and software element you need to create a reliable, repeatable bottling line that delivers ±0.5 % accuracy on a 1 L liquid fill, while also showing how a high‑quality load cell from LoadCellShop Australia can be the keystone of measurement‑driven control.


What Is an Automatic Bottle Filling Machine Using Arduino?

An automatic bottle filling machine using Arduino is a compact, programmable system that measures the weight of each bottle, controls a pump or valve to dispense a target volume, and repeats the cycle with minimal human intervention. The Arduino microcontroller acts as the brain, interpreting signals from a load cell (or alternative level sensor), driving stepper motors or solenoids, and applying a PID (Proportional‑Integral‑Derivative) algorithm to keep each fill within tight tolerance.

  • Why weight‑based control? Because mass is a direct proxy for volume when the fluid density is known, eliminating the need for expensive flow meters.
  • Why Arduino? Its open‑source ecosystem, abundant libraries (HX711, AccelStepper, PID_v1), and low entry cost make it ideal for prototypes and small‑scale production.

The result is a DIY bottling system that can be deployed on a tabletop for craft breweries, cosmetics labs, or food‑grade packaging lines, and later scaled up with industrial‑grade components.


Core Components & How They Work Together

ComponentTypical Part #Role in the SystemKey Spec to Watch
Arduino Mega 2560ATmega2560‑R3Central processor, runs the control loop≥ 54 digital I/Os, 16 MHz
Load Cell (S‑type)LS‑500 kg‑S‑RMeasures bottle weight in real time0–500 kg, 0.03 % FS accuracy
HX711 AmplifierHX711‑MODConditions the millivolt signal from the load cell24‑bit resolution
Peristaltic Pump (or Diaphragm)P‑12‑V‑1LDelivers liquid at controlled flow rate1–5 L/min, chemical‑compatible
Stepper Motor + DriverNEMA‑17 + DRV8825Drives the pump or rotary valve1.5 A/phase, 200 steps/rev
Solenoid Valve (4‑wire)SV‑12‑V‑0.5Provides fast on/off of fluid stream (optional)12 V, 0.5 mm orifice
Fluid Level Sensor (optional)FS‑ULS‑10Provides redundancy, detects empty reservoirUltrasonic, 10 cm range
Power Supply12 V/5 A (DC)Powers motors, valve, and Arduino (via regulator)Ripple < 50 mV
Enclosure & FrameAluminum extrusionHolds bottles, guides motion, isolates vibration2020 profile, 25 mm slots

How It All Interacts

  1. Zeroing: When a clean, empty bottle is placed on the load cell, the Arduino reads the baseline (tare).
  2. Filling: The pump starts, and the load cell weight is sampled at ~10 Hz.
  3. Control Loop: The PID routine compares the real‑time weight to the target (e.g., 1000 g). If the weight is below target, the pump stays on; once the target is reached, the pump stops instantly.
  4. Verification: A second reading 0.5 s later confirms stability, then the system moves the bottle to the discharge position.
  5. Repeat: The cycle restarts for the next bottle.

Because the control loop is weight‑based, variations in fluid density (e.g., temperature‑induced viscosity changes) are automatically compensated – a major advantage over timing‑based or flow‑meter‑only solutions.


Step‑by‑Step Build Guide

Below is a concise, numbered checklist that takes you from raw parts to a fully functional prototype.

  1. Design the Mechanical Frame

    • Sketch the layout (bottle rack, weighing platform, pump mount).
    • Cut aluminum extrusions to size, drill mounting holes, and assemble with T‑nuts.
    • Install a vibration‑absorbing rubber pad beneath the load cell to isolate motor noise.

  2. Mount the Load Cell

    • Attach the S‑type LS‑500 kg‑S‑R (see product table later) to the platform with the provided stainless‑steel clamps.
    • Ensure the load cell’s tension arms are vertical; misalignment introduces shear errors.

  3. Wire the HX711 Amplifier

    • Connect the load cell’s four wires (red‑+Exc, black‑‑Exc, white‑+Signal, green‑‑Signal) to the HX711 board.
    • Use shielded cable and keep the wires away from high‑current motor leads to avoid EMI.

  4. Integrate the Pump & Motor

    • Attach the peristaltic pump to a NEMA‑17 stepper motor via a flexible coupling.
    • Secure the motor to the frame with a vibration‑damping mount.
    • Connect motor driver (DRV8825) to Arduino digital pins (STEP, DIR) and supply with the 12 V rail.

  5. Add the Solenoid Valve (optional)

    • Wire the 12 V valve to a MOSFET driver circuit commanded by a digital output pin.
    • Use a flyback diode across the valve coil to protect the Arduino.

  6. Set Up Power Distribution

    • Feed the 12 V rail from a regulated PSU into a distribution board.
    • Include a 5 V regulator (e.g., LM2596) for the Arduino and HX711.

  7. Upload the Firmware

    • Open the Arduino IDE, install libraries: HX711.h, AccelStepper.h, PID_v1.h.
    • Load the provided “BottleFiller.ino” sketch (see code snippet later).

  8. Calibrate the Load Cell

    • Place a known weight (e.g., 500 g calibration mass).
    • Run the calibrateLoadCell() routine to compute the scale factor and offset.

  9. Test the Full Cycle

    • Position an empty bottle, press “Start” on the UI (serial monitor or LCD).
    • Verify that the pump stops exactly at the target weight; adjust PID gains if overshoot occurs.

  10. Fine‑Tune & Harden

    • Add a Debounce filter (moving average) to the weight readings.
    • Enclose the electronics in a sealed IP‑65 box if operating in a wet environment.

Tip: Record all calibration data in a CSV file; this aids traceability for QA teams and simplifies future re‑calibration after maintenance.


Sample Arduino Sketch (Core Logic)

cpp

// Pin assignments
const int LOADCELL_DOUT = 3;
const int LOADCELL_SCK = 2;
const int STEP_PIN = 4;
const int DIR_PIN = 5;

// Load cell
HX711 scale;
float calibration_factor = -7050; // to be set during calibration

// Stepper motor (pump)
AccelStepper pump(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
float pumpSpeed = 200; // steps per second

// PID parameters
double Setpoint, Input, Output;
double Kp = 2.0, Ki = 5.0, Kd = 1.0;
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);

void setup() {
Serial.begin(115200);
scale.begin(LOADCELL_DOUT, LOADCELL_SCK);
scale.set_scale(calibration_factor);
scale.tare(); // zero the scale
pump.setMaxSpeed(1000);
pump.setAcceleration(500);
Setpoint = 1000.0; // target weight in grams
myPID.SetMode(AUTOMATIC);
myPID.SetOutputLimits(0, 255); // PWM range for pump driver
}

void loop() {
Input = scale.get_units(5); // average of 5 readings
myPID.Compute();

// PWM to pump driver (via MOSFET)
analogWrite(9, Output);

// Optionally stop pump when within ±0.5 g
if (abs(Input – Setpoint) < 0.5) {
analogWrite(9, 0);
Serial.println(“Fill complete”);
delay(2000); // pause before next bottle
scale.tare(); // reset for next bottle
}
}

This skeleton demonstrates the essential flow; a production system would incorporate LCD status screens, safety interlocks, and data logging.


Programming the Automatic Bottle Filling Machine Using Arduino – From Bare Bones to PID Control

1. Library Overview

LibraryPurposeTypical Functions
HX711.hAmplify and read load cell datascale.get_units(), scale.set_scale()
AccelStepper.hPrecise motor control (optional if using pump)setSpeed(), run()
PID_v1.hCompute corrective output for stable fillsCompute(), SetTunings()

2. Setting PID Gains

  • Proportional (Kp): Reacts to current error. Start with 2.0.
  • Integral (Ki): Corrects steady‑state offset; increase gradually (e.g., 5.0).
  • Derivative (Kd): Dampens overshoot; typical 1.0.

Use the Ziegler‑Nichols method: set Ki and Kd to 0, increase Kp until the system oscillates, record that Kp (Ku) and the oscillation period (Pu). Then set:

Kp = 0.6 Ku
Ki = 2
Kp / Pu
Kd = Kp * Pu / 8

3. Implementing Safety Checks

  • Weight Limits: Abort fill if measured weight exceeds 1.2 × target (possible over‑pour).
  • Temperature Compensation: Read a DS18B20 sensor; if fluid temperature drifts > 5 °C, adjust target mass using density tables.

4. Data Logging

Attach an SD card module and log:

Timestamp, BottleID, Target(g), Actual(g), FillTime(ms), Status

This log is invaluable for QA auditors and for optimizing cycle time.


Calibration & Accuracy – Getting Reliable Measurements

A load cell is the heart of a weight‑controlled filler. Even the best sensor can deliver poor results if calibration is neglected.

4.1 Zero‑Balance (Tare)

  • Place the empty bottle on the platform.
  • Call scale.tare() to subtract the bottle’s own weight (tare).
  • Record the tare value for traceability; it should be repeatable within ±0.2 g.

4.2 Span Calibration

  • Use certified calibration masses (e.g., 250 g, 500 g, 1000 g).
  • Run scale.set_scale() with the known mass to compute the scale factor.

4.3 Temperature & Drift Compensation

  • Most S‑type load cells have a temperature coefficient of ±0.02 %/°C.
  • Install a temperature sensor near the cell and apply a linear correction factor in software.

4.4 Validation

Run a 20‑bottle test batch. Record the fill error distribution; a well‑tuned system should show a standard deviation ≤ 0.3 % of the target weight.


Common Pitfalls – Where Buyers Go Wrong, Cheaper Options Fail, When NOT to Use Certain Products

5.1 Selecting the Wrong Sensor

MistakeWhy It FailsBetter Choice
Using a low‑cost kitchen scale sensor (≤ 5 kg) for 1 L water (≈ 1 kg)Limited range + high non‑linearity → large error at low loadsS‑type load cell 0–5 kg or compression cell 0–2 kg from LoadCellShop
Choosing a strain‑gauge load cell without temperature compensation for hot liquidsDrift > 2 % after 30 min of operationHygienic stainless‑steel load cell with TC
Relying on a flow meter alone for viscous fluidsViscosity changes cause flow‑rate errorsCombine flow meter with weight feedback

5.2 Over‑Simplifying the Power Design

  • Cheaper 12 V linear regulators may overheat driving stepper motors, causing voltage sag that corrupts HX711 readings.
  • Solution: Use a switch‑mode buck converter (≥ 5 A) and keep motor supply isolated from the load‑cell board with a proper ground‑star topology.

5.3 Ignoring Mechanical Isolation

  • Mounting the pump directly on the weighing platform introduces dynamic forces, causing the load cell to read “noise spikes” and stop the pump prematurely.
  • Mitigation: Install a flexible coupling and a vibration‑damping plate between pump and frame.

5.4 When NOT to Use a Load Cell

SituationReason to Avoid Load CellAlternative
High‑speed bottling (> 150 bpm) where the fill time is < 0.2 sWeight measurement lag (HX711 sampling) limits controlHigh‑frequency flow meters with PID on flow rate
Extremely corrosive liquids (e.g., strong acids)Even stainless‑steel cells can degradeCorrosion‑resistant ultrasonic level sensor with closed‑loop pump
Very low fill volumes (< 10 ml)Load cell resolution may be insufficientPrecision syringe pump with linear encoder


Selecting the Right Load Cell – A Practical Guide

A quality load cell provides the precision needed for weight‑based filling. Below are three models we recommend for common Australian bottling scenarios.

Load Cell Comparison Table

Model (SKU)CapacityAccuracy Class*MaterialTypical ApplicationApprox. Price (AUD)
LS‑500 kg‑S‑R0–500 kg0.03 % FS316 SS (food‑grade)Large‑volume juice, detergent bottling$398
LC‑2 kg‑COMP0–2 kg0.02 % FS304 SSSmall‑volume cosmetics, lab reagents$185
HC‑10 kg‑SHEAR0–10 kg0.05 % FS304 SS (with epoxy coating)Beer/keg fill stations, water dispensers$240
LC‑20 kg‑HX0–20 kg0.03 % FS304 SS (hygienic)Multi‑product dairy filler$275
LS‑1 t‑COMPR0–1000 kg0.04 % FS316 SS (marine grade)Industrial bulk tanker fill$620

*FS = Full Scale

Why These Models Are Suitable

ProductWhen It’s PerfectWhen It’s NOT IdealBetter Alternative
LS‑500 kg‑S‑RFilling 5–20 L bottles of juice, where a high capacity and robust stainless steel body are required.Low‑volume (≤ 100 ml) applications – the resolution drops below 0.5 g.Use LC‑2 kg‑COMP for better resolution at low loads.
LC‑2 kg‑COMPPrecision cosmetic or pharmaceutical bottling (10–100 ml). The compact size and high accuracy keep fill error < 0.2 %.Heavy liquids (≥ 5 kg per bottle) – will overload the sensor.Switch to LS‑500 kg‑S‑R for higher capacity.
HC‑10 kg‑SHEARMid‑range beer bottling (0.33–0.5 L) where shear‑beam design resists off‑axis loads from the bottle’s weight.Extremely corrosive acids – shear‑beam cells may need extra coating.Choose LS‑1 t‑COMPR with specialized coating.
LC‑20 kg‑HXMulti‑product dairy filler, where rapid changeover between milk, yoghurt, and cream occurs.Very low‑mass syrups (≤ 0.5 kg total) – you’ll lose resolution.Opt for LC‑2 kg‑COMP.
LS‑1 t‑COMPRBulk industrial tank filling (up to 1000 kg per container).Small‑batch lab work – over‑spec and expensive.Use any of the sub‑20 kg options.

All models are stocked by LoadCellShop Australia, and custom load cells can be fabricated on request (e.g., special mounting holes or OEM branding). Our engineering team offers free consultation to match you with the perfect sensor, and we provide a 5 % bulk‑order discount for purchases of 5 units or more.

Pro tip: Pair any load cell with the HX711 amplifier board (also available at LoadCellShop) for a 24‑bit readout, ensuring the tight tolerance required for a automatic bottle filling machine using Arduino.


Installation & Maintenance Best Practices

  1. Mounting Orientation – Load cells must experience pure tension/compression. Avoid cantilever setups that introduce shear.
  2. Cable Management – Use twisted‑pair shielded cables, route them away from motor leads, and secure with cable ties to prevent vibration‑induced micro‑movement.
  3. Periodic Re‑Calibration – Perform a tare and span check after any mechanical shock or after 500 fill cycles.
  4. Cleaning Protocol – For food‑grade cells, wash the platform with a mild sanitizer; never submerge the sensor itself.
  5. Safety Interlocks – Include a limit switch that stops the pump if the bottle is removed prematurely, preventing splashing and motor stall.


Scaling Up – From Prototype to Production

Once the prototype demonstrates consistent ±0.5 % accuracy, consider these upgrades:

  • PLC Integration – Replace Arduino with a PLC for higher reliability and integration with SCADA systems.
  • Multi‑Head Fillers – Duplicate the load‑cell‑pump assembly on a rotating carousel for parallel bottling.
  • IoT Connectivity – Add an ESP32 module to stream fill logs to a cloud dashboard (e.g., Azure IoT Hub).
  • Compliance – Ensure the system meets AS 4801 (Quality Management) and, where applicable, food‑safety standards (FSANZ, HACCP).


Cost Breakdown & Return on Investment

ItemQtyUnit Cost (AUD)Total (AUD)
Arduino Mega 25601$45$45
Load Cell LS‑500 kg‑S‑R1$398$398
HX711 Amplifier1$18$18
Peristaltic Pump (12 V)1$120$120
NEMA‑17 Stepper + DRV88251$35$35
Solenoid Valve (12 V)1$30$30
Power Supply 12 V/5 A1$55$55
Aluminium Frame Kit1$180$180
Misc. (cables, fasteners, SD card)$60$60
Total Prototype Cost$941

Assuming a labor cost of $25 hour and a 2‑hour build time, the first‑unit cost is ≈ $991. With a bulk discount (5 % off) for the load cell and other parts, the cost per unit drops to ≈ $870 when producing a batch of 10 machines.

ROI estimation: If each bottle saves 5 cents of labor and you fill 1 000 bottles per day, daily savings = $50 → payback in less than 3 weeks.


Why Choose LoadCellShop Australia for Your Load‑Cell Needs

At LoadCellShop Australia (operated by Sands Industries), we understand that a reliable automatic bottle filling machine using Arduino hinges on accurate measurement.

  • Expertise: Our engineers have over 20 years of experience in precision force sensing for food, pharma, and industrial markets.
  • End‑to‑End Service: From free technical consultation to custom‑spec load cell design, we support you from concept through commissioning.
  • Local Support: Based in Smithfield, NSW, we offer rapid shipping across Australia and a dedicated support line ( +61 4415 9165 | +61 477 123 699 ).
  • Quality Assurance: Every sensor is tested to ISO 9001 standards and comes with a 2‑year warranty.

Visit our shop at https://loadcellshop.com.au/shop to explore the full catalog, or reach out via our contact page https://loadcellshop.com.au/our-contacts/ for a free consultation on selecting the perfect load cell for your bottling line.


Conclusion

Building a robust automatic bottle filling machine using Arduino is an achievable project for anyone with a solid grasp of electronics, mechanics, and control theory. By selecting the right load cell—such as the LS‑500 kg‑S‑R from LoadCellShop Australia—implementing a well‑tuned PID loop, and following rigorous calibration procedures, you can achieve industrial‑grade accuracy in a compact, cost‑effective package. Avoid common missteps by respecting sensor limits, isolating vibrations, and designing a clean power architecture.

Ready to turn your DIY bottling vision into reality? Contact LoadCellShop Australia today for a no‑obligation discussion, request a custom load cell, or place an order through our online shop. Your next batch of perfectly filled bottles is only a few wires away.


Contact Details

LoadCellShop Australia (operated by Sands Industries)
Unit 27/191 McCredie Road, Smithfield NSW 2164, Australia
Phone: +61 4415 9165 | +61 477 123 699
Email: sales@sandsindustries.com.au
Website: https://loadcellshop.com.au


Call to Action

If you’re ready to procure a high‑precision load cell, need bespoke advice, or want to explore our full range of automation components, visit our contact page https://loadcellshop.com.au/our-contacts/ or head straight to the online shop https://loadcellshop.com.au/shop. Let our experts help you achieve flawless fills, lower waste, and faster time‑to‑market—all backed by Australian support you can trust.

Leave a Reply

Your email address will not be published. Required fields are marked *