Lab 3 Microcontroller programming Interfacing to Sensors and Actuators with irobot



Similar documents
2.0 Command and Data Handling Subsystem

Setting up a Local Interconnect Network (LIN) using dspace MicroAutoBox 1401/1501 Simulink Blocks

8051 MICROCONTROLLER COURSE

Soft processors for microcontroller programming education

irobot Create OPEN INTERFACE

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

INTRODUCTION TO SERIAL ARM

Controlling a Dot Matrix LED Display with a Microcontroller

How to design and implement firmware for embedded systems

Microcontrollers and Sensors. Scott Gilliland - zeroping@gmail

Waspmote. Quickstart Guide

Board also Supports MicroBridge

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

Downloading a Sample Program over USB

AVR Butterfly Training. Atmel Norway, AVR Applications Group

Lab 2 Sensor Modeling Introduction to the Wiimote and the Wiimote LABVIEW Interface

Massachusetts Institute of Technology

EvB 5.1 v5 User s Guide

Computer Automation Techniques. Arthur Carroll

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

EMBEDDED C USING CODEWARRIOR Getting Started Manual

CB-OLP425 DEVELOPMENT KIT GETTING STARTED

Robot Board Sub-System Testing. Abstract. Introduction and Theory. Equipment. Procedures. EE 101 Spring 2006 Date: Lab Section # Lab #6

Tutorial for Programming the LEGO MINDSTORMS NXT

Example Connection between USB Host and Android

Android, Bluetooth and MIAC

PROJECT PRESENTATION ON CELLPHONE OPERATED ROBOTIC ASSISTANT

Academic Crosswalk to Common Core Standards. REC ELA.RST LA k LA

Course Project Documentation

Setup for PWM Tests of BLDC Motor

SYNOPSIS FOR ACCELEROMETER BASED BIKE/VEHICLE ACCIDENT MONITORING AND TRACKING SYSTEM USING GSM AND GPS

3. Programming the STM32F4-Discovery

A 5 Degree Feedback Control Robotic Arm (Haptic Arm)

Self-Balancing Robot Project Proposal Abstract. Strategy. Physical Construction. Spencer Burdette March 9, 2007

Tutorial for MPLAB Starter Kit for PIC18F

Application Note: AN00141 xcore-xa - Application Development

LEGO NXT-based Robotic Arm

WIZ-Embedded WebServer User s Manual (Ver. 1.0)

How to use AVR Studio for Assembler Programming

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

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

EE 472 Lab 2 (Group) Scheduling, Digital I/O, Analog Input, and Pulse Generation University of Washington - Department of Electrical Engineering

Using the VEX Cortex with ROBOTC

The Basics of Robot Mazes Teacher Notes

CONTENTS. What is ROBOTC? Section I: The Basics

Voltage Measurement with A PIC Microcontroller

ServoPAL (#28824): Servo Pulser and Timer

AC-PG-USBASP USBASP AVR Programmer

Web Site: Forums: forums.parallax.com Sales: Technical:

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

LAB 4: MOMENTUM AND COLLISIONS

RS232/DB9 An RS232 to TTL Level Converter

Microcontroller Based Low Cost Portable PC Mouse and Keyboard Tester

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

Lab 6 Introduction to Serial and Wireless Communication

Lab 1 Course Guideline and Review

Replacing N-300 PCB YZ Systems for use by YZ s distribution network and end-users.

Flight Controller. Mini Fun Fly

An Introduction to MPLAB Integrated Development Environment

Why using ATmega16? University of Wollongong Australia. 7.1 Overview of ATmega16. Overview of ATmega16

LAB 06: Impulse, Momentum and Conservation

Computer Organization and Components

Description of High Accuracy Digital Pressure Gauge Design

MAX6683 Evaluation System/Evaluation Kit

FlowKit in-circuit debug system

Embedded Software Development: Spottbillige Hardware + OSS = Zum Spielen zu Schade!

Test Driven Development of Embedded Systems Using Existing Software Test Infrastructure

Lab 2.0 Thermal Camera Interface

Capacitive Touch Lab. Renesas Capacitive Touch Lab R8C/36T-A Family

Servo Motors (SensorDAQ only) Evaluation copy. Vernier Digital Control Unit (DCU) LabQuest or LabPro power supply

Tutorial 1. Introduction to robot

USER GUIDE. ZigBit USB Stick User Guide. Introduction

Lab Course Microcontroller Programming WS2011/12

Network Enabled Battery Health Monitoring System

ECE 495 Project 3: Shocker Actuator Subsystem and Website Design. Group 1: One Awesome Engineering

Programming the VEX Robot

Lab Experiment 1: The LPC 2148 Education Board

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

MSc in Autonomous Robotics Engineering University of York

Programming Device Manual Booklet AVR Prog USB v2

Microcontroller Programming Beginning with Arduino. Charlie Mooney

BLE113 DEVELOPMENT KIT

CAN bus board. EB018

QT1 Xplained Pro. Preface. Atmel QTouch USER GUIDE

MECE 102 Mechatronics Engineering Orientation

E-Blocks Easy RFID Bundle

EasyC. Programming Tips

Quick Start Guide. CAN Microcontrollers. ATADAPCAN01 - STK501 CAN Extension. Requirements

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

P&E Microcomputer Systems, Inc. P.O. Box 2044, Woburn, MA 01888, USA

Parallax Serial LCD 2 rows x 16 characters Non-backlit (#27976) 2 rows x 16 characters Backlit (#27977) 4 rows x 20 characters Backlit (#27979)

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

CS 589 Project Smart Home Hub, Phase I Due before 9am on October 21, 2015

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

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

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

APPLICATION NOTE. Atmel AT01095: Joystick Game Controller Reference Design. 8-/16-bit Atmel Microcontrollers. Features.

Transcription:

1. Objective Lab 3 Microcontroller programming Interfacing to Sensors and Actuators with irobot In this lab, you will: i. Become familiar with the irobot and AVR tools. ii. Understand how to program a bare iron (no operating system) system in C. iii. Interface with external sensors and learn to poll or setup interrupt systems. 2. Equipment 3. Theory i. Computer with AVR tools installed ii. irobot USB interface iii. irobot and the command module with accelerometers connect. a. Introduction The irobot[1] is a complete robot development kit that allows you to program new robot behaviors without having to worry about mechanical assembly and low-level code. In this lab, you will explore the capabilities of the irobot using a command module that is added on to the irobot Create. The command module (Figure 1) contains a microcontroller (Atmel AVR ATMega168 microcontroller, see [2] page 29 for overview, see [3] for microcontroller documentation) which allows you to write programs in C/C++ to control the irobot. It is important to understand that you are not directly programming the irobot, but you are programming the microcontroller on the command module to send OI (open interface, see below) commands to the irobot through the cargo bay connector (Figure 2), which then the irobot processes the commands and actuates itself based on the command given. Figure 1. Command module added to the irobot

b. irobot platform See Figures 2,3 and 4 for the sensors and actuators on the irobot. In this lab, you will be using the cliff sensors, bump detectors and wheel drops to detect collision or cliffs. We will also attach accelerometers, which you will use for the final irobot project. Feel free to use the LEDs for debugging purposes. Figure 2. Top view of irobot Figure 3. Buttons on the irobot Figure 4. Bottom of the irobot

c. Open Interface The Open Interface (OI) defines the electronic and software interface for controlling the irobot s behavior and reading its sensors. The software protocol is briefly explained in section 4 and 5 of [2]. A reference to all the commands can be found in [4]. Make sure read the section in [4] (page 17) on the OI sensor packets. 4. PRELAB EXERCISES Read through the irobot documentations posted on the irobot page on the course webpage (http://chess.eecs.berkeley.edu/eecs124/irobotdocs/index.html). There are a lot of documents; make sure you at least looked at them and know what s in which document. It will be useful to have a general idea so when you need to reference the documents you know which one to look at. 1. Understanding the platform: a. Which microprocessor is in the command module? b. How many sensors are on the bottom of the irobot? Given the placement of some of the sensors, what problems might this cause? c. How many ports in the command module can be used for analog inputs? Digital? 2. Understanding the protocols: a. What sequence of bytes would you need to send to the irobot to make it drive forward (velocity and radius values can be arbitrary)? b. What is the command sequence for reading sensor data from the irobot? 5. IN LAB EXERCISES The final goal of this lab is to program the irobot to autonomously climb up a hill. This involves determining the correct orientation for the irobot (you want to drive towards the top of the hill); avoid driving off the hill (using the built in irobot cliff sensors and wheel drops); and collision detection (there might be obstacles along the path to the top of the hill). We have split the lab into 3 parts to help you progress towards the final goal: 1. Making the irobot autonomous 2. Finding the top of the hill 3. The autonomous hill climber irobot PART 1 Autonomous irobot 1. To get started on programming the command module, follow the step-by-step instructions in [2] to setup the programming environment. We will be using the WinAVR suite of open source development tools to compile and download your C or C++ programs. 2. The example programs mentioned in the documentation should be installed in your computer [C:/WinAVR/examples/iRobot]. You may want to load in different example programs to get familiar with how to load programs in the

Spring 2008 EE124 Lab 3 Rev. 1.00 command module and run them. 3. Look at the drive example that s in the examples folder. You can also reference the lecture on Interfacing with sensors and actuators which gives the layout of drive.c on the last slide (with some code fragments removed). It also contains the references to the header files used to define the macro-names used to access the memory mapped registered. Make sure you understand the drive.c example and how to drive the irobot and read sensor packets. 4. Question: How is the software for drive.c example architected? Is it an interrupt driven system? Polling Loop? Explain. 5. Build on the drive.c example. Program the irobot so that it becomes fully autonomous using the built in sensors of the irobot. We will test your implementation in the following conditions: a. Effective use of the cliff sensors and wheel drop. The irobot should not drive off any cliffs, but instead maneuver away when it detects one. b. Effective use of bump sensors. The irobot should not be stuck when there are obstacles in front of it, nor should it get stuck in corners. It should be able to maneuver in the right manner to avoid the obstacles. c. Basic sense of direction. We will point the irobot in an initial direction, and expect the irobot to roughly head towards that direction despite the recovery mechanisms that were implemented in the previous two conditions. PART 2 Hill Climbing 1. By now you should be familiar with how to program the microcontroller in the command module to interface with the sensors on the irobot and how to drive the robot. The next step is to attach an extra sensor to the command module and interface to it. 2. In lab you will be given an accelerometer attached to a breadboard along with connectors to allow you to connect it to the command module ports. It will look something like figure 5. Figure 5. Accelerometer board

3. Using the data sheets of the command module and the Atmel processor, correctly wire the accelerometer to the ADC pins of the command module. You will need to keep track of which ADC pin you wired so you can access it via software. 4. From the previous lab you learned how to interpret data from the accelerometer and measure tilt and roll using it. Think about how you would easily use the 2- D accelerometer to orient the irobot towards the top of the hill. 5. The purpose of this part is for the irobot to be able to determine the orientation to the top of the hill. You don t have to worry about the collision detection or avoidance yet, focus on interfacing with the accelerometer to help determine where the top of the hill is. PART 3 Putting it all together 1. Now that you have successfully interfaced with both the sensors on the irobot, and the accelerometer to find the top of the hill, your final job would be integrating the two together. Your irobot should be able to climb to the top of the hill without falling off the cliff and avoiding obstacles on the hill. 2. You will need to think about the priorities of the sensors and the accelerometer when you integrate the 2 functionalities. Which one should have the higher priority? 3. In your lab report, explain any design decisions that had to be made, and why they were made. Also explain the structure of your code. You may use diagrams (FSMs etc) or graphs, and attach a printed copy of your code (Clean it up and comment it! Make sure it s readable) at the end of your lab report. Be sure to include stuff learned in lecture (is it interrupt driven? Polling loop?). 4. Also in your lab report, include a one paragraph summary of the hardware/software interface. What conceptually is happening when your irobot is running? 6. REFERENCES [1] Documentation of the irobot Create http://chess.eecs.berkeley.edu/eecs124/irobotdocs/createmanual_final.pdf [2] Documentation of the Command Module http://chess.eecs.berkeley.edu/eecs124/irobotdocs/commandmodulemanual_v2.pdf [3] Documentation of the ATmega168 microcontroller http://chess.eecs.berkeley.edu/eecs124/irobotdocs/atmega168reference.pdf [4] Documentation of Open Interface http://chess.eecs.berkeley.edu/eecs124/irobotdocs/createopeninterface_v2.pdf 7. REVISION HISTORY Date/Author Revision Comments