User Tools

Site Tools



This stage involves the following new components.

Excited by Light

We are now going to start on our first real sensor - the light sensor!

The light sensor we are using is called a Light Dependent Resistor (LDR). Its resistance changes based on the brightness of light shining on it. The brighter the light the lower the resistance.

Using the Arduino's analog input pins we can get a measure of the light levels in our program, and use it to change the way our LEDs flash.

  • Create your voltage divider circuit as shown in the below diagram. The voltage output is made to Arduino analog input A1. Two 10K Ohm resistors in parallel results in a suitable 5K resistance.

  • Change your Arduino program to read the value on A1 instead of A0 and upload it. Now, instead of the rotation sensor determining the flashing speed/which lights which are on, the light levels on the light sensor will.
challenge_yourself.jpg Harder
(1) When the delay is long because there's a lot of light, you'll probably notice that it takes a long time for the Arduino to react to the lights being switched off for example. This is because your code isn't running while it's delaying and so it can't shorten the current delay if the environment changes. Can you fix that?

Making sound with Light

By following this sound tutorial you'll create a light controlled noise machine (the tutorial refers to a 4.7k resistor, use two 10K resistors in parallel as you did above).

Tip: If your breadboard is getting a bit crowded then remove a few of the LEDs for the time being.

challenge_yourself.jpg Easier
(1) Change the program to use the potentiometer instead of the LDR to change the tone.

Next Stage

Congratulations. Now you can go onto the next stage. Stage 4!.

workshops/arduino_for_the_curious/stage_3.txt · Last modified: 2017-04-10 11:30 by Simon

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki