ARDUINO. By Kiran Tiwari BCT 2072 CoTS.

Similar documents
Eng.mohammed Albhaisi. Lab#3 : arduino to proteus simulation. for simulate Arduino program that you wrote you have to have these programs :

BASIC ARDUINO WORKSHOP. Mr. Aldwin and Mr. Bernardo

Arduino Prof. Dr. Magdy M. Abdelhameed

FUNCTIONS USED IN CODING pinmode()

Arduino Programming. Arduino UNO & Innoesys Educational Shield

Arduino Uno Microcontroller Overview

More Arduino Programming

EP486 Microcontroller Applications

Arduino Part 2. Introductory Medical Device Prototyping

Computer Architectures

Electronic Brick Starter Kit

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S

Lab 3 XBees and LCDs and Accelerometers, Oh My! Part 1: Wireless Communication Using XBee Modules and the Arduino

USER MANUAL ARDUINO I/O EXPANSION SHIELD

EXPERIMENT 7 Please visit to learn all features of arduino before you start the experiments

keyestudio Keyestudio MEGA 2560 R3 Board

Robotics/Electronics Review for the Final Exam

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

ARDUINO EXPERIMENTS ARDUINO EXPERIMENTS

Smart Objects. SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi

FUNCTIONS For controlling the Arduino board and performing computations.

3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2

Arduino Programming and Interfacing

Introduction to Arduino

Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System

Clark College Electrical Engineering & Computer Science

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS

SPLDuino Programming Guide

Arduino and Matlab for prototyping and manufacturing

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

Introduction to Microcontrollers Using Arduino. PhilRobotics

TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO

ARDUINO WORKSHOP A HANDS-ON I N T R O D U C T I O N W I T H 65 PROJECTS JOHN BOXALL

PROGRAMMING ARDUINO COURSE ON ADVANCED INTERACTION TECHNIQUES. Luís Carriço FCUL 2012/13

Designed & Developed By: Ms. Jasleen Kaur, PhD Scholar, CSE. Computer Science & Engineering Department

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018

Experiment 3: Sonar Navigation, CAD and 3D Printing

Workshop on Microcontroller Based Project Development

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

Laboratory 1 Introduction to the Arduino boards

IME-100 Interdisciplinary Design and Manufacturing

The Arduino Briefing. The Arduino Briefing

How to Use an Arduino

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface.

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

E11 Lecture 4: More C!!! Profs. David Money Harris & Sarah Harris Fall 2011

Chapter 2 The Basic Functions

MEDIS Module 2. Microcontroller based systems for controlling industrial processes. Chapter 4: Timer and interrupts. M. Seyfarth, Version 0.

Intro to Arduino. Zero to Prototyping in a Flash! Material designed by Linz Craig and Brian Huang

EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Løkkestrukturer. Trykknap: Button, Se eksempler / Digital / Button. Decision: If: Version 01/ Loops, løkker mm. i Arduino.

Serial.begin ( ); Serial.println( ); analogread ( ); map ( );

PROGRAMMING WITH ARDUINO

Arduino Course. Technology Will Save Us - Tim Brooke 10th August Friday, 9 August 13

What s inside the kit

Make your own secret locking mechanism to keep unwanted guests out of your space!

Junying Huang Fangjie Zhou. Smartphone Locker

INDUSTRIAL TRAINING:6 MONTHS PROGRAM TEVATRON TECHNOLOGIES PVT LTD

Required Materials. Optional Materials. Preparation

Distributed Real- Time Control Systems. Lecture 3 Embedded Systems Interfacing the OuterWorld

Schedule. Sanford Bernhardt, Sangster, Kumfer, Michalaka. 3:10-5:00 Workshop: Build a speedometer 5:15-7:30 Dinner and Symposium: Group 2

TANGIBLE MEDIA & PHYSICAL COMPUTING MORE ARDUINO

Workshop Arduino English starters workshop 2

New APIs and Hacks. Servo API. Chapter 4. The Theory versus Practice

Laboratory 5 Communication Interfaces

Lab 4 LCDs and Accelerometers

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Introduction to Arduino. Wilson Wingston Sharon

Arduino Programming Part 4: Flow Control

Physical Computing Tutorials

Introduction What is MIT App Inventor?

Lab 2 - Powering the Fubarino, Intro to Serial, Functions and Variables

<Table of content> <Parts and description> <Circuit board Guide> <Pins> <Basics of Coding> <Intro to Arduino> <Intro> <Downloading Arduino IDO>

CARTOOINO Projects Book

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

#include <Keypad.h> int datasens; #define pinsens 11. const byte ROWS = 4; //four rows const byte COLS = 3; //three columns

Energia MSP-430!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1

ARDUINO FOR COMPLETE IDIOTS. by David Smith

Arduino provides a standard form factor that breaks the functions of the micro-controller into a more accessible package.

DAQ-1000 Data Acquisition and Control System Application

Laboratory 3 Working with the LCD shield and the interrupt system

STEPD StepDuino Quickstart Guide

SWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS

Arduino Programming Part 3. EAS 199A Fall 2010

User manual. For Keenlon Rarduino.

This tutorial will show you how to take temperature readings using the Freetronics temperature sensor and an Arduino Uno.

Fubar Labs Arduino Tutorial

Specification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3.

Arduino - DigitalReadSerial

The Arduino IDE and coding in C (part 1)

Fall Harris & Harris

Introduction to Arduino Programming. Sistemi Real-Time Prof. Davide Brugali Università degli Studi di Bergamo

KNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions

Arduino Platform Part I

The speaker connection is circled in yellow, the button connection in red and the temperature sensor in blue

RB-Dfr-12 DFRobot URM04 v2.0 Ultrasonic Sensor

/* to use: enter key aray and make sure that the userentered has the same number of zeros

#define CE_PIN 12 //wireless module CE pin #define CSN_PIN 13 //wireless module CSN pin. #define angleaveragenum 1

FIRE SENSOR ROBOT USING ATMEGA8L

Transcription:

ARDUINO By Kiran Tiwari BCT 2072 CoTS www.kirantiwari.com.np

SO What is an Arduino?

WELL!! Arduino is an open-source prototyping platform based on easy-to-use hardware and software.

Why Arduino? Simplifies working on a microcontroller Inexpensive Platform Simple, Clear and User Friendly Environment Easy Programming

MISSED SOMETHING? OPEN SOURCE!!

IMPORTING LIBRARY Open the Given Arduino Library Folder Copy the files to C:/Program Data/Labcenter Electronics/Proteus 8 Professional/Library/ Reopen Proteus and Use Arduino from Components Adding Panel NOTE : Program Data folder is Hidden

ARDUINO UNO DESCRIPTION 13 Pins, ~ PWM, 0&1: Rx & Tx ports USB Port SPI ( Serial Peripheral Interface) MISO MOSI Atmel ATmega 328 External Power Supply Analog Input Pins

Arduino IDE setup(){ // runs once at start of program // for initialization loop(){ // called repeatedly until board // powers off

Some Basic Programming Syntax In setup() pinmode( pinno, mode ); Mode : INPUT / OUTPUT Eg ; pinmode(13, OUTPUT); Serial.begin( baudrate ); baudrate : bits per second For Serial Communication Eg ; Serial.begin(9600);

Some Basic Programming Syntax In loop() digitalwrite ( pinno, state ); State : HIGH / LOW Eg ; digitalwrite (13, HIGH); digitalread ( pinno); Eg ; int value = digitalread(8); delay (milliseconds); Delays system by certain milliseconds Eg ; delay(1000); // for 1 sec

Some Basic Programming Syntax In loop() analogwrite ( pinno, value ); Value : 0 to 255 //(255/255) = 1 = max value Eg ; analogwrite (9, 255); // pinno with PWM analogread ( pinno); Eg ; int value = analogread (A0); Serial.println (data); Displays data on Serial Monitor with line break Eg ; Serial.println ( Text );

LED ON int ledpin = 13; void setup() { pinmode (13,OUTPUT); void loop() { digitalwrite (13,HIGH);

Exporting Hex File

Exporting Hex File

Ctrl + C Exporting Hex File

IN PROTEUS

IN PROTEUS

IN PROTEUS Ctrl + V

IN PROTEUS RUN THE SIMULATOR

LED BLINK ( IN PROTEUS )

LED BLINK ( IN IDE ) int ledpin = 13; void setup() { pinmode ( ledpin, OUTPUT ); void loop() { digitalwrite ( ledpin, HIGH ); delay(500); digitalwrite ( ledpin, LOW ); delay(500); Export Compiled Binary Run the Simulator

LED CHASER ( IN PROTEUS )

LED CHASER ( IN IDE ) void setup() { pinmode(11,output); pinmode(12,output); pinmode(13,output); Export Compiled Binary Run the Simulator void loop() { digitalwrite(11,high); digitalwrite(12,low); digitalwrite(13,low); delay(30); digitalwrite(11,low); digitalwrite(12,high); digitalwrite(13,low); delay(30); digitalwrite(11,low); digitalwrite(12,low); digitalwrite(13,high); delay(30);

LED TOGGLE ( IN PROTEUS )

LED TOGGLE ( IN IDE ) boolean currentstate = LOW; boolean laststate = LOW; boolean ledstate = LOW; void setup(){ pinmode(9, INPUT); pinmode(7, OUTPUT);

LED TOGGLE ( IN IDE ) void loop(){ currentstate = digitalread (9); if (currentstate == HIGH && laststate == LOW){ if (ledstate == HIGH){ digitalwrite(7, LOW); ledstate = LOW; else { digitalwrite(7, HIGH); ledstate = HIGH; laststate = currentstate; Export Compiled Binary Run the Simulator

LED FADE ( IN PROTEUS ) ~ PWM for analogwrite

LED FADE ( IN IDE ) int ledpin = 9; void setup() { pinmode( ledpin, OUTPUT ); void loop() { for(int i = 0 ; i<=255;i+=5){ analogwrite ( ledpin, i ); delay(10); for( int i =255; i>= 0; i -= 5 ){ analogwrite( ledpin, i ); delay(10); Export Compiled Binary Run the Simulator

LCD INTERFACING Liquid Crystal Display

LCD INTERFACING Liquid Crystal Display First Include LiquidCrystal header file #include<liquidcrystal.h> Create an Object for LiquidCrystal Eg ; LiquidCrystal lcd (12,11,5,4,3,2); Start the lcd lcd.begin (width, height); Eg ; lcd.begin (16,2); // for 16*2 LCD

LCD DISPLAY ( IN PROTEUS ) LM016L LCD RS pin to digital pin 12 LCD Enable pin to digital pin 11 LCD D4 pin to digital pin 5 LCD D5 pin to digital pin 4 LCD D6 pin to digital pin 3 LCD D7 pin to digital pin 2 LCD R/W pin to ground

LCD DISPLAY ( IN IDE ) #include<liquidcrystal.h> LiquidCrystal lcd (12,11,5,4,3,2); void setup() { lcd.begin(16,2); lcd.write("hello LCD"); void loop() { lcd.display(); Export Compiled Binary Run the Simulator

LCD BLINK ( IN PROTEUS ) LM016L LCD RS pin to digital pin 12 LCD Enable pin to digital pin 11 LCD D4 pin to digital pin 5 LCD D5 pin to digital pin 4 LCD D6 pin to digital pin 3 LCD D7 pin to digital pin 2 LCD R/W pin to ground

LCD BLINK ( IN IDE ) #include<liquidcrystal.h> LiquidCrystal lcd(12,11,5,4,3,2); void setup() { lcd.begin(16,2); lcd.write("hello LCD"); void loop() { lcd.display(); delay(500); lcd.nodisplay(); delay(500); Export Compiled Binary Run the Simulator

SOME MORE ( IN PROTEUS ) LM016L LCD RS pin to digital pin 12 LCD Enable pin to digital pin 11 LCD D4 pin to digital pin 5 LCD D5 pin to digital pin 4 LCD D6 pin to digital pin 3 LCD D7 pin to digital pin 2 LCD R/W pin to ground

SOME MORE ( IN IDE ) #include<liquidcrystal.h> LiquidCrystal lcd(12,11,5,4,3,2); void setup() { lcd.begin(16,2); lcd.write("hello Fellas!"); delay(1000);

SOME MORE ( IN IDE ) void loop() { lcd.clear(); delay(300); lcd.write("welcome"); delay(300); lcd.setcursor(9,0); lcd.write("to"); delay(300); lcd.setcursor(12,0); lcd.write("the"); delay(300); lcd.clear(); lcd.write("awesomeness!"); delay(300); Export Compiled Binary Run the Simulator

SENSORS Sense the Values Uses Analog Input Pins LDR ( Light Dependent Resistor ) Light Sensor Gas Sensor LM35 ( Temperature Sensor ) Ultrasonic Sensor ( Distance Measurer )

LDR ( IN PROTEUS ) TX to RX RX to TX

LDR ( IN IDE ) #define readpin A0 void setup() { pinmode( readpin, INPUT ); Serial.begin(9600); void loop() { int status = analogread( readpin ); Serial.println(status); delay(100); Export Compiled Binary Run the Simulator

LM35 ( IN PROTEUS ) DIGITAL THERMOMETER LM35

LM35 ( IN IDE ) #define TempPin A0 int TempValue; void setup() { Serial.begin (9600); // Sets the Baud Rate

LM35 ( IN IDE ) void loop() { TempValue = analogread (TempPin); float TempCel = ( TempValue/1024.0)*500; float TempFarh = (TempCel*9)/5 + 32; Serial.print ("TEMPRATURE in Celsius = "); Serial.print ( TempCel ); Serial.print("*C"); Serial.print(" "); Serial.print("TEMPRATURE = "); Serial.print(TempFarh); Serial.print("*F"); Serial.println (); delay(1000); Export Compiled Binary Run the Simulator

GAS SENSOR ( IN PROTEUS ) LOGICTOGGLE

GAS SENSOR ( IN IDE ) void setup() { pinmode(8,input); pinmode(13,output); void loop() { int status = digitalread (8); if(status==high){ digitalwrite(13,high); else{ digitalwrite(13,low); Export Compiled Binary Run the Simulator

ULTRASONIC SENSOR (IN PROTEUS )

ULTRASONIC SENSOR ( IN IDE ) const int triggerpin = 7; const int echopin = 6; void setup() { Serial.begin(9600);

ULTRASONIC SENSOR ( IN IDE ) void loop() { long duration, inches, cm; pinmode( triggerpin, OUTPUT); digitalwrite( triggerpin, LOW); delaymicroseconds (2); digitalwrite( triggerpin, HIGH); delaymicroseconds (10); digitalwrite( triggerpin, LOW); pinmode(echopin, INPUT);

ULTRASONIC SENSOR ( IN IDE ) duration = pulsein (echopin, HIGH); inches = microsecondstoinches (duration); cm = microsecondstocentimeters (duration); Serial.print(inches); Serial.print("in, "); Serial.print(cm); Serial.print("cm"); Serial.println(); delay(100);

ULTRASONIC SENSOR ( IN IDE ) long microsecondstoinches(long microseconds) { return microseconds / 74 / 2; long microsecondstocentimeters(long microseconds) { return microseconds / 29 / 2; Export Compiled Binary Run the Simulator

SERVO MOTOR (IN PROTEUS )

SERVO MOTOR ( IN IDE ) #include < Servo.h > Servo myservo; int val; void setup() { pinmode (A0, INPUT); myservo.attach (9); void loop() { val = analogread(a0); val = map(val, 0, 1023, 0, 180); myservo.write ( val ); delay(15); Export Compiled Binary Run the Simulator

BLUETOOTH ( IN IDE ) char c; void setup() { pinmode(13,output); Serial.begin(9600); void loop() { if( Serial.available () ){ c = Serial.read (); switch(c){ case 'a' : digitalwrite(13,high); break; case 'b' : digitalwrite(13,low); break; Export Compiled Binary Run the Simulator

FOR MORE INFO AND HELP GOTO : www.kirantiwari.com.np