Vous êtes sur la page 1sur 5

Efan Altaee

Chapter 6 Summary
This chapter focused on using a pair of light
sensors to detect bright light and shade for robot
navigation. Lots of interesting electronics concepts
and programming techniques come into play.
Electronics
What a phototransistor is, and how to identify
its base, emitter and collector

The amount of current it allows to pass into its


collector and out through its base.

What wavelengths are in the ultraviolet, visible,


and infrared spectrums

The phototransistors collector and emitter


terminals are connected to leads.

What is meant by ambient light

The lead thats closer to the flat spot is the emitter.


The lead thats further away from the flat spot is
the collector.

What the difference is between a binary sensor


and an analog sensor

The wavelength of red is closer to the wavelength


of infrared, so it should be more sensitive to red
What Ohms Law is, and how to use it to select
a resistor to adjust the phototransistor circuits
voltage response

VA3 increases with more light.

Using a phototransistor as a simple binary


sensor in a voltage output circuit

The phototransistor supplies the resistor with more


or less current.

What a capacitor is, and how small capacitors


for breadboard circuits are labeled in units of
picofarads

Change the 2 k resistor to a higher value.

Using a phototransistor as an analog sensor in


a resistor-capacitor charge-transfer circuit, also
called a QT circuit

If the applied voltage is above the threshold


voltage, the input register bit for that pin stores a
1. If its below threshold voltage, the input register
bit stores a 0.

What it means when components are


connected in serial vs. connected in parallel

The voltage decreases.

Programming
How to use the Arduinos analogRead function
to take a voltage measurement from an analog
sensors output
You do by using this code:
/*
* Robotics with the BOE Shield - Chapter 6,
Project 1
* Chirp when light is above threshold. Will
require updating value of
* threshold & retesting under bright light to get
to the right value.
*/

void setup() // Built-in initialization


block
{
tone(4, 3000, 1000); // Play tone for 1
second
delay(1000); // Delay to finish tone
}

void loop() // Main loop auto-


repeats
{
if(volts(A3) > 3.5) // If A3 voltage
greater than 3.5
{
tone(4, 4000, 50); // Start chirping
delay(100);
}
}

float volts(int adPin) // Measures volts


at adPin
{ // Returns floating point
voltage
return float(analogRead(adPin)) * 5.0 / 1024.0;
}
How a sketch can measure voltage decay time
from a resistor-capacitor circuit to take a
measurement from an analog sensor
The solution for this one is to make a copy of
LightSeekingShieldBot, and add one command to
the loop function: ndShade = -ndShade.
How to use the Arduinos constrain function to
set upper and lower limits for a variable value
Use LightSensorValues to determine a threshold.
Its best to take tLeft + tRight. You can use the
LightSensorValues to test this.

Vous aimerez peut-être aussi