Get help now

Chapter Two

Updated January 17, 2019

Download Paper

File format: .pdf, .doc, available for editing

Chapter Two essay

Get help to write your own 100% unique essay

Get custom paper

78 writers are online and ready to chat

This essay has been submitted to us by a student. This is not an example of the work written by our writers.

Chapter Two: ARDUINO 2.1 Introduction 2.1.1 Meaning of Term Arduino Arduino is a platform used for making electronics projects.

Arduino consist of two units in whole , one is the physical or hardware programmable circuit board (often referred to as microcontroller) and second is the piece of software, or IDE (Integrated development environment) that runs on computer used to write and upload computer code to the physical board. Arduino works as brain of the projects made on it ,and act as the controller of the project. Arduino was first made at Ivera interaction Design Institute as an easy tool for fast connections for students without a background in electronics and programming. Unlike most older programmable circuits boards the arduino does not require a separate partof hardware in order to program a new code onto board you can just use a USB cable. Arduino uses a basic version of c++ , making it simpler to learn the program. Arduino boards offers a typical form factor that breaks out the function of microcontroller into a more variable package.

2.1.2 ARDUINO BOARDS There are different types of arduino boards available according to the processor, memory, digital I/O, analog I/O used in these boards. The list of arduino board include : *Arduino Uno(R3) *Lilypad Arduino *Red Board *Arduino Mega(R3) *Arduino Leonardo Arduino Board Processor Memory Digital I/O Analogue I/O Arduino Uno 16Mhz ATmega328 2KB SRAM, 32KB flash 14 6 input, 0 output Arduino Due 84MHz AT91SAM3X8E 96KB SRAM, 512KB flash 54 12 input, 2 output Arduino Mega 16MHz ATmega2560 8KB SRAM, 256KB flash 54 16 input, 0 output Arduino Leonardo 16MHz ATmega32u4 2.5KB SRAM, 32KB flash 20 12 input, 0 output TABLE 2.1(Different Arduino Boards) The term “open source hardware” in defining of arduino means that these arduino boards can be modified further for more form factors and functionality. There can be more derivatives of these boards. 2.2 Board Used (Arduino Uno R3) 2.2.1 Reason To Choose Arduino Uno : The Arduino Uno R3 is a best choice for us because it is the best for the students to get started initially in this field of Arduino. It has got everything which are useful for initial start such has 14 digital input/output pins out of these 14 pins, 6 can be used as PWM output pins. 6 Analog input pins, a USB connection , Power Jack, Reset Button , Power Led Indicator, TX RX Leds, Main IC, Voltage ,Regulator.

2.2.2 Components of Arduino FIGURE 2.1(ARDUINO BOARD) 1) Power USB (USB Connector) Power USB acts as a way to connect the power source with Arduino . If the power supply is coming from the USB then we use power USB as a connector. It is also used to load code into Arduino board. 2) Barrel Jack (Power Connector) Barrel Jack is also used as a way to connect power source with Arduino .

If the power supply is coming from wall power then we use Barrel Jack as a connector. Do not use the power supply greater than 20 volts. If the supply is greater than 20 volts there is overpowering of Aduino and due to this Arduino can destroy. Suitable operating voltage for most Arduino boards is between 6 and 12 volts. PINS The pins are the places on Arduino where we connect the wire coming from breadboard in order to implement a circuit.

Made up of black plastics headers that allows you to just plug a wire right into the board. 3) Ground Pins (GND) There are two ground pins on Arduino which are used to ground the circuit we are making on breadboard. 4) 5V Pin The 5V pin supplies a power of 5 volt which is used to drive different components such as sensors. 5) 3.3V Pin The 3.3V pin supplies a power of 3.3 volt which is used to drive different components such as sensors. 6) Analog Pins The Analog pins as shown in Arduino given by “Analog In” from pin A0 to pin A5 on UNO used only as Analog input pins. The pins are used to read signal/values from the the Analog sensor and convert it to a digital value that is understandable by microcontroller of Arduino.

Each of analog input pins provide 10 bits of resolution(i.e 1024 different values of sensor). By default they measure from ground to 5 volts though it is possible to change upper end of this range by using AREF pin. A4 and A5 are also known as SDA(Serial data) and SCL(Serial clock) pins for TWI communication using wire library. These are the two wires for communicate using I2C bus between I2C master and I2C device , and hence communication is know as Two wire interface.

7) Digital Pins The Digital pins as shown in Arduino given by “Digital (PWM~)” from pin 0 to pin 13 on UNO can be used in both ways as Digital input pins or Digital output pins. Out of these 14 pins some are also used as PWM output pins, Interrupts pins(2 and 3) to trigger interrupt at low values or rising edge or falling edge or due to change in value, pin 13 an inbuilt led and TX RX pins(used for serial communication). 8) PWM Pins The PWM output pins denoted by the symbol of “~” with the some of the Digital pins on UNO. These pins are 5, 6, 9, 10, 11 on UNO. These pins normally acts as Digital pins but can also be used as PWM pins. The pulse width modulation allow us to vary how much time the signal is high in analog fashion.

The PWM pins are able to simulate analog output. 9) Analog Reference(AREF) AREF pins used to set an external refrence voltage as an limit for the Analog input pins. 10) Reset Button The Reset Button on Arduino will act as a switch. When the switch is pressed it will temporarily connects the Reset pin to the ground and restart any code that is loaded in arduino at that time. This pin can be very useful if your code does not repeat but you want to test it multiple times. Reset button will reset microcontroller when low.

11) Power Led Indicator The Power led indicator is the small led located just below the point on the Board where UNO is written. This led always light up whenever we plug the Arduino to the Power source. If this light does not turn on there is a good chance that there is a fault in the circuit. 12) TX RX LEDs The word TX stands for transmitter and RX stands for receiver.

These types of definition of TX and RX are frequently used in electronics to indicate pins responsible for serial communication. In this Arduino board there are two times these TX and RX appear i.e one time by the digital pins 0 and 1 , and second times on the indicator leds. These Leds will provide the information when the Arduino is transmitting data or receiving data by glowing that Led at the moment (for ex : when we are loading new program onto the board RX led will glow). 13) MAIN IC (Microcontroller IC ATMEGA328) The black thing with metal legs is know as the main IC also known as ATmega328 is a microcontroller which is the Brain of arduino. The IC is made by ATMEL. Main focus to understand that the Arduino board includes a microcontroller, and this microcontroller is what executes the program instruction.

If you know this the there is a difference between Arduino and ATmega328. The ATmega328 microcontroller is the microcontroller used in Arduino UNO as a controller. ATmega328 belongs to family AVR , it is an 8-bit device means it has data bus of 8 bit, internal registers are designed to handle 8 parallel data signals. ATmega328 has three types of memory: *Flash memory: 32KB nonvolatile memory.(for storing codes) *SRAM memory: 2KB volatile memory.(for storing variables used at time of running the code) *EEPROM memory: 1KB nonvolatile memory.(for storing data that will be needed Arduino is switched on) ?Pin diagram of Atmega328 FIGURE 2.2(ATMEGA 328P PIN DIAGRAM) Pin Number Description Function 1 PC6 Reset 2 PD0 Digital Pin (RX) 3 PD1 Digital Pin (TX) 4 PD2 Digital Pin 5 PD3 Digital Pin (PWM) 6 PD4 Digital Pin 7 Vcc Positive Voltage (Power) 8 GND Ground 9 XTAL 1 Crystal Oscillator 10 XTAL 2 Crystal Oscillator 11 PD5 Digital Pin (PWM) 12 PD6 Digital Pin (PWM) 13 PD7 Digital Pin 14 PB0 Digital Pin 15 PB1 Digital Pin (PWM) 16 PB2 Digital Pin (PWM) 17 PB3 Digital Pin (PWM) 18 PB4 Digital Pin 19 PB5 Digital Pin 20 AVCC Positive voltage for ADC (power) 21 AREF Reference Voltage 22 GND Ground 23 PC0 Analog Input 24 PC1 Analog Input 25 PC2 Analog Input 26 PC3 Analog Input 27 PC4 Analog Input 28 PC5 Analog Input TABLE 2.2(ATMEGA 328P PIN DESCRIPTION) ?Features Of Atmega328 CPU 8-bit AVR Number of Pins 28 Operating Voltage (V) +1.8 V TO +5.5V Number of programmable I/O lines 23 Communication Interface Master/Slave SPI Serial Interface(17,18,19 PINS) Can be used for programming this controller Programmable Serial USART(2,3 PINS) Can be used for programming this controller Two-wire Serial Interface(27,28 PINS)Can be used to connect peripheral devices like Servos, sensors and memory devices JTAG Interface Not available ADC Module 6channels, 10-bit resolution ADC Timer Module Two 8-bit counters with Separate Prescaler and compare mode, One 16-bit counter with Separate Prescaler,compare mode and capture mode. Analog Comparators 1(12,13 PINS) DAC Module Nil PWM channels 6 External Oscillator 0-4MHz @ 1.8V to 5.5V 0-10MHz @ 2.7V to 5.5V 0-20MHz @ 4.5V to 5.5V Internal Oscillator 8MHz Calibrated Internal Oscillator Program Memory Type Flash Program Memory or Flash memory 32Kbytes10000 write/erase cycles CPU Speed 1MIPS for 1MHz RAM 2Kbytes Internal SRAM EEPROM 1Kbytes EEPROM Watchdog Timer Programmable Watchdog Timer with Separate On-chip Oscillator Program Lock Yes Power Save Modes Six ModesIdle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby Operating Temperature -40°C to +105°C(+105 being absolute maximum, -40 being absolute minimum) TABLE 2.3(FEATURES OF ATMEGA 328P) 14) Crystal Oscillator The silver colour plate behind barrel jack is known as crystal oscillator. Crystal oscillator is available with a frequency of 16 MHZ.

In Our project we have main use of this oscillator in calculating time taken by the level sensor signal in twice leg travel ,first leg before deflection from object and second leg after deflection from the object. 14) Voltage Regulator The work of voltage regulator is similar as it name suggest. It will fix the voltage entering the Arduino. If the voltage greater thanvoltage given by voltage regulator trys to enter Arduino , it will be stopped by this Voltage regulator.

15) Icsp pin Icsp pin generally consist of MOSI, MISO, RESET, VCC, GND, SCK all these things together makes icsp pin which is nothing but AVR (small program header for arduino). The oher name given to iscp pin is SPI(serial peripheral interface). SPI can be taken as expansion of the output. The output device is a slave to the master of SPI bus which is used for programming this microcontroller. 2.3 Arduino Advantages 1) Inexpensive: Due to this less cost of Arduino can be used by students easily to make DIY PROJECTS.

2)Less hardware: During the period of code uploading it does not require extra hardware, uses a boot loader of 0.5 kb of space which allow program to burn directly to ckt. 3)Compatibility : Can be used with all types of operating system such as windows, linux etc. 4)Open Source Hardware : This is the thing which help the user to make their individual kit by taking guide with available kit. 5)Open Source Software : This is the thing which help the programmers to merge the Arduino code with existing programming language libraries. 6)Convenient : All the peoples who are using arduino for the first time it is easy to understand and people get used to it in less time due to this quality.

Therefore people who are starting from their first project are generally advised to work on Arduino than any other microntroller. 7)Easy Connections : The uno can be connected easily with the computer cpu by using the usb port of cpu and can transfer code by using serial communication. The serial communication is decided by the transmitter and receiver pins on the Arduino. 2.4 Arduino Architecture FIGURE 2.3(ARDUINO ARCHITECTURE) Arduino processor uses the architecture in which the program code and program data have individual separate memory.

There are two memories one is program memory and the other one is data memory. The code is stored in the memory which is known as flash program memory and the data is stored in the data memory. Atmega 328 has 32kb of flash memory for storing code out of this 32kb , 0.5kb is used for the storing code by the bootloader, 2kb of SRAM, 1kb of EEPROM and operates with clock speed of 15MHZ. 2.5 Programming of Arduino In Arduino is the program can be directly loaded to the device without usng any hardware programmer to burn the program, this all is done by 0.5kb bootloader which makes the program to burn into the circuit directly. All we need for direct loading is Arduino software IDE on which code is written. ?STEPS TO PROGRAM ARDUINO 1) Declaration of variables.

2) Inialization: written in setup() function. 3) Control code: written in loop() function. 4) Sketch is saved with .ino extension.(in sketch book directory). 5) Choose the proper board from tool menu and the serial port number.

And then click 6) on the upload button then code uploaded by bootloader onto the microcontroller. ?Arduino Basic Functions • digitalRead(pin): Reads the digital value at the given pin. • digitalWrite(pin, value): Writes the digital value to the given pin. • pinMode(pin, mode): Sets the pin to input or output mode.

• analogRead(pin): Reads and returns the value. • analogWrite(pin, value): Writes the value to that pin. • serial.begin(baud rate): Sets the beginning of serial communication by setting the bit rate. 2.6 Making of Arduino Parts needed to make an Arduino are Breadboard, a Led, a Power Jack, a IC socket, a Microcontroller atmega328, few resistors , 2 capacitors, 2 regulators. ?STEPS TO MAKE 1) First of all put Power Jack and IC socket on board by soldering. 2) Then by using capacitor and regulators make 5v and 3.3 v regulator ckts.

3) Make power connection to MCU pins. 4) The reset pin of IC socket attached with 10k resistor and then to reset puch button. 5) Attach crystal oscillator to pins 9, 10. 6) Connect the Power led. 7) Attach the pins with female headers.

8) Alternative should be kept with 6 male headers to upload program. 9) Upload the code on MCU of readymade Arduino. Chapter Three : MOISTURE MEASUREMENT 3.1 Soil Moisture Sensor This sensor can be used to test the moisture of soil, when soil is having water shortage, the module output is at high level, else the output is at low level. By using this sensor one can automatically water the flower plant, or any otherplants requiring automatic watering technique. Module triple output mode, digital output is simple, analog output more accurate, serial output with exact readings. 3.1.1 Features Sensitivity adjustable.

Has fixed bolt hole, convenient installation. Threshold level can be configured. Module triple output mode, digital output is simple, analog output more accurate, serial output with exact readings. 3.1.2 Applications Agriculture Landscape irrigation 3.1.3 Specifications Parameter Value Operating Voltage +5v dc regulated Soil moisture Digital value is indicated by out pin Table 3.1 (pin description of fc-28) 3.2 Using The Sensor Connect +5v to pin 2 and ground to pin 5 and 6. Pin 4 and 5 should be connected to particular transmitter and receiver pin of controller. Output pin may be connected to any port pins and can be used to any application.

3.3 Working Soil moisture sensors measure the water content in soil. A soil moisture probe is made up of multiple soil moisture sensors. One common type of soil moisture sensors in commercial use is a Frequency domain sensor such as a capacitance sensor. Another sensor, the neutron moisture gauge, utilize the moderator properties of water for neutrons. Soil moisture content may be determined via its effect on dielectric constant by measuring the capacitance between two electrodes implanted in the soil.

Where soil moisture is predominantly in the form of free water (e.g., in sandy soils), the dielectric constant is directly proportional to the moisture content. The probe is normally given a frequency excitation to permit measurement of dielectric constant. The readout from the probe is not linear with water content and is influenced by soil type and soil temperature. Therefore, careful calibration is required and long-term stability of the calibration is questionable In This sensor We are using 2 Probes to be dipped into the Soil As per Moisture We will get Analog Output variations from 0.60volts – 5volts Input Voltage 5V DC.

3.4 High Sensitivity Moisture Sensor Figure 3.2(soil moisture sensor fc 28) 3.4.1 Description: This Moisture Sensor uses Immersion Gold which protects the nickel from oxidation. Electroless nickel immersion gold (ENIG) has several advantages over more conventional (and cheaper) surface platings such as HASL (solder), including excellent surface planarity (particularly helpful for PCB’s with large BGA packages), good oxidation resistance, and usability for untreated contact surfaces such as membrane switches and contact points. This Moisture Sensor can read the amount of moisture present in the soil surrounding it. It’s a low tech sensor, but ideal for monitoring an urban garden, or your pet plant’s water level. This is a must have tool for a connected garden. This Moisture Sensor can be used to detect the moisture of soil or judge if there is water around the sensor, let the plants in your garden reach out for human help.

They can be very to use, just insert it into the soil and then read it. With help of this sensor, it will be realizable to make the plant remind you: Hey, I am thirsty now, please give me somewater. This Moisture Sensor uses the two probes to pass current through the soil, and then it reads that resistance to get the moisture level. More water makes the soil conduct electricity more easily (less resistance), while dry soil conducts electricity poorly (more resistance). It will be helpful to remind you to water your indoor plants or to monitor the soil moisture in your garden.

The IO Expansion Shield is the perfect shield to connect this senor to Arduino. This item have low power consumption, and high sensitivity, which are the biggest characteristics of this mdoule. This item can be compatible with Arduino UNOs Arduino mega2560s Arduino ADK etc. Figure 3.3(SILVER ALUMINIUM PROBES) 3.4.2 Features: 1. Working voltage: 5V 2. Current: 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. 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. 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. Resistant to mist and dirt Detection is not affected by accumulation of dust or dirt. 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 Two essay

Remember. This is just a sample

You can get your custom paper from our expert writers

Get custom paper

Chapter Two. (2019, Jun 18). Retrieved from