Montgomery Village Arduino Meetup Dec 10, 2016

Similar documents
Arduino Lesson 1. Blink. Created by Simon Monk

FABO ACADEMY X ELECTRONIC DESIGN

Welcome to Arduino Day 2016

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

Arduino Platform Capabilities in Multitasking. environment.

A - Debris on the Track

A - Debris on the Track

Training Schedule. Robotic System Design using Arduino Platform

Using NeoPixels and Servos Together

Demon Pumpkin APPROXIMATE TIME (EXCLUDING PREPARATION WORK): 1 HOUR PREREQUISITES: PART LIST:

A - Debris on the Track

Lab 2: Blinkie Lab. Objectives. Materials. Theory

Adafruit 16-Channel Servo Driver with Arduino

Adafruit 16-channel PWM/Servo Shield

Intelligent Systems Design in a Non Engineering Curriculum. Embedded Systems Without Major Hardware Engineering

Python Programming For Arduino

Trinket Powered Analog Meter Clock

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

J. La Favre Using Arduino with Raspberry Pi February 7, 2018

Module: Arduino as Signal Generator

Arduino Intro. Introduction to Arduino For linux geeks. By Peter Sjöberg peters-oclug at techwiz point ca.

Adafruit 16-Channel Servo Driver with Arduino

Microcontrollers and Interfacing

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

THE INPUTS ON THE ARDUINO READ VOLTAGE. ALL INPUTS NEED TO BE THOUGHT OF IN TERMS OF VOLTAGE DIFFERENTIALS.

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

APDS-9960 RGB and Gesture Sensor Hookup Guide

Getting Started with the micro:bit

CURIE Academy, Summer 2014 Lab 2: Computer Engineering Software Perspective Sign-Off Sheet

CPSC 226 Lab Four Spring 2018

Lesson 3: Arduino. Goals

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

TWEAK THE ARDUINO LOGO

The wiring is relatively simple. You should put the module on one of the compatible Arduinos. The following are compatible:

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE (

On the front of the board there are a number of components that are pretty visible right off the bat!

Analog Feedback Servos

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1

Electronic Prototyping

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

Peek-a-BOO Kit JAMECO PART NO / / Experience Level: Beginner Time Required: 1+ hour

Adafruit 16-Channel Servo Driver with Arduino

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Rochester Institute of Technology Real Time and Embedded Systems: Project 2a

Coding with Arduino to operate the prosthetic arm

Adafruit 16-channel PWM/Servo Shield

Rodni What will yours be?

Total Hours Registration through Website or for further details please visit (Refer Upcoming Events Section)

CSCI1600 Lab 4: Sound

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink

Programming a Servo. Servo. Red Wire. Black Wire. White Wire

Smart Security System using Arduino and Wireless Communication

LEARN ARDUINO SENSORS ALL SENSORS DESCRIPTION APPLICATION SPECIFICATIONS EXAMPLE CODES NOTES DOWNLOADS DHT11, DHT22 AND AM2302 SENSORS ADAFRUIT

Adafruit SGP30 TVOC/eCO2 Gas Sensor

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

Application Note AN 102: Arduino I2C Interface to K 30 Sensor

smraza Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)...

Arduino Programming Part 3

Pulse Width Modulation and

Veyron Servo Driver (24 Channel) (SKU:DRI0029)

Serial Communication AS5132 Rotary Magnetic Position Sensor

DFRduino Romeo All in one Controller V1.1(SKU:DFR0004)

MOTOR CONTROL WITH THE ARDUINO MEGA

EARTH PEOPLE TECHNOLOGY. EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual

Adafruit 16-Channel PWM/Servo HAT for Raspberry Pi

RGB LED Strips. Created by lady ada. Last updated on :21:20 PM UTC

HC-SR501 Passive Infrared (PIR) Motion Sensor

Arduino Starter Kit Manual Example Code Ebook

Community College of Allegheny County Unit 4 Page #1. Timers and PWM Motor Control

Lab 13: Microcontrollers II

Portland State University MICROCONTROLLERS

With The Arduino Part 1 Robotshop Robot Store

Circuit Playground Quick Draw

Capacitive Touch with Conductive Fabric & Flora

36 CHANNELS LED DRIVER EVALUATION BOARD GUIDE

Learning Objectives. References 10/26/11. Using servos with an Arduino. EAS 199A Fall 2011

Adafruit Si4713 FM Radio Transmitter with RDS/RDBS Support

MicroWave Sensor SKU: SEN0192

Using Servos with an Arduino

Topic 1. Road safety rules. Projects: 1. Robo drives safely - page Robo is a traffic light - - page 6-10 Robo is a smart traffic light

LESSONS Lesson 1. Microcontrollers and SBCs. The Big Idea: Lesson 1: Microcontrollers and SBCs. Background: What, precisely, is computer science?

LoRa Quick Start Guide

Internet of Things Student STEM Project Jackson High School. Lesson 3: Arduino Solar Tracker

The Robot Builder's Shield for Arduino

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

Application Note AN 157: Arduino UART Interface to TelAire T6613 CO2 Sensor

Setup Download the Arduino library (link) for Processing and the Lab 12 sketches (link).

Arduino For Dummies PDF

Attribution Thank you to Arduino and SparkFun for open source access to reference materials.

1Getting Started SIK BINDER //3

AS726X NIR/VIS Spectral Sensor Hookup Guide

My Accessible+ Math: Creation of the Haptic Interface Prototype

Saturday Academy Program

ENGI1020. Lab 0 Introduction to Arduino IDE and Hardware Lori Hogan, Lab Instructor - Winter 2019

Workshops Elisava Introduction to programming and electronics (Scratch & Arduino)

1 Day Robot Building (MC40A + Aluminum Base) for Edubot 2.0

Introduction to the Arduino Kit

Arduino Workshop A Hands On Introduction With 65 Projects John Boxall

ISSN: [Singh* et al., 6(6): June, 2017] Impact Factor: 4.116

Light Emitting Diode IV Characterization

Transcription:

Montgomery Village Arduino Meetup Dec 10, 2016 Making Microcontrollers Multitask or How to teach your Arduinos to walk and chew gum at the same time (metaphorically speaking)

Background My personal project is to prototype a computer-controlled model railroad layout. I've started a build blog for this project at ModelRailroadElectronics.blog A variety of Arduino-class microcontrollers will be used for the different parts of this system. Some of these Arduinos will need to be programmed to handle concurrent operations, which simple Arduino programming techniques don't do well.

Some Arduino varieties Adafruit Motor Shield * Arduino Gemma Adafruit Trinket Adafruit Pro Trinket Arduino Uno Arduino Micro Arduino Mega 2560 (in clear case) * Shields are peripheral boards that can be stacked onto some Arduino boards.

Arduino hardware board power flash (bytes) RAM (bytes) GPIO pins analogwrite pins analogread pins shields? Arduino Gemma 3.3v 8,192 512 3 2 1 no Adafruit Trinket 3.3v or 5v 8,192 512 5 2 3 no Adafruit Pro Trinket 3.3v or 5v 8,192 512 18 6 8 no Arduino Micro 5v 32,768 2,048 18 8 6 no Arduino Uno 5v 32,768 2,560 20 6 8 yes Arduino Mega 2560 5v 262,144 8,192 54 15 16 yes

Arduino software All Arduinos are programmed with the Arduino IDE in C++. Applications written for the Arduino are called sketches. Software interfaces to hardware are provided by libraries.

Arduino software All Arduino sketches must have two functions. void setup() { } Called once after power-up or reset of board. void loop() { } Called repeatedly after setup completes. The user application defines the content of these functions.

Blink sketch Usually the first sketch a new Arduino user runs is Blink. It flashes the onboard LED (usually on pin 13) about once every two seconds (1 second on, 1 second off). Blink uses the built-in delay() function to provide the timing of the on and off states.

Blink sketch

Blink sketch During the delays, the Arduino is doing nothing else but marking the passage of time. What if we want to drive 2 or more LEDs, but with different timings? Answer: We can't do it using this sketch as a model. We need a different approach... which doesn't rely on delay().

BlinkWithoutDelay, setup

BlinkWithoutDelay, loop

BlinkWithoutDelay sketch With this approach, the processor never gets locked up in a delay(), and could be modified to allow more than one LED to be flashed, and with different timings. We will now skip a lot of steps and jump into...

State machines A state machine (full name finite state machine or FSM) is a mechanism, in this case purely software, which at any given moment is in exactly one state out of several possible. A state machine has: states actions within states transitions between states

State machine: Push-on/Push-off switch Two states, Off and On Initial state is Off Push action causes change of state

State machine: Motion-sensor switch Sensor will turn switch On, starting timer Sensor will keep switch On, restarting timer Timer running out will turn switch Off

StateMachine library I've encapsulated the framework of a generic state machine into an Arduino library named StateMachine. This library can be downloaded from my GitHub: github.com/twrackers/statemachine-library Instructions on installing this library and others are at: github.com/twrackers/mydocuments/blob/master/installation_to_arduino.md

BlinkOneLED sketch This sketch uses the StateMachine library to flash a single LED, letting a state machine handle the timing while the sketch controls the LED based on the current state. This sketch is in the examples directory of the StateMachine library.

BlinkThreeLEDs sketch This sketch builds upon BlinkOneLED to drive three LEDs at the same time, each with its own timing. This sketch is in the examples directory of the StateMachine library.

There's a lot of repetition in this sketch, though. Can we improve upon that? Answer: Definitely.

Pulser library This library defines a Pulser object, which is a StateMachine object with two new parameters: the on-time in milliseconds the off-time in milliseconds The Pulser alternates automatically between its on and off states. The Pulser stores internally its current state (on or off) and the clock time when it last changed state. github.com/twrackers/pulser-library

LED_Pulser sketch This sketch defines a Strobe object, which is a Pulser that has a GPIO pin associated with it. Now all we need to do is create Strobe objects, each with a pin number, an on-time, and an off-time. We could easily create a Strobe library from this sketch. github.com/twrackers/pulser-library/tree/master/pulser/examples/led_pulser

State machine benefits By using the StateMachine library, and libraries and classes derived from it, we get the greatest reuse of code, which makes the downloaded code more compact. Because our sketch never gets tied up in delay calls, it can remain responsive to external inputs.