Figure 2.4(FC28 SOIL SENSOR PINLAYOUT)

3.4.3 Pin definition:

“S” stand for signal input “+” stand for power supply “-” stand for GND

3.4.4 Applications : Botanical gardening Water sensor

3.4.5 Connecting diagram

Figure 3.5(CONNECTION DIAGRAM)

This sensor module come with 3 Pin Dual-female Jumper Wire length 300mm as below:

Figure 3.6(FEMALE JUMPER WIRES)

3.5 Example:

Please use the cable to connect the Moisture Sensor with A5 interface of Arduino Sensor shied.

After hardware connection, please download the test code to Arduino after being compiled code, and the Arduino test code such asbelow:

void setup(){Serial.begin(9600);
}
void loop(){if(analogRead(5) 300 && analogRead(5) 700){
Serial.println(“Too much water, I might get hurt”);
}
delay(200);

Figure 3.7(FC28 INSTALLATION DIAGRAM)

The moisture sensor will respond according to the inputs given to arduino through Arduino IDE.

Chapter 4: WATER LEVEL MEASUREMENT

4.1 BASIC LEVEL MEASUREMENT
For Few crops Like Rice a certain level of water must be present above the Ground level. Water
level above the ground can be measured by various Meathods :
• Capacitive level Measurement

• Ultrasonic water Level Measurement

• Water level sensor integrated circuit

4.2 Capacitive level measurement
This simply works upon the change in dielectric medium of the capacitor. Initially when
air is present the default capacitance value has been measured now upon installation in
field the dielectric changes from air to water thus results in change of capacitance which
works as function of level.

4.3 Ultrasonic Water level sensor

4.3.1 Introduction
As the indicate, ultrasonic sensor measures distance by using ultrasonic waves . the sensor head emits an ultrasonic wave and receives the wave reflected back from the target. Ultrasonic sensor measure the distance to the target by measuring the time between the emission and the reception.
An optical sensor has a transmitter and receiver, whereas ultrasonic sensor uses single oscillator emits and receives ultrasonic .waves alternatively. this enable miniaturization of the sensor head.

FIGURE 4.1(SONAR SENSOR)

4.3.2 About ultrasonic

Ultrasonic sensor are used around the world, indoors and outdoors in the harshest condition, for a variety of application. Our ultrasonic sensors, made with piezoelectric crystals, using high frequency sound to resonate a desire frequency and convert electric energy into acoustic energy, and acoustic energy into electric energy sound wave are transmitted to and reflected from target back to the transducer. Target can have anyreflective form, even around certain variables, such as target surface angle, changes in temperature and humidity, and reflective surface roughness, can affect the operation of the sensors.

4.3.3 Distance calculation
The distance can be calculated with using the following formula.

4.3.3.1 Distance L = ½ * T * C

Where L is the distance, T is the time between the emission and reception, and C is the sonic speed. (the value is multiplied by ½ because T is the time for go and return distance.
Features
Characteristics enable by the detection system are following.

4.3.3.2 Transparent object detectable
Since ultrasonic waves can reflect off a glass or liquid surface and return to the sensor head, even transparent target can be detected.
4.3.3.3 Resistant to mist and dirt
Detection is not affected by accumulation of dust or dirt.

4.3.3.4 Complex shaped object detectable
Presence detection is stable even for target such as mesh trays or spring.

4.4 Types of ultrasonic sensors :
4.4.1 Proximity detection
An object passing with in the preset range will be detected and generate an output signal. The detect point is independent of target size, material or reflectivity.

4.4.2 Ranging measurement
Precise distance of an object moving to and from the sensor are measured via time intervals between transmitted and reflected bursts of ultrasonic sound. Distance change is continuously calculated and outputted.

4.4.3 Migration in ultrasonic sensing
Migration has used the advance technology of ultrasonic sensing to solve an array of a problem across a wide range of industries since 1979. Our field tested products are capable of meeting unique needs with a variety of option to help you to find a solution. Tough and reliable, we have had sensor running 24 hours a day, 7 days a week since 1980 without fail.

4.5 Migration advantage

1) Resistance to external disturbances such as vibrations, infrared radiation, ambient noise and EMI radiation.

2) Measures and detect moving objects from discrete distances.

3) Can detect small object over long operating range.

4.6 Typical application :

4.6.1 Tank level
Liquid level sensor are integral to process control and inventory management in many industries.
At migration we engineer two type level sensors (proximity sensor) and continuous level sensor (analog sensor).the type of sensor are appropriate for our liquid level measurement.

4.6.2 Production line sensor
Ultrasonic sensor can be applied to the manufacturing process for automated process control on factory floor while also being an indispensable tool for company to maximize efficiency through precise measurement and control.
Ultrasonic sensor can streamline the production process.

FIGURE 4.2(WORKING OF ULTRASOUND)

4.6.3 Distance measurement
Ultrasonic sensor can measure the distance to a wide range of objects regardless of shape color or surface texture. They are also able to measure approaching or receding objects.

4.6.4 Application using migration ultrasonic sensor

1) loop control

2) roll diameter tension control, winding and unwind

3) liquid level control

4) beam detection for high speed counting

5) full detection

6) thread or wire break detection

7) robotic sensing

8) stacking height control

9) people detection for counting

10) contouring or profiling using ultrasonic system

4.7 Use of ultrasonic sensor in industry
Ultrasonic sensor can detect movement of targets and measure the distance to them in many automated factories and process plants. Sensor can have on or off digital output for detecting the movement of objects, or a analog output proportional to distance. They can sense the edge of material as web guiding system. Ultrasonic sensors are widely used in car as parking sensors to aid the driver in reversing into parking spaces. They are being tested for a number of other automotive uses including ultrasonic people detection and assisting in autonomous UAV navigation Because ultrasonic sensor are use sound rather than light detection, they work in application where photoelectric sensor may not.
Ultrasonic are great solution for clear object detection, clear label detection and for liquid level measurement, applications that photoelectric struggle with because of target translucence. As well, target color or reflectivity do not affect ultrasonic sensors, which can operate reliably in high glare environment.Passive ultrasonic sensor may be used to detect high pressure or liquid leaks, or other hazardous conditions that generate ultrasonic sound in these devices, audio from transducer (microphone) is converted down to human hearing range.
High power ultrasonic emitters are used in commercially available ultrasonic clearing devices. An ultrasonic transducer is affixed to a stainless steel pan which is filled with a solvent (frequently water or isopropanol). An electrical square wave feeds the transducer, creating sound in the solvent strong enough to cause cavitation.
Ultrasonic testing are widely used in metallurgy and engineering to evaluate corrosion, welds, and material defects using different types of scans.

4.7.1 Use in medicine
Medical ultrasonic probe come in variety of different shapes and sizes for usin making cross sectional images of various parts of the body the transducer may be passed over a surface in contact with the body. The transducer may be passed over the surface and in contact with the body, or inserted into body opening such as rectum or vagina. Clinicians who perform ultrasound guided procedures often use a probe positioning system to hold the ultrasonic transducer.
Air detection sensor are used in various roles non invasive air detection isfor the most critical situation where safety of patience is mandatory. Many of the variable which can affect the performance of the amplitude or continuous wave based sensing system, are eliminated or greatly reduced, thus yielding and repeatable detection.
One key principle of this technology is that the transmit signal consists of short bursts of ultrasonic energy. After each burst electron looks for a return signal with in small window of time corresponding to the time it take signal received during this period will qualify for additional signal processing. This principle is similar to radar range gating.
4.8 PIN DESCRIPTION:

FIGURE 4.3(HCSR04 PIN LAYOUT)

Chapter Five: NODEMCU

5.1 Introduction

5.1.1 Defination of NODEMCU
The word nodemcu is a microcontroller chip is also known as eLUA based firmware that consist of code repository for the ESP8266 wifi system on chip (soc) or microcontroller.
NODEMCU firmware is based on espressif non-os sdk 2.2.0 and communicate with other devices using serial communication.

5.1.2 ESP8266
ESP8266 is a wifi module or system on chip(soc) or microcontroller which is very
inexpensive and has an in-built support for wifi connectivity. ESP8266 consist of the
components that a modern computer have such as cpu, ram, networking, modern operating system and sdk.
ESP8266 is somewhat hard to access and we have to solder wires with appropriate analog voltage to its pin for simplest task such as power it on and sending a keystore to computer on chip.
Programming is done in low level machine instructions in esp8266 understandable by its
hardware.

?ESP8266 BLOCK DIAGRAM

ESP-12E WiFi module is ultra low power 32-bit MCU micro, with the 16-bit short mode, Clock speed support 80 MHz, 160 MHz . The module supports standard IEEE802.11 b/g/n agreement, complete TCP/IP protocol stack. Users can use the add modules to an existing device networking, or building a separate network controller. ESP8266 is high integration wireless SOCs, designed for space and power constrained mobile platform designers. It provides unsurpassed ability to embed Wi-Fi capabilities within other systems, or to function as a standalone application, with the lowest cost, and minimal space requirement.

FIGURE5.1(ESP8266)
?FEATURES
• 802.11 b/g/n(wifi protocol).
• Integrated low power 32-bit MCU.
• Integrated 10-bit ADC .
• Integrated TCP/IP protocol stack.
• Integrated TR switch, balun, power amplifier and matching network.
• Integrated PLL, regulators, and power management units.
• Supports antenna diversity.
• Wi-Fi 2.4 GHz, support WPA/WPA2(security).
• Support Smart Link Function for both Android and iOS devices.
• SDIO 2.0(secure data input output) using peripheral buses such as SPI, UART, I2C, Infrared remote control , PWM, GPIO.
• Deep sleep power < 5uA.
• Wake up and transmit packets in < 2ms.
• Standby power consumption of < 1.0mW.
• +20dBm output power in 802.11b mode.

?Pin description

FIGURE 5.2 (ESP8266 PIN DIAGRAM)

No. Name Type Functions
1 VDDA Power Power Input 3.0V ~ 3.6V
12 LNA Input/Output RF Antenna, Output Impedance = 50?
3 VDD3P3 Power Amplifier Power 3.0V ~ 3.6V
4 VDD3P3 Power Amplifier Power 3.0V ~ 3.6V
5 VDD_RTC Power NC (1.1V)
6 TOUT Input An ADC Input or can be used to check voltage of VDD3P3
7 CHIP_EN Input Chip Enable (Active High)
8 XPD_DCDC Input/Output GPIO16, Deep Sleep Wakeup
9 MTMS Input/Output GPIO14, HSPI_CLK, I2C_SCL, I2SI_WS, PWM2
10 MTDI Input/Output GPIO12, HSPI_MISO, I2SI_DATA, PWM0, IR Tx, Link LED
11 VDDPST Power Digital IO Power Supply, 1.8V ~ 3.3V
12 MTCK Input/Output GPIO13, HSPI_MOSI, I2SI_BCK, UART0_CTS, Reset Button
13 MTDO Input/Output GPIO15, HSPICS, UART0_RTS, I2SO_BCK, PWM1
14 GPIO2 Input/Output GPIO2, UART1_TXD (flash programming UART Tx), I2C_SDA, I2SO_WS
15 GPIO0 Input/Output GPIO0, SPI_CS2, WiFi LED
16 GPIO4 Input/Output GPIO4, PWM3
17 VDDPST Power Digital IO Power Supply, 1.8V ~ 3.3V
18 SDIO_DATA_2 Input/Output GPIO9, Connect to SD_D2 (Series R: 200?), SPIHD, HSPIHD
19 SDIO_DATA_3 Input/Output GPIO10, Connect to SD_D3 (Series R: 200?), SPIWP, HSPIWP
20 SDIO_CMD Input/Output GPIO11, Connect to SD_CMD (Series R: 200?), SPI_CS0
21 SDIO_CLK Input/Output GPIO6, Connect to SD_CLK (Series R: 200?), SPI_CLK
22 SDIO_DATA_0 Input/Output GPIO7, Connect to SD_D0 (Series R: 200?), SPI_MSIO
23 SDIO_DATA_1 Input/Output GPIO8, Connect to SD_D1 (Series R: 200?), SPI_MOSI
24 GPIO5 Input/Output GPIO5, IR Rx
25 U0RXD Input/Output GPIO3, UART Rx during flash programming, I2SO_DATA
26 U0TXD Input/Output GPIO1, SPI_CS1, UART Tx during flash programming
27 XTAL_OUT Input/Output Used to provide BT clock input, Connect to crystal oscillator output
28 XTAL_IN Input/Output Connect to crystal oscillator input
29 VDDD Power Power Input 3.0V ~ 3.6V
30 VDDA Power Power Input 3.0V ~ 3.6V
31 RES12K Input 12K? resistor is connected to this pin and ground
32 EXT_RSTB Input Active Low External Reset Signal

TABLE 5.1(ESP8266 PINS DESCRIPTION)

5.2NODEMCU Development Board (IOT Development Board)
The Nodemcu development board consist of two units attach on it ,one is the nodemcu firmware for esp8266 wifi soc and the other one is developmet board on which the esp8266 wifi soc and its firmware is placed. Both the things put together forms Nodemcu development board.
Nodemcu development board is also known as IOT developmet board used in different place where there is application of iot. Iot development board can be used in different iot projects.
Some features of this board is GPIO pins and Serial communication protocol.

FIGURE 5.3 (NODEMCU DEV KIT V1.0)

5.2.1 Arduino With IOT
The programmed Arduino board connected with or controlling sensors in the field are collecting data from the sensors which can be saved and processed later by using iot
development board with Arduino as arduino alone will not able to setup a wifi connection
because there is no built-in support for wireless network unlike esp8266 wifi module has in IOT development board.
5.2.2 Versions of Nodemcu Development board
There are two versions of Nodemcu Development kit board:
1) NODEMCU DEV KIT V0.1(VERSION1)

2) NODEMCU DEV KIT V1.0(VERSION2)

5.2.3 Difference in between 1st and 2nd version NodeMCU Board

We can make difference in 1st and 2nd version of NodeMCU Development board by their
boards design and ESP modules on it.
*In 1st version of NodeMCU Dev Kit v0.9, CH341SER USB to Serial converter is
used whereas in 2nd version of NodeMCU Dev Kit v1.0, CP2102 USB to Serial
converter is used.
*1st version uses ESP-12 and 2nd version uses ESP-12E (Enhanced version).
*Extra 6 pins (MTDO, MTDI, SD_3, MTMS, MTCK, SD_2) brought out on ESP-
12E version of ESP-12 modules as shown in below figure. Though Quad SPI pins
are brought out, they are internally used for flash memory access.
* Also, there is slight antenna design difference in ESP-12 versions like ESP12-E &
ESP-12F as shown in below figure.

FIGURE 5.4 (ESP8266 TYPES)

5.2.3 Nodemcu development kit used in our Iot Project

We have used the Nodemcu development kit v1.0(version2) because it uses
ESP8266 12-E which is the enchanced version of ESP12 consist in version1, board also
has more no of general purpose input and output pin(GPIO) therefore we use the
version 1 Nodemcu board with our Iot application Project.

5.3 Nodemcu Development kit v1.0(version1) Pin layout

FIGURE 5.5 (NODEMCU DEVELOPMENT BOARD PIN LAYOUT)

5.4 NodeMCU Dev Kit v1.0 pin descriptions

GPIO (General Purpose Input Output) Pins:

NodeMCU has general purpose input output pins on its board as shown in above
pinout diagram. We can make it digital high/low and control things like LED or
switch on it.
Also, we can generate PWM signal on these GPIO pins.

ADC (Analog to Digital Converter) channel (A0):
NodeMCU has one ADC channel/pin on its board.

SPI (Serial Peripheral Interface) Pins:
NodeMCU based ESP8266 has Hardware SPI (HSPI) with four pins available for
SPI communication. It also has SPI pins for Quad-SPI communication. With this
SPI interface, we can connect any SPI enabled device with NodeMCU and make
communication possible with it.

I2C (Inter-Integrated Circuit) Pins:
NodeMCU has I2C functionality support on ESP8266 GPIO pins. Due to internal
functionality on ESP-12E we cannot use all its GPIOs for I2C functionality. So, do
tests before using any GPIO for I2C applications.

UART (Universal Asynchronous Receiver Transmitter) Pins:
NodeMCU based ESP8266 has two UART interfaces, UART0 and UART1. Since
UART0 (RXD0 & TXD0) is used to upload firmware/codes to board, we can’t use
them in applications while uploading firmware/codes.

5.4 Programming of NODEMCU development board

There are two ways to program NODEMCU:

1) BY USING LUA FIRMWARE SOFTWARE

2) BY