Arduino board program for Mobile robotss

VSARAVANAKUMARHICETS 25 views 191 slides Jul 30, 2024
Slide 1
Slide 1 of 191
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97
Slide 98
98
Slide 99
99
Slide 100
100
Slide 101
101
Slide 102
102
Slide 103
103
Slide 104
104
Slide 105
105
Slide 106
106
Slide 107
107
Slide 108
108
Slide 109
109
Slide 110
110
Slide 111
111
Slide 112
112
Slide 113
113
Slide 114
114
Slide 115
115
Slide 116
116
Slide 117
117
Slide 118
118
Slide 119
119
Slide 120
120
Slide 121
121
Slide 122
122
Slide 123
123
Slide 124
124
Slide 125
125
Slide 126
126
Slide 127
127
Slide 128
128
Slide 129
129
Slide 130
130
Slide 131
131
Slide 132
132
Slide 133
133
Slide 134
134
Slide 135
135
Slide 136
136
Slide 137
137
Slide 138
138
Slide 139
139
Slide 140
140
Slide 141
141
Slide 142
142
Slide 143
143
Slide 144
144
Slide 145
145
Slide 146
146
Slide 147
147
Slide 148
148
Slide 149
149
Slide 150
150
Slide 151
151
Slide 152
152
Slide 153
153
Slide 154
154
Slide 155
155
Slide 156
156
Slide 157
157
Slide 158
158
Slide 159
159
Slide 160
160
Slide 161
161
Slide 162
162
Slide 163
163
Slide 164
164
Slide 165
165
Slide 166
166
Slide 167
167
Slide 168
168
Slide 169
169
Slide 170
170
Slide 171
171
Slide 172
172
Slide 173
173
Slide 174
174
Slide 175
175
Slide 176
176
Slide 177
177
Slide 178
178
Slide 179
179
Slide 180
180
Slide 181
181
Slide 182
182
Slide 183
183
Slide 184
184
Slide 185
185
Slide 186
186
Slide 187
187
Slide 188
188
Slide 189
189
Slide 190
190
Slide 191
191

About This Presentation

Arduino


Slide Content

COIMBATORE – 641 004 SESSION 1 DEPARTMENT OF ROBOTICS & AUTOMATION ENGINEERING PSG COLLEGE OF TECHNOLOGY ARDUINO WORK SHOP FOR BEGINERS 1 Selvaraj . K Project Engineer PSG-Robotics

OVERVIEW Microcontroller Defined Arduino Defined Arduino Advantages Arduino Applications Types of Arduino Boards Analog, Digital, Inputs and Outputs

MICROCONTROLLER Microcontroller Like as Brain It make decision in the Robots It collect the information from the Sensors and control the actuator by the command

MICROCONTROLLER Microcontroller It is a Decision maker with help of ROM,RAM and Arithmetic Logic Unit. Input port- Eye(Sensor) Output Port- Mouth(Actuators or Speaker) All input and output ports are controlled by the programming

MICROCONTROLLER Programmers work in the virtual world. Machinery works in the physical world. How does one connect the virtual world to the physical world? A microcontroller is basically a small-scale computer with generalized (and programmable) inputs and outputs. The inputs and outputs can be manipulated by and can manipulate the physical world

INTRODUCTION ABOUT ARDUINO Based on a simple micro-controller board, and A development environment (IDE) for writing software for the board Open source electronics prototyping platform based on flexible ,Easy to use hardware and software Arduino can be used to develop interactive objects, taking inputs from a variety of switches or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino projects can be stand-alone, or they can be communicate with software running on your computer (e.g. Flash, Processing, MaxMSP .) The boards can be assembled by hand or purchased preassembled; the open-source IDE can be downloaded for free . The Arduino programming language is an implementation of Wiring, a similar physical computing platform, which is based on the Processing multimedia programming environment .

MAIN ADVANTAGES OF ARDUINO Arduino microcontrollers have become the de facto standard. Make Magazine features many projects using Arduino microcontrollers. Strives for the balance between ease of use and usefulness. Programming languages seen as major obstacle. Arduino C is a greatly simplified version of C ++. Unit price around Rs.1400

APPLICATION AREAS Light control Motor control Automation Robotics Networking Custom protocols Your imagination is the limit…

TYPES OF ARDUINO BOARDS Many different versions Number of input/output channels Form factor Processor Leonardo Due Micro LilyPad Esplora Uno Mega

LEONARDO Compared to the Uno, a slight upgrade Built in USB compatibility

DUE Much faster processor, many more pins Operates on 3.3 volts Similar to the Mega

MICRO When size matters: Micro, Nano, Mini Includes all functionality of the Leonardo Easily usable on a breadboard

LILYPAD LilyPad is popular for clothing-based projects . It is a Low weight and flexible

ESPLORA Game controller Includes joystick, four buttons, linear potentiometer (slider), microphone, light sensor, temperature sensor, three-axis accelerometer. Not the standard set of IO pins.

MEGA Compared to the Uno, the Mega: Many more communication pins More memory

ARDUINO MEGA Physically larger than all the other boards Offers significantly more digital and analog pins. Uses a different processor allowing greater program size Microcontroller : ATmega1280 Operating Voltage 5V Input Voltage: 7-12V Digital I/O Pins 54 (of which 14 provide PWM output )

ARDUINO MEGA Analog Input Pins 16 Flash Memory 128 KB of which 4 KB used by boot loader SRAM 8 KB EEPROM 4 KB Clock Speed 16 MHZ

ARDUINO UNO The pins are in three groups : Invented in 2010 14 digital pins 6 analog pins power

ARDUINO UNO Microcontroller ATmega 328 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 (of which 0.5 KB used by boot loader ) SRAM 2 KB (ATmega328) EEPROM 1 KB (ATmega328) Clock Speed 16 MHz

Totally Arduino Uno have 14 Digital Input and Output p ins. They are numbered 0 to 13. Analog Input Pins are A0 to A5

ARDUINO COMPONENTS

UNDERSTANDING INPUT VS OUTPUT INPUT PIN Inputs is a signal / information going into the board. OUTPUT PIN Output is any signal exiting the board .

ANALOG VS DIGITAL ANALOG Microcontrollers are digital devices – ON or OFF DIGITAL An Analog signal is anything that can be a full range of values. What are some examples? Think of like a ramp or a hill.

INPUT and OUTPUT analogRead -Analog INPUT analogWrite -Analog OUTPUT digitalRead - digital INPUT digitalWrite - digital OUTPUT

BASIC KNOWLEDGE REQUIRED Ohms LAW Current Voltage Resister Capacitor Inductor Voltage LAW Current Law Rheostat function Transformer Rectifier Regulator Inverter Amplifier Diode Transistor AC and DC Voltages Types of Motors Basic sensors

PULL UP RESISTER PULL DOWN RESISTER

ANALOG VS DIGITAL To create an analog signal, the microcontroller uses a technique called PWM. Pins 3, 5, 6, 9, 10, 11 are capable of producing an Analog Output Pulse Width Modulation (PWM)

BEGINNING ARDUINO PROGRAMMING SESSION II

OVERVIEW Objectives Startup Arduino IDE Arduino Sketch Details Commands ,Operators, Variables Basic Repetitions Settings and Configurations

OBJECTIVES Provide a thorough introduction to the Arduino programming environment. Develop a use of simple functions to interact with the LEDs, light sensor, push button, and buzzer on the Protosnap Pro Mini.

STARTUP ARDUINO IDE Double-click on either the Arduino Icon or wherever you installed (saved) the Arduino program.

PLUG IT IN

THE ENVIRONMENT

PARTS OF THE SKETCH

COMMENTS Comments can be anywhere Comments created with // or /* and */ Comments do not affect code You may not need comments, but think about the community.

OPERATORS The equals sign = is used to assign a value == is used to compare values And & Or && is “and” || is “or”

BASIC VARIABLE TYPES Boolean Integer Double Float Character String

DECLARING VARIABLES Boolean: boolean variableName ; Integer: int variableName ; Character: char variableName ; String: stringName [ ];

ASSIGNING VARIABLES Boolean: variableName = true; or variableName = false; Integer: variableName = 32767; or variableName = -32768;

VARIABLE SCOPE Where you declare your variables matters?

SETUP void setup ( ) { } The setup function comes before the loop function and is necessary for all Arduino sketches

SETUP void setup ( ) { } The setup header will never change, everything else that occurs in setup happens inside the curly brackets

SETUP void setup ( ) { pinMode (13, OUTPUT); } Outputs are declare in setup , this is done by using the pinMode function This particular example declares digital pin # 13 as an output, remember to use CAPS

SETUP void setup ( ) { Serial.begin ; } Serial communication also begins in setup This particular example declares Serial communication at a baud rate of 9600 . More on Serial later...

Setup, Internal Pullup Resistors void setup ( ) { digitalWrite (12, HIGH); } You can also create internal pullup resistors in setup, to do so digitalWrite the pin HIGH This takes the place of the pullup resistors currently on your circuit 7 buttons

Setup, Interrupts void setup ( ) { attachInterrupt (interrupt, function, mode) } You can designate an interrupt function to Arduino pins # 2 and 3 volatile unsigned int L=1; volatile double Le,Re ; void setup() { attachInterrupt (0, countpulsesL , FALLING); Serial.begin (9600);} void loop() { Serial.println (L); delay(1000);} void countpulsesL () {L++;}

Setup, Interrupts void setup ( ) { attachInterrupt (interrupt, function, mode) } Interrupt: the number of the interrupt, 0 or 1, corresponding to Arduino pins # 2 and 3 respectively Function: the function to call when the interrupt occurs Mode: defines when the interrupt should be triggered

Setup, Interrupts void setup ( ) { attachInterrupt (interrupt, function, mode ) } LOW whenever pin state is low CHANGE whenever pin changes value RISING whenever pin goes from low to high FALLING whenever pin goes from low to high Don’t forget to CAPITALIZE

Example program volatile unsigned int L=1; volatile double Le,Re ; void setup() { attachInterrupt (0, countpulsesL , FALLING); Serial.begin (9600);} void loop() { Serial.println (L); delay(1000);} void countpulsesL () { L++;}

If Statements if ( this is true ) { do this; }

If If ( this is true ) { do this; }

Conditional If ( this is true ) { do this; }

Action if ( this is true ) { do this; }

Else else { do this; }

BASIC REPETITION loop For while

BASIC REPETITION void loop ( ) { }

Basic Repetition void loop ( ) { }

BASIC REPETITION void loop ( ) { }

BASIC REPETITION for (int count = 0; count<10; count++) {// for action code goes here //this could be anything}

BASIC REPETITION for (int count = 0; count<10; count++) { //for action code goes here }

BASIC REPETITION for (int count = 0; count<10; count++) { //for action code goes here }

BASIC REPETITION for ( int count = 0; count<10; count++) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

BASIC REPETITION for (int count = 0; count<10; count++ ) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

BASIC REPETITION while ( count<10 ) { //while action code goes here //should include a way to change count //variable so the computer is not stuck //inside the while loop forever }

BASIC REPETITION while ( count<10 ) { //looks basically like a “for” loop //except the variable is declared before //and incremented inside the while //loop }

ARDUINO DATA COMMUNICATION SETUP 68

CONFIGURING ARDUINO Setup Board (Arduino UNO/ ATmega328) Setup COM Port PC – Highest COM #

Settings: Tools  Board

Settings: Tools  Serial Port

Input Status Bar Program Notification Area

5 .- Verify/Compile 6.- Once it compiles, you must see the following messages in the Status bar and the Program notification Area

7 . Upload it 8 . Once it upload, you must see the following messages in the Status bar and the Program notification Area

Error avrdude : stk500_getsync(): not in sync: resp =0x00   can't open device "COM10": The system cannot find the file specified

ARDUINO PROGRAMMING CHALLENGES Session III &IV

CHALLENGES Introduction to use Electronic components LED Control by Arduino Multiple LEDs Control by looping Operators conditions test Analog sensor test Analog Sensor Value based LED control

LIST OF COMPONENTS Arduino board USB cable L293 driver board Battery

LIST OF COMPONENTS Dc motor Line array sensor Potentiometer Ultrasonic sensor adapter

LIST OF COMPONENTS Connecting wires Ultrasonic sensor LEDs Resisters Reset button/switch

ARDUINO PROGRAMMING INSTRUCTIONS pinMode(pin, mode) Designates the specified pin for input or output digitalWrite(pin, value) Sends a voltage level to the designated pin digitalRead(pin) Reads the current voltage level from the designated pin analog versions of above analogRead's range is 0 to 1023 serial commands print , println, write

ARDUINO USING SOLDERLESSBREADBOARD Solderless Board is useful to build proto types . Time consuming process of soldering parts together to make connections Most important thing in using a solder less breadboard in understanding its connections wiring underneath the white cover to be able to connect parts in a way that complete and flawless lines are provided for electricity flow 82

Instruction to Components handling Doing circuit connection – Don’t power up Controller board Don’t use metal surface and maintain at free surface Circuit check before power up Don’t make short circuit After completion of Experiments- all components put in to box and cross check the list

LED PROGRAMMING FOR BLINKING FUNCTIONS

CIRCUIT CONNECTION

DIGITAL OUTPUT-LED 86 Digital pin 10 connected with Resister. Long leg connected with resister end. short Leg connected with Ground . Ground Pin Digital Pin

LED FUNCTION INSTRUCTIONS Connect the positive (+) lead of a power source to the long leg of an LED. Connect other leg of the LED to a resistor. High resistance means a darker light. Low resistance means brighter light. No resistance means to the negative lead of the power source. a burned out LED. Connect other leg of the resistor

LED FUNCTION

ARDUINO-DIGITAL OUTPUT-LED 89

BOARD SELECTION

COM PORT SELECTION

COMPILING AND UPLOADING CODE

CHALLENGES IN LED CONTROL Challenge 1A : Blink LED Every one second Challenge 1B : Multiple LEDs Blink once at a time Challenge 1C : Multiple LEDs- Knight Riders Style Challenge 1D: Color Brightness control using PWM function Challenge 1E: Color Brightness control using potentiometer Challenge 1F: Arduino-Analog Output LED Dimming Using for Loop Structure

1B. MULTIPLE LEDS CONNECTION LED1: Arduino pin2 LED2: Arduino pin3 LED3: Arduino pin4 All LED’s Gnd- Connected with Arduino Ground

MULTIPLE LEDs CONNECTION

1B. MULTIPLE LED BLINKING AT A TIME

1C. LEDS KNIGHT RIDERS STYLE

1D.BRIGHTNESS CONTROL USING analogWrite()

1E.Color Brightness control using potentiometer

1F. LED DIMMING USING FOR LOOP STRUCTURE 100

IF CONDITION

IF CONDITION LOGIC

Push button working principle

LED CONTROLLED BY PUSH BUTTON Switch output connected with Arduino pin2 Led pin connected with Arduino pin 6

PUSH BUTTON FUNCTION SWITCH IN OPEN SWITCH IN CLOSED If switch ON- circuit is closed, current will flow in the circuit path. So input voltage is 5V. Else switch OFF- circuit is open, no current flow in this path, so input current 0V.

PROGRAM FOR PUSH BUTTON CONTROL

2. CHALLENGES CHALLENGE 2A: LED ON When press any One push button at a time CHALLENGE 2B: LED ON when press all push button at a time CHALLENGE 2C: LED ON when press at least 2 push button at a time in 4 push buttons using application CHALLENGE 2D: LED ON when press at least 3 push button at a time in 4 push buttons using application

2. MULTIPLE SWICH FUNCTION

3. SERIAL MONITOR CONFIGURE BAUD RATE Serial. begin (baud rate) Some Examples Baud rate 4800,9600,14400,19200,28800,38400,5760 and 115200… etc AnalogRead Value is 0 to 1023 WATCHING OUTPUT AT SERIAL MONITOR Serial.println();

SERIAL MONITOR TEST PROGRAM

OPEN UP SERIAL MONITOR

JOYSTICK DEVELOPMENT LEFT UP DOWN RIGHT Display: RIGHT LEFT UP DOWN

Program: #include < SoftwareSerial.h > char a=2,b=3,c=4,d=5; void setup(void) { pinMode (a, INPUT); digitalWrite (a, HIGH); pinMode (b, INPUT); digitalWrite (b, HIGH); pinMode (c, INPUT); digitalWrite (c, HIGH); pinMode (d, INPUT); digitalWrite (d, HIGH); Serial.begin (9600); }

void loop(void) { if ( digitalRead (a)==LOW) { Serial.println ("LEFT"); delay(20); } else if ( digitalRead (b)==LOW) { Serial.println ("RIGHT"); delay(20); } else if ( digitalRead (c)==LOW) { Serial.println ("UP"); delay(20); } else if ( digitalRead (d)==LOW) { Serial.println ("DOWN"); delay(20); } else { Serial.println (""); delay(20); } }

LED BRIGHTNESS CONTROLLED FROM POTENTIOMETER

PROGRAM FOR LED BRIGHTNESS CONTROL LED BRIGHT: int pot = A0; // pin that the sensor is attached to pot int LED=9; void setup() { pinMode(LED, OUTPUT); Serial.begin (9600); }   void loop() { int analogValue = analogRead (pot)/4; analogWrite(LED, analogValue ); Serial.println ( analogValue ); delay(100); }

LED ON/OFF CONTROLLED WITH RESPECT TO COMPARISON OF THRESHOLD Led on/off controlled with respect to comparison of threshold and analog value from potentiometer

PROGRAM

5.Potentiometr Voltage -Voltage Display Analog Read value is 0-1023 Divisions (0-5V) 1 Division= 5/ 1023 V= 0.00488 V Formula: int POT= analogRead (A0); int Voltage = POT X 0.0049

HOME MADE AUTOMATION If push button is pressed at once - Automatically electrical fans and lights will ON If again press the same push button Automatically electrical fans and lights will OFF Experiments: LED will ON/ OFF based on this condition

Relay Board

Relay Application

CIRCUIT

int inPin = 2; // the number of the input pin int outPin = 6; // the number of the output pin int state = HIGH; // the current state of the output pin int reading; // the current reading from the input pin int previous = LOW; // the previous reading from the input pin long time = 0; // the last time the output pin was toggled long debounce = 200; // the debounce time, increase if the output flickers void setup() { pinMode ( inPin , INPUT); pinMode ( outPin , OUTPUT); } void loop() { reading = digitalRead ( inPin ); if (reading == HIGH && previous == LOW && millis () - time > debounce ) { if (state == HIGH) state = LOW; else state = HIGH; time = millis (); } digitalWrite ( outPin , state); previous = reading; }

Interrupt Counting:  volatile unsigned int L=1; volatile double Le,Re ; void setup() { attachInterrupt (0, countpulsesL , FALLING); Serial.begin (9600); } void loop() { Serial.println (L); delay(1000); } void countpulsesL () { L++; }

MOTOR CONTROL AND SENSORS INTERFACING SESSION V & VI

OVERVIEW Introduction about Sensors Introduction about Motors Motor control Ultrasonic Sensor Testing IR array sensor Testing Motor speed control based on Sensors value

INTRODUCTION ABOUT SENSORS Sensor Types of sensors IR sensor Sound sensor Temperature sensor How to use it? Where to use it?

WHAT IS A SENSOR….? A sensor is a device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument Sensors are used in everyday objects such as touch-sensitive elevator buttons (tactile sensor) and lamps which dim or brighten by touching the base Applications include cars, machines, aerospace, medicine, manufacturing and robotics

IR SENSOR

WORKING IR sensor works on the principle of emitting IR rays and receiving the reflected ray by a receiver (Photo Diode) IR source (LED) is used in forward bias IR Receiver (Photodiode) is used in bias

IR SENSOR CIRCUIT

VOLTAGE COMPARATOR A Comparator is a device which compares two voltages or currents and switches its output to indicate which is larger. Comparator is an Op-amp. PIN DIAGRAM LM 358

LIGHT SENSOR CIRCUIT

TEMPERATURE SENSOR

TIMER 555 IC The 555 Timer IC is an integrated circuit (chip) implementing a variety of timer and multivibrator applications. PIN DIAGRAM

Solar Cell Digital Infrared Ranging Compass Touch Switch Pressure Switch Limit Switch Magnetic Reed Switch Magnetic Sensor Miniature Polaroid Sensor Polaroid Sensor Board Piezo Ultrasonic Transducers Pyroelectric Detector Thyristor Gas Sensor Gieger-Muller Radiation Sensor Piezo Bend Sensor Resistive Bend Sensors Mechanical Tilt Sensors Pendulum Resistive Tilt Sensors CDS Cell Resistive Light Sensor Hall Effect Magnetic Field Sensors Compass IRDA Transceiver IR Amplifier Sensor IR Modulator Receiver Lite-On IR Remote Receiver Radio Shack Remote Receiver IR Sensor w/lens Gyro Accelerometer IR Reflection Sensor IR Pin Diode UV Detector Metal Detector

A motor is any of a class of rotary electrical motors that converts electrical energy into mechanical energy. The most common types rely on the forces produced by magnetic fields. INTRODUCTION ABOUT MOTOR

16/11/2021 PSG College of Technology TYPES OF MOTORS AC motors DC motors DC geared motors Stepper motors Servo motors

16/11/2021 PSG College of Technology AC MOTOR These are the motors which convert alternating signal into rotational motion. Examples are the motor in water pumps, table fan, ceiling fan.

16/11/2021 PSG College of Technology DC MOTOR These are the motors which convert DC signals into rotational motion In robotics applications they are preferred over AC motors as the motor and the complete circuit require same kind of supply i.e DC supply

16/11/2021 PSG College of Technology DC GEARED MOTORS These are the DC geared motors having external gear arrangement attached with motor. These are the motors that are most commonly used in robotics as they are having considerable torque.

16/11/2021 PSG College of Technology

16/11/2021 PSG College of Technology STEPPER MOTOR A type of motor which takes DC pulse input and gives rotating motion in steps. They are of two types : Unipolar : which moves in one direction only. Bipolar : which moves in both directions

16/11/2021 PSG College of Technology

16/11/2021 PSG College of Technology Servo motors are the most powerful motors for robotic applications. They comes in both variants , AC and DC. They can change the direction with same supply. SERVO MOTOR

16/11/2021 PSG College of Technology A  servomechanism , or  servo  is an automatic device that uses error-sensing feedback to correct the performance of a mechanism The term correctly applies only to systems where the feedback or error-correction signals help control mechanical position or other parameters

For both way motion ( clockwise and anticlockwise ) of one DC motor, an “H-Bridge” can be employed. For both way motion of two DC motors “dual H-Bridge IC L293D” can be employed. 16/11/2021 PSG College of Technology S1-S4 ON, S2-S3 OFF (for one direction). S2-s3 on and s1-s4 off (for other direction). ONLY POSSIBLE SWITCHES SETTING FOR ROTATION

16/11/2021 PSG College of Technology

16/11/2021 PSG College of Technology

MOTOR DRIVER CONCEPT

L293D DRIVER BOARD

L293D DRIVER IC

MOTOR CONTROL

MOTOR SPEED CONTROL

DC MOTOR SPEED CONTROL BY USING POTENTIOMETER TASK EXPLANATION: 1. Speed Control by Potentiometer 2. Direction change when potentiometer value move less than 500

MOTOR CIRCUIT CONNECTION

PROGRAMMING FOR SPEED CONTROL

PROGRAM FOR DIRECTION CONTROL

LINE ARRAY SENSOR CONNECTION 5V- Arduino 5V GND – Arduino Gnd S1- Arduino A3 S2- Arduino A2 S3- Arduino A1

ARRAY SENSOR VALUE

ULTRASONIC SENSOR Measurement Principle of Ultrasonic Sensor Ultrasonic sensors transmit ultrasonic waves from its sensor head and again receives the ultrasonic waves reflected from an object. By measuring the length of time from the transmission to reception of the sonic wave, it detects the position of the object.

CONNECTION DETAILS Vcc- Arduino 5V Trig-Arduino 12 Echo- Arduino 13 GND- Ardunio Gnd

OBSTACLE DISTANCE PROGRAM

RC Servo Motor

#include < Servo.h > Servo myservo ; int pos = 0; void setup() { myservo.attach (9);} void loop() { for(pos = 0; pos <= 180; pos += 1) { myservo.write (pos); delay(15);} for(pos = 180; pos>=0; pos-=1) { myservo.write (pos); delay(15); } } Servo Motor Loop Function

Potentiometer Control Servo Position #include < Servo.h > Servo myservo ; int potpin = 0; int val ; void setup() { myservo.attach (9); } void loop() { val = analogRead ( potpin ); val = map( val , 0, 1023, 0, 180); myservo.write ( val ); delay(15); }

LCD DISPLAY

LCD PROGRAM #include < LiquidCrystal.h > LiquidCrystal lcd (8, 9, 4, 5, 6, 7); void setup() { lcd.begin (16, 2); lcd.print (" I AM NOT A ROBOT"); } void loop() { lcd.setCursor (0, 1); lcd.print ( millis () / 1000); }

#include < LiquidCrystal.h > LiquidCrystal lcd (8, 9, 4, 5, 6, 7); void setup() { lcd.begin (16, 2); lcd.print (“ROBOTICS"); } void loop() { lcd.noDisplay (); delay(500); lcd.display (); delay(500); }

I2C Communication

Program #include < Wire.h > void setup()  {   Wire.begin ();          Serial.begin (9600);   } void loop() {   Wire.requestFrom (8, 6);    while ( Wire.available ()) {      char c =  Wire.read ();       Serial.print (c);         }   delay(500); } #include < Wire.h > void setup()  {   Wire.begin (8);           Wire.onRequest ( requestEvent ); } void loop()  {   delay(100); } void  requestEvent ()  {   Wire.write ("hello "); } Receiver Sender

Master Sender #include < Wire.h > void setup() {   Wire.begin ();  // join i2c bus (address optional for master) } byte x = 0; void loop() {   Wire.beginTransmission (8);  // transmit to device #8   Wire.write ("x is ");         // sends five bytes   Wire.write (x);               // sends one byte   Wire.endTransmission ();     // stop transmitting   x++;   delay(500); }

Slave Receiver #include < Wire.h > void setup() {   Wire.begin (8);                 // join i2c bus with address #8   Wire.onReceive ( receiveEvent );  // register event    Serial.begin (9600);            // start serial for output } void loop() {   delay(100); } void  receiveEvent (int  howMany ) {   while (1 <  Wire.available ()) {  // loop through all but the last     char c =  Wire.read ();  // receive byte as a character      Serial.print (c);         }   int x =  Wire.read ();     // receive byte as an integer    Serial.println (x);          // print the integer }

MOBILE ROBOT DESIGN SESSION VI

OBSTACLE AVOIDING ROBOT DESIGN REQUIRING COMPONENTS Arduino board Motors Wheels L293d Driver Board Battery Connecting wires Screws Screw driver Ultrasonic sensor Robot chassis Robot assemble instruction file Arduino IDE

CONCEPT Every second check the obstacle and take decision If robot meet obstacle in its path when it turn right or left.

LINE FOLLOWER ROBOT DESIGN

REQUIRING COMPONENTS Arduino board Motors Wheels L293d Driver Board Battery Connecting wires Screws Screw driver Line array sensor Robot chassis Robot assemble instruction file Arduino IDE

CHECK YOUR COMPONENTS BOX Arduino board USB cable L293 driver board Battery

LIST OF COMPONENTS Dc motor Line array sensor Potentiometer Ultrasonic sensor adapter

CHECK YOUR COMPONENTS Arduino board USB cable L293 driver board Battery

CHECK YOUR COMPONENTS Connecting wires Ultrasonic sensor LEDs Resisters Reset button/switch

AND FUNCTION (&&) INPUT 1 INPUT 2 OUTPUT 1 1 1 1 1 INPUT 1 INPUT 2 OUTPUT 1 1 1 1 1 1 1 OR FUNCTION (||)