Starter Guide to Robotics
Everyone gets excited or thinking after hearing the word robotics, i.e. How is it working? How can we make a robot?
let’s understand a little bit about robotics and robots first.
In simple word, the robot is an automatically operated machine that can ease the human effort, though it may not reduce human beings in appearance or perform functions in a specific manner.
What is Robotics?
Robotics involves the design, construction, operation, and efficient use of robots. The end goal of robotics is to design intelligent machines or valuable hardware products that can help and assist humans in their day-to-day lives and keep everyone safe or make humans work easier.
According to the definition or basic understanding of the robots, the robot needs to be able to make decisions and perform accordingly but in deep down Robots work on sense, think, act and repeat cycles. Examples of some basic robots: – line follower robots, obstacle avoider robots and many more.
A line follower is an autonomous vehicle robot which is able to follow a line, often, a black line on a white background or vice versa.
An obstacle avoider is an autonomous robot which is able to avoid obstacles in their path or change their direction or stops if they sense any obstacle in the path. A line follower robot is the first step into the robotics world. It is a very simple robot which you can make easily, and I’m sure you will learn too much about robotics after this. For being an expert in robotics and its upcoming few parts, you have to be looking at the various fields of study which you need to know about.
In electronics you have to look at what are circuits and what are their components are being used in the robotics project. You have to understand in short about the Voltage and Current.
In this section, you can see how the physical structure of the robot comes together and what are the various driving mechanisms used in that.
To actually give the robot the ability to think or work automatically we can program a robot. For this, we will go through what exactly is programming the robot or microcontroller and start from the basics.
Let’s discuss Arduino, which is basic hardware stuff or a microcontroller to start with.
What is a Microcontroller?
A microcontroller is a very small computer that has digital electronic devices built into it that helps it control things. These devices allow it to sense the world around it and drive the actions of external devices.
The microcontroller is an “embedded computer system” that continuously repeats or runs on software (programming) commands. Examples: Arduino Uno, Raspberry Pi, etc.
What is ARDUINO?
- It is an open-source physical computing platform based on a simple microcontroller board like- Atmega8, Atmega16, Atmega328 etc.
- Arduino is an open-source project prototyping platform, which is flexible and easy to use hardware and software
- It has a separate software development environment, which is also an Open-Source IDE
You are free to modify the hardware or the software of the Arduino boards according to the requirements.
For software, you can add an AVR-C library and start writing code, as in AVR studio.
What can we do with it (Arduino)??
- Arduino boards can take input from Sensors like IR, Sound etc. and respond to it as programmed, by using Digital Pins.
- Anyone having Interactive Ideas can make it alive by using Arduino boards.
Why choose Arduino?
- Cross-Platform Capability: Supports Win, Mac & Linux.
- Simple Working Environment
- Very Easy Programming
- Open-source: Can be modified by anyone
Arduino Board Details
- Microcontroller- ATmega8
- Operating Voltage- 5V
- 14 digital I/O pins (6of them provide PWM output)
- 6 analog Input pins
- DC Current for I/O pin is 40 mA
- DC Current for 3.3V pin is 50 mA
- 16 MHz Clock Speed
Arduino Development Environment
- The Arduino development environment contains-
- a text editor for writing code,
- a message area,
- a text console,
- a toolbar with buttons for common functions
- a series of menus.
- It connects to the Arduino hardware to upload programs and communicate with them.
Getting started with Arduino Programming
// we have to write our setup code here, to run once
// we have to put our main code here, to run repeatedly:
- Setup: It is called only when the Arduino is powered on or reset. Setup is used to initialize or declare variables and pin numbers as pin modes
- Loop: The loop functions continuously till the device is powered off. The main logic of the code is written in the loop section
A pin on an Arduino can be set as input or output by using the PinMode function.
pinMode(13, OUTPUT); // output pin number is 13
pinMode(13, INPUT); // input pin number is 13
Reading/writing Analog & digital values
digitalWrite(13, LOW); // output voltage on pin 13 is 0V
digitalWrite(13, HIGH); // output voltage on pin 13 is 5V
analogRead(A0); // this is used to read the analog value from the analog pin 0
What are Sketches in Arduino?
- Software written using Arduino IDE is called sketches. These sketches are written in the text editor of Arduino IDE software.
- Sketches are saved with the file extension (. ino).
- The console displays text output by the Arduino environment including complete error messages and other information.
Selecting Boards Arduino IDE: -
The board selection has two effects:
It sets the parameters (e.g. CPU speed and baud rate) which is used when compiling and uploading sketches and sets and the file used by the burn bootloader command.
- We are using Arduino Uno
- We arechoosing programmer as USB because we are programming using USB cable
Libraries provide extra functionality for use in sketches.
- To use a library in a sketch,
- –Select it from the Sketch > Import Library menu.
- This librariesinsert one or more #include statements in the code at the top of the sketch and compile the library with your sketch.
- Displays serial data being sent from the Arduino board (USB or serial board).
- –To send data to the board, enter text and click on the “send” button or press enter.
Uploading Codes in Arduino
- It means to write the program on your Arduino board.
- Before uploading your sketch, you need to select the correct serial port from the
- –Tools > Board and Tools > Serial Port menus.
- To find out, you look for a USB serial device in the ports section of the Windows Device Manager
Finally Uploading to Arduino Board
- Once you’ve selected the correct serial port and board, press the upload button in the toolbar or select the Upload item from the File menu.
- Press the reset button on the board just before starting the upload.
- On most boards, you’ll see the RX and TX LEDs blink as the sketch is uploaded.
- The Arduino environment will display a message when the upload is complete, or show an error.