Simple Liquid Dispenser For Bottling Plants

Automated liquid filling machines are used to fill various liquid materials such as oils, milk and beverages in their filling plants. But these machines are very expensive and not affordable by most small packers. This simple liquid dispenser releases a liter of liquid every time the button is pressed.

The vessel schematic diagram shown in Figure 1 shows its main stages.

block diagram for liquid dispenser
Figure 1: Diagram of a liquid distributor

circuit and work

The circuit diagram of the simple liquid distributor shown in Figure 2 includes a 5V, 7805 voltage regulator IC1, an ATtiny85A AVR (MCU) microcontroller IC2, a YF-S201 liquid flow sensor, a bi-color LED BICO1, a normally closed solenoid valve, a BD139 NPN T1 transistor.

distributor circuit diagram
Figure 2: Distributor Circuit Diagram

The ATtiny85A AVR microcontroller is the brain of the circuit that controls the preset amount of fluid flowing out. The flow sensor is connected to connector J1 and the solenoid valve is connected to connector J2.

In standby mode, the dual-color LED emits red and the LED is de-energized. Each time button S1 is pressed, the valve is energized and fluid is released from the solenoid valve. The two-color LED flashes green to indicate that the liquid filling is being processed.

When the fluid flow reaches the preset amount, the valve is de-energized by the MCU and now a two-color LED flashes red to indicate that the filling process is complete.

This cycle repeats each time the button is pressed. The S2 button is used to manually reset the MCU.

flow sensor

The flow sensor has a rotor along with a Hall effect sensor in the line of fluid passage. As the fluid flows through the sensor, the rotor rotates. This causes the Hall effect sensor to emit a pulse. Thus, flow rate (Q) can be measured as:

Flow rate (Q) in liters/min = output pulse frequency / 7.5

But we want the quantity in liters and not the flow rate in liters per minute. By rearranging the above equation for liters, we get:

Number of liters = Number of output pulses / 450

This means that it takes 450 pulses for one liter of fluid to flow through the flow sensor.

Program code

The source code was developed using the Arduino IDE. By default, the Arduino IDE does not support the ATtiny85 MCU. So, we need to add the ATtiny board to the Arduino IDE as follows:

Open the  Preferences file and copy the link mentioned below into the Additional Panels Manager URL: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json.

After this is done, open ToolsBoardBoard Manager. After you open Boards Manager, scroll down the list and search for “attiny” by Davis A. Mellis. Click on that and install it. After installing it, ATtiny will be listed in the boards list.

Now, select ATtiny25/45/85 under Tools → Board. Then select ATtiny85 under

Tools → Processor and select 8MHz (Internal) under Tools → Clock.

Next, make the Arduino Uno the ISP programmer. For this, get your Arduino Uno, connect it to your computer, and open the Arduno IDE. Make sure you have the Arduino / Genuino Uno selected as your board, and open the ArduinoISP schematic from the File → Examples option. Upload the ArduinoISP schematic to your Arduino Uno. Your Arduino Uno is now an ISP programmer.

By default, the ATtiny85 operates at 1MHz. To make it run at 8MHz, select the ToolsBurn Bootloader option. Make sure the Arduino Uno board is programmed as an ISP, and that it is connected to the ATtiny85 through the ISP pins according to Table 1. Load the Simple_L Liquid_Dispenser.ino source code using the same programmed Arduino board as the ISP.

Build and test

The layout of the actual size PCB for a simple liquid dispenser is shown in Figure 3 and the layout of its components in Figure 4. After assembling the circuit on the PCB, place it in a suitable plastic box. Install the flow sensor and solenoid valve according to your application.

PCB layout for liquid dispenser
Figure 3: PCB layout of the liquid dispenser
PCB Component Layout
PCB Component Layout

Download PCB Layout PDFs and Components: Click Here

The source code will be updated soon.


A. Samiuddhin, Circuit Designer, is a B.Tech in Electrical and Electronic Engineering. His interests include LED lighting, power electronics, microcontrollers, and Arduino programming.

Leave a Reply

Your email address will not be published.