arduino workshop

Post on 12-Jan-2017

118 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

innov8

BY – MAYUR KAGATHARAmayur.kagathara2508@gmail.com

Workshop On Arduino• Basic• Sensor interfacing• Bluetooth (Android)

What??

Arduino Board“STRONG FRIEND” CREATED IN IVREA, ITALY

IN 2005 BY MASSIMO BANZI & DAVID CUARTIELLESOPEN SOURCE HARDWARE

PROCESSORCODING IS ACCESSIBLE & TRANSFERRABLE (C++, PROCESSING,

JAVA)

Analog INPUTS

Digital I\OPWM(3, 5, 6, 9, 10,

11)

PWR IN USB (to Computer)

SCL\SDA(I2C Bus)

POWER 5V / 3.3V /

GND

RESET

"UNO" means one in Italian and it is named to mark the release of Arduino software IDE 1.0The latest Arduino UNO R3 was released in 2011 and it is the third revision of UNO boards.

Specifications:

•Microcontroller : ATmega328p•Operating Voltage : 5V•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) of which 0.5 KB used by bootloader SRAM 2 KB (ATmega328)•EEPROM : 1 KB (ATmega328)•Clock Speed : 16 MHZ

specifications

Arduino IDE

CLANGUAGE

IDE =

Integrated

Development

Environment

Why???

Some uses of Arduino will

give the answer..

5x5 LED Cube (Arduino Uno)

Arduino Uno fan control 

Obstacle Avoider Robot Using Arduino Uno And IR Proximity Sensor

Ultrasonic distance meter with LCD display on Arduino UNO

Automatic Fish Food Feeder using Arduino Uno 

Connect a serial LCD to an Arduino UNO

Room Temperature & Humidity Module using Arduino uno

Save data of temperature and humidity on MySQL with Arduino Uno and Wifly

I am not gonna show you more.

Discover it by yourself…

Trust me there are plenty of projects on Arduino.

How???

Adding control – let’s use the Arduinoand start programming!!!

Concepts: INPUT vs. OUTPUTTHINK AS IF YOU ARE ARDUINO.

Inputs is a signal going into the board.

Output is any signal exiting from the board.

Concepts: Analog vs. DigitalMicrocontrollers are digital devices – ON or OFF. Also called – discrete.analog signals are anything that can be a full range of values. What are some examples? More on this later…

5 V

0 V

5 V

0 V

Arduino Integrated Development Environment (IDE)

Two required functions / methods / routines:

void setup(){

// runs once

}

void loop(){

// repeats

}

error & status messages

Settings: Tools Serial Port

Your computer communicates to the Arduino microcontroller via a serial port through a USB-Serial adapter.

Check to make sure that the drivers are properly installed.

Settings: Tools Board

Next, double-check that the proper board is selected under the ToolsBoard menu.

Comments, Comments, Comments Comments are for you – the programmer and your friends…

or anyone else human that might read your code.

// this is for single line comments // it’s good to put a description at the // top and before anything ‘tricky’

/* this is for multi-line comments Like this… And this…. */

comments

BIG

7 C

ON

CEPT

S

digitalWrite(pin, HIGH/LOW)

analogWrite(pin, 0 to 255)

digitalRead(pin)

Serial.begin(9600);

analogRead(pin)

Serial.print(“Hello World”);

pinMode(pin, INPUT/OUTPUT)

YO… You are now expert of Arduino…

I’m not kidding..

BORING PPT IS about to OVEROK let’s do some project..

Compulsory things#include <library.h> //Require for some sensors.

void setup(){ Serial.begin(9600); //to communicate with board by computer pinMode(pin, INPUT/OUTPUT); }

void loop(){ PROGRAM THAT WILL RUN AND RUN AND RUN… delay(100);}

Let’s get to coding…Project #1 – Blink

“Hello World” of Physical Computing

Pseudo-code – how should this work?

Turn LED ON Wait

Turn LED OFF

Wait Rinse & Repeat

Three commands to know… pinMode(pin, INPUT/OUTPUT); ex: pinMode(13, OUTPUT);

digitalWrite(pin, HIGH/LOW); ex: digitalWrite(13, HIGH);

delay(time_ms); ex: delay(2500); // delay of 2.5 sec.

// NOTE: -> commands are CASE-sensitive

Project #1: Wiring Diagram

Move the green wire from the power bus to pin 13 (or any other Digital I/O pin on the Arduino board.

Image created in Fritzing

A few simple challengesLet’s make LED#13 blink!

Challenge 1a – blink with a 200 ms second interval.

Challenge 1b – blink to mimic a heartbeat

Challenge 1c – find the fastest blink that the human eye can still detect…

1 ms delay? 2 ms delay? 3 ms delay???

Common program for digital sensor#include <library.h> //Require for some sensors.int a,void setup(){ Serial.begin(9600); pinMode(pin, INPUT);}

void loop(){ a = digitalRead(pin) Serial.println(a); delay(100);}

Common program for analog sensor#include <library.h> //Require for some sensors.int a,void setup(){ Serial.begin(9600);

}

void loop(){ a = analogRead(pin) Serial.println(a); delay(100);}

SoftwareSerial.h Library

SoftwareSerial NAME(Rx, Tx); //connect deviceRx= connect Tx of BluetoothTx = connect Rx of Bluetooth

NAME.begin(baudrate); // start communication

NAME.read(); //read from device

NAME.write(data); //write to device

Common program for bluetooth#include <SoftwareSerial.h>SoftwareSerial mayur(10, 11); //common for uno, mega, leonardoint a;void setup(){ Serial.begin(9600); mayur.begin(9600);}void loop(){ a = mayur.read(pin) Serial.println(a); delay(100);}

Thank you very much…

CONTACT me at:mayur.kagathara2508@gmail.com9723044121

top related