10.07.2015 Views

Here Comes the Sun - Lego

Here Comes the Sun - Lego

Here Comes the Sun - Lego

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Here</strong> <strong>Comes</strong> <strong>the</strong> <strong>Sun</strong>The ChallengeInvent a car that finds <strong>the</strong> optimal light conditions for charging a capacitor from asolar panel. After <strong>the</strong> solar panel charges <strong>the</strong> capacitor, <strong>the</strong> capacitor must beable to run <strong>the</strong> car for a least a few seconds. Recharge <strong>the</strong> capacitor while <strong>the</strong>car is parked. How can you make sure <strong>the</strong> solar panel is facing <strong>the</strong> sunwhenever it stops?This activity requires:ü ROBOLAB 2.0 or higherü The Infrared Transmitter with serial cable #9713ü RCX® #9709,ü eLAB set #9684What to Do<strong>Here</strong> is one way to solve <strong>the</strong> problem using a touch sensor and a light sensor.Program <strong>the</strong> car to drive forward until you press <strong>the</strong> touch sensor, indicating youwish to park. When <strong>the</strong> touch sensor is pressed, <strong>the</strong> car stops and rotates slowlyas it searches for <strong>the</strong> brightest light. Once <strong>the</strong> car has found which direction has<strong>the</strong> brightest light, it turns facing that way, <strong>the</strong>n halts.Building IdeasBuild a car that can turn in a circle. Mount <strong>the</strong> solar panel securely on top. Add atouch sensor to tell it when to park and a light sensor for finding <strong>the</strong> brightestlight.Programming IdeasIn your computer program, you will need to give your car a set of instructions fordetermining <strong>the</strong> direction with <strong>the</strong> brightest light and for stopping at <strong>the</strong> optimallight level. This set of instructions for doing a task is called an algorithm.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.1


<strong>Here</strong> is one possible algorithm: Make <strong>the</strong> car turn as long as <strong>the</strong> light sensorvalues are increasing (that is, <strong>the</strong> light is getting brighter). As soon as <strong>the</strong> lightsensor values decrease, <strong>the</strong> car returns to its previous position and stops. Theadvantage of this algorithm is that it is fairly simple but it has disadvantages, too.Can you think of any?What o<strong>the</strong>r algorithms can you think of for finding <strong>the</strong> brightest parking position?Before you start programming, brainstorm methods that you could use fordetermining <strong>the</strong> direction with <strong>the</strong> brightest light as your car rotates, <strong>the</strong>nreturning to this position after <strong>the</strong> rotation is complete.Choose <strong>the</strong> algorithm that you would like to use for your computer program. Youmay use <strong>the</strong> simple algorithm described above or your own idea.JournalUse Import JPEG to create a Journal page showing your solar panel car.Create a page using <strong>the</strong> Describe template and write an explanation of <strong>the</strong>algorithm you will use for finding <strong>the</strong> brightest parking position.ProgramUse Level 4 or 5 to write <strong>the</strong> program. You can use a container to store <strong>the</strong>value of <strong>the</strong> light sensor reading. To compare <strong>the</strong> current value of <strong>the</strong> lightsensor to an earlier one, use <strong>the</strong> Light Sensor Fork, wiring <strong>the</strong> container holding<strong>the</strong> earlier value into Compare.Download <strong>the</strong> program to your car and run it. If your program did not work asyou expected, modify it and try again.UploadOnce your car and program are working to your satisfaction, upload <strong>the</strong> data to<strong>the</strong> computer.ProgramWrite a simple Pilot program that takes a light sensor reading every hundredth ofa second while <strong>the</strong> car turns a circle. Run <strong>the</strong> program to collect additional data.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.2


UploadAdd a new page and upload <strong>the</strong> data from <strong>the</strong> Pilot program as well. Examiningthis data allows you to check that your car found <strong>the</strong> brightest light.Note: If you used an algorithm in which your car made a complete rotation, <strong>the</strong>nreturned to <strong>the</strong> brightest spot, you can just compare <strong>the</strong> data from your first andsecond rotations to see if your car found <strong>the</strong> brightest light.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.3


ViewUse Compare in <strong>the</strong> View area to examine <strong>the</strong> data from your car and from <strong>the</strong>Pilot program. Look at <strong>the</strong> maximum value of each line. Did your car find <strong>the</strong>brightest spot?JournalUsing <strong>the</strong> Describe template to write a conclusion to your experiment. Developanswers to <strong>the</strong>se questions:1) Did your system optimize <strong>the</strong> available light?2) How could you improve your car and program if you had more time?PresentCreate a presentation of your experiment containing <strong>the</strong> following pages: Journalpage describing <strong>the</strong> car and algorithm, Program page, Data page(s), Journalpage of conclusions.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.4


Teacher’s Notes for <strong>Here</strong> <strong>Comes</strong> <strong>the</strong> <strong>Sun</strong>LEARNING OBJECTIVES________________________________________________________________Students will understand:ü How to write a computer program that includes sensors.ü What an algorithm is and why it is useful.ü That, through experimentation, a value (such as light intensity) can beoptimized.ü That sensor readings provide feedback to control <strong>the</strong> behavior of a device.DISCUSSION________________________________________________________________This activity can be used in a number of different ways. For example, <strong>the</strong>students could be given plans for building <strong>the</strong> car and could concentrate onprogramming it. Or, students could be given one or more algorithms to programand test, ra<strong>the</strong>r than inventing <strong>the</strong>ir own.Building IdeasThe car can be built using one or two motors. The student handout assumes that<strong>the</strong> students will build <strong>the</strong>ir own two-motor cars. Alternatively, <strong>the</strong>y can be givenbuilding plans for single-motor cars. This design will allow <strong>the</strong> car to go forwardor turn using just one motor.Sample building idea for a one-motor car:©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.5


If extra motors are available, <strong>the</strong> students can design <strong>the</strong>ir own two-motor cars.One possible car is shown below.Sample building idea for a two-motor car:Programming IdeasThe simple algorithm outlined in <strong>the</strong> student worksheet should be understandablefor students. However, it may cause <strong>the</strong> car to stop in a bright area which is not<strong>the</strong> brightest possible position because this algorithm has no way of checkingwhe<strong>the</strong>r <strong>the</strong> bright spot it has found is just a local maximum.<strong>Here</strong> is a more sophisticated algorithm: The car rotates 360 degrees, finding andstoring <strong>the</strong> highest light value on its first rotation. Then it rotates a second time,stopping when <strong>the</strong> light sensor reaches this value again.If you choose to have students develop <strong>the</strong>ir own algorithms, you may want tobrainstorm ideas as a class and discuss each algorithm’s viability before <strong>the</strong>students begin programming.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.6


Sample Programs<strong>Here</strong> is one possible solution for <strong>the</strong> simple algorithm: The car turns until <strong>the</strong> lightdims. Then <strong>the</strong> car returns to <strong>the</strong> location of <strong>the</strong> previous reading.<strong>Here</strong> are two possible solutions for <strong>the</strong> more complex algorithm: The car rotates360 degrees, finding and storing <strong>the</strong> highest light value. The car rotates asecond time, stopping when <strong>the</strong> light sensor reaches this value.Version 1. This solution uses <strong>the</strong> Timer Fork, which is only available inROBOLAB 2.0 Investigator Program Level 5.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.7


Version 2. This version uses a Loop instead of <strong>the</strong> Timer Fork. This program canbe written in Level 4. This program is harder to understand and use than Version1. The number of loops needed for <strong>the</strong> car to complete one rotation must befound by trial and error.<strong>Here</strong> is program for capturing light sensor readings every hundredth of onesecond.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.8


Testing <strong>the</strong> carsThe more complex algorithm works well in a wide range of settings as long as <strong>the</strong>light conditions remain constant while <strong>the</strong> car is turning. The simple algorithm, byit very nature, is much more sensitive to shadows, glare, and o<strong>the</strong>r problems with<strong>the</strong> lighting. It works best in a dim room with a single light source near <strong>the</strong> car,such as a reading lamp or a powerful flashlight.ExtensionThe position of <strong>the</strong> sun changes during <strong>the</strong> day. Modify <strong>the</strong> car so that if <strong>the</strong> lightshifts while it is parked, it will rotate to find <strong>the</strong> new brightest spot.Add just three commands to <strong>the</strong> original program for a solution to <strong>the</strong> extensionAt <strong>the</strong> end, right before Stop Data Logging, add a Wait for Dark icon followed bya Jump. Place <strong>the</strong> corresponding Land near <strong>the</strong> beginning, right after Start DataLogging.©2002 The LEGO Group. LEGO, Invent & Investigate and RCX are trademarks of The LEGO Group.This page may be photocopied for non-commercial educational use. All o<strong>the</strong>r rights reserved.9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!