It has three sections: sensor, microcontroller and water-pump motor circuits.The sensor circuit detects soil condition by measuring the soil voltage and comparing it with a reference voltage. A BC548 transistor is used to drive relay RL1. DC motor pump M1 is connected between the normally-open (N/O) pin and pole of the relay.
If the soil is dry, i.e., the ground voltage is greater than the reference voltage, the microcontroller (ATmega16) gives a logic-1 output signal. The transistor conducts to energise relay RL1 (as its pole pin comes in contact with the N/O pin) and the motor turns on with power supply provided from the battery.
When the soil is wet, i.e., soil voltage is less than the reference voltage, the logic-0 signal of the microcontroller turns the transistor, and hence the motor switches ‘off.’
The motor pump status (‘on’ or ‘off’) and soil condition (‘dry’ or ‘wet’) are displayed on LCD1.
The software was developed using four tools: CodeVisionAVR, Proteus, SinaProg and PCB Wizard.
The coding and hex file were generated using the Evaluation version of CodeVisionAVR tool. In CodevisionAVR, open a new project and select ‘Target AVR Chip’ as ATmega. Select the ATmega16 chip with 8MHz clock frequency, followed by output port as Port B0. Then select ‘ADC Enabled’ option and set voltage reference as AREF pin with 1000kHz clock. Next, select ‘Enable Alphanumeric LCD Support’ option followed by Port C (PC0-RP6) with 16 characters.
In ‘Program’ menu, select ‘Generate, Save and Exit’ option. Save the file three times with the same name but different extensions as indicated by the software. In the coding window, start code within the while loop to read the sensor output signal at AD0 pin of the microcontroller. Next, put a condition if reference voltage 2V is greater than or equal to the sensor signal. Then build the entire project file to produce the hex file.
To simulate the code, double-click the controller (U1) and insert the hex file. Simulation runs when the sensed voltage is higher than the reference voltage (2V). The LCD shows that the soil is dry and the motor is ‘on.’ When the sensed voltage is less than the reference voltage, the LCD shows the soil as ‘wet’ and the motor as ‘off.’
USBasp is a USB in-circuit programmer for Atmel AVR controllers, similar to AVRuPro+ board. It consists of an ATMega88 or an ATMega8 and a few passive components. The programmer uses a firmware-only USB driver, requiring no particular USB controller. It is used along with SinaProg software to burn the hex file into the controller.
SinaProg software is used to burn the hex code and set fuse bits for the AVR microcontroller. It is a good software tool for hobbyists and experimenters alike. Connect the AVR USB programmer such as USBasp to your PC. Load the hex code, select the device programmer and set the fuses (Int.2MHz)
THE SOURCE CODE AND TEMPLATE
First, program the microcontroller with the hex code and place it on the PCB. Connect the moisture sensor to the circuit, ensuring that Vcc, GND and D0 pins are properly connected. Note that the moisture sensor includes YL-38 and YL-69 modules. YL-38 is basically a driver and isolator for YL-69 moisture probe (Fig. 8). YL-38 has four pins (Vcc, GND, D0 and A0) on one side, and two pins on the other side, which are used to connect the prongs/probes (YL-69) that are to be inserted into the soil. D0 pin is used for digital output and A0 pin (not used in this project) is used for analogue output. The module also has a potentiometer to calibrate the sensitivity of the sensor.
Connect a 9V battery to the circuit. Regulator IC 7805 provides regulated 5V output to run the circuit. Note that you can also use a 12V DC power supply depending on your motor pump. During testing at EFY Lab, a 12V DC supply was used for the water motor pump.
To test the project, insert the sensor probe into the soil. Switch on the power supply to the circuit. If the soil is dry, the motor will automatically turn on and the LCD will show ‘Dry soil, Motor on’ message.
You can further extend this project to make a practical drip irrigation system. Typically, a drip irrigation system requires some special components and control systems. For example, you may need distribution lines (both large- and small-diameter pipes and pipe fittings), electronic or hydraulic control valves, poly fittings and accessories (to make connections), emitters, drippers or spray heads depending on the design and application.
Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
1 post • Page 1 of 1