Introduction:
Photovaristor is a resistor using the photoelectric effect of a semiconductor. Its resistance changes along with the intensity of the incident light, the greater the intensity, the lower the resistance, the less the intensity, the higher the resistance. It has wide application in various light-controlled circuits, such as lighting control, regulation, light-controlled switch etc.
In this project, we use graphical programming to display analog value of illumination intensity measured by photovaristor. And set this value as frequency of sound production.
Materials Required:
- 1. KEYESTUDIO UNO Control Board *1
- 2. V5 Sensor Shield*1
- 3. Photovaristor Module*1
- 4. Photovaristor Module
- 5. Female to Female Dupont Line*6
Connection Diagram:
After wiring, we can start programming.
In this project, we apply similar method in "reading analog value". Directly connect the photovaristor to analog port. The analog value varies with the intensity of light and controls the sound frequency produced by passive buzzer.
Click “download to Arduino” to see the following codes in IDE interface:
Sample Code:
***************************************************************************** int _ABVAR_1_val = 0 ; void setup() { Serial.begin(9600); } void loop() { _ABVAR_1_val = analogRead(0) ; Serial.print("light:"); Serial.print(_ABVAR_1_val); Serial.println(); tone(8, _ABVAR_1_val); delay( 500 ); } *******************************************************************************
Result:
After downloading the program, have a kook at the value of serial monitor.
The value indicates the light intensity, and the larger the value, the stronger the light intensity. Meanwhile, the value belongs to the sound frequency produced by passive buzzer.
All Projects
- ARDUBLOCK Graphical Programming Starter Kit Tutorial
- ARDUBLOCK Project 1: LED Blinking
- ARDUBLOCK Project 2: PWM Regulating Light Brightness
- ARDUBLOCK Project 3: Flowing Light
- ARDUBLOCK Project 4: Button-controlled LED
- ARDUBLOCK Project 5: Passive Buzzer Sound Production
- ARDUBLOCK Project 6: Active Buzzer Sound Production
- ARDUBLOCK Project 7: Reading-out Analog Value
- ARDUBLOCK Project 8: Light-controlled Sound
- ARDUBLOCK Project 9: Sound-controlled Light
- ARDUBLOCK Project 10: Servo Motor Control
- ARDUBLOCK Project 11:Ultrasonic Distance Measurement
- ARDUBLOCK Project 12:PS2 Joystick Module
- ARDUBLOCK Project 13: LM35 Temperature Sensor
- ARDUBLOCK Project 14: 5V Relay Module
- ARDUBLOCK Project 15: Tilting Switch Module
- ARDUBLOCK Project 16: Capacitive Touch Module Control LED
- ARDUBLOCK Project 17: Flame Alarm Module
- ARDUBLOCK Project 18: Reed Switch Module
- ARDUBLOCK Project 19: Human Body IR Pyroelectricity
- ARDUBLOCK Project 20: Line Tracking Sensor
- ARDUBLOCK Project 21: MQ-2 Combustible Gas and Smoke Sensor
- ARDUBLOCK Project 22: Soil Module
Buy it >> ARDUBLOCK Graphical Programming Starter Kit for Arduino