Activities/TurtleArt/Tutorials/Turtle Sensors Tutorial gci2012

From Sugar Labs
Jump to navigation Jump to search

Turtle Art with Sensors

Created during Google Code In 2012


Sensors are used to measure the temperature, soil moisture, water salinity, AC/DC amps, etc. Sensors also have different modes. Some of the modes include, voltage mode, resistance mode, pitch mode etc. Sensors are used to build interesting things some examples are carbon microphones, doorbells/ burglar alarms, photovoltaic panels, etc. Sensors are also used to connect to microscopes, telescopes, and many, many more things. All these sensors can be accessed through Turtle Art.

Types of Sensors

Humidity Sensor

Construir Sensor Luz


Light Sensor

Magnetic Sensor

Switch Sensor

Temperature Sensor



Hands on Example: Graphing the Loudness of Your Voice

1. Start Turtle Art.

2. Put a pen up block, after start.

3. Then have a x/y block. In the x spot put a blue left block, which can be found under the screen symbol. In the y spot have a 0 block.


4. A pen down block should follow.

5. Next comes the repeat block. Connect a width block to it. The width block is found under the screen symbol as well.

6. Inside the repeat put another x/y block. In the x input connect a xcor block which can be found under the turtle. In the y input connect a loudness block that can be found under the wire symbol.


7. Then have a blank block. This block can be found under the repeat symbol.


8. Connect yet another x/y block. In the x input connect a + block. This block will be found under the 123+-= symbol.For the top value on the + block connect a xcor block. For the bottom value connect a number block with a 1.

9. For the y value on the x/y block connect s ycor block. Your blocks should look like this:

10. Test your sensor. Hit start and talk to your computer. Your graph should look something like this:

How to Build a Sensor

Temperature Sensor


A soldering iron
Wire cutter/stripper
Insulating tape
A LM35D temperature sensor
A 3 mm audio jack
A USB cable or a USB connector


First separate your audio jack. Then cut two pieces of wire and strip them on both ends. Make a knot in one of the wires; this is so you know which wire is which. Solder one wire to the central terminal, the other to the outer terminal. Take your USB cable and cut it in the middle. You only need the black and red wires in the USB cable. To connect your temperature sensor, connect the rightmost leg when the flat side is facing you, to the black wire. Then connect the wire that is connected to the outer terminal. Connect the leftmost leg of the sensor to the red wire. Apply insulation tape over both connections. Connect the wire that is connected to the central terminal to the middle leg of the temperature sensor. Insert the audio jack into the pink input and insert the USB into the USB input. Your temperature sensor is ready to go.

Using Sensors in Art

1. Start Turtle Art.

2. Put the clean block right after start. This will clear the screen.

3. Then put a right block with 90 for the angle.

4. Get the forever block from Flow Operators palette.

5. Now attach a left 90 block.s

6. Then connect a forward block. The forward block should be attached to a loudness block that is found under the wire symbol.


7. Then add a right 270 block, followed by a forward loudness block. The end result should look like this: 8. Test your sensor. To test it click start and speak. The turtle should run all over the place, graphing your voice. Note how the turtle makes a longer line when your voice is louder. Your screen should look something like this when you are done testing it.

Scientific Sensor Application

You can use a LDR or Light Dependant Resistor to measure your pulse. A LDR is a sensor because it senses light and uses it to work. You will have to put a Cartesian block after the start block. Then connect a forever block, followed by a clean block. Connect a pen up block, followed by an x/y block. For the x input you will need a –600 block, in the y input you will need a 0 block. Then connect a pen down block, followed by a repeat block. The repeat block should be connected to a 1200 block. After the repeat block should be an x/y block. For the x input you should have a + block. Connect the top of the + block to an xcor, connect the bottom to a 1 block. For the y input you should have a – block. Connect the top of the – block to a resistance block. The bottom should be connected to a 3000 block. To test your sensor, cover the LDR with your fingertip and hold near a bright light. Your test should look something like this:

Sensors Applied


Voltage Mode

Resistance Mode

Pitch Mode

Sound Mode

Volume Mode


Measuring Temperature

Measuring Soil Moisture

Measuring Water Salinity

Measuring AC Amps

Measuring power

Measuring DC Amps

Here are some interesting usages of sensors:


Graphing Pitch and Volume