Lesson 9 Light Sensitivity


Introduction

This experiment is a very interesting one – a DIY phototransistor. DIY phototransistors use the glow effect and photoelectric effect of LEDs. That is, LEDs will generate weak currents when some light is shined on it. And we use a transistor to amplify the currents generated, so the SunFounder Uno board can detect them.


Components

- 1 * SunFounder/Arduino Uno board

- 1 * Breadboard

- 1 * USB cable

- Jumper wires

- 1 * Passive buzzer

- 1 * Resistor (10KΩ)

- 1 * LED

- 1 * NPN Transistor S8050


Principle

LEDs not only have a glow effect, but also a photoelectric effect. They will generate weak currents when exposed to light waves

NPN consists of a layer of P-doped semiconductor (the "base") between two N-doped layers (see the picture above). A small current entering the base is amplified to produce a large collector and emitter current. That is, when there is a positive potential difference measured from the emitter of an NPN transistor to its base (i.e., when the base is high relative to the emitter) as well as positive potential difference measured from the base to the collector, the transistor becomes active. In this "on" state, current flows between the collector and emitter of the transistor.

There are three poles for the regions: base (b), emitter (e) and collector (c). They form two P-N junctions, namely the base-emitter junction and collector-base junction. The arrows in the NPN symbol (see the figure right) indicates the direction of the base-emitter junction.

The symbol of NPN is shown here. We can see the two PN junctions with unilateral conductivity inside, which enables it a switch component.

A 10kΩ pull-down resistor is attached to the transistor output stage in order to avoid analog port suspending to interfere with signals and cause misjudgment.

Experimental Procedures

Step 1: Build the circuit

Step 2: Program.

Use the code in the document below and copy/paste it into the Arduino Program on your computer:

Arduino code lesson 9

Step 3: Compile the code

Step 4: Upload the sketch to the SunFounder Uno board


Now, you can hear the buzzer make sounds when the LED is shined.