CSCI1600: Embedded and Real Time Software

Slides:



Advertisements
Similar presentations
Lab7: Introduction to Arduino
Advertisements

Robotics Club, Snt Council2 The 3 Schools of Robotics: Mechanical Design – Types of motors – Material selection –
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Digital I/O Connecting to the Outside World
Introduction.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
This Thursday, Oct. 25 th 1-1:50pm: Exam in DUANE G140 Covers lectures and labs (except today’s lecture on microcontrollers) You may bring handwritten.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
July 7, 2003 Slide 1 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction To Programming Chetan Jadhav Talib Bhabharawala Seung-Kook.
CSCI1600: Embedded and Real Time Software Lecture 4: Introduction to the Arduino Steven Reiss, Fall 2015.
智慧電子應用設計導論(1/3) Arduino MEGA 2560
CSCI1600: Embedded and Real Time Software Lecture 2: Introduction Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 9: Input Output Concepts Steven Reiss, Fall 2015.
July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 5: Arduino Programming Steven Reiss, Fall 2015.
Slides created by: Professor Ian G. Harris Embedded Systems  Embedded systems are computer-based systems which are embedded inside another device (car,
Microcontroller basics Embedded systems for mortals.
Embedded systems and sensors 1 Part 2 Interaction technology Lennart Herlaar.
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Introducing the Arduino Uno Presented by Dave Mawdsley, DACS Member, Linux SIG Member (wiring, programming and running a cute traffic light simulation)
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Arduino.
Application Case Study Security Camera Controller
Microcontroller basics
Arduino Based Industrial appliances control system by decoding dual tone multi frequency signals on GSM / CDMA network. Submitted by:
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
Microcontroller basics
Chapter A - The Raspberry Pi Computer
Microprocessors Tutorial 1: Arduino Basics
UTA010 : Engineering Design – II
Microcontroller Applications
UNIT – Microcontroller.
Microcontroller Based Digital Code Lock
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
Arduino - Introduction
Introduction to Arduino Microcontrollers
How to avoid catching things on fire.
The Arduino Microcontroller: Atmel AVR Atmega 328
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.
Introduction to Microprocessors and Microcontrollers
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Journey: Introduction to Embedded Systems
Introducing the Arduino Uno
CSCI1600: Embedded and Real Time Software
Introducing the PIC Mid-Range Family and the 16F84A
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Programmable Interval Timer
Lab #1: Getting Started.
CSCI1600: Embedded and Real Time Software
Arduino Board.
Arduino म्हणजे काय?.
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Course Code 114 Introduction to Computer Science
Interrupts.
Presentation transcript:

CSCI1600: Embedded and Real Time Software Lecture 4: Introduction to the Arduino Steven Reiss, Fall 2015

What is an Arduino Lecture 4: Introduction to the Arduino 2/24/2019

Arduino Design: USB Lecture 4: Introduction to the Arduino 2/24/2019

Arduino Design: CPU Lecture 4: Introduction to the Arduino 2/24/2019

Arduino USB Lecture 4: Introduction to the Arduino 2/24/2019

Arduino CPU Lecture 4: Introduction to the Arduino 2/24/2019

Embedded Processors Arduino: a microcontroller Others exist as well General purpose processors ARM processor (low power) Raspberry Pi Special purpose processors DSP for sound, video processing Graphics processors Lecture 4: Introduction to the Arduino 2/24/2019

Other alternatives Field-Programmable Gate Array (FPGA) Less expensive than creating chip Like having a bucket of parts to wire together Except the wiring is done programmatically And the whole thing fits on a chip Easy and cheap to make in quantity Programmed in a high-level language Event-based, parallel Lecture 4: Introduction to the Arduino 2/24/2019

Arduino Restrictions Simple CPU No floating point processor Single core, single threaded No pipelining No floating point processor How is floating point done Lecture 4: Introduction to the Arduino 2/24/2019

Arduino CPU Clock Speed: 16 MHz 32KB flash, 2KB SRAM, 1KB EEPROM 16 bit processing Lecture 4: Introduction to the Arduino 2/24/2019

What you need to know Power/USB Input Ground and power outputs Digital input/outputs Analog input/outputs Reset button Lecture 4: Introduction to the Arduino 2/24/2019

Digital Input/Outputs Inputs: Must be declared (default is output) Should have value connected Should provide input Pull-up input might be enabled Outputs Provide up to 40ma Connect LEDs through 470 or 1K ohm resistor Pins 0,1 shared with USB; Pin 13 with LED Lecture 4: Introduction to the Arduino 2/24/2019

Analog Inputs/Outputs Can also be used as digital inputs/outputs Must be declared Inputs (A1-A6) Can measure 0-3, 0-5 volts 10-bit A/D converter (0-1023) Outputs (on pins 3,5,6,9,10,11) Uses pulse-width modulation Values 0-255 (% of 5v during cycle) Pins 5,6 shared for clocks Lecture 4: Introduction to the Arduino 2/24/2019

Pulse Width Modulation Lecture 4: Introduction to the Arduino 2/24/2019

Clapper Input circuit Output Circuit Analog based on sound intensity Two lights Digital (on or off) Lecture 4: Introduction to the Arduino 2/24/2019

Clapper Input Circuit Lecture 4: Introduction to the Arduino 2/24/2019

How does this work Microphone generates a weak signal https://www.jameco.com/Jameco/Products/Pr odDS/136574.pdf LM386 is an amplifier chip Amount controlled by resistor, capacitor http://www.ti.com/lit/ds/symlink/lm386.pdf Output balanced between 0 and 5 volts Lecture 4: Introduction to the Arduino 2/24/2019

Output circuit Connect Digital Output Pin to LED Through a 1K resistor (why) Other side of LED is grounded Lecture 4: Introduction to the Arduino 2/24/2019

How should the clapper work? Read the input How often Check if we have a clap What does a clap look like How would you find out Check if we have a clap sequence Turn on lights based on inputs Lecture 4: Introduction to the Arduino 2/24/2019

Clapper requirements Detect claps Handle flashing lights Based on sound input Handle flashing lights How often to check Lecture 4: Introduction to the Arduino 2/24/2019

Arduino Operating System No real operating system per se Libraries Handing I/O, timers, interrupts Single program is run setup() run once loop() run continually Lecture 4: Introduction to the Arduino 2/24/2019

Tasks The basic concept in RT/EM software Tasks are independent Break your project into tasks Tasks are independent Communicate via shared variables Communicate via network, etc. Tasks are run periodically or on demand Periodic – run every k microseconds Demand – run on event, interrupt, condition Lecture 4: Introduction to the Arduino 2/24/2019

Clapper Tasks Listen for sound Handle clapper logic Handle first light (on/off/flash) Handle second light (on/off/flash) Lecture 4: Introduction to the Arduino 2/24/2019

Detecting a clap Still Clap start Clap sense Inside clap Clap end End sense Between claps Clap start Clap sense Lecture 4: Introduction to the Arduino 2/24/2019

Finite State Models Annotate states Annotate arcs What they mean, what they do Annotate arcs When they occur (timeout, error, signal detect) We’ll cover how to do this formally Lecture 4: Introduction to the Arduino 2/24/2019

Clapper Program Each task is broken up First part goes in setup() Initialization for the task Set up input pins, precompute tables, … What is done repeatedly The real work of the task First part goes in setup() Second part called from loop() Lecture 4: Introduction to the Arduino 2/24/2019

Scheduling Tasks loop() needs to invoke all tasks Typical loop code: Tasks that should run every k ms Tasks that should run on event Typical loop code: Get time For each timed task Check if it should run, call routine for it if so For each event-based task Check flag, call routine for it if set Checks can be done in the task code itself Lecture 4: Introduction to the Arduino 2/24/2019

Clocks Arduino provides timers There are also internal clocks 16 or 32 bit, clock (16MHz) resolution Can be scaled by power of 2 There are also internal clocks millis(), microseconds() Time since board last reset / started These will wrap (how often?) User clocks as well Tick based on internal clock Task actions based on user clock Lecture 4: Introduction to the Arduino 2/24/2019

Homework https://www.arduino.cc/en/Tutorial/ HomePage Think about what the clapper code should look like logically Lecture 4: Introduction to the Arduino 2/24/2019