Www.nmmesa.org Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting Started.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Advertisements

Electrical team Arduino tutorial I BY: JOSHUA arduini
Lab7: Introduction to Arduino
Servo Background Servos provide control of rotary position Servos are used extensively in the remote control hobby world for: Aircraft (flaps, ailerons,
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Re-programming the Simon Says with Arduino Linz Craig, Brian Huang.
Living with the Lab Using Your Arduino, Breadboard and Multimeter EAS 199A Fall 2011 Work in teams of two!
Intro to Arduino with LilyPad Make a MakerSpace, Artisan’s Asylum Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett.
Living with the Lab Using servos with an Arduino EAS 199A Fall 2011.
Introduction.
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 PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Working with Arduino: Lesson #3: Force Sensitive Resistors EGN1007.
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
Microprocessors Tutorial 1: Arduino Basics
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Microprocessors Tutorial 1: Arduino Basics
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.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
SAMI MAKERSPACE MAKE: AN ELECTRONICS WORKSHOP. ARDUINO BASICS Credit to: Sparkfun and Linz Craig, Nick Poole, Prashanta Aryal, Theo Simpson, Tai Johnson,
Microcontroller Hands-on Workshop #2 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers October 31, 2009.
Microcontrollers, Microcomputers, and Microprocessors
Arduino The Internet of Things: Using the Arduino to Teach Coding.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Prototyping with Microcontrollers and Sensors. Overview Objective Background Information Problem Statement Materials Procedure Assignment Closing.
The Internet of Things: Using the Arduino to Teach Coding
Having fun with code, using Arduino in a middle school CS classroom
Arduino.
Application of Programming: Scratch & Arduino
By Rick Darby Sponsors: Geekspace Gwinnett The WorkSpot
Assist. Prof. Rassim Suliyev - SDU 2017
Prototyping with Microcontrollers and Sensors
Microcontroller basics
If you want to swing an robot arm or …
Microcontroller basics
Microprocessors Tutorial 1: Arduino Basics
Arduino & its hardware interfacing
UTA010 : Engineering Design – II
Welcome to Arduino A Microcontroller.
Arduino Part 1 Topics: Microcontrollers Programming Basics
Arduino - Introduction
Introduction to Arduino Microcontrollers
Introduction to Arduino Microcontrollers
Introduction to Arduinos
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.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Arduino : Introduction & Programming
Arduino Part 4 Let there be more light.
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
UNIT 11: RC-SERVOMOTOR CONTROL
Lab #1: Getting Started.
Arduino Uno circuit basics
Introduction to Arduinos
Introduction to Arduino IDE and Software
Presentation transcript:

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting Started

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Setting up RedBoard

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Connecting the RedBoard Connecting the CodeBender software to the Board 1.Connect your RedBoard to your Computer a.Use the USB cable provided in SIK kit to connect the RedBoard to one of your computer’s USB inputs. In codebender... b.Select the Arduino Uno or Sparkfun Redboard board c.Select a COM port It is usually the highest port number. Speed should be 9600 d.Speed should be 9600 b c d

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Agenda 9:45 AM10:00 AM The Interface – navigating to and registering on the CodeBender website in Chrome or Firefox. 10:00 AM10:10 AM Setup Board – Installing FTDI drivers (for those Advisors that brought their own laptops) 10:10 AM10:15 AM Connecting the CodeBender software to the Board 10:15 AM10:25 AM The Objects 10:25 AM10:35 AM The Code 10:35 AM10:40 AM Syntax is important 10:40 AM10:50 AM Putting the code into action 10:50 AM11:00 AM Simple LED circuit 11:00 AM11:15 AM Sensing using analog inputs 11:15 AM11:35 AM Using the Servo 11:35 AM11:45 AM Questions/Answers

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) MESA Kit ●SparkFun RedBoard (Arduino Uno) ●Multiple Colored LEDs ●RGB LED ●Temp Sensor ●Photo Sensor (LDR) ●Resistors (330 Ohm / 10k Ohm) ●Variable Resistor (Trim Pot) ●BreadBoard ●Push buttons ●Battery Holder ●H-Bridge IC ●Servo Motor ●Motors w/ Gearbox ●Battery Pack ●USB Cable Order At:

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting started with the RedBoard

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Solderless Breadboard Rows of 5 holes are connected internally by a metal clip. “Ditch” divides the two halves. Vertical “rails” on the side are connected vertically.

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Objects we will be using Today

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Objects Continued

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) What is Arduino? Started circa 2005 Small, low-cost micro-controller (mini-computer). “Arduino” describes both the hardware (board) and the programming language / environment. Terms: Sketch - A sketch is the name that Arduino uses for a program. It's the unit of code that is uploaded to and run on an Arduino board.

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) About the Arduino code

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) General notes Each sketch must have (Bare Minimum): //any text you see with double slash (//) in front of it is a comment and is only for you //the computer ignores that text. It's called a comment. void setup() { //setup runs once at the beginning of the sketch when the board is powered up! } void loop() { //loop runs over and over again really fast until you turn the power off or //you upload other code }

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Syntax Syntax is important Everything is as intended; it is intentional to have all CAPS or Camel case. The capitalization, semi colon, braces are required. There are specific commands that are reserved that Arduino has in it. There is a reference sheet to basic commands available on the nmmesa.org website. At the bottom of the codebender window, the error bar displays our error.

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Syntax Demo To turn a pin ON or OFF, we use the digitalWrite([pin], [HIGH\LOW]) command: void loop() { digitalWrite(13, HIGH);//(on) digitalWrite(13, LOW); //(off) } void loop() { digitalWrite(13, High)(on) digitalWrite(13, Low); // (off) }

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) More general notes All pins are generic. So, you must “configure” a pin before using it. void setup() { pinMode(13, OUTPUT); } void loop() { }

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Putting Code Into Action

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Saving Your Code Saving your Codebender Sketch. With the sketch open that you want to save… 1.Click on the sketch name 2.Type in a new descriptive name 3.Press the Enter key on the keyboard 4.Click the Save button 5.Verify by going back to the codebender main page. You saved sketch should be visible in the sketch list. Make sketch private. To make your sketch private, Double-click the Icon to the left of the sketch name You can only make one sketch private per user account.

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) LED Experiment Simple LED circuit Circuit, has the base word of circle. Our circle is; from power on the board to pin 13 through LED back to ground on the board. Arduino PINs are limited to 40 mA (Milliamps) The LED will pop if you put it into 5v and ground it will burn out the LED. The pins have a current limiter so they are safe. Short leg needs to go to ground Wiring diagram and instructions for Simple LED circuit 1.Plug a LED into the Breadboard with the long pin in Row 1 and the short pin on the LED in Row 2 2.Connect Negative (-) on the Breadboard to GND on the RedBoard 3.Connect A1 on the Breadboard to PIN 13 on the Redboard. 4.Connect A2 on the Breadboard to Negative (-) on the Breadboard

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) And more general notes To turn a pin ON but “dim”, we use the analogWrite([pin], [0-255]) command: void loop() { analogWrite(9, 50); } Note: Only pins that have the ~ next to them can do this. Arduino does this using a technique called PWM.

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Dimmer Experiment

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Dimmer Experiment Continued Upload the Code 1.Go to Click the Run on Arduino button. View the Trimpot’s output in the Serial Monitor section… 3.Make sure the baud rate is 9600 (data rate bits per second). This will establish what speed it will be. 4.Click Connect button. 5.You will be able to see the output from the Trimpot on the screen. 6.Adjust the Trimpot by turning the knob and look at the results in the serial monitor. 7.Click Disconnect button when done (was the Connect button). 3 4 Read the code, what is it doing? void setup() { /* Initialize the serial communication at 9600 bits per second. This allows you to send or receive sensor values and other data between the Arduino and another device (like your computer) is the standard speed most devices use.*/ Serial.begin(9600); } void loop() { /* create an integer variable (int) called val make val equal to the sensor reading on pin A0 you should get a sensor reading between 0 and 1023*/ int val = analogRead(A0); //print the string "Val = " over the serial port Serial.print("Val = "); //print the variable val and end the line with a carriage return Serial.println(val); //wait a bit delay(100); }

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) A little background on servo motors 3 wires -- black, red, white. Signal is compared to a potentiometer that is connected to the output shaft. Signal is a 50 Hz PWM (20 mS per Period)

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Using the Servo

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Servo Continued Finally, In the loop, we have the Servo going from 170 degrees to 10 degrees over and over again. The delay() commands tell the Arduino to do nothing for 500 milliseconds so the servo horn has time to move. Read the code, what is it doing? //include the Servo library in your sketch #include //create a servo object called myServo Servo myServo; void setup() { //attach myServo to pin 9 myServo.attach(9); //write the angle of 90 to myServo once myServo.write(90); } void loop() { myServo.write(170); delay(500); myServo.write(10); delay(500); ; } The first line includes the Servo.h library into the sketch. This provides access to new commands and functions to control special devices - like a servo motor. Notice that this is one of the few instances where there is no semicolon at the end of the line. The first line includes the Servo.h library into the sketch. This provides access to new commands and functions to control special devices - like a servo motor. Notice that this is one of the few instances where there is no semicolon at the end of the line. Next, Servo myServo - this creates an object that is called myServo. An object is similar to a variable that has extra properties and commands. The two commands that we care about are: attach () and. write (). The myServo.attach(9) is similar to a setup command. It links the myServo object to pin 9 on the Arduino. The myServo.write(90) is the command that tells the servo motor what angle to rotate to. The range of motion for a servo is roughly 180 degrees. You can use any value from 0 to 180 with this command. The placement in setup sets our starting angle at 90 degrees.

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) To set the angle... servo1.write(90); delay(1000); servo1.write(0); delay(1000); servo1.write(180);

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Teaching and Learning ***The Big 6*** Program Flow and Control Inputs and Outputs Data, Variables, Math, and Numbers Digital vs. Analog Communication Libraries and Object Oriented Programming (OOP)

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) learn.sparkfun.com/mesa2015

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) NM MESA website All information and resources for the 2016 MESA day will be updated on the website

Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Questions / Contact Your Regional Coordinator Rick Cole NNmmesa.org Thanks!!!