Arduino Starter Kit Tutorial

Similar documents
DEPARTMENT OF ELECTRONICS ENGINEERING

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Introduction to Arduino

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Arduino Lesson 14. Servo Motors

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

Connecting Arduino to Processing a

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

Arduino Lesson 16. Stepper Motors

Arduino Lesson 1. Blink

DS1307 Real Time Clock Breakout Board Kit

Arduino project. Arduino board. Serial transmission

Basic Pulse Width Modulation

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Working with microcontroller-generated audio frequencies (adapted from the Machine Science tutorial)

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

Introduction to Arduino

Controlling a Dot Matrix LED Display with a Microcontroller

Arduino Lab 1 - The Voltage Divider

Lab 6 Introduction to Serial and Wireless Communication

Arduino Lesson 13. DC Motors. Created by Simon Monk

IR Communication a learn.sparkfun.com tutorial

Arduino Microcontroller Guide W. Durfee, University of Minnesota ver. oct-2011 Available on-line at

2013 G Miller. 3 Axis Brushless Gimbal Controller Manual

Arduino Lesson 0. Getting Started

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

C4DI Arduino tutorial 4 Things beginning with the letter i

Lecture 7: Programming for the Arduino

INTRODUCTION TO SERIAL ARM

Pulse Width Modulation Applications

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

SainSmart UNO R3 Starter Kit

Pocket Verifier Quick Start HTC Touch Diamond

cs281: Introduction to Computer Systems Lab08 Interrupt Handling and Stepper Motor Controller

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

Arduino Lesson 5. The Serial Monitor

Trinket Bluetooth Alarm System

Electronic Brick of Current Sensor

CHAPTER 11: Flip Flops

USB to RS-422/485 Serial Adapter

EVAL-UFDC-1/UFDC-1M-16

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

User Guide Reflow Toaster Oven Controller

Sending an SMS with Temboo

Getting Started Guide: Transaction Download for QuickBooks Windows. Information You ll Need to Get Started

Bluetooth Handsfree Kit. Car Speakerphone (For Bluetooth Mobile Phones)

Programming the Arduino

The basic set up for your K2 to run PSK31 By Glenn Maclean WA7SPY

How to connect to a Class II router using a mobile-phone data cable specifically for Solwise & Safecom routers

Getting started with the O Watch

How to Make a Pogo Pin Test Jig. Created by Tyler Cooper

Home Security System for Automatic Doors

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable. Created by Simon Monk

Start A New Project with Keil Microcontroller Development Kit Version 5 and Freescale FRDM-KL25Z

Six-servo Robot Arm. DAGU Hi-Tech Electronic Co., LTD Six-servo Robot Arm

- 35mA Standby, mA Speaking pre-defined phrases with up to 1925 total characters.

The $25 Son of a cheap timer This is not suitable for a beginner. You must have soldering skills in order to build this kit.

Building A Computer: A Beginners Guide

FREQUENCY RESPONSE OF AN AUDIO AMPLIFIER

Central England People First s friendly guide to downloading

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

TUTORIAL 3 :: ETHERNET SHIELD AND TWITTER.COM

MCP4725 Digital to Analog Converter Hookup Guide

Board also Supports MicroBridge

Workshop Intel Galileo Board

Motorising the Peco Turntable - a different approach

CAN-Bus Shield Hookup Guide

Servo Motors (SensorDAQ only) Evaluation copy. Vernier Digital Control Unit (DCU) LabQuest or LabPro power supply

Sending Data from a computer to a microcontroller using a UART (Universal Asynchronous Receiver/Transmitter)

Electronics 5: Arduino, PWM, Mosfetts and Motors

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

1 INTRODUCTION. This document describes the procedure to upgrade LTMR.

Warnings: This manual is intended to guide a technicians or customers who would like to repair DBL's

Three Arduino Challenges to Connect the Logical World with the Physical One. ISTE Philadelphia

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

RPLIDAR. Low Cost 360 degree 2D Laser Scanner (LIDAR) System Development Kit User Manual Rev.1

By: John W. Raffensperger, Jr. Revision: 0.1 Date: March 14, 2008

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

Tiny Arduino Music Visualizer

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

Waspmote. Quickstart Guide

User manual DinaSys DTC/DTS and DTC/DTZ

FOLGER TECHNOLOGIES, LLC 2020 i3 3D Printer Kit

INDEX. Trademarks All name and product s trademarks mentioned below are the property of their respective companies.

Features of Your Cisco Unified IP Phone

CanSat Program. Stensat Group LLC

MeshBee Open Source ZigBee RF Module CookBook

Tutorial for Installing Skype 5.0 on your Windows PC

FTDI VCP DRIVER (free) (WIN/MAC/LINUX)

Current Cost Data Cable User Guide. Installing and configuring the data cable

ezsystem elab16m Project 1F: Alarm System (Full Project description)

Arduino Lesson 17. Sending Movement Detector

Series VoIP Phone

MSP-EXP430G2 LaunchPad Workshop

QUICK START GUIDE. Thank you for purchasing the ButtKicker Kit. This guide will help you quickly set up your new ButtKicker Kit Contents: BK-Kit-4

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Transcription:

Arduino Starter Kit Tutorial Developed by M5 Department of Electrical and Computer Engineering UMass Amherst March 2010 UMassAmherstM5.org

Arduino Kit 1x Arduino Duemilanove 1x USB Cable 1X Red Breadboard 1x Piezo Speaker 3x LEDs (Red, Yellow, Green) 3x 270 1/4W Resistors

Arduino Kit Arduino Breadboard LEDs 270Ω Resistors Piezo Speaker USB Cable

Getting Started First we are going to assemble the circuit. Place the red piezo wire into pin 9 on the Arduino Place the black piezo wire into the GND pin on the Arduino

Connecting to USB Next we will connect the USB cable to the Arduino You should now hear a lovely Lady Gaga tune USB

Lady Gaga Code // TONES ========================================== // Start by defining the relationship between // note, period, & frequency. #define c 3830 // 261 Hz #define d 3400 // 294 Hz #define e 3038 // 329 Hz #define f 2864 // 349 Hz #define g 2550 // 392 Hz #define a 2272 // 440 Hz #define b 2028 // 493 Hz #define C 1912 // 523 Hz // Define a special note, 'R', to represent a rest #define R 0 // SETUP ============================================ // Set up speaker on a PWM pin (digital 9, 10 or 11) int speakerout = 9; // Do we want debugging on serial out? 1 for yes, 0 for no int DEBUG = 1; void setup() { pinmode(speakerout, OUTPUT); if (DEBUG) { Serial.begin(9600); // Set serial out if we want debugging // MELODY and TIMING ======================================= // melody[] is an array of notes, accompanied by beats[], // which sets each note's relative length (higher #, longer note) int melody[] = {c, d, e, c, f, e, f, e, d, c, d, e, e, f, e, d, c; int beats[] = {8, 8, 8, 8, 24, 8, 8, 16, 36, 20, 16, 16, 8, 8, 8, 16, 36; int MAX_COUNT = sizeof(melody) / 2; // Melody length, for looping. // Set overall tempo long tempo = 30000; // Set length of pause between notes int pause = 1000; // Loop variable to increase Rest length int rest_count = 100; //<-BLETCHEROUS HACK; See NOTES // Initialize core variables int tone = 0; int beat = 0; long duration = 0; // PLAY TONE ============================================== // Pulse the speaker to play a tone for a particular duration void playtone() { long elapsed_time = 0; if (tone > 0) { // if this isn't a Rest beat, while the tone has // played less long than 'duration', pulse speaker HIGH and LOW while (elapsed_time < duration) { digitalwrite(speakerout,high); delaymicroseconds(tone / 2); // DOWN digitalwrite(speakerout, LOW); delaymicroseconds(tone / 2); // Keep track of how long we pulsed elapsed_time += (tone); else { // Rest beat; loop times delay for (int j = 0; j < rest_count; j++) { // See NOTE on rest_count delaymicroseconds(duration); // LET THE WILD RUMPUS BEGIN ============================= void loop() { // Set up a counter to pull from melody[] and beats[] for (int i=0; i<max_count; i++) { tone = melody[i]; beat = beats[i]; duration = beat * tempo; // Set up timing playtone(); // A pause between notes... delaymicroseconds(pause); if (DEBUG) { // If debugging, report loop, tone, beat, and duration Serial.print(i); Serial.print(":"); Serial.print(beat); Serial.print(" "); Serial.print(tone); Serial.print(" "); Serial.println(duration);

Loading Code Let s replace the Lady Gaga program with the original simple melody from the Arduino mother site http://www.arduino.cc/en/tutorial/playmelody Copy and Paste the melody code into the Arduino IDE (the formatting may look weird) This program is complicated but please don t worry. We will show you a simpler example next.

Arduino IDE PASTE YOUR CODE IN THIS WINDOW OF THE ARDUINO ENVIRONMENT

Loading Code You are now ready to upload the code Under Tools > Serial Port Choose the COM (serial) port the Arduino is connected to Click the Upload button You should now hear a new melody Upload Button

LED Blink Now we are going to upload a simpler computer program The circuit should be wired up before connecting the USB cable The circuit will be shown on two photographs and will then be followed by detailed instructions

LED Blink

LED Blink The circuit nodes (five adjacent holes) on the red breadboard are connected internally. There are 34 circuit nodes on the breadboard (17 on each half). All circuit elements (wire, LED, etc) plugged into any given node will be connected to each other via an internal metallic strip.

LED Blink Plug one side of a 270 resistor into Arduino s pin 13. Plug the other side of the resistor into any hole on the red breadboard.

LED Blink Plug one side of an LED into the node where you plugged in the resistor Plug the other LED lead into a nearby node. Run a wire from this node to ground on the Arduino (GND) This completes the circuit

LED Blink Code int ledpin = 13; // LED connected to digital pin 13 // The setup() method runs once, when the sketch starts void setup() { // initialize the digital pin as an output: pinmode(ledpin, OUTPUT); // the loop() method runs over and over again, // as long as the Arduino has power void loop() { digitalwrite(ledpin, HIGH); // set the LED on delay(1000); // wait for a second digitalwrite(ledpin, LOW); // set the LED off delay(1000); // wait for a second

Loading LED Blink Now copy the LED Blink Code into the Arduino IDE Make sure the Arduino is connected to the PC via USB Upload the code to your board Enjoy the blinking LED :) (If the LED is not blinking: remove it, rotate 180º, reinsert it)

Going Further Can you figure out how to make the other two LEDs in your kit blink? Using the websites at the end of this presentation, modify the LED blink code Always have a resistor connected in series with an LED

Websites/References At M5 we use these websites constantly for references and inspiration: www.arduino.cc Download Software (PC, Mac or Linux) Reference Page for commands www.umassamherstm5.org Tutorials section www.sparkfun.com A fantastic online shop in Colorado

Happy Making We hope you ll enjoy the Arduino. It s an amazing little powerhouse of a microcontroller board. Search for Arduino videos on the web. People are using them in many creative ways. Be Ambitious! We hope to see you in M5 soon! JDL & TBS