User:Seoul Laing Win/sandbox/Seoul Laing Win(HND-1332EEE)

Project Title: Automatic Greens-keeper

Project Aim

The purpose of this project is to practice the skills and knowledge that I learned during this Higher National Diploma course in the Electrical and Electronics Engineering program and make good use of it. The aim of this project is to create an automatic system that takes cares of the grass fields and shine electric lights when there is no sunlight. The automatic soil moisturizer in the project will detect the humidity of the soil and the sprinklers will work when needed. The automatic water filling system will fill the water tank that supplies the sprinklers. The automatic outdoor lights will be turned on as soon as there is darkness. All these systems are aimed for the convenience of people. People do not need to do these things manually anymore and can focus on other important tasks.

Project Brief Since it is all automatic system, all we need to do for the system to start is to give power. As soon as there is power in the system, the automatic outdoor light system will try to detect the sunlight. If there is not enough sunlight, the sytem will start. If it is daytime and there is enough sunlight this system will not work. In cloudy days the system will not initiate because there is still some sunlight. The system will work in foggy days and in rainy days because rainy days does not have enough sunlight. Next system is the automatic soil moisturizing system. This system will find out if the soil have enough moisture. If the soil does not have enough water in it, the system will start processing. If there is enough water in the soil the system will not need to work. Sensors will be put in the soil depending on the area of the ground. The signal will be sent to all the sensors and if the sensors cannot sense the moisture, the signal will go to the micro porcessor and start the sprinklers to pour water on the grass. The water that is used here will be from the watertank, which is automatically filled if it is not full enough. Which leads to the automatic water water filling system. The automatic water filling system will start working when the water level is low. When the water touch the upper sensor, the water filling will stop otherwise, the water will flow into the tank with the help of motors.

Project Objectives

The objectives of the project includes: To detect the humidity of the soil. To sprinkle with water if the soil is dry enough. To calculate the amount of light from the sun To light up the lampposts when the sun goes down. To detect the amount of water left in the water tank To fill water automatically if the water tank is empty To enable the user to control all three systems with ease and simple

Mindmap of the project systems

I. The Automatic Outdoor Light System Fig. 1.1 The circuit diagram of the automatic outdoor light system

Flow Chart of the Automatic Outdoor Light System

Fig 2.1 Flow Chart of the Automatic Outdoor Light System

The components used in this circuit includes: LDR IC 741 NPN Transistor 945 Capacitor 1000μF Diode (IN 4007) Resistor 470Ω Resistor 100K Ω Resistor 8.2K Ω Step Down Transformer 12V Preset 100K Ω Relay LED Universal Card Connecting Wire

In this circuit, the IC 741 works as a comparator. The light is sensed with LDR. When the sun comes up, the output of the comparator will be low and transistor will not have enough base bias Volt. Therefore the transistor will not work. As well as the relay. When the sun goes down, the output of the comparator will be high and the transistor will have base bias voltage. The current will flow from emitter to collector and then transistor will start working. The relay will then enable the power and the LED to light up. When the dark fades and the light comes, the output of the comparator will then change back to LOW and this will turn back to the first condition and the LEDs will close. We need to make sure there is no other light effecting on the LDR except from the sunlight. Capacitor C1 will prevent this. It makes sure that there is no mistaking other lights from the sunlight. When there is only a little sunlight, for the LEDs to turn on we have to adjust the VR1. By using this circuit, we can save electricity, energy and money. This system can be used anywhere required. In the streets, golf courses, playgrounds and other remote places where it is hard for people to open and close the light switch every single day. We can use this system to lessen the load of people.

II. Automatic Soil Moisturizing System

Fig 1.2 Circuit Diagram of Soil Moisturizing System

Flow Chart of the Soil Moisturing System

Fig. 2.2 Flow chart of the soil moisturizing system

This soil moisturing system works as a process that control sprinklers to pour water on the grass fields to make them always green. The systems include sensors to sense the water saturation in the soil. This process can be used in farms, golf courses, fields and etc.

The components included in this circuit are: 12V transformer 3 diodes 1 capacitor 100μF/50V 1 capacitor 10μF/50V 10K,18K,1K Ω Resistors Transistor (C945) Variable Resistor Timer IC (555) Sensor IC (Inverter IC 7404) LED Test Point Water Pump Soldering Station

The supply needed fo this circuit will be obtained from the 12V transformer and for the DC supply we use the Bridge Rectifier. The supply goes from the Bridge Rectifier to the IC 7812. Since the supply is raw DC there are some noises. To filter this, we have to use filter 1000μF/ 50V. To make sure, we use LED. Then, the 555 IC is also supplied. The 555 IC is used as timer IC and for Astable circuit. From the positive output of IC, the relay driver transistor is connected. The relay driver enables the relay and makes the water pump motor works. The two sensors A and B are stuck into the ground. For measurement, we use sensor IC 7404. If the soil is moist enough, the sensors A and B will have a current flow. When that happens, the current will reverse flow and the timer pin no.4 will have a LOW voltage supply which will make the Astable circuit Reset and the relay will not work as well as the water pump motor. If the soil does not have enough water and get dry, the sensors A and B will not flow current to each other. There is a 1K resistor connected between the input of the sensor and the rod stuck in the soil so the input of the sensor IC will have LOW voltage. Therefore the pin no.4 of the timer IC will have a HIGH voltage and the Astable circuit will work. Then the transistor will be powered and the relay and the water pump motor will be turned on. To conclude, if the soil is moist enough, the water pump motor will be turned on and if the soil is not moist enough, the water pump motor will not be turned on. The water will come through the water pump and the sprinklers to supply water to the grass.

II. Automatic Water Filling System

Fig 1.3 Circuit Diagram of the Water Filling System

Flow Chart of the Automatic Water Filling System

Fig. 2.3 Flow Chart for the automatic water filling system

Other Technology There are other ways to build this system such as arduino, Raspberry PI or using other components then the components used in this system. Arduino is very famous nowadays for it is very convienient and easy to use not only for studying purposes but also for daily use. Arduino has lots of boards namely: Arduino Uno, Arduino Leonardo, Arduino Due, Arduino Yun, Arduino micro, Arduino Esplora, Arduino Mega ADK, Arduino Robot and etc. The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

The arduino uno different from former arduikno borads since it does not contain the FTDI USB-to-(one after the other) driver chip. It uses the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-(one after the other) converter. Revision 2 of the Uno board has a resistor pulling the 8U2 HWB line to ground, making it easier to put into DFU mode. Revision 3 of the board has the following new features:

1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to the RESET pin, the IOREF that allow the shields to change to fit the voltage gave/given from the board. In future, shields will be compatible with both the board that uses the AVR, which operates with 5V and with the Arduino Due that operates with 3.3V. The second one is a not connected pin, that is reserved for future purposes. Stronger RESET circuit. Atmega 16U2 replace the 8U2. The following are some examples of arduino boards

Components in the arduino include: Microcontroller	ATmega328 Operating Voltage	5V Input Voltage (recommended)	7-12V Input Voltage (limits)	6-20V Digital I/O Pins	14 (of which 6 provide PWM output) Analog Input Pins	6 DC Current per I/O Pin	40 mA DC Current for 3.3V Pin	50 mA Flash Memory	32 KB (ATmega328) of which 0.5 KB used by boot-loader SRAM	2 KB (ATmega328) EEPROM	1 KB (ATmega328) Clock Speed	16 MHz Length	68.6 mm Width	53.4 mm Weight	25 g

Power supply for arduino The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. Plugging a 2.1mm center-positive plug into the board’s power jack can connect the adapter. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts. The power pins are as follows: VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin. 5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it. 3V3. A 3.3-volt supply generated by the on-board regulator. Maximum current draw is 50 mA. GND. Ground pins. IOREF. This pin on the Arduino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs for working with the 5V or 3.3V.

Memory The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

Input and Output Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode, digitalWrite, and digitalRead functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions: Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt function for details. PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite function. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library. LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off. The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference function. Additionally, some pins have specialized functionality: TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library. There are a couple of other pins on the board: AREF. Reference voltage for the analog inputs. Used with analogReference. Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields, which block the one on the board.

Communication The Arduino Uno has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels this serial communication over USB and appears as a virtual com port to software on the computer. The '16U2 firmware uses the standard USB COM drivers, and no external driver is needed. However, on Windows, a .inf file is required. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the Arduino board. The RX and TX LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and USB connection to the computer (but not for serial communication on pins 0 and 1). A SoftwareSerial library allows for serial communication on any of the Uno's digital pins. The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire library to simplify use of the I2C bus; see the documentation for details. For SPI communication, use the SPI library.

Programming The Arduino Uno can be programmed with the Arduino software. Select Arduino Uno from the Tools > Board menu (according to the microcontroller on your board). For details, see the reference and tutorials. The ATmega328 on the Arduino Uno comes preburned with a bootloader that allows you to upload new code to it without the use of an external hardware programmer. It communicates using the original STK500 protocol (reference, C header files). You can also bypass the bootloader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar; see these instructions for details. The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available. The ATmega16U2/8U2 is loaded with a DFU bootloader, which can be activated by: On Rev1 boards: connecting the solder jumper on the back of the board (near the map of Italy) and then resetting the 8U2. On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to ground, making it easier to put into DFU mode. You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and Linux) to load a new firmware. Or you can use the ISP header with an external programmer (overwriting the DFU bootloader). See this user-contributed tutorial for more information.

Automatic (Software) Reset Rather than requiring a physical press of the reset button before an upload, the Arduino Uno is designed in a way that allows it to be reset by software running on a connected computer. One of the hardware flow control lines (DTR) of the ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino software uses this capability to allow you to upload code by simply pressing the upload button in the Arduino environment. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload. This setup has other implications. When the Uno is connected to either a computer running Mac OS X or Linux, it resets each time a connection is made to it from software (via USB). For the following half-second or so, the bootloader is running on the Uno. While it is programmed to ignore malformed data (i.e. anything besides an upload of new code), it will intercept the first few bytes of data sent to the board after a connection is opened. If a sketch running on the board receives one-time configuration or other data when it first starts, make sure that the software with which it communicates waits a second after opening the connection and before sending this data. The Uno contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line.

USB Overcurrent Protection The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

Physical Characteristics The maximum length and width of the Uno PCB are 2.7 and 2.1 inches respectively, with the USB connector and power jack extending beyond the former dimension. Four screw holes allow the board to be attached to a surface or case. Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins.

That was the schamatic and details of arduino. Before using a product we need to know the details of that product. Therefore we have to read all this and try to understand before using it. The following ways are how to do this project with arduino.

Automatic Outdoor Light System

Things we need for this are: Arduino Uno LED LDR

Led is in pin 13 because it has a resistor included for smd LED, if you want to use another pin, use 120ohm resistors to protect Arduino board and leds. And the LDR is connected with the ground and Analog pin 0 because it is analoy input

Circuit Diagram for the Automatic Outdoor Light System with arduino

We can add resistors and add more LED lights for the real usage.

The Code for Automatic Outdoor Light System with Arduino

Automatic Soil Moisturizing System

Things we need for this circuit are:

Arduino Uno Moisture sensor Wires

One node of the soil moisture sensor will be connected to the AREF of the arduino. The other node will be connected to the Analog input pin 0 of the arduino and the last node will be connected to the GND of the arduino. This is the simple way to connect the soil moisture sensor to the arduino

Circuit Diagram for the Automatic Outdoor Light System with arduino

The Code for Automatic Outdoor Light System with Arduino

Outputs When sensor is in the air, Sensor Value = 0 When sensor is in the dry soil, 0 < Sensor Value < 300 First try	=	36 Second try	=	73 Third try	=	53 Fourth try	=	93 When sensor is in the soil, 300 < Sensor Value < 700 First try	=	432 Second try	=	654 Third try	=	376 Fourth try	=	445 When sensor is in the water, Sensor Value > 700 First try	=	835 Second try	=	931 Third try	=	946 Fourth try	=	987

Other Factors One disadvantage of this circuit is that when we power it for a long time, the moisture sensor can be corroded and we have to buy new one. This happens:

To prevent this from happening we can program the arduino to sense only for a limited time. To do that, we have to change the code and add a potentiometer.

Circuit Diagram for improved Soil Moisturizing System with arduino

Improved code for Automatic Soil Moisturizing System with arduino

This is the code so that the soil moisture sensor will only work every one-minute. We can change the amount of time delay and set it for longer or shorter time. Automatic Waterfilling System with Arduino

Things we need for this circuit are: Arduino Uno Servo motor 10K resistor Sensor Sensor Input

One pin servo-motor is connected to the no.9 slot of the digital pins of the arduino. Another pin is connected to the 5V slot. The last pin is connected to the GND slot. The sensor is connected to the sensor input circuit. The sensor input circuit has two pins. One pin goes into the 5V slot together with the servomotor and the other goes into the analog 0 slot. The 10K resistor is inbetween this pin and the last pin of the servo motor.

Circuit Diagram for Automatic Waterfilling System with Arduino

The Code for Automatic Water Filling System with Arduino

Advantages of using Arduino Boards

The main advantage of the Arduino is that it makes prototyping very convienient and time efficient. We can connect all other components to it easily. We do not need a lot of time assembling and finding components anymore. We can get free codes that are already written in the arduino application. We can also get many free libraries that we can use while coding. So that we don't need time to write very complicated and sophisticated codes. Arduino takes a lot of the complexity and difficulty out of making something work and lets you concentrate on the "interesting" part. Since we are students it is better for us. In producing real-life products the we need to make a custom circuit board to lower the cost and make the circuit smaller and lower power consumption than the arduino. Because arduino also includes other functions that we don’t need, they are excess for us.

References