Introduction To Arduino

Similar documents
Physical Programming with Arduino

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

Laboratory 4 Usage of timers

keyestudio Keyestudio MEGA 2560 R3 Board

ARDUINO LEONARDO WITH HEADERS Code: A000057

LAMPIRAN I (LISTING PROGRAM)

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

ARDUINO LEONARDO ETH Code: A000022

Arduino Prof. Dr. Magdy M. Abdelhameed

Arduino Uno. Arduino Uno R3 Front. Arduino Uno R2 Front

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

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

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

Procedure: Determine the polarity of the LED. Use the following image to help:

ARDUINO UNO REV3 Code: A000066

ARDUINO PRIMO. Code: A000135

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

Arduino ADK Rev.3 Board A000069

More Arduino Programming

Arduino Part 2. Introductory Medical Device Prototyping

Midterm- birthday card Arduino combination code

ARDUINO M0 PRO Code: A000111

analogwrite(); The analogwrite function writes an analog value (PWM wave) to a PWM-enabled pin.

Digital Pins and Constants

Digital Design through. Arduino

TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO

ARDUINO MEGA ADK REV3 Code: A000069

ARDUINO MEGA 2560 REV3 Code: A000067

How to Use an Arduino

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

ARDUINO UNO REV3 SMD Code: A The board everybody gets started with, based on the ATmega328 (SMD).

This is the Arduino Uno: This is the Arduino motor shield: Digital pins (0-13) Ground Rail

ARDUINO MICRO WITHOUT HEADERS Code: A000093

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

Introduction to Microcontrollers Using Arduino. PhilRobotics

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

Introducting Itsy Bitsy 32u4

Grove - Buzzer. Introduction. Features

Project 2: Sensor Light

Index. Jeff Cicolani 2018 J. Cicolani, Beginning Robotics with Raspberry Pi and Arduino,

AT42QT101X Capacitive Touch Breakout Hookup Guide

The Arduino Briefing. The Arduino Briefing

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS

ARDUINO YÚN Code: A000008

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

University of Hull Department of Computer Science C4DI Interfacing with Arduinos

Prototyping & Engineering Electronics Kits Basic Kit Guide

ARDUINO INDUSTRIAL 1 01 Code: A000126

Arduino Dock 2. The Hardware

USER MANUAL ARDUINO I/O EXPANSION SHIELD

Counter & LED (LED Blink)

Prototyping Module Datasheet

ARDUINO YÚN MINI Code: A000108

Introduction to Arduino

Arduino Internals. Dale Wheat. Apress

Create your own wireless motion sensor with

Digispark DIY: the Smallest USB Arduino

Halloween Pumpkinusing. Wednesday, October 17, 12

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

Introduction to Microcontrollers

AT42QT1010 Capacitive Touch Breakout Hookup Guide

Introduction to Arduino

GUIDE TO SP STARTER SHIELD (V3.0)

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

Arduino Ethernet. Arduino Ethernet Rev. 2 board front view with optional PoE module. (

TANGIBLE MEDIA & PHYSICAL COMPUTING MORE ARDUINO

FUNCTIONS For controlling the Arduino board and performing computations.

Update: Ver 1.3 Dec Arduino Learning Guide For Beginner Using. Created by Cytron Technologies Sdn Bhd - All Rights Reserved

Intel Galileo gen 2 Board

Introduction to Arduino. Wilson Wingston Sharon

Update: Ver 1.3 Dec Arduino Learning Guide For Beginner Using. Created by Cytron Technologies Sdn Bhd - All Rights Reserved

ARDUINO MINI 05 Code: A000087

Alessandra de Vitis. Arduino

IME-100 Interdisciplinary Design and Manufacturing

Score. Test. Issued. Date. Name:

IR Breakbeam Sensors. Created by lady ada. Last updated on :32:59 PM UTC

WALT: definition and decomposition of complex problems in terms of functional and non-functional requirements

FIRE SENSOR ROBOT USING ATMEGA8L

WALT: definition and decomposition of complex problems in terms of functional and non-functional requirements

Arduino Uno Microcontroller Overview

ESPino - Specifications

IoT with Intel Galileo Gerardo Carmona. makerobots.tk

EL Sequencer/Escudo Dos Hookup Guide

Arduino Programming. Arduino UNO & Innoesys Educational Shield

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

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

Lab 2.2 Ohm s Law and Introduction to Arduinos

micro:bit Lesson 2. Controlling LEDs on Breadboard

Wire Loop Game Nerves of Steel and Arduino in control

Introduction to Arduino (programming, wiring, and more!)

8:1 Serial Port Expander

WALT: definition and decomposition of complex problems in terms of functional and non-functional requirements

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

PDF of this portion of workshop notes:

Module 3B: Arduino as Power Supply

Web Site: Forums: forums.parallax.com Sales: Technical:

Physical Computing Self-Quiz

3. The circuit is composed of 1 set of Relay circuit.

SECOND EDITION. Arduino Cookbook. Michael Margolis O'REILLY- Tokyo. Farnham Koln Sebastopol. Cambridge. Beijing

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

Transcription:

Introduction To Arduino

What is Arduino? Hardware Boards / microcontrollers Shields Software Arduino IDE Simplified C Community Tutorials Forums Sample projects

Arduino Uno Power: 5v (7-12v input) Digital Pins: 14 (6 support PWM) Analog Pins: 6 Memory: 32 kb Size: 69 x 53 mm

Open Source

Arduino IDE Develop Compile Deploy Serial Monitor Support for additional boards Library support

Interfacing with the Outside World General Purpose Input Output (GPIO) Pins Read (Input) or Write (Output) Digital Analog Pulse Width Modulation (PWM) I2C SPI

Anatomy of an Arduino Sketch References and Variable Declaration Setup (required) Loop (required) Functions // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin 13 as an output. pinmode(13, OUTPUT); // the loop function runs over and over again forever void loop() { digitalwrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalwrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second

Basic Syntax Rules Setup and Loop functions are required All lines of code are terminated with a semicolon except: #define and #include After { or Use { and to group code into a singular code block Comments are ignored by the complier but are extremely helpful to the programmer // for a single line comment /* */ for multi-line comments Indentation and carriage returns are ignored by the complier but are extremely helpful to the programmer

Language Reference

Blink Define a constant for the GPIO pin the onboard LED is attached to In setup, define the digital pin with pinmode and set it as OUTPUT (as opposed to INPUT ) In loop, write to the digital pin with digitalwrite and alternate HIGH and LOW signals with a one thousand millisecond (or 1 second) delay in between #define ledpin 13 void setup() { pinmode(ledpin, OUTPUT); void loop() { digitalwrite(ledpin, HIGH); delay(1000); digitalwrite(ledpin, LOW); delay(1000);

Breadboarding

Wiring the Project Polarity check the device or datasheet Pin order check the device or datasheet Logic Voltage check datasheet Pin Voltage check datasheet

PIR Motion Sensor 5v required to power the sensor Output pin works at 3.3v Output value is HIGH when motion is detected Output value is LOW when no motion Single trigger means the same motion doesn t continue to trigger HIGH Repeat trigger outputs HIGH as long as motion is detected Working voltage range 4.5 20v High output level 3.3v / low 0v 110 degree angle sensor 7m maximum sensing distance Operating temp -15 to 70 degrees

Security System Sketch Define constants for the motion sensor and the buzzer pins Define the pins and their direction Check the motion sensor for movement Turn on the buzzer accordingly Wait a second before looping through again #define detector 12 #define buzzer 8 void setup() { pinmode(detector, INPUT); pinmode(buzzer, OUTPUT); void loop() { // check to see if motion is detected if (digitalread(detector) == HIGH) digitalwrite(buzzer, HIGH); else digitalwrite(buzzer, LOW); delay(1000);

Powering the Project Rechargeable 5v portable power packs Most commonly used for cellphones Have a USB connector Usually provide more than enough ( > 1A) current 9v battery Connect the leads to the Arduino s Vin and GND pins or get a barrel plug As long as you don t draw more than 500 milliamps AC/DC adapter aka wall wart Between 9 12 volts Atleast 500 milliamps 2.1 mm plug Center pin positive http://playground.arduino.cc/learning/whatadapter

Using tone() #define detector 12 #define buzzer 8 // notes in the melody int melody[] = { 262, 196, 196, 220, 196, 0, 247, 262; // note durations: 4 = quarter note, 8 = eighth note, etc.: int notedurations[] = { 4, 8, 8, 4, 4, 4, 4, 4 ; void setup() { pinmode(detector, INPUT); pinmode(buzzer, OUTPUT); void loop() { // check to see if motion is detected if (digitalread(detector) == HIGH) { playtune(); void playtune() { // iterate over the notes of the melody: for (int thisnote = 0; thisnote < 8; thisnote++) { // to calculate the note duration, take one second // divided by the note type. //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc. int noteduration = 1000/noteDurations[thisNote]; tone(buzzer, melody[thisnote],noteduration); // to distinguish the notes, set a minimum time between them. // the note's duration + 30% seems to work well: int pausebetweennotes = noteduration * 1.30; delay(pausebetweennotes); // stop the tone playing: notone(buzzer); delay(250);