OPTI 380B Intermediate Optics Laboratory

Similar documents
User s Manual of Board Microcontroller ET-MEGA2560-ADK ET-MEGA2560-ADK

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Arduino Due Back. Warning: Unlike other Arduino boards, the Arduino Due board runs at 3.3V. The maximum. Overview

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

Conversion Between Analog and Digital Signals

Accurate Measurement of the Mains Electricity Frequency

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Arduino ADK Back. For information on using the board with the Android OS, see Google's ADK documentation.

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

UniPi technical documentation REV 1.1

Tiny Arduino Music Visualizer

KTA-223 Arduino Compatible Relay Controller

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

Lab Experiment 1: The LPC 2148 Education Board

Arduino Lesson 13. DC Motors. Created by Simon Monk

Android Controlled Based Interface

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

EVAL-UFDC-1/UFDC-1M-16

Work with Arduino Hardware

CAN-Bus Shield Hookup Guide

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

ABB Drives. User s Manual. Pulse Encoder Interface Module RTAC-01

Wireless Security Camera

Decimal Number (base 10) Binary Number (base 2)

Arduino Lesson 14. Servo Motors

QUICK START GUIDE FOR DEMONSTRATION CIRCUIT BIT DIFFERENTIAL ADC WITH I2C LTC2485 DESCRIPTION

Tutorial. replace them with cell-phone operated module. The advantages of a cell-phone operated bot are:-

A Digital Timer Implementation using 7 Segment Displays

revolution Contents: Introduction Power 28-pin Project Board with input/output cables

- 35mA Standby, mA Speaking pre-defined phrases with up to 1925 total characters.

INTRODUCTION TO SERIAL ARM

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Microprocessor Project Laboratory

CHAPTER 11: Flip Flops

Basic Pulse Width Modulation

Advanced Data Capture and Control Systems

TURBO PROGRAMMER USB, MMC, SIM DEVELOPMENT KIT

Digital Guitar Effects Pedal

MN3310 Evaluation Kit v1 User Guide

with Electronic Assistant

Arduino project. Arduino board. Serial transmission

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

MN1010 Evaluation Kit v3 User Guide

C8051F020 Utilization in an Embedded Digital Design Project Course. Daren R. Wilcox Southern Polytechnic State University Marietta, Georgia

Serial Communications

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Electronic Circuits Spring 2007

Microcontroller to Sensor Interfacing Techniques

Welcome to the tutorial for the MPLAB Starter Kit for dspic DSCs

Hardware Connections between Arduino and IMU Nori Wilkins Apr. 5, 2013

MCP4725 Digital to Analog Converter Hookup Guide

Chapter 6: From Digital-to-Analog and Back Again

RPLIDAR. Low Cost 360 degree 2D Laser Scanner (LIDAR) System Development Kit User Manual Rev.1

MOTION COORDINATOR MC206X Quick Connection Guide

Lecture N -1- PHYS Microcontrollers

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Massachusetts Institute of Technology

PLL frequency synthesizer

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

Antenna Rotator System

Arduino Lesson 1. Blink

ETEC Digital Controls PIC Lab 10 Pulse Width Modulation

STEPPER MOTOR SPEED AND POSITION CONTROL

Disturbance Recoder SPCR 8C27. Product Guide

Pulse Width Modulation (PWM) LED Dimmer Circuit. Using a 555 Timer Chip

AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

Arduino Lesson 16. Stepper Motors

The components. E3: Digital electronics. Goals:

Selecting and Implementing H-Bridges in DC Motor Control. Daniel Phan A

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Lab 6 Introduction to Serial and Wireless Communication

Arduino Motor Shield (L298) Manual

Designing VM2 Application Boards

Project Plan. Project Plan. May Logging DC Wattmeter. Team Member: Advisor : Ailing Mei. Collin Christy. Andrew Kom. Client: Chongli Cai

Advanced LED Controller (LED Chaser)

LEN s.r.l. Via S. Andrea di Rovereto 33 c.s CHIAVARI (GE) Tel Fax mailto: len@len.it url: http//

POCKET SCOPE 2. The idea 2. Design criteria 3

NETWORK ENABLED EQUIPMENT MONITOR

Programming with the Arduino: open-source hardware in an introductory programming laboratory. Paul Cruickshank

Surveillance System Using Wireless Sensor Networks

Trigno/Vicon System Integration

K-Type Thermocouple Sensor User s Guide

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

ET-BASE AVR ATmega64/128

M68EVB908QL4 Development Board for Motorola MC68HC908QL4

Simplify Data Acquisition with a Built-in LXI Web Server

Product Information. Gateway For Connecting EnDat Encoders to PROFIBUS-DP

The self-starting solar-powered Stirling engine

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

[F/T] [5] [KHz] [AMP] [3] [V] 4 ) To set DC offset to -2.5V press the following keys [OFS] [+/-] [2] [.] [5] [V]

How To Use A Watt Saver On A Microcontroller (Watt Saver) On A Cell Phone Or Mp3 Player

PolyBot Board. User's Guide V1.11 9/20/08

SYSTEM 45. C R H Electronics Design

JNIOR. Overview. Get Connected. Get Results. JNIOR Model 310. JNIOR Model 312. JNIOR Model 314. JNIOR Model 410

UM1724 User manual. STM32 Nucleo boards. Introduction

Technical Aspects of Creating and Assessing a Learning Environment in Digital Electronics for High School Students

ECEN 1400, Introduction to Analog and Digital Electronics

Microcontrollers and Sensors. Scott Gilliland - zeroping@gmail

DS1621 Digital Thermometer and Thermostat

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Transcription:

OPTI 380B Intermediate Optics Laboratory Lab 9 Microcontroller / Data Acquisition Project I Objectives: This lab is an introduction to the world of microcontrollers. In particular, we will explore the world of digital input-output I/O using an Arduino microcontroller. This tiny computer, originally developed in Italy (2004/2005) to aid non-engineers (i.e. students of art and design) in controlling hardware, is now one of the most popular microcontrollers in the world. Its popularity is due in part to its ease of use, ease of programming, and the fact that its hardware and software are totally open-source. As a result, a variety of companies are selling "*.duino" microcontrollers. ("As of 2016, 17 versions of the Arduino hardware had been commercially produced." Wikipedia). The particular version that we will be using (the "UNO Rev.3") is an "official" Arduino and not a clone. In this lab we will: - Learn how to program the Arduino, using basic elements of the C++ language. - Use the pre-written program 'Blink.ino' to flash an LED. - Modify the 'Blink.ino' program to flash an LED at various frequencies and duty cycles. - Learn to control the digital I/O pins: Write and run a program to control the digital logic level of the output pins. Coupled with a simple LED circuit, your program will input a decimal number and visually display its binary equivalent. - Learn to use the built-in analog-to-digital converter (by reading a voltage at one of the analog input pins): Write a program and build a simple detector circuit to use the Arduino as a controller for a simple LED night light. The program will turn on an LED when the room lights are turned off. - Learn how to write information to the 16-character, 2-line LCD display. OPTI 380B Lab 9 (2016) 1

Reading Assignment: Two books are strongly suggested as being the best (i.e. easiest to read, most useful) sources of information on programming and using the Arduino: "Programming Arduino: Getting Started with Sketches" (hereafter referred to as PA) "Exploring Arduino: Tools and Techniques for Engineering Wizardry" (hereafter referred to as EA) Both books are available in the lab as reference books. Please DO NOT remove them from the lab! The official source of information for the Arduino is at: www.arduino.cc The supplier of the additional hardware boards we will use is a company called Adafruit: www.adafruit.com Their website is a great source of information for the Data Logger, Motor Controller, and LCD boards ("shields") that we will be using. Two important points before we begin: When wiring up a circuit on the breadboard, make power connections to the Arduino last (after double-checking the connections in your circuit). Most likely, the Arduino power pins are short-circuit protected but still.. To turn the power to the Arduino board OFF, simply unplug the USB cable from the main computer. Do NOT connect an output pin directly to ground, or +5V. This will, most likely, destroy the CPU. OPTI 380B Lab 9 (2016) 2

USEFUL FACTS: Programs written for the Arduino are called "sketches". The Arduino has 32KB of memory to store a sketch. Circuit boards (i.e. hardware) that plug onto the Arduino are called "shields". - Examples include the Data Logging shield, the Motor Controller shield, and the LCD shield that we will be using (all purchased from adafruit.com). The Arduino is programmed using a separate computer that is running the IDE ("Integrated Development Environment") this is a program available free from the Arduino website: www.arduino.cc The Arduino has: - 6 analog input pins (labeled A0-A5). HOWEVER, pins A4 and A5 are used for the I2C serial bus, which we will use to send data to/from the 3 shields. As a result, in practice, we only have 4 analog input pins available for sampling analog voltages. - a built-in (10-bit) analog-to-digital converter (ADC). As a result, analog voltages are sampled and represented by a digital value ranging from 0-1023. The reference voltage that the ADC uses is nominally set (internally) to 5V. To change this, connect a different DC voltage (between 0 and 5 V)to the AREF pin. The maximum digital output of 1023 "counts" corresponds to the reference voltage. - 14 digital I/O pins (labeled 0-13). HOWEVER, pins 0 (RX) and 1 (TX) are reserved for serial communications to the main computer, through the USB bus. - has 6 "analog output" pins that can supply a DC voltage between 0-5 volts. In fact, these are digital output pins 3, 5, 6, 9, 10, and 11 each labeled with a '~'. They supply a Pulse Width Modulated (PWM) signal at roughly 500Hz, that varies in amplitude (0-5V) and in duty cycle. The RMS equivalent of this PWM signal is effectively a DC voltage ranging from 0-5 V. Each of the digital I/O pins can supply a maximum current of 40 ma. DO NOT EXCEED THIS!!! OPTI 380B Lab 9 (2016) 3

THE LABORATORY EXERCISE A. LAYOUT OF THE ARDUINO MICROCONTROLLER BOARD Refer to the picture below to familiarize yourself with the Arduino circuit board: Using the actual Ardiuno circuit board, and both the PA and EA reference books, answer the following questions: [1] What is the identification of the computer chip (CPU) on our boards? [2] What is the clock frequency of the crystal? [3] What is the tiny surface-mount chip by pin 13? (HINT: 'Blink.ino') [4] Where do you make power connections from the Arduino to circuits that you build on the breadboard? [5] What is the 'safe' range of input voltages that you can supply to the DC barrel connector, to power the Arduino (instead of using the USB connector)? OPTI 380B Lab 9 (2016) 4

B. DIGITAL OUTPUT ( I/O ) LED FLASHER - Load the program Blink.ino (found in the IDE: File/Examples/01.Basics/Blink) - Run the program. [6] What is the frequency of the flash? (obtained from the code itself) [7] What is the duty cycle? (obtained from the code itself) - Modify the program to vary the frequency (maintain a 50% duty cycle). [8] What is the frequency above which you can no longer see the 'flashing'? C. DIGITAL OUTPUT BINARY NUMBER - Wire up the LED bar and the SIP resistor package so that the 8 "right-most" LED's are connected to digital I/O pins 0-7. - Run the program that you wrote in pre-lab that converts a decimal number to its binary equivalent. Configure your program so that the appropriate LED's light up. - Run the program. Debug your program until it works properly!! [9] For the following 5 decimal numbers, what is the pattern of bits that you observe as the binary equivalent? (MSB)..(LSB) 0 = 6 = 17 = 141 = 255 = D. LED NIGHT LIGHT - Wire up simple resistor voltage divider circuit (using a photoconductor and a series resistor). Connect the output (the junction of the photoconductor and the resistor) to analog input pin A5. - Write a program that turns on an LED when the room lights are turned off. (Use the "analogread(a5)" command to read the voltage at the output of the resistor divider. E. LCD DISPLAY - Learn how to write text to the LCD display (see PA ch. 9 pgs. 125-130). Run the program "Write_to_LCD.ino"..modify it to write the following: I LOVE ARDUINO! to the 2-line LCD display OPTI 380B RULES! (If time permits, create a custom character!) OPTI 380B Lab 9 (2016) 5