Before getting started with arduino, we can have some points regarding the difference between micro-controller and micro-processor and their applications,advantages and disadvantages.
|It is simply known as computer on a single chip because it has RAM,ROM and other peripherals.||It doesn’t have any memory peripheral inside and it has only CPU.|
|While defining the task, relationship between input and output is pre-defined.
Eg. Watches, controlling systems,etc,.
|Relationship between input and output is not pre-defined.
Eg. Documents, games, etc,.
|The architecture and understanding of it is complicated||It has problem of over-heating.|
Here I begin with the most basic hack of arduino and one must know these things before heading towards major applications of arduino. The following things must be known for playing the arduino uno
- It uses micro-controller ATMEGA328 which is 28 pins integrated chip.
- There are 14 I/O digital pins(0 to 13) and 6 I/O analog pins(A0 to A5).
- Operating voltage is 5V which can be given through USB(comes along with board) or external power supply.
- All the syntax-es are case sensitive.
— The term void indicates it will return none and setup() is the function prototype where initialization of variables, definition of the pin operation,etc,. An important regarding the setup() function is that it will runs only once in a program until interrupts in the form of manual reset or unplugging of supply occurs.
— The name itself suggests the loop,hence it executes continuously and used to interact with arduino. Actually it acts as while loop which is always true once the program is executed.
pinMode(pin number, MODE);
— This is used to describe the operation for the pin in the application.
— This allows you make the digital pins HIGH or LOW. HIGH on this pin allow 5v as output and LOW will give 0v.
example: digitalWrite(10,HIGH);// on 10th pin output is 5v
digitalWrite(6,LOW); // on 6th pin output is low
Note:- By default every pins will be in LOW state.
— This syntax is used to read the status of the digital pin and it can substitute to an variable and used for decision making statements.
— This is used to get the analog values of respective pin and all the interactive devices gives analog values, say sensors,etc,. It returns an integer value from 0 to 1023 as pins are provided with 10bit ADC .
analogWrite(pin number, value);
— It is used for PWM technique and it can access only the pins 3,5,6,9,10,11 alone. The value takes between 0 to 1023.
example:- analogWrite(3, 234);
NOTE:- analog pins can be accessed as GPIO(genereal purpose input output) pins i.e as digital pins.
example:- digitalRead(A0); digitalWrite(A2,HIGH);
— Serial.begin is used to set the speed of communication in bits per second(baud rate). One byte is equal to 8 bits, but serial connections send a start and stop bit to identify the start and end to a particular byte to the receiving system. Thus, 10 bits are needed to send one character. For communicating with the computer, use one of these rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200. For uno it 9600, once it is declared, it will open serial port.
— stops the program for specified time. Example:- delay(2000); //interrupts the //execution for 2 seconds.
Now let’s make it practical. Before getting into programming and hardware, make sure you have latest arduino IDE and drivers installed in your system. click the following link to download IDE http://www.arduino.cc/download_handler.php and for driver installation follow the below steps
- Plug in your board and wait for Windows to begin it’s driver installation process. After a few moments, notification appears as “Driver installation failed”.
- Click on the Start Menu, and open up the Control Panel.
- While in the Control Panel, navigate to System and Security. Next, click on System. Once the System window is up, open the Device Manager.
- Look under Ports (COM & LPT). You should see an open port named “Arduino UNO (COMxx)”. If there is no COM & LPT section, look under “Other Devices” for “Unknown Device”.
- Right click on the “Arduino UNO (COmxx)” port and choose the “Update Driver Software” option.
- Next, choose the “Browse my computer for Driver software” option.
- Finally, navigate to and select the driver file named “arduino.inf”, located in the “Drivers” folder of the Arduino Software download (not the “FTDI USB Drivers” sub-directory). If you are using an old version of the IDE (1.0.3 or older), choose the Uno driver file named “ArduinoUNO.inf”
- Windows will finish up the driver installation from there.
- Make note of the com port number. eg com22
Article was written by Bala Narayana (Facebook – Bala Shocks)