5% OFF Over $19, Code: Elephant5; 10% OFF Over $59, Code: Elephant10

ARDUBLOCK Project 8: Light-controlled Sound

Posted by Fiona Su on

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()

void loop()
  _ABVAR_1_val = analogRead(0) ;
  tone(8, _ABVAR_1_val);
  delay( 500 );

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

Buy it >> ARDUBLOCK Graphical Programming Starter Kit for Arduino


Leave a comment

Please note, comments must be approved before they are published