New version page

Interfacing the LEGO RCX to the outside world

This preview shows page 1-2-20-21 out of 21 pages.

View Full Document
View Full Document

End of preview. Want to read all 21 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

Interfacing the LEGO RCX to the outside worldOutlineWho takes electronics at Whitworth?Structure of the electronics courseStructure of the electronics labsMotivation for the robotics projectProject DescriptionWhat is the RCX?Overview of sensor inputsPassive sensor modeActive sensor modeUseful active sensor interface circuitOverview of outputsProgramming the RCX with leJOSSample motor control codeSample sensor interface codeExample: a loudest-sound-seeking robotWhat are the challenges?What are the rewards?ResourcesSlide 21Interfacing the LEGO RCX to the outside worldJohn M. LarkinWhitworth CollegeSpokane, WAOutlineElectronics at WhitworthMotivation for the Robotics ProjectDescription of the Robotics ProjectConclusionsWho takes electronics at Whitworth?Electronics is a required course for physics majors (both B.A. and B.S.) and computer science majors (only B.S.)It is offered each springtypically taken by physics majors as sophomorestypically taken by CS majors as juniors or seniorsAverage enrollment is 16-20 studentsStructure of the electronics courseContentemphasis on analog electronics for scientific instrumentation applicationsbrief introduction to digital electronicsFormattwo 55-minute lectures per weektwo 3-hour labs per weekStructure of the electronics labs16 sessions working on guided labsDC and AC circuitsRC and RLC circuitsdiodes and DC power suppliestransistors (simple amplifier and follower)op-ampslight detection (photodiodes & phototransistors)sound filtering with CD player source10 sessions working on robotics projectPresentation of project to campus-wide audienceMotivation for the robotics projectWe want students tocollaborate with a student from a different departmentleave the course enthusiastic about electronicsintegrate and apply knowledge from throughout the courseleave the course confident that they can design analog circuitsProject DescriptionGeneral project requirementsconstruct 2 custom transducers that can interface with the LEGO RCXuse those transducers, the RCX, plus other materials to do something interestingStudents are required to submit a project proposal before project work days beginfeedback on appropriate level of difficultylead time to order specialized componentsWhat is the RCX?Developed in a collaboration between MIT’s Media Lab and LEGORCX details16 MHz CPU32 kB RAM3 motor outputs3 sensor inputsIR portOverview of sensor inputsLEGO packages RCX with basic light and touch sensors as part of kit for schoolsSensor inputs have a 10 bit A/D converterSensor modes (software selected)passiveactivePassive sensor modeMeasures resistance with internal 10 k resistor as part of voltage dividerA/D conversion passes a value to software given bykΩ 101024valueRRActive sensor modeRCX alternates “input” between two states when put into active modeFor 3 ms, sensor “input” is actually an output providing approximately 8 V to power the sensor circuitFor 0.1 ms, an A/D converter captures the voltage generated by the sensor0 V → 05 V → 1023Useful active sensor interface circuitOverview of outputsRCX outputs designed to power DC motorsOutput provides 8 VPulse width modulation varies motor speedEight “power levels” can be software selectedpower level 7 = continuous outputpower level 6 = on for 7 ms, off for 1 mspower level 0 = on for 1 ms, off for 7 msProgramming the RCX with leJOSleJOS is a version of Java for the RCXWhy leJOS?many of our CS majors have previously used the RCX and leJOS in an artificial intelligence classfreeware so students can install on their own computers for development outside of the labmore traditional programming language than the LEGO graphical programming systemSample motor control codeimport josx.platform.rcx.*;public class GoAndTurn{ public static void main (String[] aArg) throws Exception { Motor.A.setPower(2); Motor.C.setPower(2); Motor.A.forward(); Motor.C.forward(); Thread.sleep(3000); Motor.C.backward(); Thread.sleep(1000); Motor.C.stop(); Motor.A.stop(); }}Sample sensor interface codeimport josx.platform.rcx.*;public class ReadAndRespond{ public static void main (String[] aArg) throws Exception { Sensor.S1.setTypeAndMode(SENSOR_TYPE_RAW, SENSOR_MODE_RAW); Sensor.S1.activate(); int x = Sensor.S1.readRawValue(); if (x > 512) Sound.twoBeeps(); }}Example: a loudest-sound-seeking robotWhat are the challenges?First portion of course must be fast paced so students have background for projectMust help 8-10 teams working on different projects Transition from highly structured labs to open-ended project is too abrupt for some studentsWhat are the rewards?Students enjoy the project and are proud of their workStudents discover that they really learned somethingFaculty discover that the students really learned somethingPresentation day is good PR for physics on campusResourcesWeb sitesleJOS homepagehttp://lejos.sourceforge.netEnthusiastic hobbyistshttp://www.plazaearth.com/usr/gasperi/lego.htmhttp://www.philohome.com/ResourcesBooksProgramming LEGO Mindstorms with Java by Giulio Ferrari, et alCore LEGO Mindstorms Programming by Brian BagnallLEGO Mindstorms Interfacing by Don


Loading Unlocking...
Login

Join to view Interfacing the LEGO RCX to the outside world and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Interfacing the LEGO RCX to the outside world and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?