Introduction: Anti-Icing System

This project aims to prevent the formation of ice or snow by using brine as the anti-icing agent. Utilising the humidity and temperature sensor to detect the environmental conditions, the sprinkler spreads the brine water which is controlled by Raspberry Pi. IR sensor is used to detect people and animals. When it detects people, the sprinkler turns off.

the entire set of instructions to build and use the project is provided in my GitHub page.

GitHub:Anti-Icing System

Step 1: GitHub Link

Kindly visit our GitHub page to understand the different components, tools and packages used to build the system.

Anti-Icing system

refer to the above link to know more about the project as it has different pages including readme and wiki associated with it to assist you better in easily building your own anti-icing system.

I will provide the step by step instructions from the third step onwards so as to make it easier for RPi enthusiasts to build it from the instructables :)

Step 2: Live Demonstration on YouTube

refer to our YouTube page for a live demonstration. link provided below:

YouTube demo for Anti-Icing system

Step 3: Components Required


1. IR sensor: HC-SR501 PIR Motion Detector
Voltage: 5V – 20VPower Consumption: 65mATTL output: 3.3V, 0VLock time: 0.2 secTrigger methods: L – disable repeat trigger, H enable repeat triggerSensing range: less than 120 degree, within 7 metersTemperature: – 15 ~ +70Dimension: 32*24 mm, distance between screw 28mm, M2, Lens dimension in diameter: 23mm

2. Humidity and temperature sensor: DHT22(AM2302)

Low cost3 to 5V power and I/O2.5mA max current use during conversion (while requesting data)Good for 0-100% humidity readings with 2-5% accuracyGood for -40 to 80°C temperature readings ±0.5°C accuracyNo more than 0.5 Hz sampling rate (once every 2 seconds)Single-bus data is used for communication between MCU and DHT22, it costs 5ms for single time communication.

3. Brushless DC Motor Pump Decdeal QR50E

Low cost and Versatile12V 5W Rating280l/H pump quantitycan handle different types of solutions including salt water (brine) and oil at various temparatures

4. DC 12V battery/ power supply

Step 4: How to Implement Code and Connections

  • Code:
  1. Clone the repository.
  2. Copy the Code/html to /var/www/html
  3. In the Code folder, the main file can be executed.
  4. If you changed the input/output pin number, you can use CMake to rebuild the main file.
  5. Open browser enter the address of raspberryPi to access the user interface.
  • Connections:

We use WiringPi numbering in our code, hence:

power GPIO: 4.

motor GPIO: 3.

PIR sensor GPIO: 0.

DHT22 sensor GPIO: 7.

Step 5: Installation

As our project involved Mysql, Php, web-server, there are several commands to set up the working environment as follows:

  • Checking the raspberry pi system is up to date.

sudo apt-get update

sudo apt-get upgrade

  • Installing apache2, php, mysql supports

sudo apt-get install apache2 -y

sudo apt-get install php7.0

sudo apt-get install mysql-server

sudo apt-get install mysql-client

sudo apt-get default-libmysqlclient-dev

After installing supports for the environment, database and relevant table should be created in order to read and write data.

If you would like to create a specific login account rather than using the 'root', you can simply go through the following commands:

  • Creating a new user named as 'pi'

sudo mysql -u root for entering mysql database.

mysql> USE mysql;

mysql> CREATE USER 'pi'@'localhost' IDENTIFIED BY '';

mysql> GRANT ALL PRIVILEGES ON *.* TO 'pi'@'localhost';

mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='pi';


mysql> exit;

service mysql restart

  • Creating a database for raspberry pi

mysql>create database sensor;

mysql>use sensor;

mysql>create table th_sensor(name char(20) not null primary key,value float(10,2) not null, value2 float(10,2);


Now you can copy /Code/html folder to the default localhost directory as /var/www/html.

Creating a boot script for launch the system once the pi opened.

For example, creating a file named as boot.desktop under the directionary: .config/autostart/

The content of the file as follows:

[Desktop Entry]




Exec= xxx/xxx/xx ./main

The "xxx/xxx/xx " is the directory of your main file.

Finally, after reboot your pi, you can open your web browser to see the interface.

Step 6: PCB Design

Schematic and PCB
We selected Orcad capture and PCB editor to draw the PCB.

  • Sensors Circuit:

The original file of the schematic. Please open this file by Orcad Capture.

The original file of the PCB. Please open this file by PCB Editor.

The schematic of sensors circuit is provided above along with the PCB files. 16 pins are enough for our project, so we only used a header with 16 Pins.

J2 is for PIR sensor

J3 is for humidity&temperature sensor

J4 is for GPIO

R1 and R2 are the pull-up resistors

D1 LED is for the motor test. This signal is used to control motor.

D2 LED is for observation. It will show if the circuit is working.

  • Motor Control Circuit:

The original file of the schematic. Please open this file by Orcad Capture.

The original file of the PCB. Please open this file by PCB Editor.

Schematic and PCB for Motor Drive

The Schematic of Motor driver circuit is provided above along with the PCB files.

J1 is for Power source.

J2 is for Motor.

J3 is for Control signal that comes from the GPIO.

J4 is for switch.

Q1 is to control the motor.

D2 LED is to check if the circuit works properly.

Step 7: Detailed Control Flow Graph of the System

A detailing of the signal flow in the entire system along with the time delays, sampling and refresh rates and the bus protocols used is provided above for further understanding the system.

as always further suggestions for improvement and modifications are delightfully welcomed :)

Step 8: Code

The code package has been uploaded in a .zip file which you can use to extract and compile in your raspberry pi.

We use GitHub as our version control software as it is free,easy to maintain and release newer versions logging all the changes made to the program.

The process of cloning the package and compiling using the 'make' command should be easier as compared to coding each line (it is difficult to write different types of code for various components and tasks in different languages in different files).

Disclaimer: This should in no way be taken as an advertisement or a demotivation for a different website, as I believe that we are an open-minded and a mature community working together to build a better future bit by bit :)

Hope you enjoy building this project as much as we did :)


Microcontroller Contest

Participated in the
Microcontroller Contest

Spotless Contest

Participated in the
Spotless Contest