Difference between revisions of "Lesson 13--Microduino "Light alarm (DIY a phototransistor by yourself)""

From Microduino Wiki
Jump to: navigation, search
(Vidoe)
 
(3 intermediate revisions by 3 users not shown)
Line 19: Line 19:
  
 
==Triode==
 
==Triode==
Triode is semiconductor device used to control current, its role is to amplifie weak signal into radial value larger electrical signals, and switch or voltage follow. Transistor has three poles, respectively called collector C(collector), base B(base),emitter E(emitter). Divided into NPN and PNP two types.
+
Triode is semiconductor device used to control current, its role is to amplifier weak signal into radial value larger electrical signals, and switch or voltage follow. Transistor has three poles, respectively called collector C(collector), base B(base),emitter E(emitter). Divided into NPN and PNP two types.
  
The deffience for commonly used triode, please refer:http://wenku.baidu.com/view/0fc3bc5077232f60ddcca1ae.html
 
Triode pin identification, please refer:http://wenku.baidu.com/view/3e636bb469dc5022aaea0098.html
 
  
 
This experiment use 9014 triode (NPN), with model number to his side, from left to right is E, B, C. As shown in figure:
 
This experiment use 9014 triode (NPN), with model number to his side, from left to right is E, B, C. As shown in figure:
Line 55: Line 53:
 
===Tone() function===
 
===Tone() function===
 
*Function:On a pin to create a specifies the square wave duty ratio is 50%.Duration can be specified, until the end of the call noTone (it).Function may impact the PWM output of pin 3 and 11.
 
*Function:On a pin to create a specifies the square wave duty ratio is 50%.Duration can be specified, until the end of the call noTone (it).Function may impact the PWM output of pin 3 and 11.
*Grammar:
+
*Grammar:
 
**tone(pin, frequency)  
 
**tone(pin, frequency)  
 
**tone(pin, frequency, duration)
 
**tone(pin, frequency, duration)
*Parameter:
+
*Parameter:
**pin:Audio output pin
+
**pin: Audio output pin
**frequency:Audio's frequency, the unit is HZ - int type
+
**frequency: Audio's frequency, the unit is HZ - int type
**duration:Duration for color, the unit is ms - long type(optional)
+
**duration: Duration for color, the unit is ms - long type(optional)
  
 
==Result==
 
==Result==
When there is a strong light, the buzzer sends dripping sound. DIY a phototriode.
+
When there is a strong light, the buzzer sends dripping sound. DIY a photo triode.
 +
 
 +
[[File:Lesson13.jpg|600px|thumbnail|center]]
  
 
==Vidoe==
 
==Vidoe==
 
|}
 
|}
 
 
  
 
https://www.youtube.com/watch?v=7IRSB3IV-n0
 
https://www.youtube.com/watch?v=7IRSB3IV-n0

Latest revision as of 07:25, 12 September 2016

Language: English  • 中文

Objective

LED used for indictor and using its the luminous effect, today we tested its another function of the photoelectric effect. The principle is that the LED light-emitting diodes creates a weak electric current in response to a strong light, we can use triode to enlarge it. When the value has changed with buzzer warning. The LED is used to achieve the purpose of the instructions.

Equipment

  • Microduino-Core
  • Microduino-FT232R
  • Other hardware equipment
    • Breadboard Jumper one box
    • Breadboard one piece
    • LED Light-emitting diodes one
    • 10k,1k resistor one
    • buzzer one
    • 9014 triode one
    • USB Data cable one

Triode

Triode is semiconductor device used to control current, its role is to amplifier weak signal into radial value larger electrical signals, and switch or voltage follow. Transistor has three poles, respectively called collector C(collector), base B(base),emitter E(emitter). Divided into NPN and PNP two types.


This experiment use 9014 triode (NPN), with model number to his side, from left to right is E, B, C. As shown in figure:

Lesson13-triode.jpg

Experimental schematic

Lesson13-schematic.jpg

This experiment use the voltage following connection that the trigger signal connect the base B, collector C to VCC, and emitter to GND, the output signal through a pulldown resistor to GND. If the base B has a weak current trigger, as the switch is opened, the current flows by C - B - E, emitter E voltage almost equals to the base voltage. The initial state light intensity is not enough, the electric current produced by the photoelectric effect is not enough to trigger, so triode disconnect, directly through the pulldown resistor to pull low voltage. When light intensity increased, the photoelectric effect produced by the electric current triode trigger conduction, but the voltage is very low, so it is difficult to consider the strength of the light, as long as there is voltage change is detected light effect, let the buzzer sound.

Program

void setup()
{ 
Serial.begin(115200);
}
void loop()
{
  int n=analogRead(A0);   //Read analog prot data        
  if(n>0)                 //The voltage changed,run the following program to generate pulse and let the buzzer sound
  {    
    tone(9, 1000);        
    delay(100);
    noTone(9);
  }
 Serial.println(n);
 delay(10);// Add a delay in serial monitor, otherwise the speed is to fast and esay to crash the system.
}

Tone() function

  • Function:On a pin to create a specifies the square wave duty ratio is 50%.Duration can be specified, until the end of the call noTone (it).Function may impact the PWM output of pin 3 and 11.
  • Grammar:
    • tone(pin, frequency)
    • tone(pin, frequency, duration)
  • Parameter:
    • pin: Audio output pin
    • frequency: Audio's frequency, the unit is HZ - int type
    • duration: Duration for color, the unit is ms - long type(optional)

Result

When there is a strong light, the buzzer sends dripping sound. DIY a photo triode.

Lesson13.jpg

Vidoe

https://www.youtube.com/watch?v=7IRSB3IV-n0