Sensors are like our human senses. Sensors provide information to the computer
as our senses provide information to our brain.
In this exploration, you will learn to control the
motor, lamp, and sound element with information from sensors.
Turn on the computer and start the RoboLab
software. Connect the motor to output
port A, the lamp to output port B and the sound element to output port C.
Now look at the Control Lab Block itself Find the yellow
and blue input ports numbered 1 through 8 on the left side of the interface
box.
The yellow ports are numbered 1 through 4. The blue
ports are numbered 5 through 8.
Sensors connected to these ports can provide information
to the computer.
Find the yellow and blue sensors in the LEGO DACTA
Technology building set.
There are two categories of sensors provided with LEGO
DACTA Control Lab. The yellow sensors
connect to the yellow input ports and do not require any electrical power to
function. The blue sensors connect to
the blue input ports and do require electrical power to function.
The yellow (un-powered) sensors include a touch sensor and a temperature
sensor.

The blue (powered) sensors include an angle sensor and a light
sensor.

Each sensor has a connecting lead permanently connected
to it. Both the sensor and the end of
the connecting lead are colored either yellow or blue, corresponding to the
categories mentioned above.
Find the small notch or channel at the back end of each
sensor.
This channel gives the connecting lead wire a pathway if
the back end of a sensor is placed against another building element in a
model. The wire can go either up the
channel or down the channel.
Since the wire provides the electrical pathway in and out
of the sensor, none of the sensors have metallic studs or metal recesses. However, all of the sensors can be used as
building elements and can be incorporated into the structure of models.
Touch Sensor
A touch sensor asks the question, “Am I touching something?"
The answer can be "true" or "false"
Clip the end of the connecting lead of the yellow touch
sensor to input port 1.

Create a program that has the touch sensor with the arrow pointing in between
the two traffic lights. Touch sensors
are found in the Wait for functions pallet.
You must also assign a port to the touch sensor. Ports are found in the control lab
pallet.

Click on the white run arrow to begin the program.
In the Start CLI-1.vi window, click to put a check mark
in the view box.
A display of the Lego Control Lab Block will show with a
zero above the touch sensor.
The touch sensor connection you made in the program
corresponds to the actual sensor connection you made on the Control Lab
interface block.
Press the button on the touch sensor and observe the display above touch
sensor icon on the Control lab display screen.
When the button is pressed, the sensor and the interface
box send the word "true" or 1 to the computer.
Release the switch.
What happens?
The 1 “true” changes back to "false" or 0.
The touch sensor is an example of a binary device. It has only two states: “true" or 1 and
"false" or 0.
When you press the touch sensor, the number changes to a
1 meaning true the touch sensor is pushed in.
This means that the sensor and interface box are sending
"true" to the computer. When
you release the touch sensor button, a 0 meaning false is displayed meaning the
touch sensor is not touched. This means
that the sensor and interface box are sending "false" to the
computer.
The touch sensor interacts with Control Lab as if it
were forever answering the question, "Is the switch being pushed?"
The answer is "false" if the switch is not being pushed, and
"true" if the switch is being pushed.
Create a program to turn on Motor A for 4 seconds after
the touch sensor is pressed. Motor A
should stop after 4 seconds.
![]()
When you click the white arrow, nothing happens to the
motor. If you click view you see a 0
above the touch sensor and the program is forever checking to see if the touch
sensor is pressed. This means that
Control Lab is carrying out the instructions in that program.
Wait as long as you like, then press the touch
sensor. What happens?
The sensor touch1
reports "true" to the computer.
LEGO DACTA Control Lab turns on the motor and lets it run for 4
seconds. The waituntil touch sensor icon makes Control Lab wait until the touch
sensor icon reports "true." Then any commands following are carried
out.
Touch sensor Challenge
![]()
Experiment in a similar fashion with the touch sensor but replace the
motor with the lamp and the sound element.
Press the touch sensor to activate the lamp or motor.
Temperature Sensor
A temperature sensor reports the amount of heat it
senses at the metal end of its probe.
The RoboLab software automatically reports the heat in terms of the
Celsius scale.
Clip the connecting lead of the temperature sensor to input port 2 on the
Control Lab Block.
Drag a temperature sensor icon to input port 2 on the
Setup page.
This means that the RoboLab program is now expecting
that a "temp" sensor is connected to input port "2" on the
interface block.
Create a program that has the temperature sensor with the greater than
sign and the °F in between the two traffic lights.
Temperature sensors are found in the Wait for functions pallet.
Click on the white run arrow to begin the program.
In the Start CLI-1.vi window, click to put a check mark
in the view box.
A display of the Lego Control Lab Block will show with a
number above the temperature sensor. The
temperature sensor connection you made in the program corresponds to the actual
sensor connection you made on the Control Lab interface block.

A number appears over the temperature sensor icon on the
screen. Do not be concerned if your
number is not the same as the number shown above. The number indicates that the sensor and
interface box are sending temperature information to the computer. The number represents the temperature in
degrees Fahrenheit.
Gently grasp the metallic tip of the probe with your fingers to warm it
up.
In
a few moments, the number over the temperature sensor icon goes up, indicating
that the tip is now warmer than the surrounding air.
After
the temperature changes, release the probe.
Over
the next few minutes, the number goes down.
The probe absorbs heat quickly from direct contact with your skin. The air absorbs heat less quickly from the
probe.
This
is why it usually takes a little more time in this particular experiment for
the temperature reading to go down than to go up. To speed up the process we will use some cold
water.
lmportant:
Hold only the probe of the sensor in
the water. Do not submerge the whole
element.
Hold
the probe of the temperature sensor in the cup of cold tap water for a few
seconds and observe the results.
The
number above the temperature sensor icon decreases in response to the cold
water temperature.
Sensors
which can report specific values are called digital devices. Sensors which report a range of continuously
varying values are called analog devices.
The temperature sensor is actually an analog device, but the computer
can report its information only in specific values. Thus, the sensor and computer combination is
a digital system.
![]()
Select a number which is a few degrees
higher than the current temperature sensor reading and which you can obtain
with the heat from your fingers. Wire a Numeric Constant modifier from the
Modifier Pallet to the bottom right of the temperature sensor.
For
example, if the current reading is about 65, you could select 70.
Make
sure that the motor is still connected to output port A.
Create the following program.
Remember to substitute your number for 70.
Run
the program by clicking on the white run arrow.
Click on the view check box to observe the temperature change.
Warm
the metallic tip of the probe by grasping it again.
As
the temperature rises, the number above the temperature sensor icon on the
Setup page goes up. When it is greater
than the number you typed in, program Motor A turns on. This is how the thermostat works in an air
conditioning units.
Warm
the probe until it is at least 5 degrees warmer than the temperature that you
used in your program. Release the probe.
Quickly, before the temperature drops,
replace the icon with one that show the temperature less than. Run the program again. Remember to substitute your number for 70.
This example uses 70.
The “<”symbol means "less than."
Since the tip is no longer being warmed, its temperature
begins to drop. If it is dropping slowly
use the cold water to help speed things up.
When the temperature reading is less than the number you
typed in, the program, the motor should turn on for 4 seconds. This is how the thermostat works in a heating unit to
blow the warm air out.
The yellow temperature sensor has no moving parts. The metallic tip of the probe contains a
temperature sensing device. You can
submerge the probe in water (but not the brick part) to measure the
temperature. The temperature range for
the sensor is from –20 to +50 degrees Celsius or –4 to +140 degrees
Fahrenheit. This means you will be able
to measure the temperature of water as it freezes (0 degrees Celsius or 32
degrees Fahrenheit) but not the temperature of water as it boils (100 degrees
Celsius or 212 degrees Fahrenheit)
Temperature Sensor Challenge
Create a program that starts with the light on, waits
until the temperature reaches 75 degrees and then turns the light off.

Angle Sensor
Clip the connecting lead of the blue angle sensor to input port 7 on the Control
Lab Block.
Insert an axle through the + shaped hole in the angle sensor. Turn the axle slowly in one direction and
then in the other.
Drag an angle sensor icon on port 7 onto the program page.
The angle sensor icon remains on input port 7 means that
Robo Lab expects that an "angle" sensor is connected to input port
"7" on the interface box
The angle sensor connection you made on the Setup page corresponds to the
actual sensor connection you made on the Control Lab Block.
Create a program with an angle sensor icon attached to
port 7 as shown.
Gently grasp the axle and turn it slowly once more. What happens?
The angle sensor number changes as the axle moves.
The numbers represent the angle of turning. One complete turn is 16 units.
Now reverse the direction of your turning. What happens?
As you turn in one direction, the numbers increase. The numbers decrease when you turn in the
other direction. This means that the
angle sensor reports both the amount and the direction of turning. The angle sensor is a device which can report
a wide range of positive and negative rotation values.
Make sure that the sound element is still connected to
output port C and the touch sensor to port 1.
Angle Sensor Challenge
Create a program that waits until the angle sensor
reaches 50 and turn on a siren sound for 2 seconds.

Light Sensor
The light sensor can "see" reflected and
ambient light (the light in the room around the sensor)
Clip the connecting lead of the blue colored light
sensor to input port 8 on the Control Lab Block.
A small red light at the end of the light sensor begins
shining.
The actual light sensing mechanism is housed in the
clear window next to the red light on the sensor
The light sensor icon with the yellow hallo (wait for
Light to reach a certain level) on input port 8 means that Robo Lab expects
that a "light" sensor is connected to input port "8" on the
Control Lab Block.
The light sensor connection you made in the program corresponds
to the actual sensor connection you made on the interface box.
Create a program with a light sensor icon on input port 8.
Run the program and click the view check box to view the
value of the light sensor.
A number appears over the light sensor icon on the
screen. This means that the sensor and
interface box are sending numbers to the computer. The numbers represent the intensity of the
light.
Pick up the light sensor and point it very closely
toward these different color bricks (Yellow, Blue, Black and White ). Observe how the numbers change.
Fill in the table with the values that your light sensor
read for the different color bricks.
|
BRICKS |
INTENSITY
# |
|
Black |
|
|
Blue |
|
|
Yellow |
|
|
White |
|
What is the highest number you can produce?
What is the lowest?
In general, the more light that enters the sensor, the
higher the number it reports. Therefore,
light objects report higher numbers and darker objects report lower
numbers. The light sensor is a device
which can report a range of specific values for light intensity.
Light Sensor Challenge
Select a number about in the middle of all the numbers
you produced with the light sensor. The
example uses the number 35.
Make sure the lamp is still connected to output port B.
Place the light sensor in a dark area so that it reports
a low number.

Create a program that waits until the light sensor
reaches 35 and turns on a light for 4 seconds.
Move the light sensor slowly toward something giving off
more light.
Watch the light8 numbers as they increase.
When the light sensor number is greater than the
number you typed in, your program turns on the lamp.
Using Task Splits to run two tasks simultaneously

There are occasions where you want to run two completely different tasks
at the same time. To do this you need to
use a task split icon. Task split icons
are found in the structures pallet. Each
task that splits off will need its own separate end command (red traffic
light).
Create the following program that runs two separate procedures at the
same time.
The first procedure waits until the light sensor reads a
light darker than 35, turns on Lamp B for 2 seconds and then turns the light
off.
The second procedure waits until a touch sensor is
pressed turns on motor A for 6 seconds and then stops.
Notice that the light sensor and the touch sensor both
control separate tasks. Neither is
dependent on the other to run their part of the program. The light sensor can complete its program
minutes before the touch sensor is even pressed. The program continues to run until both tasks
have been completed.
Task
Create a program that runs two separate procedures at
the same time.
The first procedure turns on motor A until the rotation
sensor reaches 750 then turn off motor A.
The second procedure turns on lamp B until the
temperature sensor reaches 75 degrees, lamp B then turn off.
