Arduino
What is Arduino Arduino is not a Microcontroller. Arduino is an open-source platform used for building electronics projects. Arduino consists of both a physical programmable circuit board (often referred to as a MC) and a piece of software, or IDE (Integrated Development Environment) that runs on a host system(computer).
What is the Arduino
Programmer
The Arduino Development Board Making-robots-with-arduino.pdf
Features of Arduino UN0 Microcontroller-ATmega328 Operating Voltage 5V and 3.3 V Input Voltage (recommended) 7-12V Input Voltage (limits) 6-20V Digital I/O Pins -14 (of which 6 provide PWM output) Analog Input Pins-6 DC Current per I/O Pin-40 mA DC Current for 3.3V Pin-50 mA Flash Memory-32 KB (ATmega328) SRAM-2 KB (ATmega328) EEPROM-1 KB (ATmega328) Clock Speed-16 MHz
Arduino Pins
Cont.… Analog pins-6 Power Pins Vin 5V GND 3.3V Other Pins AREF RESET A0-A5 Power Pins Vin 5V GND 3.3V Other Pins AREF RESET Digital pins-14 Serial: 0 (RX) and 1 (TX) External Interrupts: 2 and 3. PWM: 3, 5, 6, 9, 10, and 11 BT Reset: 7 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). Led 13 Pin 8
Arduino is a platform The Arduino Software (IDE) allows you to write programs and upload them to your board. The language itself is based in C.
Connect the USB Cable
Functions There are 9 important functions in Arduino platform. PinMode(pin, mode); Configures a digital pin to read (input) or write (output) a digital value. DigitalRead(pin); Reads a digital value (HIGH or LOW) on a pin set for input. DigitalWrite(pin, value); Writes the digital value (HIGH or LOW) to a pin set for output.
Functions analogRead(pin):Reads the value from the specified analog pin. analogWrite():Writes an analog value to a pin. Serial.println(value):Prints the value to the Serial Monitor on your computer. Serial.begin(baud rate):Sets the data rate in bits per second (baud) for serial data transmission.
Arduino IDE
Select Serial Port and Board
Status Messages
Overview of The C Programming Language
About Programming Code is case sensitive Statements are commands and must end with a semi-colon Comments follow a // or begin with /* and end with */ Loop and Setup
Terminology
Example 1 Demonstration Start up the Arduino software and open up the Blink sketch. For the most basic kind of program you’ll need a simple actuator, an LED with the long leg(Anode +) pushed into pin 13 and the short leg (Cathode -) in the adjacent ground pin (GND). Pin 13 is special, in the sense that it has a built in resistor to correctly control the voltage going into a testing LED just like this.
Add an External LED to pin 13 File > Examples > Digital > Blink LED’s have polarity Negative indicated by flat side of the housing and a short leg www.instructables.com
Our First Program
Code Structure: Header Example 1 Code Structure: Header Header provides information
Code Structure: setup function Example 1 Code Structure: setup function setup function is executed only once at the start
Code Structure: loop function Example 1 Code Structure: loop function loop function is repeated indefinitely
Code prepare pin 13 for outputs of voltage Example 1 pinMode(13, Output) prepare pin 13 for outputs of voltage
Code Sets pin 13 to a voltage that means “on” Example 1 digitalWrite(13, HIGH) Sets pin 13 to a voltage that means “on”
Code Tells microcontroller to do nothing for 1000 ms = 1 s Example 1 delay(1000); Tells microcontroller to do nothing for 1000 ms = 1 s
Code Sets pin 13 to voltage that means “off” Example 1 digitalWrite(13, LOW) Sets pin 13 to voltage that means “off”
Example 1 The connections
Upload a program At this stage we just programmed the LED to blink on and off at a set time interval. Press the reset button on the board and then click ‘Upload to I/O board’ in the IDE. If all goes well lights should flicker on the board and the IDE will confirm success.
Advantages of Arduino Open source Simplified and user-friendly programming language No additional programmer/burner hardware required for programming board Portable Low power consumption
Applications of Arduino Home Automations Sensor prototyping Robotics ISP programming Easy Wifi ,Gsm ,Ethernet , Bluetooth , zigbee Conectivity