Robotics Notes
Robotics Notes
Definition of a Robot
• "A reprogrammable, multifunctional manipulator designed to move material,
parts, tools, or
specialized devices through various programmed motions for the performance of
a variety of tasks" .
Characteristics
There are some characteristics of robots given below:
Appearance: Robots have a physical body. They are held by the structure of
their body and are moved by their mechanical parts. Without appearance,
robots will be just a software program.
Brain: Another name of brain in robots is On-board control unit. Using this
robot receive information and sends commands as output. With this control
unit robot knows what to do else it’ll be just a remote-controlled machine.
Sensors: The use of these sensors in robots is to gather info from the outside
world and send it to Brain. Basically, these sensors have circuits in them that
produces the voltage in them.
Actuators: The robots move and the parts with the help of these robots move
is called Actuators. Some examples of actuators are motors, pumps, and
compressor etc. The brain tells these actuators when and how to respond or
move.
Program: Robots only works or responds to the instructions which are
provided to them in the form of a program. These programs only tell the brain
when to perform which operation like when to move, produce sounds etc.
These programs only tell the robot how to use sensors data to make
decisions.
Behaviour: Robots behavior is decided by the program which has been built
for it. Once the robot starts making the movement, one can easily tell which
kind of program is being installed inside the robot.
Scope and limitations of robots: The advance version of machines are robots
which are used to do advanced tasks and are programmed to make decisions on
their own. When a robot is designed the most important thing to be kept in mind
is that What the function is to be performed and what are the limitations of the
robot. Each robot has a basic level of complexity and each of the levels has the
scope which limits the functions that are to be performed. For general basic
robots, their complexity is decided by the number of limbs, actuators and the
sensors that are used while for advanced robots the complexity is decided by the
number of microprocessors and microcontroller used. As increasing any
component in the robot, it is increasing the scope of the robot and with every
joint added, the degree of the robot is enhanced.
Advantages: The advantages of using robots are given below:
They can get information that a human can’t get.
They can perform tasks without any mistakes and very efficiently and fast.
Applications: Different types of robots can performs different types of tasks. For
example, many of the robots are made for assembly work which means that they
are not relevant for any other work and these types of robots are called
Assembly Robots. Similarly, for seam welding many suppliers provide robots
with their welding materials and these types of robots are known as Welding
Robots. While on the other hand many robots are designed for heavy-duty work
and are known as Heavy Duty Robots. There are some applications given below:
Caterpillar plans which is aiming to develop remote-controlled machines and
are expecting to develop heavy robots by 2021.
A robot can also do Herding task.
Robots are increasingly been used more than humans in manufacturing while
in auto-industry there are more than half of the labors are “Robots”.
Many of the robots are used as Military Robots.
Robots have been used in cleaning up of areas like toxic waste or industrial
wastes etc.
Agricultural robots.
Household robots.
Domestic robots.
Nano robots.
Swarm robots.
Advantages:
1. Increased Efficiency: Robots can work 24/7 without getting tired, leading to
increased productivity and efficiency.
2. Improved Accuracy: Robots are capable of performing tasks with high
precision and accuracy, reducing errors and improving quality.
3. Increased Safety: Robots can perform tasks that are dangerous for humans,
improving overall safety in the workplace.
4. Reduced Labor Costs: The use of robots can lead to reduced labor costs, as
robots can perform tasks more cheaply than human workers.Robots are used
in different factories to produce items like plane, car parts etc.
5. Maximum robots are automatic, so they can perform different tasks without
needing human interaction.
6. They can be used for mining purposes and can be sent to earth’s madrid.
Disadvantages:
• A robot may not injure a human being, or, through inaction, allow a human being
to come to harm
• A robot must obey orders given it by human beings, except where such orders
would conflict with the First Law.
• A robot must protect its own existence as long as such protection does not
conflict with the First or Second Law.
SENSORS
Keeping that in mind, there are many sensors for many applications. So how are
we going to distinguish them.
Types of Sensors
Now, remember all of the sensors can be classified mainly into these two types. But
there are other ways to classify them.
Let’s get to know these types better and see what sensors fall into these
categories.
Temperature Sensor
Proximity Sensor
Accelerometers
Pressure Sensor
Load cell
Light Sensor
Tilt Sensor
Vibration Sensor
Heartbeat Sensor
Gas Sensor
Rotary Encoder
Tachometer
The Arduino Uno is one kind of microcontroller board based on ATmega328, and
Uno is an Italian term which means one. Arduino Uno is named for marking the
upcoming release of microcontroller board namely Arduino Uno Board 1.0. This
board includes digital I/O pins-14, a power jack, analog i/ps-6, ceramic resonator-
A16 MHz, a USB connection, an RST button, and an ICSP header. All these can
support the microcontroller for further operation by connecting this board to the
computer. The power supply of this board can be done with the help of an AC to
DC adapter, a USB cable, otherwise a battery. This article discusses what is
an Arduino Uno microcontroller, pin configuration, Arduino Uno
specifications or features, and applications.
The Arduino Uno board can be built with power pins, analog pins, ATmegs328,
ICSP header, Reset button, power LED, digital pins, test led 13, TX/RX pins, USB
interface, an external power supply. The Arduino UNO board description is
discussed below.
below.
Arduino Uno Board Pin Configuration
Power Supply
The Arduino Uno power supply can be done with the help of a USB cable or an
external power supply. The external power supplies mainly include AC to DC
adapter otherwise a battery. The adapter can be connected to the Arduino Uno by
plugging into the power jack of the Arduino board. Similarly, the battery leads
can be connected to the Vin pin and the GND pin of the POWER connector. The
suggested voltage range will be 7 volts to 12 volts.
The 14 digital pins on the Arduino Uno can be used as input & output with the help
of the functions like pinMode(), digitalWrite(), & Digital Read().
Pin1 (TX) & Pin0 (RX) (Serial): This pin is used to transmit & receive TTL serial
data, and these are connected to the ATmega8U2 USB to TTL Serial chip
equivalent pins.
Pin 2 & Pin 3 (External Interrupts): External pins can be connected to activate
an interrupt over a low value, change in value.
Pins 3, 5, 6, 9, 10, & 11 (PWM): This pin gives 8-bit PWM o/p by the function of
analogWrite().
SPI Pins (Pin-10 (SS), Pin-11 (MOSI), Pin-12 (MISO), Pin-13 (SCK): These pins
maintain SPI-communication, even though offered by the fundamental hardware,
is not presently included within the Arduino language.
Pin-13(LED): The inbuilt LED can be connected to pin-13 (digital pin). As the
HIGH-value pin, the light emitting diode is activated, whenever the pin is LOW.
Pin-4 (SDA) & Pin-5 (SCL) (I2C): It supports TWI-communication with the help of
the Wire library.
AREF (Reference Voltage): The reference voltage is for the analog i/ps with
analogReference().
Reset Pin: This pin is used for reset (RST) the microcontroller.
Memory
Communication
Arduino Uno can detect the surroundings from the input. Here the input is a
variety of sensors and these can affect its surroundings through controlling
motors, lights, other actuators, etc. The ATmega328 microcontroller on the
Arduino board can be programmed with the help of an Arduino programming
language and the IDE (Integrated Development Environment). Arduino projects
can communicate by software while running on a PC.
Arduino Programming
Once the Arduino IDE tool is installed in the PC, attach the Arduino board to the
computer with the help of USB cable. Open the Arduino IDE & select the right
board by choosing Tools–>Board..>Arduino Uno, and select the right Port by
choosing Tools–>Port. This board can be programmed with the help of an
Arduino programming language depends on Wiring.
To activate the Arduino board & flash the LED on the board, dump the program
code with the selection of Files–> Examples..>Basics..>Flash. When the
programming codes are dumped into the IDE, and then click the button ‘upload’
on the top bar. Once this process is completed, check the LED flash on the board.
The Arduino Uno board has a rearrangeable poly fuse that defends the USB port
of the PC from the over-voltage. Though most of the PCs have their own inner
protection, the fuse gives an additional coating of safety. If above 500mA is given
to the USB port, then the fuse will routinely crack the connection until the over-
voltage is removed.
Physical Characteristics
The physical characteristics of an Arduino board mainly include length and width.
The printed circuit board of the Arduino Uno length and width are 2.7 X 2.1
inches, but the power jack and the USB connector will extend beyond the previous
measurement. The board can be attached on the surface otherwise case with the
screw holes.
The initial step to start with Arduino is the IDE download and installation.
Brackets
There are two types of brackets used in the Arduino coding, which are listed below:
o Parentheses ( )
o Curly Brackets { }
Parentheses ( )
The parentheses brackets are the group of the arguments, such as method,
function, or a code statement. These are also used to group the math equations.
Curly Brackets { }
The statements in the code are enclosed in the curly brackets. We always require
closed curly brackets to match the open curly bracket in the code or sketch.
Line Comment
There are two types of line comments, which are listed below:
The text that is written after the two forward slashes are considered as a single line
comment. The compiler ignores the code written after the two forward slashes. The
comment will not be displayed in the output. Such text is specified for a better
understanding of the code or for the explanation of any code statement.
The // (two forward slashes) are also used to ignore some extra lines of code
without deleting it.
Coding Screen
The coding screen is divided into two blocks. The setup is considered as the
preparation block, while the loop is considered as the execution block. It is shown
below:
The set of statements in the setup and loop blocks are enclosed with the curly
brackets. We can write multiple statements depending on the coding requirements
for a particular project.
For example:
1. void setup ( )
2. {
3. Coding statement 1;
4. Coding statement 2;
5. .
6. .
7. .
8. Coding statement n;
9. }
10. void loop ( )
11. {
12. Coding statement 1;
13. Coding statement 2;
14. .
15. .
16. .
17. Coding statement n;
18. }
It contains an initial part of the code to be executed. The pin modes, libraries,
variables, etc., are initialized in the setup section. It is executed only once during
the uploading of the program and after reset or power up of the Arduino board.
Zero setup () resides at the top of each sketch. As soon as the program starts
running, the code inside the curly bracket is executed in the setup and it executes
only once.
The loop contains statements that are executed repeatedly. The section of code
inside the curly brackets is repeated depending on the value of variables.
Time in Arduino
The time in Arduino programming is measured in a millisecond.
For example, for a 5-second delay, the time displayed will be 5000 milliseconds.
Example:
pinMode ( )
The specific pin number is set as the INPUT or OUTPUT in the pinMode () function.
Where,
pin: It is the pin number. We can select the pin number according to the
requirements.
Mode: We can set the mode as INPUT or OUTPUT according to the corresponding
pin number.
Code:
The high current and short circuit of a pin can damage the ATmel chip. So, it is
recommended to set the mode as OUTPUT.
The digitalWrite () will disable the LOW during the INPUT mode. The output pin will
be considered as HIGH.
We can use the INPUT mode to use the external pull-down resistor. We are required
to set the pinMode as INPUT_PULLUP. It is used to reverse the nature of the INPUT
mode.
The sufficient amount of current is provided by the pull-up mode to dimly light an
LED, which is connected to the pin in the INPUT mode. If the LED is working dimly, it
means this condition is working out.
o The void loop () would include digitalWrite( ) and delay ( ) as the main
function.
digitalWrite( )
The digitalWrite ( ) function is used to set the value of a pin as HIGH or LOW.
Where,
HIGH: It sets the value of the voltage. For the 5V board, it will set the value of 5V,
while for 3.3V, it will set the value of 3.3V.
If we do not set the pinMode as OUTPUT, the LED may light dim.
Example:
The HIGH will ON the LED and LOW will OFF the LED connected to pin number 13.
The digitalRead () function will read the HIGH/LOW value from the digital pin, and
the digitalWrite () function is used to set the HIGH/LOW value of the digital pin.
delay ( )
The delay () function is a blocking function to pause a program from doing a task
during the specified duration in milliseconds.
Code:
Here, the LED connected to pin number 13 will be ON for 2 seconds and OFF for 1
second. The task will repeatedly execute as it is in the void loop ().
Example: To light the LED connected to pin number 13. We want to ON the LED for
4 seconds and OFF the LED for 1.5 seconds.
Code:
1. void setup ()
2. {
3. pinMode ( 13, OUTPUT); // to set the OUTPUT mode of pin number 13.
4. }
5. void loop ()
6. {
7. digitalWrite (13, HIGH);
8. delay (4000); // 4 seconds = 4 x 1000 milliseconds
9. digitalWrite (13, LOW);
10. delay (1500); // 1.5 seconds = 1.5 x 1000 milliseconds
11. }
As we open the Arduino IDE, the display will look like the below image:
The two functions that encapsulate the pieces of code in the Arduino program are
shown below:
1. void setup ( )
2. void loop ( )
Functions
o The functions in Arduino combine many pieces of lines of code into one.
o The functions usually return a value after finishing execution. But here, the
function does not return any value due to the presence of void.
o The setup and loop function have void keyword present in front of their
function name.
o The multiple lines of code that a function encapsulates are written inside curly
brackets.
o Every closing curly bracket ' } ' must match the opening curly bracket '{ ' in
the code.
o We can also write our own functions, which will be discussed later in this
tutorial.
Spaces
o Arduino ignores the white spaces and tabs before the coding statements.
o The coding statements in the code are intent (empty spacing at the starting)
for the easy reading.
o In the function definition, loop, and conditional statements, 1 intent = 2
spaces.
o The compiler of Arduino also ignores the spaces in the parentheses, commas,
blank lines, etc.
Tools Tab
o The verify icon present on the tool tab only compiles the code. It is a quick
method to check that whether the syntax of our program is correct or not.
o To compile, run, and upload the code to the board, we need to click on the
Upload button.
Uses of Parentheses ( )
Semicolon ;
Program Flow
The program flow in Arduino is similar to the flowcharts. It represents the execution
of a program in order.
Flow Charts
A flowchart uses shapes and arrows to represent the information or sequence of
actions.
An oval ellipse shows the Start of the sequence, and a square shows the action or
processes that need to be performed.
The Arduino coding process in the form of the flowchart is shown below:
Here, the processor enters our code, and the execution of code begins. After the
setup, the execution of the statement in the loop begins.
#######################################################
Semester 2
NODEMCU
NodeMCU is an open-source Lua based firmware and development
board specially targeted for IoT based Applications. It includes firmware that runs
on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based
on the ESP-12 module.
Control EN, RST The pin and the button resets the microcontroller
Pins
SPI Pins SD1, CMD, NodeMCU has four pins available for SPI
SD0, CLK communication.