The CMPE 118 Cockroach Robot Dept. of Computer Engineering, UCSC

Similar documents
EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

MAX-FIRE AND E-FIRE ELECTRONIC DISTRIBUTORS

RR Concepts. The StationMaster can control DC trains or DCC equipped trains set to linear mode.

Freescale Semiconductor, I

SOLAR LIGHTING CONTROLLER SUNLIGHT MODELS INCLUDED IN THIS MANUAL SL-10 SL-10-24V SL-20 SL-20-24V

Slippage Detection and Traction Control System

ITCEMS950 Idle Timer Controller - Engine Monitor Shutdown Isuzu NPR 6.0L Gasoline Engine

ECE 5671/6671 Lab 5 Squirrel-Cage Induction Generator (SCIG)

BUMP AND SPIN KIT ESSENTIAL INFORMATION. Version 1.0 PROGRAM AND DESIGN YOUR OWN BUGGY WITH THIS

Lingenfelter NCC-002 Nitrous Control Center Quick Setup Guide

Advanced Troubleshooting Guide Snorkel V Battery Charger Rev 0 3JAN07

Chapter 2. Battery Charger and Base Assembly


PowerLevel s e r i e s

General Purpose Ignition System GS6. User Manual. Document No PS-0009

Working with VEX Parts

ECT Display Driver Installation for AP2 Module

Config file is loaded in controller; parameters are shown in tuning tab of SMAC control center

IFC-BL02 Interface Free Controller Brushless Motor Card

Back-UPS 650 VA 230 V with AVR (BX650CI-ZA)

Idle Timer Controller - ITC515-A Ford Transit Contact InterMotive for additional vehicle applications

Welcome to ABB machinery drives training. This training module will introduce you to the ACS850-04, the ABB machinery drive module.

To increase the height of the trailer increase the length, to reduce the height, decrease the length of the link.

Alliance Towel Dispensing System. Operation Manual

Issue 2.0 December EPAS Midi User Manual EPAS35

I. CONNECTING TO THE GCU

Cannondale Diagnostic Tool Manual

TRITON ERROR CODES ERROR CODE MODEL SERIES DESCRIPTION RESOLUTION

Simple Line Follower robot

June 2011 Model Solution

INVESTIGATION ONE: WHAT DOES A VOLTMETER DO? How Are Values of Circuit Variables Measured?


BC-1230P/ 1240P/ 1260P Multi-Stage Battery Chargers User Manual

SawStop Quick Start Guide

Azatrax MRX3 Grade Crossing Signal Controller Installation Guide

Optimal Series. Automatic Transfer Switch. Installation and User Manual for the OPT2225 Automatic Transfer Switch. Full Version

Auto Sentry-eXP Maintenance. Revised 12/21/07

An ISO 9001:2008 Registered Company

SMART DRIVE ELECTRONIC WASHING MACHINE

Pulsar Evolution 1500 / 1500 Rack 1100 / 1100 Rack 800 / 800 Rack 500 Rack

Warning! Before continuing further, please ensure that you have NOT mounted the propellers on the MultiRotor.

CONTROLLER DIAGNOSTIC GUIDE

Implementation Notes. Solar Group

BigStuff3 - GEN3. 1st Gear Spark Retard with Spark Retard Traction Control System (SR 2 ) Rev

Active Controlled Cooling System

Abstract. GLV Systems Test Plan 1

TECHNICAL PAPER 1002 FT. WORTH, TEXAS REPORT X ORDER

Professional Wireless Products

Application Note. First trip test. A circuit breaker spends most of its lifetime conducting current without any

QUICK INSTALLATION GUIDE

User Manual Back-UPS BX650CI-MS 230 Vac with AVR

MAGNAMAX DVR DIGITAL VOLTAGE REGULATOR

Installation and Service Manual M² Sync Room Slideout System without Room Lock Connectors on Control Box

Electronic Dynamo Regulator INSTRUCTION MANUAL. COPYRIGHT 2014 CLOVER SYSTEMS All Rights Reserved

PSC1-003 Programmable Signal Calibrator

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

e-ask electronic Access Security Keyless-entry

TRANSMISSION SPECIFICS VALVE BODY COMPONENTS

Wireless Tire Pressure and Temperature Monitoring System Color Display Manual. Wide Screen Color Display Model #: TST-507-D-C

index changing a variable s value, Chime My Block, clearing the screen. See Display block CoastBack program, 54 44

Build your own omni robot

Installation & Service Manual

Automatic Sliding Door Retrofit Drive Assembly. Installation Manual DoorControlsUSA.com

Dual Voltage Solar Power Charge Controller Board Connection & Operation V2.xx

SECTION Multifunction Electronic Modules

Syringe Pump Procedure

IDST (Isuzu Diagnostic Service Tool) User Guide Table of Contents

DTC P0A04 - Open Wiring Fault

Spray Height Controller

PowerLevel. Operation Guide. Owner s Manual Hydraulic Leveling CAUTION. Winnebago Industries Hydraulic Leveling System by Power Gear.

Model: AEM14 Analog Engine Monitor

Series 905-IV16(E) CAN/CANopen Input Modules Installation and Operating Manual

SD Bendix ET-2 Electronic Treadle DESCRIPTION OPERATION

SECTION G2: CABLE PROCESSOR MODULE MAINTENANCE

Quick Setup Guide for IntelliAg Model YP Air Pro

WARNING ATTENTION. Please read this information carefully before operating your safe.

MiR Hook. Technical Documentation

Exercise 6. Three-Phase AC Power Control EXERCISE OBJECTIVE DISCUSSION OUTLINE DISCUSSION. Introduction to three-phase ac power control

All vehicles. 1. Turn all vehicle accessories OFF. system (SRS) vehicle and when handling an air bag module. This will reduce the risk of injury in

Quick Setup Guide for IntelliAg Model YP40 20 Air Pro

MANUAL TROUBLESHOOTING. ECM Motor. ECM / ECM-DX Series. v100 Issue Date: 08/15/ Price Industries Limited. All rights reserved.

Sól Dual Voltage Buck Boost Solar Charge Controller Connection & Operation V1.00

FUNCTIONAL SAFETY SOLUTIONS in Solenoid Valves

Chapter 1: Battery management: State of charge

ECO3-601/602 EcoStar III * Chevy Express/GMC Savana Contact Intermotive for additional vehicle applications

PPS20 COMMUNICATIONS POWER SUPPLY AND BATTERY MANAGEMENT SYSTEM

Safety Exhaust Valve Integration Guide

Installation and Service Manual M² Sync Room Slideout System without Room Lock Connectors on Control Box

Automated Seat Belt Switch Defect Detector

Hello and welcome to training on general purpose motor drivers in the 3 to 15 volt range. I m Paul Dieffenderfer & I will be your host for this

Instruction of connection and programming of the VECTOR controller

INTRODUCTION. Specifications. Operating voltage range:

Table of Contents. Product Registration 18 FAQ 19 Troubleshooting 20 Customer Support / Warranty 21

Cordless Drill Motor Control with Battery Charging Using Z8 Encore! F0830 Reference Design

VOLUMETRIC BLENDING SYSTEM OPERATION MANUAL

Functional Testing & Analysis

INSTALLATION GUIDE Table of Contents

Kelly HSR Series Motor Controller with Regen User s Manual V 3.3. Kelly HSR Opto-Isolated Series Motor Controller with Regen.

MAGPOWR Spyder-Plus-S1 Tension Control

ALARM UPGRADE FOR FACTORY REMOTE KEYLESS ENTRY SYSTEM INSTALLATION PRECAUTIONS & WARNINGS

Transcription:

The CMPE 118 Cockroach Robot Dept. of Computer Engineering, UCSC Background: The CMPE-118 Cockroach robot is designed to be an accessible mobile platform to teach you basic state machine programming. This document will serve as an introduction to the functionality of the CMPE-118 Cockroach. It includes descriptions of how to drive the roach, use its light sensor to detect changes in ambient light levels, and read its bump sensors. This document describes the new roach robot, however the functionality between the new and old robots are the same, except for the LED array, which is not available on the old roaches. The CMPE-118 Cockroach is a simple two-wheeled direct drive ground mobile robot. The chassis is made of laser cut acrylic, with two roller blades wheels attached to the drive motors at the center of the robot. Skids front and back allow the robot to balance on the two main wheels (but will get the robot stuck if the surface is too rough). The microcontroller is a PIC32 packaged in the same Digilent Uno32 form as used elsewhere in the class. Basic Roach Layout: Figure 1: The CMPE-118 "Cockroach" Robot, annotated to show the relevant parts of the chassis. The basic roach robot is a laser cut acrylic chassis with drive motors and electronics pictured in Figure 1. The front and rear bumpers are floating acrylic pieces, constrained by tabs and a screw/nut combination, that push on snap action lever roller switches. The switches appear as the red/black rectangles with aluminum tabs coming out, and are below the top plate. The roller lever pushes back on the switch plates, restoring them to unbumped when pressure is removed from the plate. Indicator LEDs are located at each corner of the electronics board to indicate when the switch is down (not present on old roach design). Note that these are hardware LEDs, and indicate that the switch circuit is working. Version 1.1

There is a main ON/OFF slider switch on the front of the electronics board (on old roach, these are located to the side of the electronics board). It is labeled on the board itself for ON and OFF. If a battery is connected and the switch is turned ON, then POWER GOOD will light indicating that the roach is receiving battery power. The 5V LED will illuminate when the Uno32 is attached and functional, powered either through the battery (with the switch in the ON position) or when the USB cord is plugged in for programming and debugging. Next to the 5V LED light is the RESET button, which is used to reset the PIC32 processor. Note: battery power is ONLY required to drive the motors. Bump sensors and light sensors will work with just USB power when testing. The light sensor is an Advanced Photonix Inc PDV-P8001 cadmium sulfide (CdS) photo-resistor, whose resistance changes proportionally to the light falling on its surface. Lower resistance indicates more light, and higher resistance indicates less light. It is passed through a simple OpAmp buffer to ensure no loading of the circuit distorts the sensor, and then directly into the analog to digital converter (ADC) stage of the PIC32. The H-bridge is a TI SN754410E 1A dual h-bridge that is capable of driving each of the wheels in either direction under software control. There are 8 total flyback diodes to snub the inductive kick from driving the motors, and each motor has a FWD/REV indicator LEDs to visually confirm the direction of rotation. Note that due to the internal manufacturing of the H-bridge, both LEDs will light unless at 100% PWM. The electronics board has a battery voltage monitor (a 9:1 divider fed directly into an ADC pin) which will monitor the LiFePo4 battery for undervoltage. Software on board will shut down functionality of the roach and echo Low Battery Voltage!! Recharge your battery on the serial port. Leaving the roach ON and unattended overnight will kill the battery (~$10/per). Should you need to change the battery, slide it out of the compartment, and pull the Deans connector apart; they are stiff and require a good grip. Get a fully charged battery and plug it in, and slide the battery back into the compartment. Lastly, the roach has 12 LEDs together in a single line (light-bar) as a user-addressable debugging tool. Each LED can be addressed individually, and functions are provided for access in the Roach software library (detailed below). The old roaches do not have the LED bar, however calling the functions will not result in any ill effects (they will return error if you are checking the return values, see below). Using the CMPE118 Cockroach Robot: Driving Forwards: Forward motion is implemented by setting both of the Cockroach s motors to the same speed. The left and right motors are controlled by the Roach_LeftMtrSpeed and Roach_RightMtrSpeed functions, respectively. The functions require integer arguments between 1 and 100 to move the roach forward (note that the roach might not start from a stop at low numbers). Be sure to check your individual roach to make sure both motors turn in the expected direction when you drive them. Roach_LeftMtrSpeed(80); Roach_RightMtrSpeed(80); Driving Backwards: Reverse motion is also accomplished by setting the Cockroach motors to the same speed. However, in this case the arguments to Roach_LeftMtrSpeed and Roach_RightMtrSpeed must be negative, between -1 and -100. The same caveats about motion and polarity apply. Roach_LeftMtrSpeed(-70); Roach_RightMtrSpeed(-70); Stopping: Stopping is accomplished by setting both of the Cockroach s motors speeds to 0. This is done with the Roach_LeftMtrSpeed and Roach_RightMtrSpeed functions. Roach_LeftMtrSpeed(0); Roach_RightMtrSpeed(0);

Turning: Turning the Cockroach is accomplished by setting different speeds on each of the Cockroach s motors. Turns can be made moving forwards or backwards, depending on the sign of the parameter passed to the motor control functions. Depending on the desired effect, there are various types of turns that can be implemented on the Cockroach (often you will need several of them): 1. Gradual turn: Both motor speeds positive, turns in direction of wheel with slower speed. 2. Pivot turn: One motor speed is set to 0, the other positive. Roach pivots about stopped wheel. 3. Hard turn: One motor positive, other is negative. Roach will turn hard in direction of negative speed wheel. 4. Tank turn: One motor is set to positive number; the other is set to same value but negative. Roach will spin in place in direction of negative number. Roach_LeftMtrSpeed(80); Roach_RightMtrSpeed(-80); // tank turn to right (Clockwise) Reading Changes in Battery Voltage: The battery voltage level is read using the Roach_BatteryVoltage function, which takes no parameters returns an unsigned integer. The divider results in a 10:1 divide of the value, such that each count of the result is 32mV (e.g.: 272 indicates 8.75V on the battery, at which point the battery should be recharged to prevent damage). uint16_t currentbat; currentbat = Roach_BatteryVoltage(); Reading Changes in Light Level: The amount of light hitting the Cockroach is obtained by using the Roach_LightLevel function, which takes no parameters returns an unsigned integer. The function returns a 10-bit value corresponding to the amount of light seen by the Cockroach s light sensor (with more light being closer to 0 and less light being closer to 1023). A transition from light to darkness, or viceversa, is sensed by detecting a change in this measured value. Often, successive values returned by the Roach_LightLevel function will vary by quite a few bits due to noise on the sensor. This causes a problem with implementations that rely on discrete measurements, as in the case of detecting light-to-dark (or dark-to-light) transitions. In order to avoid repeated sensing of a transition due to fluctuating values returned by the Roach_LightLevel function, it is beneficial to add a tolerance band (hysterisis) to the transition condition. Hysterisis may be implemented by running two different threshold tests that depend on two values, LIGHT_THRESHOLD and DARK_THRESHOLD. LIGHT_THRESHOLD defines the minimum light level required for a valid light condition and DARK_THRESHOLD defines the maximum light level for a valid dark condition. If LIGHT_THRESHOLD and DARK_THRESHOLD are slightly lower and higher than the nominal transition point, respectively, false transitions will be minimized. In the example below a light level of 500 is the mid-point of the hysteresis band (note that these numbers will change with every roach): An event function that tests if the roach has entered the dark may be implemented using hysteresis (with two thresholds) as: #define LIGHT_THRESHOLD 470 #define DARK_THRESHOLD 530 static uint16_t lastlight = 0; unsigned char TestIfDark(void) { uint8_t gonedark = FALSE; gonedark = if((roach_lightlevel() > DARK_THRESHOLD) && (lastlight < LIGHT_THRESHOLD));

} if (gonedark) { lastlight = Roach_LightLevel(); } return gonedark; The roach s entry into light would then be detected by a TestIfLight function, with the thresholds reversed, thus completing the hysteresis loop. Several other implementations of the hysteresis loop are possible, this is but one (simple) example. Reading Changes in Bumper State: The state of the Cockroach s bumpers are accessed individually through the functions Roach_ReadFrontLeftBumper, Roach_ReadFrontRightBumper, Roach_ReadRearLeftBumper, and Roach_ReadRearRightBumper. These functions return either BUMPER_TRIPPED or BUMPER_NOT_TRIPPED when called. No debouncing is implemented in these functions, they simply read the appropriate I/O pin and return the value (note that old roaches use Hall effect sensors that usually do not require debouncing, but new ones use mechanical switches which do). if (Roach_ReadFrontLeftBumper() == BUMPER_TRIPPED) { // bumper hit, do something } In addition to the individual functions, there is a Roach_ReadBumpers function which reads all four bump sensors simultaneously and returns a 4-bit value assembled in the following order: front left, front right, rear left, rear right. A 1 in the bit position indicated the switch is BUMPER_TRIPPED and a 0 indicates that the corresponding switch is BUMPER_NOT_TRIPPED. This function can be extremely useful when implementing switch debouncing on the bumpers. if (Roach_ReadBumpers() & 0x01) { // use bitwise AND // front left bumper hit, do something } Using the LED light bar: The CMPE-118 Cockroach robot includes a diagnostic LED light bar under user control (not available on old roaches). Functions are provided for writing to (and reading from) the LEDs either individually or as a bar graph to show an analog value (in 12 discrete steps). The functions Roach_LEDSSet and Roach_LEDSGet provide access to each individual LED. Roach_LEDSSet takes as a parameter a 12 bit pattern, where a 0 in the pattern causes the corresponding LED to be OFF, and 1 in the pattern causes the corresponding LED to be ON. Roach_LEDSGet returns a 12 bit pattern corresponding to a 1 in each bit where the LED is ON, and a 0 corresponding to the LED being OFF (the orthogonal function to Roach_LEDSSet). Roach_LEDSSet(0xAAA); // lights every other LED Roach_LEDSSet(Roach_LEDSGet()^0x01); // toggles LED_0 In addition to the pattern functions for accessing the LEDs, a bar graph function is implemented to light successive LEDs to indicate an analog value. The function Roach_BarGraph takes an input value from 0 to 12 and lights the corresponding number of lights from the left with 0 being no lights and 12 being all lit. This is useful for displaying analog values appropriately scaled to indicate what is being read (e.g.: battery voltage). Roach_BarGraph(8); // lights the leftmost 8 LEDs Full details of all of the functions can be found by examining the Roach.h header file in the C:\CMPE118\include directory. Comments for each public function explain its use and functionality.

CMPE118 Cockroach Robot Software Library Test Harness: The CMPE-118 Cockroach robot software library has a built-in test harness (as does every library that is given in the class). This is enabled by adding a #define ROACH_TEST to the project which conditionally compiles the test harness in Roach.c. The test harness is intended to fully test the roach hardware, and demonstrate that all of the hardware is working correctly. Loading the test harness.hex file onto a roach and resetting it (either using the reset button or via the ds30loader), will begin the test harness execution. The test harness will first print out the serial port (setting at 115200 8-N-1): Welcome the the CMPE118 Roach Test Harness This code will allow someone to confirm operational hardware and software of a Roach The LED bar will light sequentially 5 times and then will flash alternating LEDs 5 times to demonstrate functionality of the LED bar graph. It will then print out instructions on the serial port: To test a roach, click a bumper. Each bumper runs a specific test. Front Left: display the current battery voltage Front Right: Display the Light level live Rear Left: Test left motor Rear Right: Test right motor Each subsystem test will now be triggered by the corresponding bumper. The front left bumper (test 1) will flash the LED bar once, and then slave the battery voltage live to the LED bar (with the USB plugged in and the power switch off, the LED bar should remain off. With the power switch on, some of the LEDs should light. In addition, the battery voltage from the ADC will be displayed on the serial port, for example: Battery voltage is 283 Battery Level Test Complete The LED bar will flash once again to indicate that test 1 is complete. The front right bumper (test 2) will flash the LED bar twice, and slave the light sensor to the LED bar while displaying the ADC value on the serial port. Dark (or covering the light sensor) will drive the LED bar towards fully illuminated, and light will drive the LED bar to off. The light sensor should be reactive, and have the LED bar change to changing illumination on the sensor. In addition the light sensor reading will be printed to the serial port (at a much lower rate): Current Light Level: 589 Current Light Level: 600 Current Light Level: 852 Light Level Test Complete The LED bar will flash twice again to indicate that test 2 is complete. The rear left bumper (test 3) will flash the LED bar three times, and then drive the left motor forward at different speeds (fastest to slowest), the reverse directions and again drive it from fastest to slowest. The LED bar will indicate direction and speed in four steps during the progression. The speed changes will be printed to the serial port during the test: Left Motor at 100 Left Motor at 80 Left Motor at 60 Left Motor at 40 Left Motor at 0 Left Motor at -100 Left Motor at -80 Left Motor at -60

Left Motor at -40 Left Motor at 0 Left Motor Test Complete The LED bar will flash three times again to indicate that test 3 is complete. The rear right bumper (test 4) will flash the LED bar 4 times, and then drive the right motor identically to how the left motor was driven in test 3. When the test is done the LED bar will again flash 4 times to indicate that the test is complete. With all four tests of the test harness run, the roach is confirmed to have all of its hardware fully functional. If the test is not passed, demonstrate where it fails to a tutor/ta in order to have it repaired. Note that it is a good idea to load the test harness and run it whenever you are working with a new roach to verify that all the hardware is in good working order. CMPE118 Cockroach Robot Schematics: