throbber
2;
`
`;4nV36.23A.f
`
`.wxin
`
`flzz,
`
`5.,,~.$3;W,
`»mswH».~.w,,.«s
`5
`3*v-5
`2/429:
`
`M?0WWW‘,..mi}
`
`3
`
`at
`
`+1.
`
`$5.2L.
`
`
`
` ,...,mQ.m.
`
`,3w?x.?».£H.,mafia“:
`
`
`
`,.A:_H6%.3%....,
`
`:
`i.bra‘s a
`
`:$2.:u
`
`....f9...
`.»
`
`f‘?!
`
`3.»
`
`
`
`
`
`
`
`
`
`
`
`

`
`
`
`58
`
`Chapter 4 v Reading Sensors
`
`Entroéuetion
`Motors, El1I‘O1Igl] gears and
`pulleys. provide motion to your
`muscles that move its l
`robot; they are the
`egs and arn1s.The time has coin
`with st’//5011s: Wliicli will act as its eyes, ears, and fingers.
`e to equip your creature
`The MINDSTORM-S box cont;uns two types otisensorsz tl
`O7i'.Cl]6I1]> and the /‘lg/Ir so//.«‘o;'. In tlus chapter, well
`ie four/1 .«‘e/2501' (two
`ulescrihe their peculiarities. and
`those of the optional sensors th
`at you can buy separately: the rr>mtz‘mz .<r/1501' and
`the tcrrzpe/*afzr1'e sr'zz.m1'. All these devices have been designed for
`but you’ll be surprised at their versatility and the wide r
`:1 specific purpose,
`2-lflgtf of situations they
`can nia:1;1ge.\}Ve ‘will also cover the cases where one typ
`e of sensor ran cmr//are
`another, which will help you replace those th
`isiug a little trick
`at ;1ren’t available. U
`that talces gidvantage ofthe infrzired (IR) light on the RCX, you will also
`how to turn your light sensor into a sort of rarlaut
`We invite ‘you to lceep your Mll\lD§TC)R,MS set h
`the C'i].21ptC‘.T, so you c
`experiments.
`y your side while reading
`an play with the real thing and replicate out
`For the sake of completeness, Vv’C‘~ll describe some
`STORIVIS expan.sion sets or TECHN
`parts that come lroin lVlIl_\J'D~
`EC sets. Don’t worry ifyou don"/t l13V‘t‘ them
`now; this wont cornproinise your cl
`iances to build great robots.
`
`discover
`
`toueh §ensor
`The fund; sensor (
`
`member
`Figure -4.1) is probably tl
`ie siinplest and most intuitive
`1 button portion of
`ofthe LEGO sensor f}m1il_V. lt worl«:s more or l
`ess like the pusl
`your doorbell: when you press it‘ a circuit is completed and electricity flows
`through it. The RCX is able to d
`etect this How, and your program can rezzd the
`state of the touch sensor. on or off
`Figure 4.1 The Touch Sensor
`
`
`
`some of the model
`
`J playecl with Vour RIS, read tl
`.
`ie Constructopedizz, and built
`5, you’re probably faniili
`ie s‘ensors’1nost common
`ar with tl
`
`
`
`

`
`:--W’
`
`Reading Sensors * Chapter 4
`
`59
`
`application, as bzmipers. Bumpers are a simple Way of interacting with the environ-
`ment; they allow your robot to detect obstacles when it hits them, and to change
`its behavior accordingly.
`A bumper typically is a lightweight mobile structure that actually hits the
`obstacles and transmits this impact to a touch sensor, closing it.You can invent
`many types of bumpers, but their structure should reflect both the shape of your
`robot as Well as the shape of the obstacles it will meet in its environment.A very
`simple bumper, like the one in Figure 4.2, could be perfectly okay for detecting
`walls, but might not work as expected in a room with complex obstacles, like
`chairs. In such cases, We suggest you proceed by experimenting. Design a tentative
`bumper for your robot and move it around your room at the proper height from
`the floor, checking to see if it’s able to detect all the possible collisions. lf your
`bumper has a large structure, dont take it for granted that it will impact the
`obstacle in its optimal position to press the sensor. Our example in Figure 4.2 is
`actually a bad bumper, because when Contact occurs, it hardly closes the touch
`sensors at the very end of the traverse axle. lt’s also a bad bumper because it trans-
`mits the entire force of the collision straight to the switch, meaning an extremely
`solid bracing would be necessary to keep the sensor mounted on the robot.
`
`Figure 4.2 A Simple Bumper
`
`
`
`
`
`A Be empirical, try different possible collisions to see if your bumper works
`..P’50P‘31”1Y in any situation.You can write a very short program that loops forever,
`e Pmducing a beep when the sensor closes, and use it to test your bumper.
`it Wheii talking of bumpers, people tend to think they should press the switch
`W1 Elm obstacle gets hit. But this is not necessarily true.They could also release
`Watch during a collision. Look at Figure 4.3, the rubber bands keep the
`
`

`
`
`
`60
`
`Chapter 4 ~ Reading Sensors
`
`bumper gently pressed against tl
`ie sensor; when the front part oft
`touches something, the switcl1 gets released.
`Figure 4.3 A Normally Closed Bumper
`
`he bumper
`
`
`
`E
`i
`x
`
`5%
`
`
`
`Actually, there are some import
`
`ant reasons to prefer this kind of bumper:
`
`T E The impact force doesnt transfer to the sensors itself. Sensors are a bit
`more delicate than standard LE TO bricks and you should avoid
`shocking them unnecessarily.
`E The rubber bands absorbing the force
`your sensor but the whole bod
`Cant when your
`
`Bumpers '
`
`*
`
`*
`
`s to be pushed manually
`ar event. Can you think ofa
`could push a button to
`
`c0m‘rol.YoL1 see 3
`
`earning robot about its behayiongoorl or bad. The list could be long.
`'
`J
`’ll demand from your
`switch sensors is pas/f1‘mz
`n example of this in Figure -‘l.4.Tl
`ie rotating head of our robot
`
`
`
`

`
`
`
`(Figure 4.4a) mounts a switch sensor that closes when the head looks straight
`ahead (Figure 4.4b).Your software can rely on timing to rotate the head at some
`level (right or left), but it can always drive back the head precisely in the center
`simply waiting for the sensor to close. By the way, the cam piece we used in this
`example is really useful when Working With touch sensors, as its three half—spaced
`crossed holes allow you to set the proper distance to close the sensor.
`
`Reading Sensors * Chapter 4
`
`61
`
`Figure 4.4 Position Control with a Touch Sensor
`
`;§Sh€.f€ Would be many other possible applications in regards to position control.
`5‘? “meet some of them in the third part of this bool-:.\X/hat matters here is to
`'3 Outo explore many dif:"erent approaches before actually building your
`
`

`
` (
`
`another exzunpl
`
`ojng
`e to clarify what we
`J
`(
`' to stop at any floor.Your F11-gt
`,
`'
`1en1 closes you know tl
`
`rat
`
`an interesting project to you.You coul
`your problem one floor
`
`Witl1
`
`'
`
`/ not put the sensor on the l
`.
`(
`,700tl'1 instead of on the st
`‘
`91 single sensor on the boot
`ructurer
`h, and pegs that close it 3
`yide your eley
`;1tor with as many floors ;
`, oy reversing our original
`approach you found :1 much better solution.A
`1 ahso.utely eqL1i\z;—
`lent? No. they ;1ren’t. In tl1e first, you ‘
`'
`booth, while in the second you are ahl
`you do need 21 known starting
`'
`/
`atiye position.Tl1at is,
`point, so you can dedv. '‘
`counting the floors froni there.
`ce the position of the cab
`Either require that the cab must be at 3 specific
`level when tl
`1e prograni starts, or use 2 second sensor to detect :1 specific floor. For
`exaniple, place 3 sensor at the ground level, so the very first thing yourprogram has
`ted is to lower the elevator until it detects the ground level. From
`ien on, it can rely on the cab sensor to detect its position
`Now your elevator is able to propeil
`last probl
`fly navigate up and d—QXN‘H.Y@‘Cl lmve one
`ein to solve: How do you inform your elevator‘ which floor it should go
`to? Placing :1 touch sensor at every floor to m// the elevator there is l111p1f8CtlC£1l
`You have only one input port left on your RCX. W/l1at could you do With. (1
`an you apply the previous approach here, too?
`Yes.You can (omit the pushes on El singl e touch sensor.
`means third floor, and so on. Now you are ready to
`For exzmiple, three clicks
`actually huild your eley;1to1‘.'
`
`
`
`
`ecouhtifig cm
`rhe_ror1o‘w;ng‘é;2am’ _ g ‘
`
`
`to do when star
`tl
`
`single sensor? C
`
`4
`
`to build an eley1tor.You obviousl
`idea is to put a switch at every le '
`
`I
`
`the cal) has reaclied th;
`however, you h
`doesn’t seem l
`but tl
`
`ike such
`1is simply pushes
`l\/lea11wl1ile, the tl
`
`

`
`1
`
`.w4m%%‘
`
`Reading Sensors - Chapter4
`
`63
`
`‘.Sens0rl‘is,df
`
`Cbnfinaedz
`
`

`
`
`
`I
`at the /1};/if 55’/z.<
`C,
`Wh
`at it actually does is
`
`1in1itationS V‘ )
`
`
`'0
`or Fioure 4.5‘ “
`detect Hg
`
`secs’
`In and 1116*
`
`'
`
`‘j
`
`'
`
`'
`
`,
`
`./
`
`too strong
`
`
`
`

`
`
`
`‘;“’”~‘"uAi]|l
`
`Reading Sensors - Chapter 4
`
`65
`
`This ability to trace an external light source is interesting, but probably not
`the most amazing thing you can do with this sensor.We introduce here another
`feature of this device: not only does it detect light, but it emits some light as well.
`There is a small red LED that provides a constant source of light, thus allowing
`you to measure the reflected light that comes back to the sensor.
`When you want to measure reflected light, you must be careful to avoid any
`possible interference from other sources. Remember that this sensor is Very sensi-
`tive to IR light, too, like the one typically emitted by remote controls, Video
`cameras, or the LEGO IR tower.
`
`
`
`The amount of light reflected by a surface depends on many factors, mainly
`lor;te:>¢tu—r&aiid—i—t&d—i—sta—nee frc—>n=i the source. A blacl: object i=efleets4essfil—i—glart—vT—
`’ Jtlian a White one, while a black matte surface reflects less light than a black shiny
`' iirface. Plus, the greater the distance of the objects from the sensor, the less light
`“:1 ins to the detector.
`These factors are interdependent, meaning that with a simple reading from
`_ ighz: sensor, you cannot tell anything about them. But if you keep all the
`E3 0_ ‘3.01’lSt21nt except one, you are now able to deduce many things from the
`3834 For example, if your light sensor always flices the same object, or objects
`same texture and color, you can use it to measure its relatizxe dfslczrzre. On
`Chet hand, you can place different objects in front of the sensor, at a constant
`61 VCO recognize their color (or, more accurately, their F63]/'lC’c'fl'0I'l).
`
`

`
`
`
`66
`
`Chapter 4 = Reading Sensors
`
`Measuring Ref!
`ected Light
`To ihustra te t1
`1e concept ofme
`:r<ur1'ng 1'eflec1'ed hght, let’; prepare an experiment
`Take yo u r R
`CX, turn it on, attach :2
`ig}1t sen.<or t
`'
`the port properh
`j mirlg the Test Panel otflyour MI
`LED should iIhm1ir1ate). Prepare the
`Nr_>s'roRMs 1)o.\: (the red
`environment.You need :1 dark room, not
`necessarily completely dark hut there
`sh,ou}d he as I
`RCX h
`ittle light
`as :1 mzzm/c’ mode that
`as possible. The
`allows you to View the mine of:1 sensor in real
`time. Press tl
`re View button o
`11 your R CX until a short arrow in the display
`points to the
`port the sensor is attached to. The rnain section ofthe d“
`the v;
`zhre your sensor is re
`ading. Now you can proceed. Put the
`the tab!
`e.Take some LEGO hriclis of"d1'fi’erent colors and place them one by one
`at short distances from the sensor (;1hout 0.5 hr, or 1
`to '1 .5
`them separated from C’
`ach other at the 9'
`"J notice how chfl‘
`might want to write d
`own the vzrhres on 1 sheet)
`For the second part or the expeurrlent take ti‘
`", always looking at the values in
`; ~ the dist;mce.You
`.ame Value you h
`ave read For
`rat we me
`ant to p1;<1\:c:You
`cam1o‘t
`at the same trme, but if
`you know th
`range, you can Calcul
`ate the other. We stress
`our best to Shier
`d your system fro
`
`Cm). Keep all of
`
`amount of hght HULK
`
`at one of the
`again that in both
`In ambient hght.
`
`’ properties doesrft C}
`cases you must do y
`
`
`
`
`
`rjs}(o.f=any’
`yr/jvalues.
`t
`y
`ta; specific ké,r§c:"of_
`h’”955?0A5—_5’:i.'d?3‘fé’9
`nit ra.nge.- ;
`
`
`
`V.
`
`.5
`
`.
`
`_
`
`
`
`Conti trad
`
`

`
`Reading Sensors = Chapter 4
`
`67
`
`.\("D
`
`
`
`lained that the sensor doesn’t actually read colors, rather it reads the reflected
`"For this reason, it’s hard to tell :1 black brick from a blue one. But, for now,
`Qhtinue to use the expression rcadizzg colors", now that you know what’s really
`1d the reading.
`
`
`
`
`
`.' Following
`13’ the most widespread usage of the light sensor is to make the robot read
`17 marks on the floor where it 1noves.This is a way to provide swtificial
`
`

`
`
`
`68
`
`Chapter 4 ° Reading Sensors
`
`landn1arl<:s your robot can rely on to naviggate its e
`nvironment. The simplest case
`is /fizc’_fE.i//nzM’/ig. The setup for this project is very si
`mple, which is one of the rea-
`sons its so popular. Despite its
`apparent simplicity, this task
`deserves a lot of
`attention and requires careful d
`esign and prograini1iirig.\X/e will discuss this topic
`in greater detail in Part ll; for
`now, though, we want to bring your attention to
`what happens when the l
`ight sensor “reads” a black line on a light floor.
`‘When the se
`nsor is on the floor, it returns, let’s say, 70 percent, while on the
`black line, it returns 30 percent. Ifyou move it slowly from the floor to the l
`or Vice versa, you notice that the readings dou’t leap all of
`ine
`the other, they go through a series of intermediate
`a sudden from one to
`Values. This happens because
`the sensor docsn’t read a single point, but a small
`area in front ofit. So when the
`sensor is exactly over the borderline, it reads hal
`fthe floor and half the black
`strip, returning an intermediate result,
`ls this feature useful? We
`ll, sometimes it is, sometimes its not. \7(/hen dealing
`with line following in partic
`ular, it is we/‘y useful. In fiict, you can (and should)
`program your robot to follow
`the “gi"ay"’ area along the borde
`actual black lint-.Th
`is way when the robot ne
`which direction to turn: lfit reads too “dark,” it should turn toward the “light”
`
`region, and vice versa.
`
`
`
`
`
`_
`.
`jfueié.,r¢UAr«é‘én‘§OrM
`
`_
`‘the k§la:C7.l§’:f.ine‘.‘§i,In:ithivs_ca_se,fand‘a‘,s‘a‘_.giootfigene,
`’
`,
`rib, o,Wtiféj’fhe,é>i’PeCtéd ii/élués B5.§C5:”SfaUT5h:ydU,?i I
`
`.,yoim
`1
`y
`p
`M _
`.,gh:,ai~s»mg“p‘r
`.
`!
`'qb,ot‘”to :r_e[a_d‘;::them'iby Etselffitirou '
`'
`M
`;.
`
`,d_L}_re.l.‘S‘t ymfg:,wfthjthe_ l_§,né,fg_lI
`“
`i
`~
`5':
`I
`‘l’?’P.U‘§’iP¢?ff‘ii¢”‘3TQ‘¥?hs:S6950
`-_‘f0l_3:O,:€__Qfi,_the.,floolfj‘and
`f§ie.n on; 1
`
`
`
`H r"to.be' " ‘
`
`.
`
`
`
`
`

`
`
`
`Reading Sensors ° Chapter 4
`
`69
`
`VVhen you need to navigate a more complex area, one, for example, that
`includes regions of three different colors, things get more difflcult. Imagine a pad
`divided into three fields: White, black, and gray. How can you tell the gray area
`from the borderline between the white and the black? You can’t, not from a
`single reading, anyway.You must take into consideration other factors, like pre~
`vious readings, or you can make your robot turn in place to make it gather more
`information and understand where it is.To handle a situation like this, your soft-
`
`ware is required to become much more sophisticated.
`The light sensor is such a versatile device that you can imagine many other
`ways to employ it.You can build a form of proportional control by placing a
`multicolor movable block of LEGO parts in front of it. Figure 4.6 shows an
`example of this kind.\X/hen you push or pull the upper side of the beam, the
`sensor reads difterent light intensities.
`
`Figure 4.6 An Analogue Control with a Light Sensor
`
`
`
`
`
`Combining the light sensor with a lamp brick (not included in the MIND»
`STORMS kit) you get a photoelectric cell (Figure 4.7); your robot can detect
`when something interrupts the beam from the lamp to the sensor. Notice that
`»1i‘Qpl€lGE%el%—l—Xé7.—GH6~—hOl<%l9—%1—Hl4¥Hfi1QIJ1;Q.flt;h&l,igllLS,€lZlS.OI
`to re_dii_c_e the pos-
`sible interference from ambient light.
`
`Figure 4.7 A Photoelectric Cell
`
`
`
`

`
`Reading Sensors v Chapter 4
`
`69
`
`When you need to navigate a more complex area, one, for example, that
`includes regions of three different colors, things get more difficult. Imagine a pad
`divided into three fields: white, black, and gray. How can you tell the gray area
`from the borderline between the white and the black? You can’t, not from a
`single reading, anyway.You must take into consideration other factors, like pre—
`vious readings, or you can make your robot turn in place to make it gather more
`i ormation and understand where it is.To handle a situation like this, your soft-
`ware is required to become much more sophisticated.
`The light sensor is such a Versatile device that you can imagine many other
`ways to employ it.You can build a form of proportional control by placing a
`multicolor movable block of LEGO parts in front of it. Figure 4.6 shows an
`example of this kind.When you push or pull the upper side of the beam, the
`sensor reads different light intensities.
`
`Figure 4.6 An Analogue Control with a Light Sensor
`
`
`
`
`
`
`
`
`
`‘ Combining the light sensor with a lamp brick (not included in the MIND-
`- STORMS kit) you get a photoelectric cell (Figure 4.7);iyour robot can detect
`M
`hen something interrupts the beam from the lamp to the sensor. Notice that
`
`, plaeed a 1 X 2 o—n—e—~hele baeam in front of the light sensor to re,d,u_c_e the pos-
`V‘ ble interference from ambient light.
`a Figure 4.7 A Photoelectric cen
`
`
`
`

`
`
`
`70
`
`Chapter 4 6 Reading Sensors
`
`Proximity Detection
`You can also use tl
`robot hits them. Tl
`
`at to de
`
`ie ligl
`it sensor as a sort ofrad
`tect obstacles /}£_’fl7f'(’ your
`iis is called 11)/'o.\*z'/ii/ry ({(.’[£'
`tr/'oiz.Tlie tecl
`mique is based on a
`property we liave al
`ready discussed
`and explored: th
`at the light sensor c
`to measure rel
`ative distances based
`an be used
`on reflected ligl
`it. Suppose your robot is
`straight, with :1 ligl
`it sensor pointing ahead oflit. S
`going
`uppose also that your robot
`moves in a darlq
`. room, with no other source
`5 oflight except tl
`LED of the sensor. \X/l
`ie emitting red
`iile moving forward, tl
`ie robot continuously re
`sensor. If the readings tend to
`ads the
`increase rapidly, you can d
`,
`.
`educe that the robot is
`going toward something. Tl
`ieres nothing you can te
`ll about the izatzm’
`obstacle and its dist
`of th e
`ance, but ifnothing el
`se moves inside the
`the robot is getting closer to tl
`ie obstacle. Gre
`atl We now
`obstacles instead of being limit
`ed to detecting
`
`room, you are sure
`have :1 system to azmd
`gh collisions.
`
`them throu
`
`
`
`Unforttinately, tl
`iis technique doesnt w
`ork Very well in
`source oflight, because your
`a room with any
`program cannot tell the
`light reflected back, or
`difference between its red
`any other change in the
`ambient ligl
`stronger independent source 0
`it.You would need a
`n the robot to provide a better
`Thankfully, you just happen to h
`reference.
`ave one.’ The RCX l
`sages to the tower or
`ias an IR LED to send mes-
`to another RCX. Sending
`the RCX to encode t
`H IHCSSQSC‘ U
`ses the IR LED in
`he hits in a
`format that c
`don’t care abo
`an be receiv
`ed by the tower. We
`ut the contents oft
`he message; we
`light, tl
`just want the light. lnfiared
`iough not Visible to the l"
`ligl
`iurnan eye, is of the Very s
`at, and the LEGO li
`ame nature as Visible
`ght sensor hap
`30 you now h ave all the el
`grams. Send
`
`
`
`pro~
`. nsor.You had better
`"nal sources (we’ll
`discuss
`ant increase be
`
`tween two subse-
`cent, your robot is V
`ery likely
`
`
`
`

`
`Reading Sensors - Chapter 4
`
`71
`
`Rotatéen Seneer
`
`The third LEGO sensor wed] examine is the romriorz sensor (Figure 4.8). It’s a pity
`this piece of hardware is not included in the 1\/IINDSTORNIS kit, itsi versatility
`being second only to the light sensor. However, there is one included in the 3801
`Ultimate Accessory Set, together with a touch sensor, a lamp brick, the remote
`control, and a few other additional parts.
`
`Figure 4.8 The Rotation Sensor
`
`

`
` i
`
`|
`A
`
`:, n the other, the co
`mm to the startina
`O position of the sensor. W/hen you initiali7e t
`'
`'
`'
`is set to zero, and y
`By counting rotations, I
`nected to the whe>
`
`of the Wheel.Then you can conver
`it by the elapsed time. In fiict, tl
`distance = speed x time
`
`and the circumference
`speed, ifyou want, div
`.
`ie basic equation for distance is:
`
`iding
`
`from which you get:
`
`speed = distance/time
`
`otation sensor to
`, you must remember to
`an example along with the
`nected to the main Wheels wit
`nected to the motor,
`
`any axle between the motor and t
`he
`apply the proper ratio to
`the count you read. Lets
`math together. In your robot, the motor is con-
`h a 1:3 ratio. The rotation sensor is directly con-
`so it shares the same 123 r
`'
`'
`
`1e sensor counts 16 units, so 16 X 3 = ’
`single turn of the WI
`
`gest spoked wh eel,
`ameter (LEGO uses tl
`1e metric system), thus its circumference is
`81.6 X 7t z 81.6 X 3.14 = 256.
`22cm. At this point, you have all the elements: the
`distance traveled by tl
`1e wheel results from the increment in
`divided by 48 and tl
`the rotation counter
`161’) multiplied by 256. Lets summarize the steps. Calling R
`16 counts per turn)
`the resolution ofth
`e rotation sensor (tl
`and G, the gear ratio
`between it and the
`Wheel, We define I
`as the increment in the rotation count that
`corresponds to a turn of the wheel:
`l=GxR
`
`In our example G is 3, While R is always 16 for
`
`we get:
`
`LEGO rotation sensors. Thus,
`
`l = 3 X T5 = 48
`
`On each turn, the wheel covers a distance equal
`
`7 by using the formula:
`
`to its circumference, C.You
`
`

`
`1«»maul
`
`C=DXTE
`
`'5
`
`\Which, in our case, means (with some rounding):
`
`C = 81.6 X 3.14 = 256.22
`
`Reading Sensors - Chapter 4
`
`73
`
`The final step is about converting the reading of the sensor, 8, into the traveled
`distance,T, with the equation:
`
`T=SXC/l
`
`If your sensor reads, for example, 296, you can calculate the corresponding
`distance:
`
`T -= 296 X 256.22 / 48 = 1580
`
`
`
`The distance, T, results with the same unit you use to express the diameter of
`the Wheel.
`Actually doing this math in your program, even it is nothing more than a
`division and a multiplication, requires some care (something we will discuss later
`in Chapter 12).
`Controlling your Wheels with rotation sensors provides a different Way to
`detect obstacles, a sort of indirect detection.The principle is quite simple: If the
`motors are on, but the wheels don’t rotate, it means your robot got blocked by an
`obstacle.This technique is very simple to implement, and Very effective; the only
`requirement being that the driving wheels don’t slip on the floor (or don't slip
`too much), otherwise you cannot detect the obstacle.You can avoid this possible
`swtproblem by connecting the sensor to an idle wheel, one not powered by a motor
`0
`but instead dragged by the motion across the floor: If it stops while you’re pow~
`1 ering the driving wheels, you know your motor has stalled.
`wimp
`7 There are many other situations where the rotation sensor can prove its Value,
`lfifiinly by Way of controlling the position of an arm, head, or other movable
`. parts. Unfortunately, the RCX has some problems in detecting precisely any
`M Count when the speed is too low or too high. Actually, this is not the fault of the
`itself, but its fimzware, which misses some counts if the speed is outside a
`icific range. Steve Baker proved through an experiment that 50 to 300 rpm is a
`lie 1”r1I1ge, with no counts missed between those values. However, in ranges under
`Ab;;l7P1‘pI1 Or over 1400 rpm, the firmware will surely miss some counts.The areas
`€511 12 rpm and 50 rpm, and between 300 rpm and 1400 rpm, are in a gray
`2 lmrfi your RCX Iniglit miss some counts.
`his is a small problem, if you consider that you can often gear your sensor
`J
`Pig» dolvn to put it in the proper range.
`
`2
`
`'
`
`

`
`Chapter 4 - Reading Sensors
`
`Temperature Sensor
`This is the last sensor ofthe LEGO MINDST
`not supplied with the I\/HNDSTORMS kit, 13
`onhne shop or through their Shop—At—Home
`U
`vithout, even though
`at warns you if}/our drink
`b
`There are no movabl
`'
`'
`'
`flom the body ofthc sensor (Figure 4.9). If
`your code, you can get the temperature values returned in Celsius or F
`degrees.
`t can dete
`but is Very slow in
`device to use 1'1'"‘*ou’*>
`
`ORMS line. It’.s an option
`3} sensor,
`ut it’s easy to get t
`hrough the LEGO
`service.
`Lefisjust say that itk 2
`it can support
`5,
`Warm or too cold.
`'
`
`”
`
`* next, so it’s not th
`'
`ct sudden changes in the temperature.
`
`

`
`Reading Sensors - Chapter 4
`
`75
`
`The equation used to convert raw values from this sensor into temperatures
`(in C”) is the following:
`
`C’ = (785 — raw value) / 8
`
`Celsius degrees translates into Fahrenheit according to the formula:
`
`F°=C°X9/5+32
`
`Sensor Tips and Tricks
`Sooner or later you will probably find yourself without the proper sensor for a
`particular project. For instance, you need three touch sensors, but have only two.
`Or you need a rotation sensor, but don’t have any at all. Is there anything you can
`do? There’s no way to turn any sensor into a light sensor or a temperature sensor,
`but touch and rotation sensors are at some level replaceable.
`Another problem we do battle with every time we build with the RCX is
`the limited number of ports. Later in the book we’ll explore some non—LEGO
`solutions to this problem, but for now We’ll talk about some simple cases where
`you can connect two or more sensors to the same input port.
`In the following sections, you’ll find some common and well—tested tips that
`can help.
`
`
`
`Emulating a Touch Sensor
`F Turning a light sensor into a touch sensor is an easy task; you already know the
`lvsolution. Basically, you build something similar to what we showed in Figure 4.6.
`F
`In its default state, the sensor has a LEGO brickjust in front ofit.The pressure
`on a lever (or beam, axle, plate, and so on) moves a brick ofa different color in
`
`ontpf’thedrglrt1’ensor;’wherenyourtsoftvvare deteeets the ehange. Use a belt to
`F’ ’’’’T‘
`lfiettp your assembly in its default position.Try and protect the light sensor as
`much as possible from external interferences.
`limulating a touch sensor with a rotation sensor is also doable by building a
`F3913 . actuator that rotates the sensor at least a sixteenth of a turn when touched.
`of the I‘11€1IJ‘y’ possible approaches is shown in Figure 4.10.
`tnulating a Rotation Sensor
`ll?
`5 a long list of possible alternatives to the rotation sensor. All the suggested
`d5 are based upon counting single impulses generated by a rotating part.
`
`
`
`M
`
`
`
`

`
`
`
`76
`
`Chapter 4 - Reading Sensors
`
`They all work well, but usually they dont detect the direction of rotation. In
`many cases this is not a problem, because when coupled with a motor you lerzou;
`which direction your sensor is moving.
`Figure 4.10 Emulating a Touch Sensor with a Rotation Sensor
`
`
`
`The assembly pictured in Figure 4.11 shows an axle with a cam that closes a
`touch sensor. This is the principle, use eiteher a cam or‘a‘rry other suitable part
`that, while rotating, periodically pushes the touch sensor. Counting only a single
`tick per turn, this sensor has a Very low resolution.You can increase it by making
`the sensor close more than once per turn, or simply by gearing the sensor up a
`hit until you get the required accuracy.
`Figure 4.11 Emulating a Rotation Sensor with a Touch Sensor
`
`
`
`
`Making a rotation sensor out ofa light sensor is not Very dirierent: build
`some kind of rotating disk with sectors ofclifferent color, and count the transi~
`t10nS from one color to the other (Figure 4.l2).T'he general tip for the light
`
`

`
`
`
`sensor applies to this case, too:Try and insulate the light sensor from external
`light sources as much as possible.
`
`Figure 4.12 Emulating a Rotation Sensor with a Light Sensor
`
`Reading Sensors - Chapter 4
`
`77
`
`
`
`There are two LEGO electric devices that, though not being actual sensors,
`can be successfully employed to emulate a rotation sensor. None of them is
`included in the MINDSTORMS kit, but they’re not hard to find.
`. The first is the polarity switch we introduced in. Chapter 3. Connect it as
`shown in Figure 4.13, and configure it as a touch sensor. With every turn, it
`closes the circuit twice.
`
`‘ Figure 4.13 Emuiating a Rotation Sensor with a Polarity Switch
`
`. §',l¢’%§&§5i‘£1.”'99@5§’§$§!
`
`

`
` Chapter 4 - Reading Sensors
`
`
`
`nect it directly to an input port ofyour RCX and configure it as 21 light sensor;
`rotate it slowly While Viewing its Values on the display They swing from about 70
`percent down to 2 percent, then back to 70 percent.You can count sixteen tran—
`sitions per turn. Thus, the resolution is the same as the original rotation sensor. It
`has a Very low friction quotient, too, resulting in an ideal substitute.
`Figure 4.14 The Fiber Optic System Unit
`
`In some particular cases, connecting multiple sensors to the same port is doable
`and safe for your deVices.Touch sensors, for example, are easy
`' up of them gets
`pressed, you read an on state. This is very easy to achieve, simply stacking all the
`
`mation fi'om other known facts. For example, say you have a robot with fiont and
`rear bumpers.You can connect them to two switches wired to the same port.
`
`
`
`

`
`Reading Sensors = Chapter 4
`
`79
`
`When a bumper closes, your program knows if the robot was going forward or
`backward, thus it can properly interpret the information and behave accordingly.
`in another example, perhaps your moving robot has a lift arm that requires a limit
`switch to stop at a specific position. If your robot is stationary when it activates
`the arm, you can safely use the same port for that limit switch and for a switch
`
`wired to a bumper.
`The scheme to combine two sensors in an AND configuration is a bit more
`
`compleX.Torn Schumm came up with the solution shown in Figure 4.15. It
`works well, provided you connect the wires exactly as shown in the diagran1.You
`get an on state only when both sensors are pressed at the same time.The scheme
`can be extended for an AND configuration using more than two sensors, though
`it’s hard to imagine a situation where you might need such a combination.
`
`Figure 4.i 5 Connecting Two Touch Sensors in an AND Configuration
`
`

`
`
`
`80
`
`Chapter 4 v Reading Sensors
`
`
`
`
`
`The other sensors (light, rotation, and temperature), don’t go together well
`when used on the same port. lf you combine any of them with others of the
`same or different kind, you will get unpredictable or useless results.There’s only
`one very significant exception to this rule:iYou can connect a light sensor and a
`touch sensor to the same port (when configured for a light sensor).This trick,
`suggested by Brian Stormont, works because the light sensor actually never reads
`more than about 90 percent, but when the touch sensor gets pressed, the reading
`jumps to 100 percent, allowing your code to detect the event. The only drawback
`is that you cannot read the light intensity while the touch sensor is closed. But
`there are many situations where the touch receives only short impulses, and by
`applying this trick, you conserve one ofyour input ports.
`
`Qther Sensors
`
`There are other kinds of sensors in the LEGO universe, but we won't discuss
`them in great detail because they are either difiicult to acquire or not very useful.
`The Cybermaster set (code 8482) includes three touch sensors that are very sim~
`ilar to the MINDSTORMS Variety, but that come in three flavors recognizable
`by the different colors of the buttons (see Figure 4.l6).Their transparent casing
`allows you to see the internal mechanism, which feature internal resistors of dif-
`ferent values. For this reason, in terms o£ravsLvaluekthey/returnrdifferent indi-
`vidual readings. This means you can wire them to the same port, and by reading
`the resulting raw value, determine which one was pressed.
`Figure 4.16 The Cybermaster Touch Sensors
`
`
`
`The LEGO DACTA line of products includes other sensors designed to
`survey weather conditions (like humidity) or other specific quantities. They are of
`no general use, and tend to be very expensive.
`Many people have developed their own designs when building custom sen-
`sors, and some of them are quite useful if you ’re open to adding nonoriginal parts
`to your system.\)Ve’ll return to this topic in Chapter 9.
`
`
`
`

`
`Reading Sensors - Chapter 4
`
`81
`
`If you want to learn more about how LEGO (and non—LEGO) sensors work,
`
`don’t miss the reference material in Appendix A, and be sure to check out
`Michael Gasperi’s site as Well. He is an authority in this field, having discovered
`many functional details himself, and so displays them in his Web site along with
`useful information collected from other people.
`
`Summary
`
`In this chapter, vve’ve introduced you to the world of sensors, four basic types in
`particular: touch, light, rotation, and temperature.Their basic behavior is easy to
`understand, but here you’ve discovered that if you want to get the very most out
`of them, you must study them in greater detail.The touch sensor, for example,
`seems to be a simple device, but with some clever Work on your part, it can
`become an important tool for counting clicks, or can make a good bumper.
`You were also introduced to the light sensor, a small piece of incredibly Versa-
`tile hardware, vvhich can act as a substitute for both the touch and rotation sen-
`
`sors vvith minimal effort. Together with the IR LED of the RCX, it makes
`proximity detection possible, a technique that allows your robot to avoid obstacles
`before it physically touches them.
`The rotation sensor will be your partner in the most sophisticated project of
`
`this book. Now you know how it Works, a

This document is available on Docket Alarm but you must sign up to view it.


Or .

Accessing this document will incur an additional charge of $.

After purchase, you can access this document again without charge.

Accept $ Charge
throbber

Still Working On It

This document is taking longer than usual to download. This can happen if we need to contact the court directly to obtain the document and their servers are running slowly.

Give it another minute or two to complete, and then try the refresh button.

throbber

A few More Minutes ... Still Working

It can take up to 5 minutes for us to download a document if the court servers are running slowly.

Thank you for your continued patience.

This document could not be displayed.

We could not find this document within its docket. Please go back to the docket page and check the link. If that does not work, go back to the docket and refresh it to pull the newest information.

Your account does not support viewing this document.

You need a Paid Account to view this document. Click here to change your account type.

Your account does not support viewing this document.

Set your membership status to view this document.

With a Docket Alarm membership, you'll get a whole lot more, including:

  • Up-to-date information for this case.
  • Email alerts whenever there is an update.
  • Full text search for other cases.
  • Get email alerts whenever a new case matches your search.

Become a Member

One Moment Please

The filing “” is large (MB) and is being downloaded.

Please refresh this page in a few minutes to see if the filing has been downloaded. The filing will also be emailed to you when the download completes.

Your document is on its way!

If you do not receive the document in five minutes, contact support at support@docketalarm.com.

Sealed Document

We are unable to display this document, it may be under a court ordered seal.

If you have proper credentials to access the file, you may proceed directly to the court's system using your government issued username and password.


Access Government Site

We are redirecting you
to a mobile optimized page.





Document Unreadable or Corrupt

Refresh this Document
Go to the Docket

We are unable to display this document.

Refresh this Document
Go to the Docket