Intro to the Arduino Topics: The Arduino Digital IO Analog IO Serial Communication.

Slides:



Advertisements
Similar presentations
Lab7: Introduction to Arduino
Advertisements

What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
Re-programming the Simon Says with Arduino Linz Craig, Brian Huang.
Khaled A. Al-Utaibi  Digital Vs Analog Signals  Converting an Analog Signal to a Digital One  Reading Analog Sensors with the.
Intro to Arduino with LilyPad Make a MakerSpace, Artisan’s Asylum Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett.
Digital I/O Connecting to the Outside World
Introduction.
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
Khaled A. Al-Utaibi  What is Arduino?  Arduino Boards  Arduino Shields  Arduino Uno Hardware.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
Embedded Programming and Robotics
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Colorado Space Grant Consortium Gateway To Space ASEN 1400 / ASTR 2500 Class #12 Gateway To Space ASEN 1400 / ASTR 2500 Class #12 T-58.
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc.
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Intro to the Arduino Topics: The Arduino Digital IO
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Overview What is Arduino? What is it used for? How to get started Demonstration Questions are welcome at any time.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
Microprocessors Tutorial 2: Arduino Robotics. Agenda 1. Robot Anatomy 2. Sensor Review 3. PWM 4. MAKE: Fade 5. Motors 6. H Bridge 7. Robot Control library.
Getting Started With the Arduino Uno
智慧電子應用設計導論(1/3) Arduino MEGA 2560
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
SAMI MAKERSPACE MAKE: AN ELECTRONICS WORKSHOP. ARDUINO BASICS Credit to: Sparkfun and Linz Craig, Nick Poole, Prashanta Aryal, Theo Simpson, Tai Johnson,
Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output.
PWM: Pulse Width Modulation © 2014 Project Lead The Way, Inc.Digital Electronics.
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Pulse-Width Modulation: Simulating variable DC output
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Application Case Study Christmas Lights Controller
Arduino.
Arduino Part 1 Topics: Microcontrollers
Embedded Systems Intro to the Arduino
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Welcome to Arduino A Microcontroller.
By Rick Darby Sponsors: Geekspace Gwinnett The WorkSpot
Microcontroller basics
Microprocessors Tutorial 1: Arduino Basics
Intro to the Arduino Created by
UTA010 : Engineering Design – II
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
Introduction to Arduino Microcontrollers
Arduino and Grove LET’S START.
Roller Coaster Design Project
مقدمة في الاردنيو د فضل الاكوع.
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Intro to the Arduino Topics: The Arduino Digital IO
Arduino Board.
Intro to the Arduino by Someet Singh
Arduino Practice: Photoresistors, PWM, Potentiometers, Motors
Sensors and actuators Sensors Resistive sensors
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino Leonardo Setup
Introduction to Arduino
Lab #1: Getting Started.
Arduino and Grove LET’S START.
Introduction to Arduinos
Introduction to arduino
Pulse-Width Modulation: Simulating variable DC output
Presentation transcript:

Intro to the Arduino Topics: The Arduino Digital IO Analog IO Serial Communication

Topic 1: Meet Arduino Uno

Getting Started Check out: 1.Download & install the Arduino environment (IDE) (not needed in lab) 2.Connect the board to your computer via the USB cable 3.If needed, install the drivers (not needed in lab) 4.Launch the Arduino IDE 5.Select your board 6.Select your serial port 7.Open the blink example 8.Upload the program

Arduino IDE See: for more informationhttp://arduino.cc/en/Guide/Environment

Select Serial Port and Board

todbot.com/blog/bionicarduino

Input/Output Image from Theory and Practice of Tangible User Interfaces at UC Berkley

Topic 2: Digital Input/Output Digital IO is binary valued—it’s either on or off, 1 or 0 Internally, all microprocessors are digital, why? 1 0

Arduino Digital I/0 pinMode(pin, mode) Sets pin to either INPUT or OUTPUT digitalRead(pin) Reads HIGH or LOW from a pin digitalWrite(pin, value) Writes HIGH or LOW to a pin Electronic stuff Output pins can provide 40 mA of current Writing HIGH to an input pin installs a 20K Ω pullup

Our First Program

IO Pins Image from Theory and Practice of Tangible User Interfaces at UC Berkley

In-class Exercise 1: Digital IO Use a push-button to turn ON/Off LED

Topic 3: Analog Input Think about music stored on a CD---an analog signal captured on digital media –Sample rate –Word length

Resolution: the number of different voltage levels (i.e., states) used to discretize an input signal Resolution values range from 256 states (8 bits) to 4,294,967,296 states (32 bits) The Arduino uses 1024 states (10 bits) Smallest measurable voltage change is 5V/1024 or 4.8 mV Maximum sample rate is 10,000 times a second Arduino Analog Input Image credit: Tod Kurt

How does ADC work? How does ADC work Excel Demonstration

Can a digital devise produce analog output? Topic 3: Analog Output Analog output can be simulated using pulse width modulation (PWM) Image from Theory and Practice of Tangible User Interfaces at UC Berkley

Pulse Width Modulation Can’t use digital pins to directly supply say 2.5V, but can pulse the output on and off really fast to produce the same effect The on-off pulsing happens so quickly, the connected output device “sees” the result as a reduction in the voltage Image from Theory and Practice of Tangible User Interfaces at UC Berkley

PWM Duty Cycle Fixed cycle length; constant number of cycles/sec Image credit: Tod Kurt output voltage = (on_time / cycle_time) * 5V

PMW Pins Command: analogWrite(pin,value) value is duty cycle: between 0 and 255 Examples: analogWrite(9, 128) for a 50% duty cycle analogWrite(11, 64) for a 25% duty cycle Image from Theory and Practice of Tangible User Interfaces at UC Berkley

In-class Exercise 2: Analog IO A light theremin Part 1:

In-class Exercise 2: Analog IO Add a 330 ohm resistor and an LED to pin 9 Using the analogWrite() command, set the intensity of the LED as a function of the value of prReading Part 2: Add an LED

Topic 4: Serial Communication Image from

todbot.com/blog/bionicarduino

Serial Communication Compiling turns your program into binary data (ones and zeros) Uploading sends the bits through USB cable to the Arduino The two LEDs near the USB connector blink when data is transmitted RX blinks when the Arduino is receiving data TX blinks when the Arduino is transmitting data todbot.com/blog/bionicarduino

Open the Serial Monitor and Upload the Program

Some Commands Serial.begin() - e.g., Serial.begin(9600) Serial.print() or Serial.println() - e.g., Serial.print(value) Serial.read() Serial.available() Serial.write() Serial.parseInt() Example Program

Serial-to-USB chip---what does it do? Image from Theory and Practice of Tangible User Interfaces at UC Berkley The LilyPad and Fio Arduino require an external USB to TTY connector, such as an FTDI “cable”. In the Arduino Leonardo a single microcontroller runs the Arduino programs and handles the USB connection.

Two different communication protocols Serial (TTL): Image from

USB Protocol Much more complicated Image from

In-class Exercise 3: Serial Communication Modify your program from in-class exercise 2-part 2 to control the intensity of the LED attached to pin 9 based on keyboard input. Use the Serial.parseInt() method to read numeric keyboard input as an integer.Serial.parseInt() An input of 9 should produce full intensity and an input of 0 should turn the LED off.