MAHATMA GANDHI INSTITUTE OF TECHNOLOGY (Affiliated to Jawaharlal Nehru Technological University, Hyderabad, A.P.)
Chaitanya Bharathi P.O., Gandipet, Hyderabad500 075
Department of Electronics and Communication Engineering
CERTIFICATE Date: 23rd July 2016 This is to certify that the Mini project work entitled “INPUT FOLLOWER BOT” is a bonafied work carried out by
K.PAVAN SAI K.ANUDEEP V.KRISHNA
(13261A0421) (13261A0426) (14265A0403)
in partial fulfillment of the requirements for the degree of BACHELOR OF TECHNOLOGY in ELECTRONICS & COMMUNICATION ENGINEERING by the Jawaharlal Nehru Technological University, Hyderabad during the academic year 2012-13. The results embodied in this report have not been submitted to any other University or Institution for the award of any degree or diploma.
(Signature) Mr. D.V.S.Nagendra Kumar, Sr.Asst. Professor Advisor/Liaison
(Signature) Dr. S P Singh Professor &Head
ACKNOWLEDGEMENT
We express our deep sense of gratitude to our Guide Mr. Ramakrishna, Cranes Varsity, Hyderabad, for his invaluable guidance and encouragement in carrying out our Project.
We are highly indebted to our Faculty Liaison Mr. D.V.S.Nagendra Kumar, Sr. Assistant Professor, Electronics and Communication Engineering Department, who has given us all the necessary technical guidance in carrying out this Project.
We wish to express our sincere thanks to Dr. S.P.Singh, Head of the Department of Electronics and Communication Engineering, M.G.I.T., for permitting us to pursue our Project in Cranes Varsity and encouraging us throughout the Project.
Finally, we thank all the people who have directly or indirectly help us through the course of our Project. K.Pavan Sai K.Anudeep V.Krishna
Table of contents CERTIFICATE FROM ECE DEPARTMENT ACKNOWLEDGEMENTS ABSTRACT CHAPTER 1. OVERVIEW 1.1Introduction 1.2Aim of the project 1.3Significance and applications 1.4Organization of work CHAPTER 2. FUNDAMENTALS OF ARDUINO UNO 2.1 Introduction 2.2 Pin description 2.3 Functionality of each pin 2.4 Advantages and Applications CHAPTER 3. ABOUT
THE BOT
3.1 Introduction 3.2 Basic idea and Connections of the BOT 3.3 program Code Using Arduino Software
CHAPTER 4. RESULTS AND CONCLUSIONS 4.1 Use of Serial Monitor 4.2 Result REFERENCES
CHAPTER-1 OVERVIEW 1.1 INTRODUCTION
Robotics can be described as the current pinnacle of technical development. Robotics is a confluence science using the continuing advancements of mechanical engineering, material science, sensor fabrication, manufacturing techniques, and advanced algorithms. The study and practice of robotics will expose a dabbler or professional to hundreds of different avenues of study. For some, the romanticism of robotics brings forth an almost magical curiosity of the world leading to creation of amazing machines. A journey of a lifetime awaits in robotics. Robotics can be defined as the science or study of the technology primarily associated with the design, fabrication, theory, and application of robots. While other fields contribute the mathematics, the techniques, and the components, robotics creates the magical end product. The practical applications of robots drive development of robotics and drive advancements in other sciences in turn. Crafters and researchers in robotics study more than just robotics. The promise of robotics is easy to describe but hard for the mind to grasp. Robots hold the promise of moving and transforming materials with the same elan and ease as a computer program transforms data. Today, robots mine minerals, assemble semi-processed materials into automobile components, and assemble those components into automobiles. On the immediate horizon are self-driving cars, robotics to handle household chores, and assemble specialized machines on demand. It is not unreasonable to imagine robots that are given some task, such as reclaim desert into photovoltaic cells and arable land, and left to make their own way. Then the promise of robotics exceeds the minds grasp.
In summary, robotics is the field related to science and technology primarily related to robotics. It stands tall by standing the accomplishments of many other fields of study.
1.2 AIM OF THE PROJECT To built ardunio based bot and use it for several applications
CHAPTER -2
FUNDAMENTALS OF ARDUINO UNO 2.1
Arduino is
INTRODUCTION
a hardware and software company, project, and user community that designs and manufactures computer open-source hardware, open-source software, and microcontroller-based kits for building digital devices and interactive objects that can sense and control physical devices. 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 crystal oscillator, 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 Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-to-serial converter. "Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduno, moving forward. The Uno is the latest in a series of USB Arduino boards, and the reference model for the Arduino platform; for a comparison with previous versions, see the index of Arduino boards.
The project is based on microcontroller board designs, produced by several vendors, using various microcontrollers. These systems provide sets of digital and analog Input/output (I/O) pins that can interface to various expansion boards (termed shields) and other circuits. The boards feature serial communication interfaces, including Universal Serial Bus (USB) on some models, for loading programs from personal computers. For programming the microcontrollers, the Arduino project provides an integrated development environment (IDE) based on a programming language named Processing, which also supports the languages C and C++.
HISTORY OF ARDUINO The first Arduino was introduced in 2005, aiming to provide a low cost, easy way for novices and professionals to create devices that interact with their environment using sensors and actuators. Common examples of such devices intended for beginner hobbyists include simple robots, thermostats, and motion detectors. Arduino boards are available commercially in preassembled form, or as do-ityourself kits. The hardware design specifications are openly available, allowing the Arduino boards to be produced by anyone. Adafruit Industries estimated in mid-2011 that over 300,000 official Arduinos had been commercially produced, and in 2013 that 700,000 official boards were in users' hands. An Arduino board historically consists of an Atmel 8-, 16- or 32-bit AVR microcontroller (although since 2015 other makers' microcontrollers have been used) with complementary components that facilitate programming and incorporation into other circuits. An important aspect of the Arduino is its standard connectors, which let users connect the CPU board to a variety of interchangeable add-on modules termed shields. Some shields communicate with the Arduino board directly over various pins, but many shields are individually addressable via an I²C serial bus—so many shields can be stacked and used in parallel. Before 2015, Official Arduinos had used the Atmel megaAVR series of chips, specifically the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560. In 2015, units by other producers were added. A handful of other processors have also been used by Arduino compatible devices. Most boards include a 5 V linear regulator and a 16 MHz crystal oscillator (or ceramic resonator in some variants), although some designs such as the LilyPad run at 8 MHz and dispense with the onboard voltage regulator due to specific form-factor restrictions. An Arduino's microcontroller is also pre-programmed with a boot loader that simplifies
uploading of programs to the on-chip flash memory, compared with other devices that typically need an external programmer. This makes using an Arduino more straightforward by allowing the use of an ordinary computer as the programmer. Currently, optiboot bootloader is the default bootloader installed on Arduino UNO. At a conceptual level, when using the Arduino integrated development environment, all boards are programmed over a serial connection. Its implementation varies with the hardware version. Some serial Arduino boards contain a level shifter circuit to convert between RS-232logic levels and transistor–transistor logic (TTL) level signals. Current Arduino boards are programmed via Universal Serial Bus (USB), implemented using USB-to-serial adapter chips such as the FTDI FT232. Some boards, such as later-model Uno boards, substitute the FTDI chip with a separate AVR chip containing USB-toserial firmware, which is reprogrammable via its own ICSP header. Other variants, such as the Arduino Mini and the unofficial Boarduino, use a detachable USB-to-serial adapter board or cable,Bluetooth or other methods, when used with traditional microcontroller tools instead of the Arduino IDE, standard AVR insystem programming (ISP) programming is used.
The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits. The Diecimila, Duemilanove, and currentUno]provide 14 digital I/O pins, six of which can produce pulse-width modulated signals, and six analog inputs, which can also be used as six digital I/O pins. These pins are on the top of the board, via female 0.1-inch (2.54 mm) headers. Several plug-in application shields are also commercially available. The Arduino Nano, and Arduinocompatible Bare Bones Board and Boarduino boards may provide male header pins on the underside of the board that can plug into solderless breadboards. Many Arduino-compatible and Arduino-derived boards exist. Some are functionally equivalent to an Arduino and can be used interchangeably. Many enhance the basic Arduino by adding output drivers, often for use in school-level education, to simplify making buggies and small robots. Others are electrically equivalent but change the form factor, sometimes retaining compatibility with shields, sometimes not. Some variants use different processors, of varying compatibility.
The Arduino project provides the Arduino integrated development environment (IDE), which is a cross-platform application written in the programming language Java.It originated from the IDE for the languages Processing and Wiring. It is designed to introduce programming to artists and other newcomers unfamiliar with software development. It includes a code editor with features such assyntax highlighting, brace matching, and automatic indentation, and provides simple one-click mechanism to compile and load programs to an Arduino board. A program written with the IDE for Arduino is called a "sketch".
2.2 PIN DESCRIPTION OF ARDUINO Looking at the board from the top down, this is an outline of what you will see (parts of the board you might interact with in the course of normal use are highlighted):
Starting clockwise from the top center:
Analog Reference pin (orange)
Digital Ground (light green)
Digital Pins 2-13 (green)
Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for digital i/o (digitalRead and digitalWrite) if you are also using serial communication (e.g. Serial.begin).
Reset Button - S1 (dark blue)
In-circuit Serial Programmer (blue-green)
Analog In Pins 0-5 (light blue)
Power and Ground Pins (power: orange, grounds: light orange)
External Power Supply In (9-12VDC) - X1 (pink)
Toggles External Power and USB Power (place jumper on two pins closest to desired supply) - SV1 (purple)
USB (used for uploading sketches to the board and for serial communication between the board and the computer; can be used to power the board) (yellow)
Microcontrollers ATmega328 (used on most recent boards)
Digital I/O Pins
Analog Input Pins
DC Current per I/O Pin
14 (of which 6 provide PWM output)
ATmega168 (used on most Arduino Diecimila and early Duemilanove)
Digital I/O Pins
14 (of which 6 provide PWM output)
Analog Input Pins
6 (DIP) or 8 (SMD)
6 (DIP) or 8 (SMD)
40 Ma
Flash Memory
32 KB
SRAM
2 KB
EEPROM
1KB
DC Current per I/O Pin Flash Memory SRAM EEPROM
40 mA 16 KB 1 KB 512 bytes
ATmega8 (used on some older board) 14 (of which 3 Digital provid I/O Pins e PWM output) Analog Input 6 Pins DC Current 40 mA per I/O Pin Flash 8 KB Memory SRAM 1 KB EEPRO 512 M bytes
2.3 FUNCTIONALITY OF EACH PIN In addition to the specific functions listed below, the digital pins on an Arduino board can be used for general purpose input and output via the pinMode(), digitalRead(), and digitalWrite() commands. Each pin has an internal pull-up resistor which can be turned on and off using digitalWrite() (w/ a value of HIGH or LOW, respectively) when the pin is configured as an input. The maximum current per pin is 40 mA.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. On the Arduino Diecimila, these pins are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip. On the Arduino BT, they are connected to the corresponding pins of the WT11 Bluetooth module. On the Arduino Mini and LilyPad Arduino, they are intended for use with an external TTL serial module (e.g. the Mini-USB Adapter).
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. On boards with an ATmega8, PWM output is available only on pins 9, 10, and 11.
BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth module.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.
LED: 13. On the Diecimila and LilyPad, 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. Analog Pins
In addition to the specific functions listed below, the analog input pins support 10bit analog-to-digital conversion (ADC) using the analogRead() function. Most of the analog inputs can also be used as digital pins: analog input 0 as digital pin 14 through analog input 5 as digital pin 19. Analog inputs 6 and 7 (present on the Mini and BT) cannot be used as digital pins.
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library (documentation on the Wiring website). Power Pins
Vin (sometimes labelled "9V"): 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. Note that different boards accept different input voltages ranges, please see the documentation for your board. Also note that the LilyPad has no VIN pin and accepts only a regulated input.
5V:The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.
3.3V: (Diecimila-only) A 3.3 volt supply generated by the on-board FTDI chip.
GND: Ground pins. Other Pins
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. The Arduino IDE supports the languages C and C++ using special rules to organize code. The Arduino IDE supplies a software library called Wiring from the Wiring project, which provides many common input and output procedures. A typical Arduino C/C++ sketch consist of two functions that are compiled and linked with a program stub main() into an executable cyclic executive program:
setup(): a function that runs once at the start of a program and that can initialize settings. loop(): a function called repeatedly until the board powers off.
setup() The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup Example
int buttonPin = 3; void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT); } void loop() { // ... }
Function will only run once, after each powerup or reset of the Arduino board.
loop() After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively,
allowing your program to change and respond. Use it to actively control the Arduino board. Example
const int buttonPin = 3; // setup initializes serial and the button pin void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT); } // loop checks the button pin each time, // and will send serial if it is pressed void loop() { if (digitalRead(buttonPin) == HIGH) Serial.write('H'); else Serial.write('L'); delay(1000); }\
2.4 ADVANTAGES
1- Ready to Use: The biggest advantage of Arduino is its ready to use structure. As Arduino comes in a complete package form which includes the 5V regulator, a burner, an oscillator, a micro-controller, serial communication interface, LED and headers for the connections. You don't have to think about programmer connections for programming or any other interface. Just plug it into USB port of your computer and that's it. Your revolutionary idea is going to change the world after just few words of coding.
2- Examples of codes: Another big advantage of Arduino is its library of examples present inside the software of Arduino. I'll explain this advantage using an example ofvoltage measurement. For example if you want to measure voltage using ATmega8 micro-controller and want to display the output on computer screen then you have to go through the whole process. The process will start from learning the ADC's of micro-controller for measurement, went through the learning of serial communication for display and will end at USB - Serial converters. If you want to check this whole process click on the link below. DC voltage measurement using Atmel AVR micro-controller .
3- Effortless functions: During coding of Arduino, you will notice some functions which make the life so easy. Another advantage of Arduino is its automatic unit conversion capability. You can say that during debugging you don't have to worry about the unitsconversions. Just use your all force on the main parts of your projects. You don't have to worry about side problems.
4- Large community: There are many forums present on the internet in which people are talking about the Arduino. Engineers, hobbyists and professionals are making their projects through Arduino. You can easily find help about everything. Moreover the Arduino website itself explains each and every functions of Arduino.
So, We should conclude the advantage of Arduino by saying that during working on different projects you just have to worry about your innovative idea. The remaining will handle by Arduino itself.
Real-Time Applications of Arduino Uno Board
1.Arduino Based Home Automation System The project is designed by using Arduino uno board for the development of home automation system with Bluetooth which is remotely controlled and operated by an Android OS smart phone. Houses are becoming smarter and well developed by using such kind of advanced technologies. Modern houses are gradually increasing the way of design by shifting to centralized control system with remote controlled switches instead of conventional switches. 2.Arduino based Auto Intensity Control of Street Lights As the intensity is cannot be controlled by using High Intensity Discharge (HID) lamps power saving is not possible in street lights with these lamps as the density on roads is decreasing from peak hours of nights to early morning. 3. Arduino Based Solar Streetlight This project is designed to control the intensity of a LED based street light powered by the solar powerfrom a photo voltaic cell using Arduino. 4.The Obstacle Avoidance Robot Operated with Arduino The main concept of this project is to design a robot using ultrasonic sensors to avoid the obstacle. A robot is a machine and it is a combination of programs instructions and motors. It can perform some task with some guidance or automatically.
CHAPTER-3 ABOUT THE BOT
3.1 INTRODUCTION A Bot, also known as Robot , is a software application that perform task that are both simple and structurally repetitive, at a much higher rate than would be possible for a human alone. Given the exceptional speed with which bots can perform their relatively simple routines, bots may also be implemented where a response speed faster than that of humans is required. Bots are routinely used on the internet where the emulation of human activity is required. Given the exceptional speed with which bots can perform their relatively simple routines, bots may also be implemented where a response speed faster than that of humans is required. Common examples including gaming, whereby a player achieves a significant advantage by implementing some repetitive routine with the use of a bot rather than manually, or auction-site robot where last-minute bid-placing speed may determine who places the winning bid – using a bot to place counterbids affords a significant advantage over bids placed manually. The success of bots may be largely due to the very real difficulty in identifying the difference between an online interaction with a bot versus a live human. Given that bots are relatively simple to create and implement,] they are a very powerful tool with the potential to influence every segment of the World Wide Web
3.2 COMPONENTS AND CONNECTIONS
MATERIALS REQUIRED
Arduino Uno and USB cable
Arduino software
Breadboard
100rpm dc motors
Jumper wires
Chassis and wheels
9V battery
Transistors and resistors
Battery clips 1. The Arduino board
The Arduino board will be the brain of the robot, as it will be running the software that will control all the other parts. My son had an old Arduino Uno that he ended up not using, so I did not need to buy one. There are plenty of Arduino models or even Arduino compatible boards that can be used.
2. The Prototyping Board and Cables
One of the restrictions I decided to impose myself with this project is that I would not do any soldering, so that I can assemble and disassemble the robot to my heart's content without ruining any parts. Then I needed a platform where I can easily connect all the components together. For this kind of task people typically use a breadboard
3. The USB Cable
The Arduino board is connected to a computer via a USB port. The USB connection is used to upload software and also can be used as a power source when testing. I took a cable from an old printer I have, so I did not need to buy this item. If you need to buy a cable, make sure you get the right connectors. The computer side is the standard A-Male, but on the Arduino side you need a B-Male connector.
4. The Vehicle Kit
There are many choices for robot friendly vehicles. My only requirements were that it had a large platform where all the parts can be mounted and that it came with the wheels and motors. In the end I decided to get the Magician Chassis. This is a kit that is extremely simple to build. It includes two motors and a battery box that plugs directly into the Arduino board.
5. Transistors and resistors
The transistor and resistor are used with the motor to make it act like a switch.
CONNECTING THE BOT The connections to the motor are made based on the simple circuit diagram shown below.
After connecting the BOT it looks like the one above and is ready to receive the inputs from the receiver.
3.3 PROGRAM CODE char ByteReceived; void setup() { pinMode(13,OUTPUT); pinMode(12,OUTPUT); Serial.begin(9600); Serial.println("--- ENTER THE DIRECTION---"); Serial.println(" Type in Box above, . "); Serial.println("(Decimal)(Hex)(Character)"); Serial.println(); } void loop() { if (Serial.available() > 0) {
ByteReceived = Serial.read(); Serial.print(ByteReceived); Serial.print("
");
Serial.print(ByteReceived, HEX); Serial.print("
");
Serial.print(char(ByteReceived)); /*FORWARD DIRECTION*/ if(ByteReceived == 'F') { digitalWrite(12, HIGH); digitalWrite(13, HIGH); delay(800); digitalWrite(12, LOW); digitalWrite(13, LOW); Serial.print(" FRONT"); } /*RIGHT DIRECTION*/ if(ByteReceived == 'R') { digitalWrite(12, HIGH); digitalWrite(13, LOW); delay(500); digitalWrite(12, LOW); digitalWrite(13, LOW); Serial.print(" RIGHT");
} /*LEFT DIRECTION*/ if(ByteReceived == 'L') { digitalWrite(12, LOW); digitalWrite(13, HIGH); delay(550); digitalWrite(12, LOW); digitalWrite(13, LOW); Serial.print(" LEFT"); } /*BACKWARD DIRECTION*/ if(ByteReceived == 'B') { digitalWrite(12, LOW); digitalWrite(13, HIGH); delay(1250); digitalWrite(12, LOW); digitalWrite(13, LOW); digitalWrite(12, HIGH); digitalWrite(13, HIGH); delay(800); digitalWrite(12, LOW); digitalWrite(13, LOW); Serial.print("BACK");
} /*STOP MOTION OF THE BOT*/ if(ByteReceived == 'S') { digitalWrite(12, LOW); digitalWrite(13, LOW);
Serial.print(" STOP"); }
Serial.println(); } }
CHAPTER -4 RESULTS AND CONCLUSIONS 4.1 SERIAL MONITOR The Serial Monitor is a separate pop-up window that acts as a separate terminal that communicates by receiving and sending Serial Data. See the icon on the far right of the image above. Serial Data is sent over a single wire (but usually travels over USB in our case) and consists of a series of 1's and 0's sent over the wire. Data can be sent in both directions .
The serial monitor is the 'tether' between the computer and your Arduino - it lets you send and receive text messages, handy for debugging and also controlling the Arduino from a keyboard! For example, you will be able to send commands from your computer to turn on LEDs.
4.2
RESULT OF THE PROJECT
THE RESULT ON THE SERIAL MONITOR ARE AS FOLLOWS