Arduino ebook



Arduino for Beginners


                                                      

What is an Arduino?



The Arduino is the board shown in the figure below.





Basically, it is a small development board with a brain (also known as a microcontroller) that you can connect to electrical circuits. This makes it easy to read inputs – read data from the outside – and control outputs - send a command to the outside. The brain of this board (Arduino Uno) is an ATmega328p chip where you can store your programs that will tell your Arduino what to do.

Exploring the Arduino Uno Board



In the figure below you can see an Arduino board labeled. Let’s see what each part does.


Microcontroller:
the ATmega328p is the Arduino brain. Everything on the Arduino board is meant to support this microcontroller. This is where you store your programs to tell the Arduino what to do.

Digital pins: Arduino has 14 digital pins, labeled from 0 to 13 that can act as inputs or outputs.
o   When set as inputs, these pins can read voltage. They can only read two states: HIGH or LOW.
o   When set as outputs, these pins can apply voltage. They can only apply 5V (HIGH) or 0V (LOW).

 PWM pins: These are digital pins marked with a ~ (pins 11, 10, 9, 6, 5 and 3). PWM stands for “pulse width modulation” and allows the digital pins output “fake” varying amounts of voltage. You’ll learn more about PWM later.

TX and RX pins: digital pins 0 and 1. The T stands for “transmit” and the R for “receive”. The Arduino uses these pins to communicate with other electronics via Serial. Arduino also uses these pins to communicate with your computer when uploading new code. Avoid using these pins for other tasks other than serial communication, unless you’re running out of pins.

LED attached to digital pin 13: This is useful for an easy debugging of the Arduino sketches.

TX and RX LEDs: these leds blink when there are information being sent between the computer and the Arduino.

Analog pins: the analog pins are labeled from A0 to A5 and are often used to read analog sensors. They can read different amounts of voltage between 0 and 5V. Additionally, they can also be used as digital output/input pins like the digital pins.

Power pins: the Arduino provides 3.3V or 5V through these pins. This is really useful since most components require 3.3V or 5V to operate. The pins labelled as “GND” are the ground pins.

Reset button: when you press that button, the program that is currently being run in your Arduino restarts. You also have a Reset pin next to the power pins that acts as reset button. When you apply a small voltage to that pin, it will reset the Arduino.

Power ON LED: will be on since power is applied to the Arduino.

USB jack: you need a male USB A to male USB B cable (shown in figure below) to upload programs from your computer to your Arduino board. This cable also powers your Arduino.

Downloading the Arduino IDE

The Arduino IDE (Integrated Development Environment) is where you develop your programs that will tell the Arduino what to do.
You can load new programs onto the main chip, the ATmega328p, via USB using the Arduino IDE. To download the Arduino IDE, please click on the following link: https://www.arduino.cc/en/Main/Software. Select which Operating System you’re using and download it. Then, simply follow the installation wizard to install the Arduino IDE.
When you first open the Arduino IDE, you should see something similar to the figure below:

Connecting your Arduino

Connect your Arduino UNO to your computer via USB.
After connecting your Arduino with a USB cable, you need to make sure that the Arduino IDE has selected the right board.
In our case, we’re using Arduino Uno, so we should go to Tools 4 Board: 4

Arduino/Genuino Uno.


Then, you should select the serial port where your Arduino is connected to. Go to

Tools 4 Port and select the right port.



Uploading an Arduino Sketch


To show you how to upload code to your Arduino board, we’ll show you a simple example. This is one of the most basic examples – it consists in blinking the on-board LED or digital pin 13 every second.

1.    Open your Arduino IDE.


2.    Go to File 4Examples 4 01.Basics 4 Blink




By default, the Arduino IDE comes pre-configured for the Arduino UNO. Click the


Upload button and wait a few seconds.




After a few seconds, you should see a Done uploading message.




This code simply blinks the on-board LED on your Arduino UNO (highlighted with red color). You should see the little LED turn on for one second, and turn off for another second repeatedly.







The features of Arduino Uno ATmega328 includes the following.

  • The operating voltage is 5V.
  • The recommended input voltage will range from 7v to 12V.
  • The input voltage ranges from 6v to 20V.
  • Digital input/output pins are 14.
  • Analog i/p pins are 6.
  • DC Current for each input/output pin is 40 mA.
  • DC Current for 3.3V Pin is 50 mA.



































1 Comments

  1. I am G DHEEPAK from Villupuram.I like ROBOTICS.Your projects gave me some inspiration.Thanks for that sir.I am also tryingbto do some project in ARDUINO

    ReplyDelete