Module: Arduino as Signal Generator

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

FABO ACADEMY X ELECTRONIC DESIGN

Training Schedule. Robotic System Design using Arduino Platform

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

Coding with Arduino to operate the prosthetic arm

The Motor sketch. One Direction ON-OFF DC Motor

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

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

Lab 2: Blinkie Lab. Objectives. Materials. Theory

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

Experiment 9 : Pulse Width Modulation

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

Part 1: DC Concepts and Measurement

Lesson 3: Arduino. Goals

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

LABORATORY 4. Palomar College ENGR210 Spring 2017 ASSIGNED: 3/21/17

Pulse Width Modulation and

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

DC Motor and Servo motor Control with ARM and Arduino. Created by:

ArbStudio Triggers. Using Both Input & Output Trigger With ArbStudio APPLICATION BRIEF LAB912

Programming 2 Servos. Learn to connect and write code to control two servos.

PLAN DE FORMACIÓN EN LENGUAS EXTRANJERAS IN-57 Technology for ESO: Contents and Strategies

INA169 Breakout Board Hookup Guide

Computational Crafting with Arduino. Christopher Michaud Marist School ECEP Programs, Georgia Tech

A servo is an electric motor that takes in a pulse width modulated signal that controls direction and speed. A servo has three leads:

Arduino An Introduction

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

Experiment 1.A. Working with Lab Equipment. ECEN 2270 Electronics Design Laboratory 1

Lecture 4: Basic Electronics. Lecture 4 Brief Introduction to Electronics and the Arduino

1Getting Started SIK BINDER //3

Exercise 7. The Buck/Boost Chopper EXERCISE OBJECTIVE DISCUSSION OUTLINE DISCUSSION. The Buck/Boost Chopper

Lab 2.4 Arduinos, Resistors, and Circuits

Rodni What will yours be?

Arduino Workshop 01. AD32600 Physical Computing Prof. Fabian Winkler Fall 2014

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

1. Controlling the DC Motors

BME/ISE 3511 Laboratory One - Laboratory Equipment for Measurement. Introduction to biomedical electronic laboratory instrumentation and measurements.

Sten-Bot Robot Kit Stensat Group LLC, Copyright 2013

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

MICROCONTROLLERS Stepper motor control with Sequential Logic Circuits

Lab 4 Rev. 1 Open Lab Due COB Friday April 6, 2018

LV8716QAGEVK Evaluation Kit User Guide

GE 320: Introduction to Control Systems

Experiment 8: Semiconductor Devices

Digital Debug With Oscilloscopes Lab Experiment

ARDUINO / GENUINO. start as professional

CONSTRUCTION GUIDE Capacitor, Transistor & Motorbike. Robobox. Level VII

INTRODUCTION to MICRO-CONTROLLERS

Page 1/10 Digilent Analog Discovery (DAD) Tutorial 6-Aug-15. Figure 2: DAD pin configuration

Arduino Lesson 1. Blink. Created by Simon Monk

Exercise 8. The Four-Quadrant Chopper EXERCISE OBJECTIVE DISCUSSION OUTLINE DISCUSSION. The Four-Quadrant Chopper

Physics 120 Lab 1 (2018) - Instruments and DC Circuits

The University of Jordan Mechatronics Engineering Department Electronics Lab.( ) Experiment 1: Lab Equipment Familiarization

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

Application Note. Communication between arduino and IMU Software capturing the data

Hello, and welcome to this presentation of the FlexTimer or FTM module for Kinetis K series MCUs. In this session, you ll learn about the FTM, its

Lesson 2 Bluetooth Car

Electronics Design Laboratory Lecture #6. ECEN2270 Electronics Design Laboratory

Physics 323. Experiment # 1 - Oscilloscope and Breadboard

Welcome to Arduino Day 2016

2.017 DESIGN OF ELECTROMECHANICAL ROBOTIC SYSTEMS Fall 2009 Lab 4: Motor Control. October 5, 2009 Dr. Harrison H. Chin

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

Electronics I. laboratory measurement guide

Experiment 1: Robot Moves in 3ft squared makes sound and

Sensors and Sensing Motors, Encoders and Motor Control

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

EE 210: CIRCUITS AND DEVICES

Exercise 4 - THE OSCILLOSCOPE

Blink. EE 285 Arduino 1

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

ASCOM EF Lens Controller

LABORATORY 7 v2 BOOST CONVERTER

Embedded Controls Final Project. Tom Hall EE /07/2011

ECEN 449: Microprocessor System Design Department of Electrical and Computer Engineering Texas A&M University

Arduino

Quantizer step: volts Input Voltage [V]

ZX Distance and Gesture Sensor Hookup Guide

E x p e r i m e n t 2 S i m u l a t i o n a n d R e a l - t i m e I m p l e m e n t a t i o n o f a S w i t c h - m o d e D C C o n v e r t e r

Laboratory Project 1a: Power-Indicator LED's

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

Practical Assignment 1: Arduino interface with Simulink

CSCI1600 Lab 4: Sound

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Lab Timer: Blinking LED Lights and Pulse Generator

University of North Carolina-Charlotte Department of Electrical and Computer Engineering ECGR 3157 Electrical Engineering Design II Fall 2013

PMOS Digital Testing at Rochester Institute of Technology

Mechatronics Engineering and Automation Faculty of Engineering, Ain Shams University MCT-151, Spring 2015 Lab-4: Electric Actuators

t w = Continue to the next page, where you will draw a diagram of your design.

// Parts of a Multimeter

ESE 350 Microcontroller Laboratory Lab 5: Sensor-Actuator Lab

Digital Logic Troubleshooting

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

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

Written by Hans Summers Wednesday, 15 November :53 - Last Updated Wednesday, 15 November :07

Arduino Setup & Flexing the ExBow

Lab #1 Lab Introduction

Ohm s Law. Equipment. Setup

Parts to be supplied by the student: Breadboard and wires IRLZ34N N-channel enhancement-mode power MOSFET transistor

Lab Exercise 9: Stepper and Servo Motors

Experiment 8: An AC Circuit

Transcription:

Name/NetID: Teammate/NetID: Module: Laboratory Outline In our continuing quest to access the development and debugging capabilities of the equipment on your bench at home Arduino/RedBoard as signal generator. If you have followed the progression of the Arduino as Bench Equipment modules you should now be able to supply 3.3V, 5V, and the battery voltage to external circuitry and to use the analog input pins to read voltages at different points in a circuit. Using the Digital Input/Output (I/O) pins you can craft a time-varying signal. Since the outputs are digital the voltage signal is either 5V or 0V so the resulting signal is a train of pulses of a square wave. A square wave with a fixed period and a variable duty cycle can be generated with a single statement. Pulse Width Modulation is a technique that uses the variability of the duty cycle to control the behavior of circuit components like the brightness of an LED or the speed of rotation of a DC motor.

The Digital Output Pins on the Arduino/RedBoard There are 14 pins available that are digital pins and can be configured as either Inputs or Outputs. The distinction between analog and digital refers to the nature of the voltages. All voltages are analog in the sense that they are continuous in time and can vary in value. What distinguishes a digital signal is that the voltages are assumed to take one of two values. For the hardware on the Arduino/RedBoard one value is 0V designated LOW when setting the output levels in the code, and 5V designated HIGH in the code. The digital output pins are very good at providing a reliable digital signal with only these 2 possible voltages. On input, since the board has no control over the external signals connected to a digital input pin, the distinction is more complicated so that a range of voltages are considered to be LOW and a separate range is considered to be HIGH. Figure 1: Physical layout of the RedBoard.

Generating a Square Wave Using a very simple program you can generate a variable duty cycle square wave on any of the digital pins marked with a ~ next to the pin number. Because a common use for these signals is to control the behavior of devices like the motors where the speed is directly proportional to duty cycle the pins with the ~ are labeled PWM or Pulse Width Modulation. You will use this method in a later lab. Question 1: Which of the digital pins can be used to generate a square wave? ü Below is the bare minimum code needed to output a square wave using the digital I/O pins. Open a new sketch (the Arduino calls new code files sketches) and type in these few statements. Question 2: This program has no comments so navigate to the Arduino site arduino.cc. Using the help section indicate purpose of the statements pinmode and analogwrite by adding comments into the code. Include a copy

of your results you may write them if you wish or print a copy but they must use the proper comment format. Explain why the PinMode command is not really necessary. ü After checking under the Tools menu that the software knows which board you are using (the RedBoard is a clone of the Arduino Uno) and which COM port you are using to upload the program to the board by clicking the icon at the top of the window. NOTE: When you plug the USB cable into the lab computer the associated COM port is usually the highest numbered port. For Mac users the USB communication ports are the device file names. Question 3: Once the program has loaded, using channel 1 of the oscilloscope, probe the voltage between the digital I/O pin 9 and any of the ground pins (GND) on the board. Plot the waveform. Question 4: Modify the code by changing the second parameter of the analogwrite function to a different number in the range 0 255. Plot the waveform on top of the one you obtained in Questions 3.

Question 5: How is the second parameter related to the duty cycle? Try several different values. Draw a graph or write a simple equation relating the two. Question 6: There is no parameter when using the analogwrite statement to specify the frequency of the square wave because the special hardware that generates the signal always outputs the same frequency. You can only change the duty cycle. What is the period of the square wave? Question 7: Now add lines to the code so that pin 11 also outputs a square wave with a duty cycle of 50% and pin 9 outputs a duty cycle of 25%. Using channel 2 of the oscilloscope probe the voltage between pin 11 and another GND pin or establish a ground on the breadboard. Plot both signals on the same plot. Question 8: Trigger the scope on channel 1, then channel 2 you can do that a few times. Do both signals remain steady or does one drift when you change the trigger channel? You can trigger on channel 3 to see what untriggered signals look like.

Somehow the hardware onboard the Arduino/RedBoard synchronizes all of the PWM signals so that the rising edges occur at the same time even though the pulse widths may be different. This implies that any of the signals can be used to trigger the oscilloscope and all of the waveforms should remain stationary. For our uses it is probably not critical that the waveforms be synchronized but many circuits do rely on these signals to maintain strict timing constraints. Manually Generating a Square-ish Wave Using different code you can generate a string of pulses that can vary in width. While the sequence is periodic because the loop{} section cycles repeatedly, the signal can be more complicated than a square wave. ü Add the following code segment anywhere in the loop {} section. ü Upload the code to the board Question 9: What do the statements digitalwrite() and delay() do? Question 10: Using channel 3 of the oscilloscope probe the voltage between pin 13 and another GND pin or establish a ground on the breadboard. Be sure to trigger on Channel (or Source) 3 to get a steady signal. Plot the waveform on a new graph. Question 11: When the oscilloscope is triggered using channel 3 what happens to the triggering of channels 1 and 2?

Question 12: What is the period of the new waveform? ü Now insert this statement Serial.begin(9600); into the setup {} section of the code. This statement establishes communication between the computer and the board as in the Arduino as Voltmeter module. ü Insert the following code at the end of the loop section. This is nonsense code designed to add a the time needed to complete one round in the loop() section. And to show you the looping statement for(). Question 13: This has some new statements. What does the for() statement do? Explain the purpose of the 3 parameters. Those of you who know C or C++ you will recognize this statement. Question 14: Plot the waveform on channel 3 on the graph you just made in Question 9. How has the new signal changed? Did the waveforms on channels 1 and 2 change significantly?

That is the power of using the pins that can generate a square wave using the pins marked with a ~. The processor generates signals on these lines as a response to the analogwrite() command that is locked to an internal clock. Other statements can be added in the loop() section and the timing remains fixed. You can do this with the delays but it requires the ability to program the board at the assembly language level. ü Remove the for() loop and program up a crazy looking signal using the delay statements. Question 15: Plot it. Using this signal you can get your car to maneuver by turning the motors on and off for specific amounts of time.