Arduino Workshop Day 2

Post on 31-Aug-2014

122 views 7 download

Tags:

description

Day 2 Presentation topic on Arduino

Transcript of Arduino Workshop Day 2

ARDUINO AND

ACCESSORIES

ORGA

NIZE

D BY

:DI

GITR

ONIX

, WRC

www.digitronixnepal.blogspot.com

SOFTWARE REQUIREMENTSArduino IDE

Serial Port Driver

MATLAB

INTRODUCTION TO ARDUINO

- Open Source Hardware and Software Platform

-Self Contained Computer in an IC

=INTEL 286

Arduino Diecimila

INTRODUCTION TO ARDUINO

- Based on AVR microcontrollers that are widely popular for their RISC architecture, hight flash memory, inbuilt different features

- Arduino Uses C programming(E A S Y)……

WHY ARDUINO?

- Inbuilt ADC, Serial Interface, PWM, IO pins

-Programming so easy……(Can be used available libraries)

-Open Source platform

HARDWARE

I/O PORTS ========== 14PWM ========== 6Analog ========== 6

8 bit =======25610 bit ======= 1023

ADC

DIFFERENT B0ARDS

DUE

ELEVENUNO

DIFFERENT B0ARDS

DUE

LILYPAD MEGANANO

ARDUINO PROGRAMMING BASICS

Void setup(){//your initialization code}

GLOBAL Variables1.

2.

Void loop(){//your repeating code}

3.

Functions used in setup()1. pinMode(13, OUTPUT); makes pin 13 as output pin2. pinMode(8, INPUT); makes pin 8 as input pin3. Serial.begin(9600) ; starts serial communication with Baudrate 9600Functions used in loop()1. digitalWrite(13, HIGH): makes pin 13 high ie pin13=ON;2. delay(500) : delays system by 500 ms.3. analogRead() : Reads analog value4. analogWrite() : writes anlog value(PWM)5. Serial.print() : Prints at serial monitor6. Serial.println() : prints at serial monitor with line break

WRITE Down!

Now Real Program Starts

Serial Programming==In Serial communication , data is transmitted one bit at a time on a single path. ==To establish serial

communication , both sender and receiver must define set of rules known as protocol. ==The protocol should define:

=>Data Transfer Rate=>How to Begin and End

Serial ProgrammingDon’t worry about TMOD, SCON…..as you seen on other microcontrollersWrite down these functions:

=>Serial.begin()=>Serial.available()=>Serial.print()=>Serial.write()=>Serial.flush()

Lets control the LED at pin 13 using commands ‘H’ or ‘L’

from your LAPTOP…Any IDEA!!!!???????

Lets control the LED at pin 13 using commands ‘1’ for hIGH and ‘0’ for LOW and show

Invalid for other input from your LAPTOP

Sensors InterfacingDisplaying POT values at Serial

Monitor

Useful FunctionsanalogRead();analogWrite();map();

Reads Analog ValueWrites Analog Value at PWM PINSMapping Digital data in Certain

Range

CONNECTION:DIGITRONIX

POT=====A0

LED Brightness control using POT

LCD INTERFACING

Arduino Shields

#include<LiquidCrystal.h>

lcd.print()lcd.display();lcd.noDisplay();

Header File

Functions

Group WorkGroup 1:

Interface Ultrasound and display various distances

Group 2:Interface IR sensor and use it for obstacle detection of the range 10

to 20 cmGroup 3:

Use PIR sensor for the motion detection and make sound at buzzer on detection of the motion

MATLAB+

ARDUINO=

MATDUINO

LOAD GIVEN MATLAB CODEMake Simple GUI

Write Matlab Code

Perform

www.mathworks.com>>Arduino Support Package

>>Load Arduino with Arduino Digital IO server

>>Open Matlab>>Type GUIDE on command Window

*****At Openingclear all;global a;a=arduino(‘COM3’);

*****at Push Button 2****a.digitalWrite(12, 0);a.digitalWrite(13, 1);

*****at Push Button 1****a.digitalWrite(12, 1);a.digitalWrite(13, 0);

Introduction to AmarinoConnection of Android phone and Arduino PlatformSensors in Android like (G sensor, GPS, Microphone) with advanced software platform can be united to produce advanced prototypes.

Different modules

ETHERNET SHIELD W/MICRO-SD READER

EXTREME SHIELD STACKING

BLUETOOTH TO TTL 5V MODULE

USB TO TTL MODULE

RS-232 TO TTL MODULE

REVIEW:Sensor InterfacingLCD interfacingSerial programmingPWM programming

THANK

YOU!