Report on Project Simulation of Industrial Automation using Raspberry Pi on Proteus
Introduction:
The proposed simulation is to provide industrial or home automation is useful for monitoring the devices from any distance. A micro controller is used which monitors are the components according to the given message, with the sensed information sent from the sensors. This report discusses the working of temperature, humidity, pH, water leakage and Ultrasonic sensors. As the automation is microcontroller based it automatically regulates the parameters changes.
In older days mechanical systems were used to control these systems. Their controlling action was not so precise and accurate. Further electronic based systems are initiated, which are far better than those older mechanical systems hence implemented regularly and became common. Now days microcontroller based automated precise temperature controlling systems are used.
Components Used:
Raspberry Pi 3

RASPBERRY PI 3 is a development board in PI series. It can be considered as a single board computer that works on LINUX operating system. The board not only has tons of features it also has terrific processing speed making it suitable for advanced applications. PI board is specifically designed for hobbyist and engineers who are interested in LINUX systems and IOT (Internet of Things).
Raspberry Pi-3 Pin Configuration
PIN GROUP | PIN NAME | DESCRIPTION |
---|---|---|
POWER SOURCE | +5V, +3.3V, GND and Vin | +5V -power output |
+3.3V -power output
GND – GROUND pin|
|COMMUNICATION INTERFACE|UART Interface(RXD, TXD) [(GPIO15,GPIO14)]|UART (Universal Asynchronous Receiver Transmitter) used for interfacing sensors and other devices.|
|SPI Interface(MOSI, MISO, CLK,CE) x 2
[SPI0-(GPIO10 ,GPIO9, GPIO11 ,GPIO8)]
[SPI1–(GPIO20 ,GPIO19, GPIO21 ,GPIO7)]|SPI (Serial Peripheral Interface) used for communicating with other boards or peripherals.||
|TWI Interface(SDA, SCL) x 2 [(GPIO2, GPIO3)]
[(ID_SD,ID_SC)]|TWI (Two Wire Interface) Interface can be used to connect peripherals.||
|INPUT OUTPUT PINS|26 I/O|Although these some pins have multiple functionsthey can be considered as I/O pins.|
|PWM|Hardware PWM available on GPIO12, GPIO13, GPIO18, GPIO19|These 4 channels can provide PWM (Pulse Width Modulation) outputs.
*Software PWM available on all pins|
|EXTERNAL INTERRUPTS|All I/O|In the board all I/O pins can be used as Interrupts.|
Raspberry Pi 3 Technical Specifications
Microprocessor | Broadcom BCM2837 64bit Quad Core Processor |
---|---|
Processor Operating Voltage | 3.3V |
Raw Voltage input | 5V, 2A power source |
Maximum current through each I/O pin | 16mA |
Maximum total current drawn from all I/O pins | 54mA |
Flash Memory (Operating System) | 16Gbytes SSD memory card |
Internal RAM | 1Gbytes DDR2 |
Clock Frequency | 1.2GHz |
GPU | Dual Core Video Core IV® Multimedia Co-Processor. Provides Open GLES 2.0, hardware-accelerated Open VG, and 1080p30 H.264 high- profile decode. |
Capable of 1Gpixel/s, 1.5Gtexel/s or 24GFLOPs with texture filtering and DMA infrastructure.|
|Ethernet|10/100 Ethernet|
|Wireless Connectivity|BCM43143 (802.11 b/g/n Wireless LAN and Bluetooth 4.1)|
|Operating Temperature|-40ºC to +85ºC|
Board Connectors
Name | Description |
---|---|
Ethernet | Base T Ethernet Socket |
USB | 2.0 (Four sockets) |
Audio Output | 3.5mm Jack and HDMI |
Video output | HDMI |
Camera Connector | 15-pin MIPI Camera Serial Interface (CSI-2) |
Display Connector | Display Serial Interface (DSI) 15 way flat flex cable connector with two data lanes and a clock lane. |
Memory Card Slot | Push/Pull Micro SDIO |
LM 35 Temperature Sensor

LM35 is a precession Integrated circuit Temperature sensor, whose output voltage varies, based on the temperature around it. It is a small and cheap IC which can be used to measure temperature anywhere between -55°C to 150°C . It can easily be interfaced with any Microcontroller that has ADC function.
Pin Configuration:
Pin Number | Pin Name | Description |
---|---|---|
1 | Vcc | Input voltage is +5V for typical applications |
2 | Analog Out | There will be increase in 10mV for raise of every 1°C. Can range from -1V(-55°C) to 6V(150°C) |
3 | Ground | Connected to ground of circuit |
LM35 Regulator Features:
Minimum and Maximum Input Voltage is 35V and -2V respectively. Typically 5V.
Can measure temperature ranging from -55°C to 150°C
Output voltage is directly proportional (Linear) to temperature (i.e.) there will be a rise of 10mV (0.01V) for every 1°C rise in temperature.
±0.5°C Accuracy
Drain current is less than 60uA
Low cost temperature sensor
Small and hence suitable for remote applications
Available in TO-92, TO-220, TO-CAN and SOIC package
HIH5030 Humidity Sensor

HIH-5030 is a covered integrated circuit humidity sensor. The HIH-5031 is a covered, condensation-resistant, integrated circuit humidity sensor that is factory-fitted with a hydrophobic filter allowing it to be used in many condensing environments including industrial, medical and commercial applications.
Operating Temperature
-40°C to 85°C [-40°F to 185°F]
Stability at 50% RH
±1.2 %RH
Response Time
5 s 1/e in slow moving air
Supply Current
500 µA
Moisture/Dust Filter
Yes
Alarms
No
Long-term Stability (Drift)
±1.2 %RH for five years; ±0.25 %RH each year
Accuracy (Best Fit Straight Line)
±3.0 %RH
Package Type
Surface mount
Repeatability
±0.5 %RH
Combined Humidity and Temperature Sensor
No
Output Signal
Analog voltage
Calibration and Data Printout
No
Covered Device
Yes
Supply Voltage
3.3 Vdc typ.
Series Name
HIH-5030/5031
Interchangeability
0 %RH to 10 %RH ±7 %RH, 11 %RH to 89 %RH ±3 %RH
Hysteresis
±2 %RH
pH Sensor

Combination pH sensors are a type of electrochemical pH sensor that feature both a measuring electrode and a reference electrode. The measuring electrode detects changes in the pH value while the reference provides a stable signal for comparison.
Mostly pH sensors have 3 pins; Vcc, Gnd, and Signal out pin.
It is a analog sensor so, must be connected to Analog pins. It gives values from 0 to 1023 and the values are mapped with 0 to 14 get the pH of a liquid.
Water Sensor

This is the Water Level Depth Detection Sensor Module. It is easy-to-use and cost-effective with high level/drop recognition sensor by having a series of parallel wires exposed traces measured droplets/water volume in order to determine the water level.
Specifications
Working Voltage | DC 3-5V |
---|---|
Working Current | <20mA |
Sensor Type | Analog |
Detection Area | 40 mm x 16 mm |
Size | 65 mm x 20 mm x 8 mm |
Humidity | 10% -90% non-condensing |
LM016L LCD Screen

We can print 32 characters on this lcd display. There are 2 rows and 16 columns on this. Typically works on 5v DC.
Ultrasonic Sensor HCSR04

The ultrasonic level sensor’s working principle Ultrasonic level sensors use the Time-of-Flight measuring principle to measure level. The device sends sound waves at a frequency higher than humans can hear, from 20 kilohertz to one gigahertz. These waves bounce from the surface of the product, creating an echo that goes back to the sensor.
MCP3208 Analog to Digital Convertor IC

The MCP3208 features a successive approximation register (SAR) architecture and an industry-standard SPI™ serial interface, allowing 12-bit ADC capability to be added to any PICmicro® microcontroller.
Since most of the sensors are analog sensors and Raspberry Pi is not able to read analog signals due to the absence of inbuilt ADC. So, we will convert analog output to digital by this IC and then send the signals to Raspberry Pi 3.
Features:
12-bit resolution
Eight single-ended inputs
SPI interface
±1 LSB DNL
±1 LSB INL
100 ksps sample
Power Supply
All these sensors and Raspberry Pi need a source of Power supply so it can be 5-12v battery or adapter.
Block Diagram:










Block Diagram Explanation:
In the above block diagram, sensor data from Temperature sensor, humidity sensor, pH sensor, water sensor are first sent to MCP3208 ADC IC because these are analog data and Raspberry Pi doesn’t have inbuilt ADC to convert it to digital signals. So we need an ADC to do it.
Data from ultrasonic Sensor is digital so it is directly sent to Raspberry Pi.
In Raspberry Pi, data is processed according to the requirement and the displayed on the LM016L LCD Screen and sent to cloud or server for further analysis and insights.
Pins Connection:
Note : Must connect Vcc and Gnd Pins of all the sensors to 5V and Gnd of Raspberry Pi or any other power source.
Ultrasonic Sensor
Trig – GPIO 26
Echo – GPIO 21
LM35 Temp Sensor
Vout - CH0
HIH5030 Humidity Sensor
Out – CH2
pH Sensor
Out – CH3
Water Level Sensor
Out – CH1
LCD Display
VDD - Gnd
RS – GPIO22
RW - Gnd
V – GPIO23
D4 – GPIO4
D5 – GPIO17
D6 – GPIO18
D7 – GPIO27
MCP3208 ADC IC
Vref – 5v
AGnd – GND
CLK – CLK(Pi)
DIN – MOSI(Pi)
DOUT – MISO(Pi)
CS – CS(Pi)
Circuit Diagram :

Software Required for Simulation :
Proteus 8 Professional
Simulation Setup:
Install Proteus Software
Paste the .HEX, .IDX and .LIB files of Ultrasonic and Water Sensor (given in project folder) at the given location.
C:\Program Files (x86)\Labcenter Electronics\Proteus 8 Professional\DATA\LIBRARY

Paste the .HEX file of Ultrasonic and Water Sensor at the Program box of their widgets respectively.


Paste the Python Code In Source code Section.
#!/usr/bin/python
import spidev
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
Open SPI bus
spi = spidev.SpiDev()
spi.open(0,0)
Define GPIO to LCD mapping
LCD_RS = 15
LCD_E = 16
LCD_D4 = 7
LCD_D5 = 11
LCD_D6 = 12
LCD_D7 = 13
TRIG=37
ECHO=40
Define sensor channels
temp_channel = 0
water_channel=1
humidity_channel=2
pH_channel=3
‘’’
define pin for lcd
‘’’
Timing constantsss
E_PULSE = 0.0005
E_DELAY = 0.0005
delay = 1
GPIO.setup(LCD_E, GPIO.OUT) # E
GPIO.setup(LCD_RS, GPIO.OUT) # RS
GPIO.setup(LCD_D4, GPIO.OUT) # DB4
GPIO.setup(LCD_D5, GPIO.OUT) # DB5
GPIO.setup(LCD_D6, GPIO.OUT) # DB6
GPIO.setup(LCD_D7, GPIO.OUT) # DB7
Define some device constants
LCD_WIDTH = 16 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False
LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line
LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line
‘’’
Function Name :lcd_init()
Function Description : this function is used to initialized lcd by sending the different commands
‘’’
def lcd_init():
Initialise display
lcd_byte(0x33,LCD_CMD) # 110011 Initialise
lcd_byte(0x32,LCD_CMD) # 110010 Initialise
lcd_byte(0x06,LCD_CMD) # 000110 Cursor move direction
lcd_byte(0x0C,LCD_CMD) # 001100 Display On,Cursor Off, Blink Off
lcd_byte(0x28,LCD_CMD) # 101000 Data length, number of lines, font size
lcd_byte(0x01,LCD_CMD) # 000001 Clear display
time.sleep(E_DELAY)
‘’’
Function Name :lcd_byte(bits ,mode)
Fuction Name :the main purpose of this function to convert the byte data into bit and send to lcd port
‘’’
def lcd_byte(bits, mode):
Send byte to data pins
bits = data
mode = True for character
False for command
GPIO.output(LCD_RS, mode) # RS
High bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x10==0x10:
GPIO.output(LCD_D4, True)
if bits&0x20==0x20:
GPIO.output(LCD_D5, True)
if bits&0x40==0x40:
GPIO.output(LCD_D6, True)
if bits&0x80==0x80:
GPIO.output(LCD_D7, True)
Toggle ‘Enable’ pin
lcd_toggle_enable()
Low bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x01==0x01:
GPIO.output(LCD_D4, True)
if bits&0x02==0x02:
GPIO.output(LCD_D5, True)
if bits&0x04==0x04:
GPIO.output(LCD_D6, True)
if bits&0x08==0x08:
GPIO.output(LCD_D7, True)
Toggle ‘Enable’ pin
lcd_toggle_enable()
‘’’
Function Name : lcd_toggle_enable()
Function Description:basically this is used to toggle Enable pin
‘’’
def lcd_toggle_enable():
Toggle enable
time.sleep(E_DELAY)
GPIO.output(LCD_E, True)
time.sleep(E_PULSE)
GPIO.output(LCD_E, False)
time.sleep(E_DELAY)
‘’’
Function Name :lcd_string(message,line)
Function Description :print the data on lcd
‘’’
def lcd_string(message,line):
Send string to display
message = message.ljust(LCD_WIDTH," ")
lcd_byte(line, LCD_CMD)
for i in range(LCD_WIDTH):
lcd_byte(ord(message[i]),LCD_CHR)
Function to read SPI data from MCP3008 chip
Channel must be an integer 0-7
def ReadChannel(channel):
adc = spi.xfer2([1,(8+channel)<<4,0])
data = ((adc[1]&3) << 8) + adc[2]
return data
Function to calculate temperature from
TMP36 data, rounded to specified
number of decimal places.
def ConvertTemp(data,places):
ADC Value
(approx) Temp Volts
0 -50 0.00
78 -25 0.25
155 0 0.50
233 25 0.75
310 50 1.00
465 100 1.50
775 200 2.50
1023 280 3.30
temp = ((data * 330)/float(1023))
temp = round(temp,places)
return temp
Define delay between readings
delay = 5
lcd_init()
lcd_string("welcome ",LCD_LINE_1)
time.sleep(2)
while 1:
temp_level = ReadChannel(temp_channel)
temp = ConvertTemp(temp_level,2)
water_level=ReadChannel(water_channel)
humidity_level=ReadChannel(humidity_channel)
humidity = (humidity_level/1023)*100
pH_level=ReadChannel(pH_channel)
pH= ((pH_level/1023))*14
Print out results
lcd_string("Temperature ",LCD_LINE_1)
lcd_string(str(temp),LCD_LINE_2)
time.sleep(1)
if 300>water_level>0:
lcd_string("Leakage Detected ",LCD_LINE_1)
lcd_string(“Small Leakage”,LCD_LINE_2)
time.sleep(1)
elif 600>water_level>=300:
lcd_string("Leakage Detected ",LCD_LINE_1)
lcd_string(“Moderate Leakage”,LCD_LINE_2)
time.sleep(1)
else:
lcd_string("Leakage Detected ",LCD_LINE_1)
lcd_string(“Big Leakage”,LCD_LINE_2)
time.sleep(1)
lcd_string("Humidity ",LCD_LINE_1)
lcd_string(f’{str(int(humidity))}%’,LCD_LINE_2)
time.sleep(1)
lcd_string(f’pH is {str(pH)}%’,LCD_LINE_1)
if 7>pH>6.5:
lcd_string(“Neutral Liquid”,LCD_LINE_2)
time.sleep(1)
elif 6.5>=pH>=0:
lcd_string(“Acidic Liquid”,LCD_LINE_2)
time.sleep(1)
else:
lcd_string(“Basic Liquid”,LCD_LINE_2)
time.sleep(1)
GPIO.setup(TRIG, GPIO.OUT) # Trigger Pin
GPIO.setup(ECHO, GPIO.IN) # Echo Pin
GPIO.output(TRIG,False)
time.sleep(0.2)
GPIO.output(TRIG,True)
time.sleep(0.00001)
GPIO.output(TRIG,False)
while GPIO.input(ECHO)==0:
pulse_start=time.time()
while GPIO.input(ECHO)==1:
pulse_end=time.time()
pulse_duration=pulse_end-pulse_start
distance=pulse_duration*17150
distance=round(distance,2)
lcd_string("Distance ",LCD_LINE_1)
lcd_string(f’{str(distance)}%’,LCD_LINE_2)
time.sleep(1)
Run the simulation.
Algorithm:
Start.
Collects analog data from the sensors expect Ultrasonic.
Sent to ADC for coverting to digital signals.
For Temperature Sensor, value in degree Celsius is displayed on LCD display.
For Water Sensor; if sensor value=0, no leakage detected will be printed, 300>sensor value>0, small leakage detected will be printed, 600>sensor value>300, moderate leakage detected will be printed, sensor value>600, Big Leakage will be printed on the LCD display.
For pH Sensor; 0<pH<6, Acidic Liquid will be printed, 6<pH<8, Neutral Liquid will be printed and for ph>8, Acidic liquid will be printed on the LCD display.
For Humidity Sensor, Humidity % will be printed.
For Ultrasonic, Liquid level will be displayed corresponding to Tank Size, on the LCD display.
NOTE – All the information related to corresponding sensor will be displayed after the delay of 1 second.
Conclusion:
We can measure all the parameters of such big tanks in industry in without human involvement, which can be fatal or very risky.
We can measure them remotely from any location in the world, at anytime very easily more accurately and precisely.
It can save time, efforts, money and reduce risk, since it is cheap, easy, safe and smart.
We can also generate further insights and useful information with the help of a lot of gathered data from these sensors by applying some ML/AI algorithms.
Applications and future scope:
Applications and future scope these type of automation system can used in homes, industries etc. By using this automation design, we can reduce the usage of man power, and the damage of devices can also be reduces. By using transmission units we can control the equipment from long distances. Thus we can conclude that this kind of devices is very useful for regulating the temperature changes in the equipment.
For more details:
Contact: Tushar Gupta
Email - tushartg600@gmail.com