Panasonic EVE-KC2F2024B 24 pulses per revolution 6mm diameter flattened output shaft output type: quadrature (incremental) minimum life: 15,000 rotations.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

Button Input: On/off state change Living with the Lab Gerald Recktenwald Portland State University
EMS1EP Lecture 6 Digital Inputs
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Intro to Arduino with LilyPad Make a MakerSpace, Artisan’s Asylum Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett.
IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Colorado Space Grant Consortium Gateway To Space ASEN 1400 / ASTR 2500 Class #12 Gateway To Space ASEN 1400 / ASTR 2500 Class #12 T-58.
Switches & whiskers on the Arduino living with the lab lever arm switches mounted to Arduino © 2012 David Hall.
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
Introduction to the Arduino
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Servos The material presented is taken from a variety of sources including:
Code The Arduino Environment.
Lynxmotion Robotic Arm
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Interfacing to External Devices  Explore Digital Interfaces techniques  Introduce some complex optical devices and how to interface them  Describe methods.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Embedded Programming and Robotics Lesson 11 Arduino Interrupts 1.
IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
LAB1 TYWU. Devices Dip Switch (4 Switches) Triple Output LED (RGB) –Common Cathode.
Lynxmotion Robotic Arm © 2013 Project Lead The Way, Inc.Computer Integrated Manufacturing
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Pulse-Width Modulation: Simulating variable DC output
1 Transistor. 2 Transistors are used to turn components on and off They come in all different shapes and sizes.
Having fun with code, using Arduino in a middle school CS classroom
Lab 7 Basic 1: Game of Memory
Assist. Prof. Rassim Suliyev - SDU 2017
Microcontroller basics
Wireless Cue Light Project
Arduino & its hardware interfacing
UTA010 : Engineering Design – II
Get Your Project Started with Arduino
European Robotic LABoratory
UCD ElecSoc Robotics Club 2017/2018
Get Your Project Started with Arduino
Lab 1: Arduino Basics Topics: Arduino Fundamentals, First Circuit
INC 161 , CPE 100 Computer Programming
Controlling a Motor with Cascading Switches
Arduino Uno and sensors
Introduction to Arduino Microcontrollers
Introduction to Arduino Microcontrollers
How to avoid catching things on fire.
Analog Input through POT
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.
What is Arduino? By James Tedder.
1 Code
Using Photoresistors with an Arduino
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Digital Input from Switches
Implementing Switches Using Interrupts
Arduino: For Loops.
Interfacing a Rotary Encoder with an Arduino
Arduino : Introduction & Programming
Programming 2: The Arduino IDE & First Sketches
CTY SAR FCPS Shawn Lupoli, Elliot Tan
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Multiplexing seven-segment displays
Arduino 7 Segment Display Lab
Arduino Uno circuit basics
Arduino程式範例.
Interrupts.
Pulse-Width Modulation: Simulating variable DC output
Presentation transcript:

Panasonic EVE-KC2F2024B 24 pulses per revolution 6mm diameter flattened output shaft output type: quadrature (incremental) minimum life: 15,000 rotations cost: less than $1 (USD) Arduino Uno microcontroller board Interfacing a Rotary Encoder with an Arduino living with the lab Rotary encoders are used keep track of the rotational position of a knob, like a volume knob on a stereo, or the rotational position of a motor shaft.

living with the lab 2 A B COM clockwise rotation of knob counterclockwise rotation of knob B pin B = ON pin B = OFF A pin A = ON pin A = OFF When switch A goes ON and B is OFF, then rotation must be clockwise. When switch A goes ON and B is ON, then rotation must be counterclockwise. When switch A goes OFF and B is ON, then rotation must be clockwise. When switch A goes OFF and B is OFF, then rotation must be counterclockwise. increment rotational counter decrement rotational counter Encoder Output and Rotational Direction

living with the lab 3 The Guts of a Mechanical Encoder spring-loaded electrical contacts As the encoder knob is turned, the spring-loaded contacts pass over metal segments that connect to the A, B and COM pins. Electrical continuity occurs when a contact touches metal, but no continuity occurs when a contact touches the black plastic. One of the three contacts is always touching COM. A COM B electrical continuity between A and COM no electrical continuity between A and COM

Sensor Wiring (need four 10kΩ resistors and two 0.01  F capacitors) living with the lab 4 10kΩ the encoder is the part in the red box this part of the circuit keeps the A, B and COM “switches” from flickering at the beginning or end contact... this “debounces” the switches

A Simple Sketch living with the lab 5 volatile int encoderPos = 0; // the value of a volatile variable can change // in the function called by the interrupt void setup() { pinMode(2, INPUT); // encoder pinA is attached to digital pin2 pinMode(3, INPUT); // encoder pinB is attached to digital pin3 attachInterrupt(0, encoder, CHANGE); // interrupt0 maps to pin2 Serial.begin (9600); } void loop(){ } // main body of the sketch employing the interrupt void encoder() { if(digitalRead(2) == digitalRead(3)) // check to see if pins A & B have the same state {encoderPos--; } // decrement position if A & B are the same else {encoderPos++; } // increment position if A & B are not the same Serial.println (encoderPos, DEC); // send encoderPos to serial monitor } This sketch increments the variable “encoderPos” when the encoder knob is turned clockwise and decrements the variable when the knob is turned counterclockwise. The sketch uses an “interrupt” to avoid missing any changes in the position of the knob. The Arduino Uno has two interrupts attached to digital pins 2 and 3; we only use pin 2 as an interrupt here.

living with the lab 6 Example Application This implementation shows a knob mounted to the rotary encoder. This hardware includes two LEDS that come on and off as the encoder passes over the contacts. The hardware can be used with the sketch on the previous slide to demonstrate how the encoder works.