Circuit design and calculation

Một phần của tài liệu Iot - Based automatic monitoring and control system for agriculture (Trang 30 - 54)

a. Supply power block

Tab. 3.1 below is a summary of all the equipment used in this project. These include the device name, the number of each device, and the operating voltage and current consumed by the manufacturer of each device, from which proposed system calculates the power consumed and selects the appropriate source for the model.

TABLE 3.1. Parameters about power consumption of components Name of Part Amount Operating Voltage

(V)

Current Consumption (mA)

ESP32 1 5 147

ESP32 CAM 1 5 96

Pumping Motor 1 12 500

Sensors 2 5 25

Module Relay 1 channel

1 5 62

LCD I2C 1 5 200

Fan 1 12 500

LED 1 12 500

Step Motor 2 12 500

CNC Shield v3 module

1 5 500

ServoMSG90 1 5 500

Sum ~4500

Power consumption formula:



 n 0 i

UI

P (3.1)

While as:

 P: Capacity of Load (W)

 V: Voltage of Load (V)

 I: Current (A)

 i: Parameter.

15

 n: Number of Loads.

From the formula (3.1) and the table. The Power Consumption of this System is calculated as below:

Pmax = 5*0.147 + 5*0.096 + 12*0.5 + 5*0.025*2 + 5*0.062 + 5*0.2 + 12*0.5 + 12*0.5 + 12 *0.5*2 + 5*0.5 + 5*0.5 = 37.775 W.

Select the source block to ensure the conditions are: Ipower ≥ Imax, Ppower ≥ Pmax. Thus, selecting the source is the 220 AC transformer to DC power (12V - 5A) honeycomb with P = 60 W is enough to provide power for all blocks.

Here the group select a 12V - 5A honeycomb set to ensure the continuity of the garden and restricting the use of batteries to lead to expensive cost.

Power supply

The 12V 5A honeycomb power supply, also known as a 12-volt DC power supply, converts voltage from 110/220VAC AC to 12V DC to power working equipment. Actual image of the 12V 5A honeycomb power supply as Fig. 3.2 below.

Fig. 3.2. Honeycomb power supply

The feature of the honeycomb power supply as heat dissipation, overload protection, short circuit, and overvoltage protection are all possible features of the main device. It also has high efficiency and a consistent output voltage within the permitted power limit (no voltage drops when large consumption current).

LM2596 Buck Converter

The LM2596 is a step-down DC voltage, often known as a buck converter. This module has great capacity and line control and is supplied in stable output voltages such as 3.3V, 5V, and 12V. The DC-DC Buck LM2596 3A voltage dropping circuit has a compact size and is capable of decreasing voltage from 30VDC to 1.5VDC while retaining high efficiency (92%), making it appropriate for power distribution, low voltage, and power supply equipment such as cameras, robots, and so on [11]. Actual image of the LM2596 Buck Converter as Fig. 3.3 below.

16

Fig. 3.3. LM2596 Buck Converter Some features of LM2596:

1. The output voltage can be adjusted by the using the flat head turn the variable resistor.

2. The converter could supply up to 3 amps of direct current load current.

3. Heating shutoff and current limit are two methods of circuit protection.

Fig. 3.4. The schematic of LM2596 Buck Converter

The LM2596 is known for its high current rating of 3A. It has many versions with fixed output voltage such as 3.3V, 5V and 12V. But, the most famous is the LM2596- ADJ which has variable output voltage as Fig. 3.4 shows above.

Unregulated voltage is applied to pin 1 (Vin) through the filter capacitor to reduce input noise. The ON/OFF pin or the trigger pin (pin 5) must be connected to ground to enable the IC. If set to high, the IC will go into off mode and prevent leakage current. This feature will be useful to save input power when operating on battery. The feedback pin is an important pin that sets the output voltage. It senses the output voltage and based on the value of this output voltage, the switching frequency of the internal switch is adjusted to

17

provide the desired output voltage. Finally the output voltage is obtained through pin 2 through an LC filter.

 Calculate the output voltage for LM2596

The output voltage of the LM2596-ADJ can be controlled using the feedback pin.

Circuit diagram showing the feedback pin receiving the feedback voltage from a voltage divider made with resistors R1 and R2.

The value of these R1 and R2 determines the output voltage of the IC. The formula for calculating R1 and R2 is given below.

Vout = Vref (1.0 + R2 / R1) (3.2)

Here the value of Vref can be considered as 1.23V hence the formula becomes Vout = 1.23 * (1+(R2 / R1))

Herewith,

R1 should be in range from 1k Ohm to 5k Ohm

R2 is required needing flat-head screwdriver to adjust resistance.

For example, if the thesis requires Vout = 5V. Follow formula (3.2) the R2 is:

5 = 1.23 * (1+(R2 / 1.21*1000)) R2 = ~3.7k Ohm.

So it is required needing to turn varible resistor and measuring it output voltage that equal to 5V.

Tab. 3.2 shows some details of the LM2596 circuit such as the input voltage from 3V to 30V, the output voltage can be adjusted through rotating resistor R2 and the power of the circuit is 15W.

TABLE 3.2. LM2596 buck converter specifications

Name of component Descriptions

Input voltage 3V to 30V

Output voltage Adjustable from 1.5V to 30V

Maximum Response Current 3A

Efficiency 92%

18

Wattage 15W

Dimension 45*20*14 (mm)

b. Central processing block

ESP 32 module

Currently, ESP32 is a progression of minimal expense, low power consumption on a chip microcontroller with integrated Wi-Fi and dual mode Bluetooth. It is intended to accomplish the best performance and RF execution, robustness, adaptability, and dependability in a wide assortment of uses, for example, voice encoding, music streaming and MP3 decoding [12].

ESP32 is equipped for working dependably in mechanical conditions, with a working temperature going from – 40°C to +125°C. Fueled by cutting edge adjustment hardware, ESP32 can progressively eliminate outside circuit blemishes and adjust to changes in outer conditions [12].

ESP32 provides a complete and closed Wi-Fi network solution; It can be used for application storage or offloading Wi-Fi network functions from other application handlers.

When the ESP32 stores the application, it starts up directly from the external flash. In addition, it can connect to other controllers that need a Wi-Fi connection by connections such as SPI, I2C or UART [12]. So, in this system, ESP32 acts as a central processor. The Fig. 3.5 below shows the actual image of the ESP32 module, and the pin diagram.

19

Fig. 3.5. Pin diagram of ESP32 Module

Tab. 3.3 describes the specifications of the pinout configuration of the ESP32 module, including parameters such as pin category, pin name, and more details.

TABLE 3.3. The pinout configurations of the ESP32 module

Pin Category Pin Name Details

Power Micro-USB, 3.3V, 5V, GND

Micro-USB: The ESP32 may be charged via a USB connector.

5V: To power the board, a regulated 5V can be given to this pin, which will then be regulated to 3.3V by the on-board regulator.

3.3V: To power the board, a regulated 3.3V can be applied to this pin.

GND stands for ground pins.

Enable EN The microcontroller is reset using the pin and button.

Analog Pins ADC1_0 to ADC1_5 and ADC2_0 to ADC2_9

12-bit 18 Channel ADC is used to measure analog voltage in the range of 0-3.3V.

DAC pins DAC1 and DAC2 Converting from digital to analog

20

Tab. 3.4 describes the specifications of the ESP32 module, including parameters such as type of microprocessor, maximum operating frequency, operating voltage, analog input pins, digital to analog converter pins, digital input/output pins, direct current on I/O and 3.3V pins, number of SRAM, the standard type of communication, Wi-Fi and Bluetooth.

Input/Output Pins

GPIO0 to GPIO39 There are 39 GPIO pins in total, which can be utilized as input or output pins. 0V (low) and 3.3V (high) voltages (high). However, pins 34 to 39 can only be utilized as inputs.

Capacitive Touch pins

T0 to T9 These ten pins can be utilized as touch pins, similar to the ones found on capacitive pads.

RTC GPIO pins

RTCIO0 to RTCIO17 The ESP32 may be woken up from deep sleep state using these 18 GPIO pins.

Serial Rx, Tx TTL serial data is received and transmitted using this device.

External Interrupts

All GPIO An interrupt can be triggered by any GPIO.

PWM All GPIO Any GPIO may be modified to work as PWM

through the software, and there are 16 distinct channels available for PWM.

VSPI GPIO23 (MOSI),

GPIO19(MISO), GPIO18(CLK) and GPIO5

(CS)

Used for SPI-1 communication.

HSPI GPIO13 (MOSI),

GPIO12(MISO), GPIO14(CLK) and

GPIO15 (CS)

Used for SPI-2 communication.

21

TABLE 3.4. ESP 32 module specifications

c. Image processing block

ESP 32 CAM

The ESP32-CAM is a tiny camera module that costs about $10 and uses the ESP32- S microprocessor. It has an integrated OV2640 camera, a few GPIOs for connecting peripherals, and a microSD card slot for storing photos captured with the camera or papers to be provided to clients [13]. The pinout and picture of the ESP32-CAM are displayed in Fig. 3.6.

Name of component Descriptions

Microprocessor Tensilica Xtensa LX6

Maximum Operating Frequency 240MHz

Operating Voltage 3.3V

Analog Input Pins 12-bit, 18 Channel

DAC Pins 8-bit, 2 Channel

Digital I/O Pins 39 (of which 34 is normal GPIO pin)

DC Current on I/O Pins 40 mA

DC Current on 3.3V Pin 50 mA

SRAM 520 KB

Communication SPI (4), I2C (2), I2S (2), CAN, UART (3)

Wi-Fi 802.11 b/g/n

Bluetooth V4.2 – Supports BLE and Classic Bluetooth

22

Fig. 3.6. ESP32-CAM pinout

The development board module ESP32-CAM is 27 mm by 40 mm in size. It frequently integrates with a camera framework that includes an ESP32 module. The ESP32-CAM can be widely used in a variety of IoT applications. It is suitable for Internet of Things applications such as wireless industrial control, smart home devices, and more.

The development board is perfect for IoT applications [8].

The pinout configuration of the ESP32 CAM's pinout is described in detail in Tab.

3.5, which also includes information on the device's size, RAM, Wi-Fi standard, interface support, TF card support, UART baud rate, image output format, antenna, security, power supply range, and operating temperature..

TABLE 3.5. ESP 32 CAM specifications

Name of component Descriptions

Size 27*40.5*4.5 (+-0.2) mm

RAM 520KB SRAM

Wi-Fi 802.11 b/g/n

Support interface UART, SPI, I2C, PWM

Support TF card Maximum 4GB

UART baud rate Default 115200 bps Image Output Format JPEG only (OV2640).

Antenna Onboard PCB antenna, gain 2dBi

Security WPA/WPA2

Power Supply Range 5v

Operating Temperature -20*C – 85*C

23

The pinout configuration of the OV2640 Camera is described in detail in Tab. 3.6, with information on parameters like resolution, array size, power supply, power consumption, maximum image transfer rate, sensitivity, S/N ratio, dynamic range, pixel size, dark current, fixed pattern noise, image area, package dimensions, output format, shutter type, color filter array, and ISP functions included..

TABLE 3.6. OV2640 specifications

Attribute Values

Resolution 2 megapixels, UXGA SVGA and below

Array Size 1600 x 1200 (UXGA)

Power Supply

Core: 1.3V DC ± 5%

Analog: 2.5~3.0V DC I/O: 1.7V to 3.3V Power Consumption

YUV mode full res & framerate: 125mW

Compressed mode full Res & framerate: 140mW Standby:600μA

Maximum Image Transfer Rate 1600×1200@15fps, SVGA@30fps, CIF@60fps

Sensitivity 0.6V/Lux-sec

S/N ratio 40dB

Dynamic Range 50dB

Pixel Size 2.2 x 2.2 μm

Dark Current 15mV/s at 60°C

Fixed Pattern Noise <1% of VPEAK-TO-PEAK

Image Area 3590 x 2684 μm

Package Dimensions 5725 x 6285 μm

Output Format YUV/RGB/Raw RGB Data

Shutter Type Rolling Shutter

Color Filter Array RGB Bayer Array

ISP Functions AE, AWB, Sharpness, Noise Reduction, Defect Reduction, Gamma, Color Saturation, Special Effects

24 d. Sensor block

The sensor block's requirements state that it is in charge of gathering environmental parameters and delivering them to the central processing unit so that they can be processed and altered to best support the growth and growth of plants in the garden. The group is interested in the ambient temperature, air humidity, and soil moisture parameters in this topic. There are numerous options available for every characteristic, each with a wide range of costs and features. For instance, there are numerous possibilities for temperature measurement needs, such the LM35, DS18B20, DHT11, DHT22,... or industrial sensors with extremely high temperature ranges and excellent accuracy. In response to the demand for sensors that can track and detect changes in environmental conditions in an inaccurate, affordable, and easy-to-use manner.

Therefore, this research has selected the following sensors:

 Using the DHT22 sensor to measures temperature and air humidity. With the requirement of measuring the humidity of the air, the DHT22 temperature sensor itself has a built-in feature, so the DHT22 sensor will be used.

 With the requirement of measuring soil moisture, this research uses a soil moisture sensor.

DHT22 sensor

The air's temperature and humidity are measured using the DHT22 sensor. The DHT22 sensor employs a 1-wire communication protocol. The sensor features an 8-bit microcontroller for serial data output of temperature and humidity values as well as a specialized NTC for temperature measurement. Figure 3.7 displays a picture of the DHT22 and its pinout.

Fig. 3.7. DHT22 sensor pinout

The DHT22 sensor can measure temperature from -40°C to 80°C and humidity from 0% to 100% with an accuracy of ±0.5°C and ±1% [14]. More detailed information is described in Tab. 3.7, in this table describes the DHT22 specifications such as operating

25

current, operating voltage, data type of output, resolution, accuracy, temperature and humidity range.

TABLE 3.7. DHT22 specifications

Name of component Descriptions

Operating Voltage 3.5V to 5.5V

Operating current 0.3mA (measuring) 60uA (standby)

Output Serial data

Temperature Range -40°C to 80°C

Humidity Range 0% to 100%

Resolution Temperature and Humidity both are 16-bit

Accuracy ±0.5°C and ±1%

Soil moisture sensor

Soil moisture sensor is used to measure soil moisture. The two sensors of the sensor are plugged into the ground to detect moisture. Use wires between the sensor and the converter module. The Fig. 3.8 shows the image of soil moisture sensor and its pinout.

Information on soil moisture will be read and sent to the conversion module. The converter module is composed of a LM393 comparator IC, 4 100-ohm bonding resistors and 2 paste capacitors. Variable resistor function threshold compares with the signal of soil moisture read from the sensor. Threshold comparison and sensor signal will be 2 inputs of LM393 comparator IC. When the humidity is lower than the preset threshold, the output of the IC is high (1), otherwise low (0) [15].

Fig. 3.8. Soil moisture sensor

26

Tab. 3.8 describes the soil moisture sensor specifications such as type of microprocessor, operating current, operating voltage, PCB size, output digital and analog.

TABLE 3.8. soil moisture specifications

Name of component Descriptions

Microprocessor LM393 based design

Operating Voltage 3.3V to 5V DC

Operating Current 15mA

Output Digital 0V to 5V, Adjustable trigger level from preset Output Analog 0V to 5V based on infrared radiation from fire

flame falling on the sensor

PCB Size 3.2cm x 1.4cm

e. Actuator block

Required actuator: When the media readings from the sensor do not match the growth and development of the plant, the central processing block will affect the actuator to regulate Adjust the parameters of the garden through the operation of the equipment in this block.

 When it is necessary to act on soil moisture, a water pump system will be used.

 When it is necessary to impact the ambient temperature and humidity, fans and heating lamps will be used.

 Module Stepper Motor A4988, STP-43D2033 Stepping motor will be supported for plant tree system.

Arduino CNC Shield V3

The Arduino CNC Shield V3 is an Arduino UNO R3 expansion board for controlling DIY CNC machines. It can be used in a CNC milling machine, a laser cutting machine, a plotter, a 3D printer, or any project that demands accurate stepper motor control.

Actual image of Arduino CNC Shield V3 shown in Fig. 3.9.

27

Fig. 3.9. Arduino CNC Shield V3

There are 3 main components needed to get the CNC Shield up and running: CNC Shield, Stepper Drivers, and ESP 32 module [16].

Module Stepper Motor A4988

A4988 is a micro DMOS controller with transducer and overcurrent protection. A4988 can drive bipolar stepper motors with currents up to 2A per winding [17].

o Maximum current can be adjusted via a resistor allowing the stepper motor to operate at maximum power

o Interrupts protection during over temperature, over voltage and over current

o Short circuit protection

Tab. 3.9 provides some of the requirements needed to operate a motor, such as stepper control mode, operating voltage, maximum supply current per phase, and module PCB size.

TABLE 3.9. Module steeper control A4988 specifications

Name of component Descriptions

Microprocessor Module Stepper Motor A4988

Control modes full step, haft step, 1/4, 1/8, 1/16.

Operating voltage 8V ~ 35V

Continuous current per phase 1A ~ 2A

PCB Size 15.24 x 20.32cm

Fig. 3.10 depicts a wiring schematic for connecting wires from the A4988 to the CNC shield circuit mentioned above for simpler step control. In this case, this research utilizes a two-step motor to operate the nozzle in the garden's X and Y axis.

28

 Circuit connected to the microcontroller

Fig. 3.10. Attach A4988 module to CNC shield and wire 2 step motors

Need to supply control voltage (3-5.5V) to two pins VDD and GND, and voltage source for the motor (8-35V) connected to two pins VMOT and GND. The power supplies should have capacitors placed close to the module, and be able to provide enough expected current (max 4A to supply the motor) [17]. Moreover, the module can be connected to 4- wire, 6-wire, 8-wire stepper motors.

Tab. 3.10 displays the micro step techniques that the A4988 module is able to achieve. Please keep in mind that my group will float the MS1, MS2, and MS3 pins so that the step motor may be operated in full-step mode.

TABLE 3.10. Number of step control

MS1 MS2 MS3 Step

Low Low Low Full step

High Low Low 1/2 step

Low High Low 1/4 step

High Low High 1/8 step

High High High 1/16 step

29

Fig. 3.11 represents the A4988 module's output and input. It is important to note that in order for the circuit to function, the ENABLE pin must be connected to the GND pin in order to activate A4988.

Fig. 3.11. Module Stepper Motor A4988 schematic

Dual Full Bridge Driver - L298

Many microcontrollers work on low-voltage also current so that it is not able to operate the motor. To fix this issue, the need for the motor driver is crucial so that additional power is connected to the L298 motor module to provide the output power necessary to start and run the motor [18]. Actual image of Motor Driver Module shown in Fig. 3.12.

Fig. 3.12. L298 Motor Driver Module

30

L298 offers a lot of excellent characteristics such as low saturation voltage, excessive current protection, and so on. It also has a wide range of applications, include robotics, automatic security door systems, CNC machine and so on.

Tab. 3.11 depicts the L298 is a 15-pin IC, as illustrated in the L298 pin diagram, with each pin's function detailed below.

TABLE 3.11. Pin functions of L298

Pin Name Function

OUT1, OUT 2 Control direction of DC motor 1.

12 V Jumper Enable 5V regulator on board.

Vs Voltage Supply for DC motor

OUT3, OUT4 Control direction of DC motor 2.

GND Ground.

Vss Voltage Supply for L298 circuit.

ENA DC motor 1 activate.

ENB DC motor 2 activate.

IN1, IN2, IN3, IN4 Input from microcontroller.

The Tab. 3.12 below summarizes some of the technical characteristics, such as motor driver, output channels, max operating voltage, peak output current, maximum and minimum logic state voltage.

TABLE 3.12. L298 module technical specifications

Name of component Descriptions

Motor Driver LM298N based design

Output Channels 2

Max operating voltage 46V

Peak output Current 2A

Min logic state voltage 4.5V

Max logic state voltage 7V

31

Because the L298N is used to drive inductive or magnetic loads, voltage spikes in the output are possible. Internal parasitic or Flywheel diodes should be used to prevent voltage spikes. But it lacks them. These flywheel diodes are used externally.They can be 1N5819 Schottky diodes or 1N4001 rectifier diodes.

Enable pins (ENA, ENB) and current sense pins are provided on each bridge (CSA, CSB). Current sensing pins can be grounded, but the thesis can also use a low-value resistor to make the voltage reading proportionate to the current. Both enable pins can be utilized at the same time, making all outputs active at the same time. All four inputs and enable pins operate on 5v TTL logic, making microcontroller connections simple as shown in Fig.

3.13 below.

Fig. 3.13. Schematic of L298 circuit

Module Relay

Relay is an electrical switch, and it has two states: open and close. They are divided into two categories: relay activates at low level trigger (PNP transistor) or relay activates at high level trigger (NPN transistor).

Normally relay consists of 6 pins. In which, three pins are used for jacking (including VCC, GND, IN) and the remaining three pins are connected to power sources COM, NO, NC. More detailed information is described in Fig. 3.14, it describes pinout diagram and schematic of relay module

Một phần của tài liệu Iot - Based automatic monitoring and control system for agriculture (Trang 30 - 54)

Tải bản đầy đủ (PDF)

(89 trang)