Hello Everyone! Happy to see you here. I welcome you on board. In this tutorial, I’ll walk you through the Water Sensor Library for Proteus. You’ll never find this library in the proteus library before, and I’m introducing it the very first time. I’m doing this to help you better understand the working of sensors with proteus simulation.
If you think proteus library of some commonly used sensors is not available in proteus already, you can share your suggestions in the section below, I’ll try my best to create and share that library from the get-go in easy to read and easy to digest tutorial.
Before I go further, it’s better to scratch and get a hold of what is a water sensor? A water sensor is a device used to detect the presence of water. It detects the water by measuring the water's electrical conductivity. These sensors are mainly used to ward off the flow of water in case any leakage happens, thus informing the entire circuit by sending a signal of the water presence. This device is mainly used for detecting water level, rainfall, and water leakage.
Let’s dive in and study how to download and simulate Water Sensor Library For Proteus.
Water Sensor Library For Proteus
- Click the button below, to download a water sensor library for proteus:
- As you download the file, it will appear in .zip file that comes with two folders named: Proteus Library and Proteus Simulation.
- Copy all these three files and paste them into the Library Folder of the proteus software.
- After doing this drill, you have to start the proteus software. If it’s already open, restart.
- After starting the proteus software, search for the water sensor available in the component’s search box as mentioned below:
- As you search for the sensor, you will get the figure below. This is our water sensor library for proteus that we have recently added to the proteus library.
- As you click ‘OK’ you’ll watch the sensor appearing as a blinking image, indicating you can place this sensor anywhere you want in the proteus workspace. After doing this, you’ll get the result below.
- Almost half work is done. You’ve created the proteus workspace with the water sensor.
Sensor LayoutStill reading? Perfect. Before I move further and discuss how to add a sensor’s hex file and run proteus simulation of the water sensor, let’s discuss the sensor’s pins and layout first. This water sensor comes with four pins as follows:
- (S): This is an analog output pin that is used for the connection with the input of the circuit.
- (-): This pin is connected to ground.
- (+): This is a power supply pin that is used to power the sensor. It is officially recommended to connect this pin with voltage ranging from 3.3V to 5V.
- TestPin: This test pin is used for proteus simulation. You won’t find this pin in real-time on the water sensor.
- Though these copper trances are not directly connected, they stand connected when they all are submerged in water. Generally, they are placed together where one sense trace stands between two power traces.
- There is one LED incorporated on the board that turns on when the sensor is powered.
Working Of Water SensorWorking is pretty simple.
- The exposed parallel traces work as a variable resistor whose resistance is directly related to the water level.
- The sensor resistance is inversely proportional to the water level.
- When the sensor is fully immersed it shows the low resistance, thus indicating more height of the water.
- And when the sensor is partially immersed, it shows more resistance, less conductivity, thus indicating less height in correspondence with the resistance.
- This variable resistance is directly related to the voltage appearing across the sensor. By measuring that voltage we can detect the water level.
Adding Sensor’s Hex File
- I hope you’ve got a clear idea of how this sensor works and detects the water level. Now, we’ll add the hex file of this sensor available in the library folder.
- Right-click on the water sensor and look for “Edit Properties” as shown in the figure below.
- You can also get the “Edit Properties” panel by double-clicking on the sensor.
- Now, you can add the sensor’s hex file by clicking the browse button as shown below. This file you can find in the library folder of the proteus software.
- You’ve added the hex file successfully. Now click “OK” and close the “Edit Properties” panel.
Proteus Simulation of Water Sensor
- Now we simulate the sensor we’ve produced in the proteus workspace.
- To do this, we’ll design a small LC circuit that will help simulate the water sensor.
- Connecting the LC circuit with the sensor is simple and straightforward. We’ll connect the sensor’s analog output pin (S) with the LC circuit through a voltmeter. And we’ll attach the variable resistor to the TestPin of the sensor. This resistance of this variable resistor will help us detect the water.
- The voltage on this voltmeter connected with the LC circuit gives the value against the variable resistor.
- When the resistance is zero, it gives the maximum voltage across voltmeter i.e. 4.97V. Recall, when the sensor is fully immersed in water, it shows zero resistance, thus indicating more height of the water level.
- And when we start increasing the resistance across the variable resistor, the voltage on the voltmeter will start decreasing, thus indicating the sensor is not immersed in water, projecting the low height of the water level.
- There is a reason we’ve connected the sensor with the LC circuit. Because proteus always provides peak to peak value of the sensor and we need to convert that peak to peak value into Vrms.
- We are using this LC circuit to run our proteus simulation, we don’t need it in the real-time hardware implementation of the water sensor.
- We’ve done it. This is the complete simulation of the water sensor. This water sensor library is not available in the Proteus library, we’ve added it the very first time.
- Now, click the play button at the bottom left of Proteus software, it will show the result above.
Water Sensor with Arduino
- Now, we’ll attach this sensor with Arduino.
- We’ll connect the output of the water sensor appearing across the voltmeter to the analog input pin of the Arduino board.
- When the resistance is zero, the voltage will appear 4.97V, thus giving an equivalent analog value of 1019 on the LCD attached to the Arduino Board.