The use of automatic filling stations using a belt conveyor system is most economical, fast and commonly used system used in almost all beverages and pharmaceutical (liquid) industries. This project works as a prototype for basic concept of automatic filling stations in beverages, pharmaceutical and dairy process industries.

Step 1:

The objective of the project is to detect the presence of a glass bottle at the filling station, fill the liquid in the bottle to a certain height and forward the bottle for further processing. The project consists of a belt conveyor, for filling of bottles to a required level of liquid, driven by a DC motor at a constant preset speed. The motor will keep driving the conveyor until an infrared (IR) sensor detects the presence of a bottle right below the filling station. The IR sensor sends the signal to the controller which in return sends a signal to the motor to stop. As soon as the conveyor stops, the actuator for filling, i.e. a solenoid valve, turns the filling on. The liquid level in the bottle is continuously monitored using an ultrasonic sensor. A preset required level of liquid is already entered in the controller. The controller compares the instantaneous level to the preset required level. As soon as the desired level is reached, the solenoid valve turns off the filling. When filling stops, the conveyor starts moving so that next bottle can be filled.

Step 2: Components

TIP 122:

In electronics,
the Darlington transistor (often called a Darlington pair) is a compound structure consisting of two bipolar transistors (either integrated or separated devices) connected in such a way that the current amplified by the first transistor is amplified further by the second one.

Sonar HC-SR04

Ultrasonic ranging module HC - SR04 provides 2cm - 400cm non-contact measurement function, the ranging accuracy can reach to 3mm. The modules includes ultrasonic transmitters, receiver and control circuit. The basic principle of work:

(1) Using IO trigger for at least 10us high level signal,

(2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back.

(3) IF the signal back, through high level , time of high output IO duration is the time from sending ultrasonic to returning.

Test distance = (high level time × velocity of sound (340M/S) / 2.

Step 3: Components

Solenoid valve (12V, ¼”)

A solenoid valve is an electromagnetically operated valve. The valve is controlled by an electric current through a solenoid: in the case of a two-port valve the flow is switched on or off; in the case of a three-port valve, the outflow is switched between the two outlet ports. Multiple solenoid valves can be placed together on a manifold.

Infrared Sensor for detection

An infrared sensor is a sensor that reacts to infrared (IR) ray of light projection. An infra red ray of light emerges from one terminal known as emitter and is received by another terminal known as receiver. The emitter and receiver may be on the same side or the opposite side. The sensing can be to sense an obstacle that breaks the projection to imply presence of an external object, or to sense the projection at receiver to imply moving of an object that was supposed to be breaking the light beam, or both.

Step 4: Circuits


The circuit is supplied with two different power sources (two 9 volts battery) and one 12v 2.0amp source. There are two switches which will turn on the circuit. When the beaker is placed on the conveyor belt, when it comes in between the LED and Phototransistor, then the output signal will be generated by a comparator, which has some preset value set by a potentiometer against the sensitivity of the light received by the phototransistor. This output is then read by a 8bit 32KB AVR microcontroller (ATMEGA 328) which then immediately stops the conveyor and through relay it will turn on the solenoid valve and hence the liquid will flow through it by the action of gravity into the beaker via valve from the reservoir. The ultrasonic sensor will detect the level of water, following the Doppler’s phenomena, the value of level is experimentally set in the programming. Once the level of the liquid is achieved the controller after taking decision will switch off the solenoid valve and turn on the conveyor and will weight for the other beaker to come.

Step 5: Arduino Code

Program (SourceCode)


// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

#define echoPin 7 // Echo Pin

#define trigPin 8 // Trigger Pin

#define relay 10 // Onboard LED

#define Glass 9 // Bottle detection

#define solenoid 13 // Solenoid detection

byte armsUp[8] = {










int maximumRange = 200; // Maximum range needed

int minimumRange = 0; // Minimum range needed

long duration, distance; // Duration used to calculate distance

void setup() {

lcd.createChar(4, armsUp);

lcd.begin(16, 2);


lcd.print(" Production Line Automation by Saad Zeeshan Waqas Saeed Adeel ");

for (int positionCounter = 15; positionCounter < 84; positionCounter++) {

// scroll one position left:


// wait a bit:






pinMode(trigPin, OUTPUT);

pinMode(solenoid, OUTPUT);

pinMode(Glass, INPUT);

pinMode(echoPin, INPUT);

pinMode(relay, OUTPUT); // Use LED indicator (if required)


void loop()


digitalWrite(trigPin, LOW);


digitalWrite(trigPin, HIGH);


digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

//Calculate the distance (in cm) based on the speed of sound.

distance = duration/58.2;

int Detect_glass =digitalRead(Glass);

if(Detect_glass == HIGH) //no glass


digitalWrite(relay, HIGH); //conveyor

lcd.setCursor(0, 0);

lcd.print("Conveyor Start");

digitalWrite(solenoid, LOW);


delay(40); //int a = a++;


if(Detect_glass == LOW)


lcd.setCursor(0, 0);

lcd.print("Conveyor Stop");

digitalWrite(relay, LOW); //conveyor off


digitalWrite(solenoid, HIGH); //solenoid on

//sonar value for level detector



digitalWrite(solenoid, LOW); //water off


digitalWrite(relay, HIGH); //conveyor on