Project 8 Light-controlled Sound

1.Introduction

Photoresistor 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.

2.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

3.Connection Diagram

4.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 );
}

5.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.