Microcontroller basics Embedded systems for mortals.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Electrical team Arduino tutorial I BY: JOSHUA arduini
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Embedded Sumo 1T4 – 1T5 UTRA.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Living with the Lab Using Your Arduino, Breadboard and Multimeter EAS 199A Fall 2011 Work in teams of two!
ELCT 201 week 13 Analog ON/OFF control system conversion to Digital ON/OFF control system.
Intro to Programming and Microcontrollers. Activity Group into pairs and sit back-to-back. Pick one person who is going to draw. The other person will.
Living with the lab Introduction to Arduino Programming arduino.cc Gerald Recktenwald Portland State University
Finish your programs from last week STOPLIGHT CIRCUIT! You may need … – int – void setup() – void loop() – pinMode – digitalWrite – delay.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Embedded Programming and Robotics
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
chipKit Sense Switch & Control LED
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Cascade switching of an LED EAS 199B Winter 2013.
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.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
LECTURE 2 – INPUTS THIS LECTURE WILL INTRODUCE HOW TO INPUT SIGNALS INTO AN ARDUINO.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Microcontrollers, Microcomputers, and Microprocessors
Arduino libraries Datatekniker Udvidet hardware/software.
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.
Microcontroller basics Embedded systems for mortals.
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University
Introducing the Arduino Uno Presented by Dave Mawdsley, DACS Member, Linux SIG Member (wiring, programming and running a cute traffic light simulation)
Arduino.
Arduino Part 1 Topics: Microcontrollers
Assist. Prof. Rassim Suliyev - SDU 2017
Microcontroller basics
Microcontroller basics
Wireless Cue Light Project
Microcontroller basics
UTA010 : Engineering Design – II
Cascade switching of an LED
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
Arduino Part 1 Topics: Microcontrollers Programming Basics
3.0 ARDUINO WORKSHOP PRESENTATION FOR STUDENTS IN 4º DEGREE OF COMPULSORY SECONDARY EDUCATION 3.0.
Introduction to Arduino Microcontrollers
How to avoid catching things on fire.
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.
IoT Programming the Particle Photon.
Arduino 101 Credit(s):
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Welcome to Digital Electronics using the Arduino Board
Introducing the Arduino Uno
Arduino programs Arduino toolchain Cross-compilation Arduino sketches
Chapter 1 Introduction of Arduino
Arduino Part 4 Let there be more light.
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
Lab #1: Getting Started.
Arduino Uno circuit basics
Setting up a basic program with Arduino
SAURABH GINGADE.
Arduino程式範例.
Introduction to Arduino IDE and Software
Interrupts.
Presentation transcript:

Microcontroller basics Embedded systems for mortals

Topics Working with Arduino IDE Basic electric components Your first program Digital input and output

Arduino IDE with Teensy MCU Download Arduino IDE from (version 1.6.7): Download Teensyduino from (version 1.27):

About Teensy Microcontroller used in these excersises is Teensy MHz 8-bit Atmel Processor (AT90USB1286)

Basic Components Resistor Capacitor LED Push button Inductor Transistor Integrated circuit (IC) Passive componentsActive components

Breadboard Terminals with blue and red lines are called power busses and are connected together horizontally. Terminals in the middle are connected together vertically. The gap in the middle separates the two sides.

Breadboard Example: How to connect Teensy++ 2.0

Setting up Arduino IDE

Writing your first program byte ledPin = 6; //Variable to store the pin number //(the built in LED on Teensy++2.0 is connected to pin 6) void setup() { pinMode(ledPin, OUTPUT); //set ledPin as output digitalWrite(ledPin, LOW); //Set the default state of the pin to GND(0 Volts) } void loop() { digitalWrite(ledPin, HIGH); //LED ON delay(100); //Wait 100ms (=0,1s) digitalWrite(ledPin, LOW); //LED OFF delay(1000); //Wait 1000ms (=1s) } Basic blinking LED

Uploading the program 1.Click Verify 2.Click Upload 3.Plug in and reset Teensy

Arduino C – Basic functions void setup() {} void loop() {} Setup function is run once, when the microcontroller boots up or resets. After setup function the processor moves to run code inside the loop function. Code inside loop function will be run over and over until the microcontroller is shut down. pinMode(var1, var2) pinMode functions sets the mode of given pin. Var1 is the number of the pin and var2 is the mode (INPUT, INPUT_PULLUP, OUTPUT) digitalWrite changes the status of the pin. Var1 is the number of the pin and var2 is the status (LOW, HIGH). digitalWrite(var1, var2) IMPORTANT TO NOTICE: It’s required to have both setup() and loop() functions in the code Depending whether the pin is set as an OUTPUT or INPUT the actual effect of digitalWrite() is different

Example 2 - Setup Reading digital input (Using push button)

Example 2 - Code byte ledPin = 6; byte buttonPin = 12; void setup() { pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); pinMode(buttonPin, INPUT); //set buttonPin as input digitalWrite(buttonPin, HIGH); //Set the default state of the pin to HIGH(+5V) } void loop() { if(digitalRead(buttonPin) == LOW) { digitalWrite(ledPin, HIGH); //LED ON } else { digitalWrite(ledPin, LOW); //LED OFF } Reading digital input (Using push button)

P=U*I M U=R*I Microcontrollers typically operate on low voltages (0-5V) →You must be careful when connecting devices Know the electrical limits of the microcontroller: Teensy can handle max 5V/40mA per pin Always double check the wiring! If you see smoke it’s already too late!

P=U*I M U=R*I

Example 3 - Schematic

Example 3 – Breadboard Setup

Example 3 - Code byte ledPin = 24; //new ledPin value byte buttonPin = 12; void setup() { pinMode(ledPin, OUTPUT); digitalWrite(ledPin, LOW); pinMode(buttonPin, INPUT); digitalWrite(buttonPin, HIGH); } void loop() { if(digitalRead(buttonPin) == LOW) { digitalWrite(ledPin, HIGH); //LED ON } else { digitalWrite(ledPin, LOW); //LED OFF } Controlling external LED with push button

You have just entered the Matrix