0% found this document useful (0 votes)
9 views

Arduino - 2021 Updated User Guide to Learn Arduino Programming Step by Step

The document is a user guide for learning Arduino programming, covering its history, functionality, and applications. It explains what Arduino is, how to get started, and the programming languages involved, emphasizing its simplicity and accessibility for beginners. The guide also highlights the advantages of using Arduino for various electronic projects and robotics.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Arduino - 2021 Updated User Guide to Learn Arduino Programming Step by Step

The document is a user guide for learning Arduino programming, covering its history, functionality, and applications. It explains what Arduino is, how to get started, and the programming languages involved, emphasizing its simplicity and accessibility for beginners. The guide also highlights the advantages of using Arduino for various electronic projects and robotics.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

Arduino:

2021 Updated User Guide to Learn Arduino


Programming Step by Step
CONTENTS

Introduction

Chapter 1: What is Arduino and Why Should You Buy It?

Chapter 2: How to get Arduino started.

Chapter 3: Programming Languages for Arduino

Chapter 4: Choosing Arduino

Chapter 5: The Theory of Creating a Robot Based on Arduino

Chapter 6: Simple Robots for You

Concluding
Thank you for purchasing this book!

I hope it will be useful for you.


Introduction

Joseph Marie Jacquard invented a punched card for the weaving machine in
1808, the French weaver. Although it was not a computer, it was an analog
to contemporary automatic lines, for the first time the programming
principle, in which modern robotics stands, was applied in the industry.

Over time, control methods, in particular wired and radio waves, have been
improved. In 1898, Nicola Tesla first demonstrated a self-propelled, radio-
controlled boat. At the same time, other devices have begun to acquire
simple and more powerful miniature electric motors instead of complex
mechanical drives.

All the factors leading to the formation of the first robots were already
established by the beginning of the 20th century. Electric current has not
only become a source of energy, but also a way of receiving, transmitting
and processing information. It is impossible to tell when the first robot
appeared, in the current context of the term. Many companies and
individual developers of that time worked on these machines. More than 30
mechanisms were developed in the 20s-30s of the last century that still
fulfill the demands of high-quality robotics.

And yet it is claimed to be an American inventor, Roy Wensley from


Westinghouse Electric Company, who developed the first working robot.
The mechanism, which he had created in 1928 dubbed "Herbert Televox,"
was a humanoid computer that could unlock doors and windows, shut down
the oven, electric motors, etc. The biggest change of this innovation from
automatons being the capacity to react and operate on telephone
instructions. However, the robot was not specifically linked to the phoneline
- like a man, it heard commands using its integrated microphone. As the
technology at the period incomplete, these instructions were not in standard
language, they were a certain series of beeps, squeaks, squeaks and other
sounds of various tones.

Roy Wesley's championship is challenged by the Japanese biologist Makoto


Nishimura who created the first active robot in Japan (1929). This
anthropomorphic wire-controlled system was able to carry out different
manipulations, especially in prose. Another nominee for the robot pioneer's
position was Eric. It was also established in 1928 by William Richards, the
British military. The mechanism not only shifted its limbs, but also
addressed some queries "intelligently," also making jokes.

However, this and many other robots were designed rather than for specific
practical activities to demonstrate scientific achievements. Later on,
robotics emerged in manufacturing or agriculture as such work required a
qualitatively new level of technology. Although the first prototype of an
industrial robot was founded in 1898, the manipulator created by American
engineer Babbitt pulled the blanks out of a red-hot furnace.
Only after the end of the Second World War did robotics grow entirely in
the industry.
General Electric created the first industrial robot to operate in a nuclear
reactor in the United States in 1948. Its feature was that the operator was
able to see its movement in the workspace but also to feel the strength that
had been developed by the manipulator's gripper which enabled the
mechanism to be controlled more accurately.

In the middle of the fifties, American George Devol established Unimation,


which released the first series of industrial robots, which were programmed
with punched cards. In the mid-60s, several dozen companies had started
manufacturing such machines in developed countries. In particular, Japan
succeeded in this – having purchased the first "Unimation" robots in 1968.
Ten years back, this nation became the global pioneer in the manufacture
and machinery of its own analogs of production plants.

Today, nearly all fields of operations have been invaded by robots. Industry,
scientific research, energy, medicine, entertainment, military operations and
space – modern mechanisms are used extensively, either automatically or
remotely controlled, and human work is even increasingly overwhelmed.
Robots have been developed in several directions – improving mechanisms
and drives, improving algorithms, establishing control systems of self
learning (weak artificial intelligence) and developing new interfaces
between humans and computers. Biotechnology and cybernetics are closely
related to roboticism which leads to the development of cybernetic
organisms, functional bionic prostheses, fully autonomous cars, vessels,
spacecraft and aircraft (including military). So Karl Capek described our
society imperceptibly in the future only one century ago.
Now even a robot can be installed at home. Arduino is perfect for this
mission.
Chapter 1: What is Arduino and Why Should You Buy It?

Arduino is a "forum for hardware computing."

What is a checker?
For all that have no insights into the subject: not to be mistaken with the
microcontroller - atmega is the crystal microcontroller, the PIC and other
"chips," and the controller is the board for which the microcontrolling is
soldered.
For those that have no idea: the controller is an electronic device that
controls something, i.e. by manipulating others, that reacts to changes in
certain parameters. Take the air conditioner on the wall, for example. There
is an intelligent control panel which switches the air on and off when
necessary, heating/cooling/dehumidification/humidification. A microwave
controller often regulates different tasks on the microwave oven.
Air conditioners, mp3 players, bike devices, sensors, smart phones,
browsers - many of them (usually) have advanced controllers. However, the
desktop machine is a basic controller that can also be extended and can be
used and incorporated with its support. Only suitable expansion cards and
software are required.

Arduino

Arduino is thus indeed a universal controller to be sharpened for any


mission and transformed for any reason into a full electronic unit from an
alarm clock to a robot. Or just to play - to gather all kinds of things. This
can be considered a radio maker.
The board itself may be attached to many sections – keys, such sensor
forms (temperature, pressure, illumination, acceleration, etc.), LEDs, liquid
crystal displays (alphanumeric, but you cannot attach an LCD)
communicate as you like.
Systems for data collection (black box for the aquarium - it writes the
temperature every 5 minutes).
Timers-Event counters (how much has the dog entered the vacuum bowl?).
Alarm advertisers (the dog exceeded the allowed number of approaches to
the bowl, the temperature in the aquarium is below 0, someone left the toilet
without turning off the lights and much more).
This is evident, of course, like the first machine, but it can be quite
fascinating.
We may even attach different devices to the Arduino – for different
purposes, we add shields. This helps you to monitor any form of motor and
even the network load (light, heater, kettle, etc.). You can connect to your
GPS or GSM machine, collect satellite co-ordinates, or transfer your phone
data; your co-ordinates, which were taken by the partner, or while you are
going on a business trip to find out that your beloved flowers are not
watered or that the cat has not been fed for two days – it's God prohibited.
You can plug in the Ethernet module and release your computer over the
internet - transfer data to your website, or let it write it all to the special
shielded SD card. You should incorporate channels of contact — a radio
channel or also Bluetooth in general.

Arduino is a nice idea. A good thing. You will do this to provide a:

• Tank controller • Livestock vehicle feeder


• Intelligent home elements (control of light, curtains, ventilation, power
supply, air conditioning, heating, other electrical appliances)
• Vehicle debugger (all temperatures, pressures, engine speed of your car on
a beautiful small screen, decoding blink codes)
• Remote devices for telemetry
• Basic industrial device • Robots machine.
Everything can be accomplished arbitrarily; you just need to learn the
program.
Why Arduino? Why Arduino?
Yes, a range of universal controllers and development boards are still there,
which allow more ambitious ventures. Yet Arduino has a range of benefits:
• No programmer required • No specific knowledge of Microcontroller
Program • Fully free Arduino Project • The framework is gaining
prominence • Standardizing the position of the results • Cross-Platform
Environmental Creation
Chapter 2: How to get Arduino started.

Starting with Arduino

Arduino is an electronic board in which you can plug several different


devices in a specific programming setting and make them function together
using a software written in Arduino.
The wires can be fixed to the board and multiple components can be linked.
The prototyping board is generally used for the attachment for installation
without soldering. You can connect LEDs, cameras, switches, generators,
connectivity modules and relays, and create hundreds of fascinating smart
device designs. The Arduino board is a smart socket that enables and
disables anything attached to it, according to how it is configured.

All project work is split into the following phases:

• We come up with a concept and a specification • The electric circuit is


received by us. The sample board that simplifies the installation of elements
may be used here. Naturally, you need the knowledge to deal with
electronic equipment and use a multimeter
• The Arduino board is linked to a device via USB
• Write and write the software directly to the board by pushing a button in a
specific Arduino programming setting on the panel • Detach the device. The
computer now operates separately – when turned on, it is managed by the
software we saved.
Arduino uses its own dialect C++, but all C++ features are supported.
Another version of writing code - a graphic editor is available. Nothing
must be published - you can only shift the blocks and apply the algorithm
you want from them. With a simple mouse press, the software can load onto
the linked board!
The visual environment is preferred for younger pupils; it is best to review
the "true" Arduino immediately for older engineers. In comparison, C++
experience isn't going to harm anybody.
All seems pretty straightforward in general, right? The specifics need to be
understood.

Easy old Arduino job

Let's begin by knowing what we're going to do and what. What is and how
to use Arduino? If you already know the issue - you should easily hop on. If
not, let's swim together for a little period.
Arduino

Arduino is not a designer brand or supplier name. Instead, this is a popular


name for a whole family of different technology and an open framework
which includes hardware (controller cards and compatible hardware) and
hardware. In essence, Arduino is an infrastructure and environment in
which compatible electronic and mechanical parts can be installed together
in a single unit and then configure the actions of this hardware as you need
it in only two minutes on a standard machine.
Arduino is a gateway to the realm of actual objects and computers from a
futuristic machine world. After the software has been written on a standard
device, we handle not virtual objects, but quite actual sensors, motors and
displays. We are transforming the environment around us - only by
computer programming, open software and several samples of already
equipped libraries.

Arduino's founders

Massimo Banzi, creator of Arduino, is considered to be a teacher at the IDII


Institute in Ivrea, Italy, who tried to develop a convenient programming
platform for students. After selecting the ATMEGA microcontroller, it
simply attached to the board a binding needed for convenient service. A
great team of electronic engineers and software developers was then able to
manufacture a commodity that was strongly desired by the consumer and
steadily gained prominence.
As is always the case, the invention received its name by accident. The
inspirational root was the bar where Arduino's future developers liked a cup
of tea. This organization was called Arduino by the name of King Arduino,
King Ivrea's major historical figure. This historic character was evidently
regarded as a loser, but the reputation is now known to millions around the
world due to the production team of the digital platform.
Benefits:

Arduino's charm resides in its clear advantages:


1. Simplicity.
Although Lego and other toys are definitely more familiar, we do not
equate them. Arduino "hides" a number of technological problems for
young electronics entrepreneurs. Without extended absorption in
specifics, several very complicated designs can be produced quite
easily. And this is really necessary for an infant - not to lose
confidence until it has its own hands to produce the first result.
2. Trusting.
Arduino is incredibly common, so many forums or websites will
quickly address queries. The Arduino culture is extensive and
welcoming - there are very few snobs and it's full of amateurs and
newcomers who happily share their excitement with them. This, of
course, implies the appointment efficiency is poorer, but in general,
even the most difficult problems can be addressed easily using
forums and websites.
3. Offering.
Both hardware itself and nearly all applications have been published
under open licenses and you can access the jobs, libraries and
schemes of others openly, often also for commercial use. This saves
you lots of time and helps you to go a long way, relying on previous
researchers' knowledge.
4. Low price.
If you plan to start experimenting with Arduino, you'll need: an
Arduino boards with a computer link + USB cable + a production
board with wires + a collection of simple electronic components and
a battery-type adapter

In the potential, if the schools are carried away and the tests are to be
continued, the list of facilities must be broadened:
The monitors / Telescreens and indications / Telescopic motors and drives,
relays and engine drives / Telescopic contact systems / Numerous other
extension and card modules.
Chapter 3: Programming Languages for Arduino

Depending on the degree to which you plan to go about your experiments,


whether you only want to use them for fun, or make Arduino an earnings
platform, you need to develop your skills in hardware design and
programming language studies.
Arduino is a very small programming interface, in particular contrasted
with the Raspberry Pi. Although the entry level is exceedingly low (the
simple tutorial has 3 sheets with A4 format), there would be no excess of
languages until additional modules are attached. The base here is C/C++,
but you'll have links to running Python, C#, Go, and children's activities
such as Snap! and ArduBlock from different IDEs and libraries.
C/C++ +

The fundamental langue of the Arduino Framework, which is used in the


regular software shell with some modifications and simplifications, doesn't
bother to take advantage of the original C++ language functionality, so no
supplements are required. If you choose to play with 'plain' C, then the
WinAVR software, which is optimized for Windows OS and AVR MK
series interaction, which is used on the Arduino, is in your service.
For people who have already an understanding about programming, study
many languages at school and want to build something on Arduino than an
LED flasher or a basic computer, C/C++ is suggested.

Let's look at what WinAVR is

It's a versatile open source environment for writing programs for


microcontrollers of the AVR series.

WinAVR consists of the GNU GCC compiler that supports the C, C +, and
Objective-C languages, including complete AVR/AVR32 creation cycle and
additional resources, each with a particular task to write microcontroller
software. The most popular of them are: • Programmers Notepad - a
program editor • AVR-LibC - microcontroller library
• AVRDUDE - a computing chip tool with an SPI interface · GNU debug
(GDB) - Command line debugger • Insight - Interactive interface deployer •
Simulavr – GDB help microcontroller AVR • SRecord - a full collection of
EPROM boot files to operate with.

Production climate WinAVR


Working with WinAVR is quite easy, the full collection of documents helps
clear the problems. The software generates a lightweight, respectable code,
which parallels the classic C language syntactically. One downside is the
inability to customize AVR hardware via source code and communicate
with other devices. WinAVR can be paired with proprietary microcontroller
tools from Atmel Studio. Together these packages allow the creation and
intuitive debugging of programs that support all Atmel chip capabilities.

The package falls under the GNU license and is fully free to distribute. In
your discretion, each user may change or modify the software. Furthermore,
there is a compact variant of the store kit that does not include placement on
an external storage media. The WinAVR installation position address bar
does not have spaces or Cyrillic characters. After the software is mounted, a
whole set of shortcuts emerge, which launch different package utilities. The
key one is the "Notepad Operator."
Eric B. Weddington is the app creator.

Bloc of arduousness

Temporarily switch from adult languages into the cherished childish tongue
of Scratch - Ardublock. All here is the same, except with your platform
adaptation - colored bricks, builders, Russian titles, the most basic
reasoning. And for those who don't know about programming, this choice is
fantastic. Like the Emblem you can transfer a virtual bug to a virtual plane,
here you can interest the child in the actual understanding of his program
behavior with the aid of basic operations.

Yeah, by the way, you have to mount a plugin on your Arduino IDE
standard. The new models are better, not to skip, but very complicated. In
the beginning, the date of the end of 2013 is acceptable. Rename it for
"ardublock-all" to mount the downloaded file and push into the "My
Documents/Arduino/tools/ArduBlockTool/tool" folder. Build it if it doesn't
exist.

Snap!

In contrast with Ardublock, Snap! is able to utilize lists and functions in the
form of additional blocks. That is, Pop! is largely an adult programming
language, and does not count that you do have to play code constructor.

You must go to snap4arduino.org and download the appropriate


components for your operating system to use this language.

For the younger age group, people who learned programming too long ago
don't know something, or even people who want to tempt their kids with
Scratch and Snap!. It is recommended.
Snap! – is Scratch-based block programming framework at Berkeley
University of California (University of California at Berkeley).

The key differences in this Scratch programming framework are the


specialized features for constructing your own bricks, lists and first class
functions. Snap! not just at primary school, but also for high school and
other students can be used for these strong features.
Snap! operates immediately in the browser and needs no user download. It
is written in JavaScript and has no influence on the machine so you can
operate projects with other users comfortably.

Snap! was created by MioSoft Corporation's Ens Mönig, now SAP and
Berkeley's Brian Harvey.
Snap! from Scratch's biggest distinction are first-class data forms.
First class items are named elements to which a vector or element of an
array may be delegated, passed as a parameter and returned from a method.
This helps you to build two-dimensional arrays in Snap!.
Unlike the #Scratch features, first class artifacts are still in Snap! This helps
you to transfer a function to another function as a statement. In the
following example, the operation "Multiply by 10" is given as an argument
to the map function and this action is executed by the map function, with
the entire list as the second argument.
Another surprising distinction is that sprites are good performing objects as
well and can be passed as statements.
These features in Snap! encourage students to become acquainted with
practical programming as opposed to the normal Scratch programming.

Compatibility.

In the following browsers, Snap! will work:

The Chrome edition 43 or higher (this is the browser suggested for Snap
work!)
· version of Safari not less than 8.4; • version of Firefox not below 38; >
version of Edge not less than 12; > version of the Firefox version not less
than 32;

The following djdolphin.github.io/Snapin8r2/ will import projects built in


Scratch to Snap!.

Snap! projects can be stored in XML format and translated to executable


EXE files using snapp.citilab.eu's online service.
With the following external devices attached to the screen, Pop! may be
used:

• Orbotix sphero; • Lego NXT; • Nintendo Wiimote; • Robot Finch and


Hummingbird; • LEAP Motion; • Arduino; • Fisheries technology
ROBOTICS TXT Controllers; • Raspberry Pi.

Python

Formally in Arduino you should at least use Piet language so you can
compile everything into the computer code with sufficient perseverance.
However, since Python is one of the most common languages with a nearly
optimum combination of complexity/competency, its applicability in
Arduino will be incomprehensible to circumvent.
You use PySerial libraries (you may previously use them to connect with
device ports) and vPython to do this.

Go and other languages of programming.

More may be achieved on Arduino and sometimes sometimes it needs to be


handled. You may use the serial port to do so by submitting Go orders.

Arduino includes a serial class used to link an Arduino unit to a machine or


other devices supporting a serial interface. At least one serial port is
available for all Arduino cards (UART, sometimes called USART). Serial
data interchange uses 0 (RX) and 1 (TX) optical I/O ports as well as USB
ports. It is necessary to note that, if you use the Serial class, ports 0 and 1
cannot be used for other purposes concurrently.

In Go, it is better to use the sio kit to operate with the serial port. This kit is
not physically quite big, but it is adequate to transmit and receive data from
the computer.
As Arduino works with Python through the PySerial library, so can Go, c
Java and HTML connect with anything you want. Arduino is quite
common, so that the option of a convenient language does not deter another
adventurer. The only thing the owner of this small board wants is to grasp a
remarkably fascinating thing, and a realistic method would eventually be
usable.
Chapter 4: Choosing Arduino

The option and purchasing of Arduino boards is not a major problem for
experienced electronics engineers who build a single project. Information
and skills help them to choose the right job choice. However, it may be hard
for robotic novices to select because the selection of boards is very diverse,
and there are also many analogs for each original.
Look at the number of Arduino in any specialized online shop. It may also
be very difficult to select a suitable cost from all the current variety, but it is
possible.
Arduino preference depending on the project

So, the first thing that determines Arduino's option is which project would
you implement?:

• рroject ready.
• independent project. independent project.
• not decided yet.

All is straightforward in the first case. Get the Arduino board originally
measured for the project.

When you put your own ideas into motion, start with any fee you want to
pay. After that, pick based on removal. That is, if you install modules with
contacts under Arduino Uno during the project, then you automatically
exclude ProMini or Micro, for example. After that, exclude the larger
Arduino from the project:

• Sizes
• Speed of the clock
• Number of results
• Stress

Note that the board memory size must be at least 30% of the required
project size.

If you are determined to find the best, concentrate on the feedback for
similar work on the Internet. Pay attention to the most famous at the same
time. It's most definitely the Arduino Uno, one of the oldest in the card line
and continuously upgraded.

Choose an Arduino according to the model

xxx Arduino

Standard and normal size. When "Arduino" ("Ordinary Arduino") is


mentioned, it typically means that all these cards are at once.

The first boards were in this type factor and the most reincarnations
remained in this version (USB versions in chronological form):

Extreme, NG, Duemilanove, Leonardo, Diecimila.

You may not believe it, but only Leonardo demonstrates a tangible
difference for the consumer.

Next to Leonard and Uno the official site only offers for purchase, but
Duemilanove choices are overloaded on the Internet (our CraftDuino is just
its variety for good purpose – everything that the average consumer wants
have been integrated in Arduino Extreme already, and since then very little
has changed.

All of these cards have the same number of inputs and outputs, are placed
on the same connectors, are programmed via USB and have an ATMega
microcontrollers on board. ATMega8 was installed in earlier models,
ATMega168 was installed and ATMega328 was installed.
There are only 3 PWM outputs on "eight" and 8Kb under 1Kb RAM, but
that's enough for many applications. ATMega168 already has 6 PWM and
16Kb for your needs, the 328th has 32Kb and already has 2Kb of RAM for
programs. By the way, the user does not have all flash memory, and the
boot loader does take part. There was a USB-UART chip converter FT2322
on every board before the UNO, allowing you to stick the board directly to
USB and program it without a programmer. A virtual COM port was found
within the device and is used for programming by the Arduino development
environment.

Starter Kit Arduino

The manufacturer suggests that the Arduino Starter Kit be used to learn
Arduino. In this package are included the board of Arduino UNO and other
electronics for the Arduino study: LEDs, resistors, servo drives, motors,
buttons, LCD panel, piezoelectrical modules, sensors and more.

You have to spend around € 80 to buy the Arduino Starter Kit from the
official manufacturer.
Analogs benefit greatly from similarly configured rates.

Almost all these sets contain the minimum required for beginners and are
suitable for learning our Arduino lessons for beginners (in small sets there
is often no photo resistor).

Arduino United

The board's benefit is its success. The majority of online lessons were
therefore developed for this reason, so there are plenty of comprehensive
usage details. The existence of the DIP panel and the ability to adjust the
microcontroller are also noted.
You won't be able to create circuits on the Breadboard from the
disadvantages. This can also be considered to be less than high.

NANO Arduino V3.0 Arduino

It works as well as ProMini and UNO and can be used for creating
breadboard circuits. The board is much larger than the Arduino ProMini,
but has a USB port without the use of an external programmer.

There are a variety of inconveniences. First, it does not suit the shield
created under the Arduino UNO. Second, a USB port with a controller has
resulted in an increase in the amount of flash memory assigned to the boot
loader. This is worse than the ProMini Arduino.
Mega Arduino 2560

Model advantages:
• Shields for Uno suit the board
• Multiple connections
• High density memory.

The drawbacks are similar to those of Uno: the dimensions that are the
biggest of Arduino boards and the inability to create circuits on the
Breadboard.

Leonardo Arduino

The board is an updated version of Uno and most programs are compatible.
Furthermore, both shields are appropriate for Uno. The board also benefits
from simulating computer devices with a USB input like a keyboard, mouse
etc. Among the deficiencies is the inability to create circuits on the
breadboard and a rise in the share of memory used by the microcontroller to
move USB input functions.

ProMini Arduino 3.3V

This model provides the versatility of Uno and Nano, but can also be used
for Breadboard electronic circuits. It is small in size and can be soldered to
the board without contacts and with pin type. It makes the hinged
installation possible. The drawbacks include the failure to function with
Uno shields and the need to attach external programmers, since the board
has no USB controllers.

MICRO Arduino

The Arduino MICRO is as diverse as the Leonardo. The benefits here are:

• Build electronic circuits on all boards, Breadboard included

• Thin, but featured in more dimensional boards •

• Simulates USB input machines.

The drawbacks include the impossibility of using UNO shields.

ProMini Arduino 5V

Arduino ProMini 5B has Nano and UNO functions


This can be used for creating breadboard circuits. This is the smallest
motherboard in the family Arduino. This helps you to use a mounted
installation since no pin contacts are built into it.

There are a variety of inconveniences. First, the shield generated under


Arduino IT can't be used. Secondly, it has no USB controller, which needs
an external programmer.

The range of Arduino panels is very wide, so analyze all their advantages
and inconveniences when designing a project and buy an acceptable choice.

Start learning with an Arduino-Robot ready-made.

The best way to start with Arduino is to buy a finished robot. This is ideal
for children and very lazy beginners.

There are a wide number of Arduino-based kits. This way of exploring the
Arduino is better for young children because it is a finished toy in which
you can play and dismount and use the Arduino board and other
components during training.

Of course, in the beginner's lesson the finished robot does not have all the
data, but everything missing could be purchased separately. Easy DIY
components can be purchased from any store of radio components, such as
LEDs and resistors.

What do you do if you remain undecided on the board?

• If you haven't decided on a project but want to buy Arduino for your own
experiments, the number of different examples on the network, one or
another version of Arduino, should be taken into account. The undisputed
leader is Arduino UNO, since this board is the oldest and is not out of date
because it has undergone several changes since its inception.

If you are going to carry out your own project, Arduino should be chosen
using an elimination process. If your project has Arduino Uno output
modules, Arduino ProMini 3.3V, Arduino ProMini 5V, Arduino Nano and
Arduino MICRO are removed. If the modules are not usable, we exclude
Arduino which are not suitable in size and then Arduino which have more
than the number of outputs (digital, analog, PWM, interface), clock
frequency and voltage needed by the project. In that case, at least 30% of
the needed project must have a memory margin.

The case with analogs is slightly more complex. They have the same
designation as the original (such as xDuino UNO R3 CH340G and
DCcduino Uno R3 Ch340G) but may have a different form of USB
connector, slightly different lengths, a different type of USB controller, a
different type of microcontrol box, color of the panel etc. Here you can
understand that the boards repeat their original functionality (names that
mimic their own name), as they use the same ATmega microcontroller in
the same sequence. Photography may identify the size of the board, the
microcontroller case and the type of USB port. And with the "CH340G" in
the title you do not need to install the CH340G CH340G driver as a USB
controller for an Arduino, but its CH340G analog, to connect the Arduino
to your device. These boards are ideal for those who agree that installing a
once driver is not unpleasant and that reduced costs are a benefit over the
original name.
Chapter 5: The Theory of Creating a Robot Based on Arduino

Arduino Boards have several features, but it can be challenging for a novice
to begin with difficult tasks and let's begin with the easiest. We can start
with a beetle or a spider from a primitive robot whatever you want.

Your initial code


Your first step towards building a robot would be to mount the Arduino IDE
after you purchase the correct package.

Arduino IDE is a free development environment cross-platform. After the


installation has been completed, you should verify how it functions in the
simplest way. And the easiest thing, as you know, is the LED blinking. It is
attached to pin 13 on most Arduino controllers. By the way, programs are
called sketches in the world of Arduino. Here is the text of the sketch:

Be cautious with the configuration and loop functions. They must be


present in every sketch of Arduino.

Setup
This is used once when the controller is powered up or after restarting. If
you just want the code to run once, it should be positioned exactly as in our
example. There are most frequently numerous forms of initialization
procedures. Our sketch is no exception: Digital Arduino contacts can be
used as inputs and outputs. In the configuration feature, pin 13 will serve as
the controller's digital output.

If the setup function is done, a closed loop is immediately launched, which


calls the loop function. We've got to write about what we want to do. And
we want to add a logical 13-level unit (5 V) to pin 13, i.e. light the LED,
wait one second (in milliseconds, 1000), then turn the zero-level logic (0 V)
on and wait one second. The next call for the loop will repeat it all.

Now "fill in" our controller sketch. We don't need a programmer in this
situation. Arduino controllers include a special boot loader program, which
handles the device download code. To complete the sketch you only need a
USB cable and the File + U menu item (Ctrl + U) in the Arduino IDE.
Theory and reality

You can build several walking robots and they can all look different. A
robot might look like a man. This is regarded as a biped (2 legs). For most
species this may also be the template - 4 legs - quadrupled. The robot can
also be insect-like and have six legs - hexapod. And the coolest robot,
including crabs, spiders and scorpions, can be 8-legged - octopod.
In addition to the number of legs, it is necessary to configure each leg. The
key attribute of the foot is its number of degrees of freedom or its
proportions (DOF). The freedom level is the ability to transform or bend
around a single axis (or less often - to move progressively along it).
Obviously, if you're free, you can't go far on such a leg. Two-degree legs
(2DOF) already allow multi-legged robots to run, even though 2DOF
allows you to move the foot end in only one level freely. The "foot" is
pushed in 3D space in a 3D-foot (if, of course, not all three axes are
parallel). There are 4DOF legs that only make the legs more flexible and
moving. Insects have 4DOF-paws most often.
What does it mean to us? Each degree of freedom in cheap amateur robots
is realized by a single engine, or more precisely a servo drive. The
configuration of the leg determines the number of servos required.
Therefore, it takes 18 servo drives for 3DOF-hexapods, and 32 for 4DOF-
spider. Don't be afraid of the large number; the small servo drives used in
amateurs are very inexpensive. You can find them in online stores by
requesting a micro servo.
To program the servos, it is enough to know that the key work is already
done by a controller. It just takes a power supply and a digital signal to tell
the controller where we want to switch the drive shaft. Information about
their style is simple to find. Their protocol is the simplest of all optical
protocols of communication: pulse-width modulation - PWM. There is a
three pin connector to all simple servos: ground, +5V (voltage can differ
depending on size and power) and signal input. In two different ways,
Arduino controllers can produce such a signal. The first is a PWM hardware
which can be created by the chip itself on several of its digital I / O pins.
The latter is software. Software helps you to receive more PWM signals at
the same time than hardware. The Arduino offers a handy wrapper - Servo
library. You can simultaneously use 12 servo devices on most of the smaller
controllers (Uno, Due, Nano) and 48 servo devices on and around Arduino
Mega. The servo's signal touch is related to the digital output of Arduino.
Earth and power - obviously, they are common to all servos to land and
power. On three wired servo drives, the ground is black or brown, in the
center is normally red + 5 V and, eventually, the signal is white or yellow.
Management from a software point of view is extremely simple:

Most servo drives will rotate the shaft to 180° and the middle position is
90° for them. Many solutions are available to simplify servo drive
connections to the Arduino board. The most commonly used is the Sensors
Shield. You can attach your connectors to it directly when you mount it on
an Arduino Uno and use power on the servers on the terminals.

The Robot Strength

Nutrition is another critical problem. You can use a single power source, but
it has to be a very powerful power source because you have a multifunction
board that allows the whole device to be supplied with one power line.
There are several different sources of influence. The choice is enormous but
the best one for radio models is Li-Ion / Li-Po briquettes. You would
certainly need special loaders for these models if you plan to use them.
When you choose a simpler controller, such as Uno/Due/Nano, you can
power it separately with a 9-volt-source, for example, then connect the
servos to the main power battery. If you follow my advice, food will be
adequate. You need to be much more vigilant than normal if you want to
use lithium batteries to regulate the voltage so that there is no over-
discharge. To do so, you should explain the permissible voltage for a
specific form of battery immediately. To accomplish this, a small digital
voltmeter must be connected to the robot. This will be further discussed.
Chapter 6: Simple Robots for You

Stomping robotic beetle - do it yourself

You need to get all ready before you start the first assembly of your first
robot. You certainly have to verify what you have. To make it simple, pick
the Arduino Uno Controller for the first time. That's the example we used.
You will need 3 servomotor bits. Do not forget the battery compartment
with a click for the "Crown." You naturally have to mount a Krona battery
in this compartment. You need an infrarot receiver, too. Do not forget steel
wire of approximately 1.5 mm diameter. For the equipment you need a
soldering iron and everything you need to solder. No need to solder a lot
and no special expertise is required. If you don't have soldering iron, you're
going to have to buy it because you want to buy more after you have made
your first robot. You certainly have to have a glue weapon and rods. Do not
forget to work with the wire pin. When everyone is gathered, it's time to
begin.

Control of the robot

First of all, we must learn how to use the control panel and know the codes
to operate our console and robot correctly. These codes are then useful for
the sketch of the robot power.
You will need an infrared receiver and prototype board at this stage of
production. I hope that no one is worried that almost all remote controls and
infrarot remotes operate in 36 kHz, 38 kHz or 40 kHz carrier frequencies.
Each infrarot receiver is usually very suitable for us at 36, 38 or 40 kHz.
The frequency may not exactly correspond to the signal carrier frequency.
In this case, the recipient's sensitivity decreases, but in practice, this is
mostly not noticed.
Therefore, TSOP21xx, TSOP22xx, TSOP312xx, are suitable for most
remote receivers. The last two numbers may be 36, 37, 38 or 40. You can
specify the position of its contacts before turning on the Infrared receiver -
there are only three:

+ 5V: This is food


GND: Grounding
Vs: This is the way out.

Next, you need to assemble a diagram, as shown in the illustration.

Below you see an illustration of a properly assembled scheme.


As you can see, we connected the output of the infrared receiver to the
analog input of the controller A0.

Here is the sketch code:


The architecture uses a special IRremote.h library to interpret the signals
from different infrarot remote controls. This library is an open source
project, so downloading is not difficult. And to link it to our project, you
have to take three steps:
• Copy the library directory to the library directory that is located in the
installation directory of Arduino IDE • Delete IDE.
• At the beginning of our sketch, add the line "#include "IRremote.h"
Now in the sketch, INFRARED signal decoding functions are visible. But
we will also use the Serial object to see the codes got. We transmit the
codes through a serial port to a device (the same USB cable). We initialize
the Serial object in the setup function. '9600' is 9600 baud — the speed to
be used for data transmission. After initialization the println function allows
us to write to the serial port. Pick the Tools / Serial Monitor menu item for
displaying the outcome of this output on an Arduino IDE device (Ctrl +
Shift + M). Make sure it's set to baud 9600.
This means that the controller receives power through a USB cable and
transmits data. Load the sketch, start the Serial Monitor and start pressing
the buttons for remote control. In the Serial Monitor window, codes should
appear. The remote protocols are different, sometimes one code, sometimes
many. In every case, you can always pick codes special to every remote
button.

We need 13 remote keys. I've been using the following:

• 1 - turn left • 2 - step forward • 3 - turn right • 4 - turn left at the spot • 5 -
turn right • 6 - turn backward at the spot • 7 - backward at a right turn • 8 -
backward at a turn • 9 - backward at a left turn • very slow • yellow –
slowly – green • rapid • red – very fast.
Write down the codes for these buttons and they are later needed for a robot
control sketch.

Algorithm of motion

We won't examine the drawing in depth.


Insect movement is really interesting. And while all these beetles may fall
to the ground, they are still stable for some reason. At any given time at
least three legs remain on the board, two on one side and one on the other.
And as these legs pull the beetle towards a target, the other three pull this
movement up again. Something similar is our mission.
Our beetle has three servo motors perpendicular to the movement. The
shaft's axis is directed upwards on left and right servomotors, and forward
on the central axis. The role of the left servo, for example, is to swing two
legs at once: the left and left front. By the way, the servos are rigidly wired
and fixed to the rocking chair. The central servo's job is to lift the left side
of the beetle and then the right side. Therefore, the center left and the right
legs are linked to the rocking chair of this engine, which are a single U-
shaped piece.
The sketch should allow the robot to move forward, backward, and
smoothly and move in motion. And I want to regulate the beetle's pace.
Remember that the left and right servomotors must travel exactly the same
way while going forward or reverse. And the motors have to turn in
different directions when cornering (symmetrically). It is also noteworthy
that the forward and reverse movements differ only in the central
servomotor phase.
So how does this work? We note that the controller calls the loop function
continuously. This means that we have to place in this function a code that
defines and sets the current location of the servomotors. Every servomotor
needs to swing. The position of the servo motor can be determined at t
according to the following formula:
X = a sin where X is the desired position of the servomotor, A is the
amplitude of the swing and T is the time of oscillation.
So, depending on timeT, the value of X varies in the range –A to +A. Servo
motors can be mounted between 0 and 180 °. It is therefore easier for us to
swing around the 90° 'zero' spot. And if we want oscillations to be 1 s about
90 ° with an amplitude of 30 °, the formula is translated to the following
form:
X = 90 + 30 sin (2αt/1000), where T is the period that has passed in
milliseconds since oscillation started. We may adjust the oscillation time to
regulate the speed of movement of the stumping beetle. The higher it is, the
quicker it is.
Now, again, let us return to our scheme, since the above formula has not yet
been completed. How to ensure synchronous movement of the left and right
servo motor? How can the central servomotor process be changed? We need
to add an oscillation phase to our formula. Shifting the sinous claim to β for
example would cause the right engine to function in anti-phase to the left,
i.e. how we have to transform. So now is our formula going to look like: X
= 90 + 30 sin, where the oscillation phase is a value from 0 to 2β.

How to mount a robot

Now let's assemble the robot on the board of prototypes and add a sketch.
This is a very critical pre-assembly level. Try disconnecting the USB cable
and adding power to the "Krona" battery layout. Test all movement phases
to make sure it works. It will be harder to alter anything after the robot is
assembled (for example, to replace an idle servomotor).
We switch now to the assembly. The battery compartment is the main
carrier. I recommend that you use a locked cabinet and always use a key.
The details of the beetle can be quickly fastened using a glue gun. Begin
with servomotors. Remove unwanted lugs and join the devices. Then paste
this three-serve motor assembly into the battery cabinet lid. Remember to
open the battery compartment to change the battery.
It is easier to paste the controller into the battery compartment, but I really
do not like this choice because I will still have to send the Arduino Uno to
the beetle. You may then complicate your life and use the Arduino
connectors to link to the battery portion. Paste the male connector with a
pitch of 2.54 mm on the bottom of the compartment. The control socket
should be located in the region of the digital pins 8–11. If the connector is
not usable, fit the curved paper clip in U-shape.
The wires must be wired to the Vin pins and adjacent GND in the battery
compartment. Don't deceive polarity! More "Krona" on wine, minus on
GND. To ensure secure contact of wires with Arduino connectors, wrap the
thicker tip of the wire and use a small piece of the paper clip instead of the
plug. Place the tube next to the soldering tube.
Servo connections should be cut off, the power wires (+5V – typically red
and GND – black or brown) should be combined and brought on the
controller to the 5V sockets and to the adjacent GND. We're going to talk
later. Signal control wires (normally yellow) are created to the digital output
of the controller: left servo motor pin 2, center pin 4 and right pin 7.
"+" and "-" INFRARED can be inserted in the Arduino connector (5V and
adjacent GND). Half bending doubles its thickness. We solder the
previously supplied control wires of the servomotors to the same power legs
of the INFRARED receiver. The INFRARED receiver's output signal is
unlikely to meet the A0 controller's Analog Input, so you have to increase
its cable.
Tips to make legs. Next, plan the "front-rear" legs left and right. Ensure that
they are symmetrical (pay attention to the lengths and angles of the bends).
Start gluing the legs only, make sure the servomotors are located "zero" (90
°).
It is safer to mount the medium legs last on average. I advise you first to
make the middle legs longer and then shorten them to the perfect length
after installation. All six legs have to stand on the surface in the "zero"
position. The "front-back" bends should not be messed with by the rolling
of the middle legs at a 15° amplitude.

What other things would you do?

Your robot can do a lot with the aid of Stomping Beetle. This is a mobile
platform, ready to use, based on one of the most common and affordable
controllers. You can add your robot features. If you add an infrarot
Directed, your robot will engage in the war against robots. The robot's
tactile sensors and range-finder can be linked. You may teach the robot to
circumvent obstacles or to follow a certain path. A camera can also be
mounted on the robot. All you need is a fantasy and a properly selected
collection of Arduino to successfully execute the idea.
Concluding

However, you need some information about electrical engineering and


programming to work with Arduino. You need to understand how a certain
sensor or sensor can be linked. You need to know how to convert the
microcontroller-produced signals to power the actuators, like the engine.
You may need to know how to attach other microcontroller devices like
your Arduino display or video camera. At least the fundamentals of C
writing systems must be known.
It should also be noted that due to the limited amount of memory and
processor speed Arduino can and cannot perform complex calculations and
process large quantities of information. More sensors and actuators cannot
be related than the findings on the Arduino board. The characteristics of the
microcontroller used: ATMEGA enforce these limitations.
Arduino is an ideal solution for robotic applications. It enables you to
perform the easiest robot management tasks. In complex robots, commands
from the main computer can be used to monitor individual pieces.
This book is a little analysis of what Arduino can do. You and I have just
looked into the fascinating robotic universe.

You might also like