1 / 21

Interfacing the LEGO RCX to the outside world

Interfacing the LEGO RCX to the outside world. John M. Larkin Whitworth College Spokane, WA. Outline. Electronics at Whitworth Motivation for the Robotics Project Description of the Robotics Project Conclusions. Who takes electronics at Whitworth?.

robyn
Download Presentation

Interfacing the LEGO RCX to the outside world

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Interfacing the LEGO RCX to the outside world John M. Larkin Whitworth College Spokane, WA

  2. Outline • Electronics at Whitworth • Motivation for the Robotics Project • Description of the Robotics Project • Conclusions

  3. Who 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 students

  4. Structure 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 week

  5. Structure 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 audience

  6. Motivation 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 circuits

  7. Project 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 components

  8. What 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 port

  9. Overview 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 • active

  10. Passive sensor mode • Measures resistance with internal 10 kW resistor as part of voltage divider • A/D conversion passes a value to software given by

  11. Active 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 → 1023

  12. Useful active sensor interface circuit

  13. Overview 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 ms

  14. Programming 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 system

  15. Sample motor control code import 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(); } }

  16. Sample sensor interface code import 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(); } }

  17. Example: a loudest-sound-seeking robot

  18. What 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 students

  19. What 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 campus

  20. Resources • Web sites • leJOS homepage • http://lejos.sourceforge.net • Enthusiastic hobbyists • http://www.plazaearth.com/usr/gasperi/lego.htm • http://www.philohome.com/

  21. Resources • Books • Programming LEGO Mindstorms with Java by Giulio Ferrari, et al • Core LEGO Mindstorms Programming by Brian Bagnall • LEGO Mindstorms Interfacing by Don Wilcher

More Related