Introduction to Arduino | The Complete guide to IoT


This is the first post after introduction, in the series on complete guide to Internet of Things. In this post we will know what the heck is Arduino.

 Arduno Uno iot course circuit and code





So before going directly into Arduino let me explain bit by bit. So we can say that Arduino is nothing but a micro controller contained development board. In our day to day task you must have used many these micro controllers. Some are Air Conditioner, Refrigerator, Microwave Oven, Washing Machine, even your Android or Simple phone these all contains micro controller. And our Arduino is also a micro controller. But what is micro-controller…
In electronics there are two systems one is Microprocessor another is Microcontroller. Let us understand both of these one by one

MicroProcessor:

Microprocessor is a Integrated Circuit(IC) containing millions and billions of Switches (or Electronics Gates viz. NAND, NOR etc.) wrapped inside a small chip. It do not contain any memory or input/output component. It is generally known as CPU. Let me clear this, the device you are using to read this article also contains CPU.
If it an Android device then your phone might be having MediaTek Processor or SnapDragon Processor.
If it is a Laptop or PC then it might have any one of Intel i3, i5, i7 or AMD Ryzen 3,5 etc. so this i3, i5 is the CPU which we are talking about. It contains millions of small switches wrapped on a small chip. Here is some picture to illustrate the same.

Microprocessor IoT circuit and code


These chips are general purpose it means you can do various task with this. Let me make it more clear. In your Laptop/ PC , when you listen music, play videos, games, browse Internet, and do coding so all these different tasks are easily done by your microprocessor(CPU).
So microprocessor is a chip which supports wide variety of functions and task and do not have any memory or input-output component.
Since they do not have memory and Input Output component hence we have to add it from our side to work properly.
They are fast but costly.

MicroController:

Micro controller is a chip that contains low powered microprocessor(CPU) along with memory, input – output components and other components. It is generally used in embedded system.
Lets make it more clear these micro controllers already have mini CPU, memory, input output component and power supply. They are low powered and can be powered by battery for many days. Hence they can be considered as a mini computer designed not for general purpose but for specific purpose. Like the micro controller designed to handle the temperature and cut out of Microwave oven can’t operate the Air Conditioner and vice versa. Hence they are task specific.
mictocontroller arduino course circuit and code

They are cheap but slow.
Concluding
Microprocessor
Microcontroller
Microprocessor is the heart of
Computer system.
Micro Controller is the heart of an
embedded system.
It is only a processor, so memory
and I/O components need to be
connected externally
Micro Controller has a processor
along with internal memory and
I/O components.
Memory and I/O has to be connected
externally, so the circuit becomes
large.
Memory and I/O are already
present, and the internal circuit
is small.
Cost of the entire system is high
Cost of the entire system is low
General purpose use.
Application specific use.

















Now you are clear about Micro controller and Microprocessor. So what is Arduino?
Its a microcontroller contained Development board.
Let me explain you, it has microcontroller(ATmega328) which has Internal Memory, SRAM and EPROM, and also contains Input Output Pins, Its cost is very low, It is not used in general purpose, i.e you can’t play GTA 4 with it, you cant browser Internet with it. It is only used to get sensor data and give you required output according to the program you burn into it.
Arduino is know for various things Arduino is a board, Arduino is a company, Arduino is an Integrated Development Environment.
Arduino company designs and sells boards that make microcontroller easy to use. In our case it is ATmega328 Development board or Arduino UNO.
Simple Arduino Boards are also known as Arduino UNO.
However, there are many more other types of advanced boards with lot of functionality.
arduino boards IoT course circuit and code

What is Arduino ?

Arduino is an open-source electronics board which senses the environment by receiving inputs from many sensors through Input pins, and affects its surroundings by controlling lights, motors, and other actuators.
You can tell the board to behave as you want to the inputs give by programming it with Arduino IDE using Arduino Programming Language both of which we will discuss in our upcoming articles.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping, aimed at students without a background in electronics and programming. 
Arduino.cc
As the official website says that this board was developed aiming for students who have ZERO knowledge in electronics and programming can also do everything without any problem and complications.
As we know it is an Open Source organization so you can easily get their code / board / software / library and modify it according to your need and also redistribute to others.
Have a look at the board and I will explain each and every components which is on the board.

arduino structure and components iot course circuit and code

Starting clockwise from the top center:
  • Analog Reference pin (orange)
  • Ground (light green)
  • Digital Pins 2-13 (green)
  • Digital Pins 0-1/Serial In/Out – TX/RX (dark green) – These pins cannot be used for digital i/o (digitalRead and digitalWrite) if you are also using serial communication (e.g. Serial.begin).
  • Reset Button – S1 (dark blue)
  • In-circuit Serial Programmer (blue-green) to program board without usb cable.
  • Analog In Pins 0-5 (light blue) for analog signals
  • Power and Ground Pins (power: orange 5v and 9v for Vin, grounds: light orange)
  • External Power Supply In (9-12VDC) – X1 (pink) used to power this board using battery or dc source if not using USB cable
  • It has built in Voltage regulator which will reduce the voltage to 5v, if we will use the power through DC jack or Vin and Gnd Pin
  • Toggles External Power and USB Power (place jumper on two pins closest to desired supply) – SV1 (purple)
  • USB (It is used for uploading the code to this board and also for serial communication which we will learn later) (yellow)
  • IC1 shown in the figure is the microcontroller ATmega382 which is the mini computer.
  • PR1 is a programmer which is there on the board. It helps us in programming the microcontroller. It also helps in serial communications.
  • Just beside the microcontroller you will notics a small shiny crystal oscillator which controls how fast microcontroller is running.
Don’t get afraid we will not use everything in our first project, also I will describe everything in detail with pictures.
Lets understand some important components from above
Digital Pins
The main function on Arduino is to take input then process the data and give output. The process of taking input and giving output is done through various I/O(Input-Output) Pins. Digital Pins are one of them which take and give data in either HIGH or LOW form i.e either 1 or 0.
We use various functions to control these Pins like pinMode(pin-number) to set wheather the perticular pin number will act as Input or as Output. Similarly digitalRead(pin-number) in input mode to read the voltage value coming at that pin from the sensor. And digitalWrite(pin-number,HIGH) to set that pin to high voltage to activate the output device.
Each pin has an internal pull-up resistor which can be turned on and off using digitalWrite() (w/ a value of HIGH or LOW, respectively) when the pin is configured as an input. (This concept is hard to explain in words so I recommend to watch this video.) The maximum current per pin is 40 mA. The section below shows how the same pin is used as input and output.
Microcontroller I/O Ports
  • These can be inputs or outputs.
  • The TRISx registers determine whether each I/O line is an input or output.
This is the circuit showing two tristate buffers. Only one is ever active. In this way data can flow in or out but never at the same time.
tristate logic circuit and code
https://reviseomatic.org/help/2-assembler/Assembler%20Tristate%20Logic.php

  • Pin 0 to 13. These pins are digital pins as explained above but some of them have special properties.
  • Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) serial data. These pins are generally used for serial communication using various communication modules like Bluetooth, WiFi, etc.
  • PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. It means you can write analog values like 0-254 and not only 0 and 1 unlike in normal Digital Pin using Pulse Width Modulation.
  • SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication. You can use these special pins to control various devices that work on these special pins like SD card Reader etc. Will be explained later in detail.
  • LED: 13. There is a built-in LED on the board connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.
Analog Pins
The analog input pins support 10-bit analog-to-digital conversion (ADC) using the analogRead() function to read the analog data from the input device. We can use analog pin as digital if we want viz. analog input 0 as digital pin 14 through analog input 5 as digital pin 19.
  • I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library We will use this to control devices like OLED Display , Accelerator and Gyro Sensor
Power Pins
  • VIN (sometimes labelled “9V”). The input voltage to the Arduino board when it’s using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.
  • 5V. The regulated power supply used to power the microcontroller and other components on the board and also the external devices connected to the board. It comes Vin via an on-board regulator, or via USB or another regulated 5V supply.
  • 3V3. A 3.3 volt supply output by the voltage regulator. We can use it for powering up devices which uses power supply limit of 3.3v and which will be destroyed at 5v. Like ESP8266 WiFi module etc.
  • GND. Ground pins.
So how to power the board
You can power Arduino in 2 different ways, by USB through PC/ laptop or Power Bank or by using an external power supply like battery or DC Supply. If you want to use battery, connect battery pins to the Vin and GND pins on the board. To use DC adapter, connect a 2.1mm center positive plug in to the board’s power jack. Shown in Orange X1 . The most suitable range of input is 7-12V. When powered using 7 volt and if you connect high load it will reset the board every time the load is powered. If higher than 12V chances of burning of board is there. Optimal Voltage is 9v.
Other Pins
  • AREF. Reference voltage for the analog inputs. Not currently supported by the Arduino software.
  • Reset. Reset the Arduino and start execution again from beginning.
Here is the Schematic diagram of Arduino UNO if you are Interested
Arduino_Uno_Rev3-schematic circuit and code

Why Arduino?

The Arduino software is easy-to-use for beginners, also flexible for advanced users. It runs on various operating system like Mac, Windows, and Linux. You can build low cost scientific instruments, to prove chemistry and physics principles, or to get started with programming and robotics. 
  • Cheap– Arduino boards are inexpensive as compared to other microcontroller platforms.
  • Cross-platform – The Arduino Software i.e Arduino IDE runs on Windows, Macintosh OSX, and Linux operating systems.
  • Open source and extensible hardware and software – Open source is always a goo way to learn as there are lot of users continuously contributing towards it.
  • Simple, clear programming environment – The Arduino Software (IDE) is easy-to-use for beginners. It uses languages like C and C++ using special rules of code structuring.
These are some details about Arduino UNO.
How did you like this post. Was it informative, Did you understood all the points, What problem you faced during reading this article. Do you have any doubts or any query…
Comment Down each and everything I am eager to hear from you. The link for Next Article is given Below KEEP LEARNING. Bye
In the next Article We will learn how to install Arduino IDE into your PC to begin with programming your Arduino.

Post a Comment

0 Comments