User Tools

Site Tools


project:laser_light_sensor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
project:laser_light_sensor [2015/06/26 01:20]
dp [List of components]
project:laser_light_sensor [2015/07/14 13:17] (current)
dp [Light diffuser]
Line 1: Line 1:
 ====== Laser/light sensor ====== ====== Laser/light sensor ======
-Aim of the project is to build lightweight laser/light sensor that can be mounted on quadcopter and used for gaming purposes. Sensor reads environmental light level via LDR, and sets the threshold below it. Any significant change in the light level will trigger the LED-s. Sensor will be used for the Dronosphere workshop and performance.\\ +Aim of the project is to build lightweight laser/light sensor that can be mounted on quadcopter and used for gaming purposes. Sensor reads environmental light level via LDR, and sets the threshold below it. Any significant change in the light level will trigger the LED-s. Sensor will be used for the [[http://radiona.org/dronosfera-dronosphere/|Dronosphere]] workshop and performance.\\ 
-{{:draft:light_sensor_1.jpg?direct&100|}} +{{:light_sensor_1.jpg?direct&100|}} 
-{{:draft:light_sensor_2.jpg?direct&100|}}+{{:light_sensor_2.jpg?direct&100|}}
 ==== List of components ==== ==== List of components ====
   * 1 Arduino Uno (or Duemilanove with an ATmega328)   * 1 Arduino Uno (or Duemilanove with an ATmega328)
Line 17: Line 17:
  
 ===== Arduino ===== ===== Arduino =====
-It's recommended to test the circuit on Arduino first. You will have serial monitor available and you will be able to read LDR readings and further fine-tune the code or components. +It's recommended to test the circuit on Arduino first. You will have serial monitor available and will be able to see LDR values and further fine-tune the code or components.
- +
-==== Arduino Uno schematic ====+
  
 +==== Arduino schematic ====
 +{{:ldr.png?direct&300|}}
 ==== Arduino code ==== ==== Arduino code ====
  
Line 57: Line 57:
       delay(50);       delay(50);
     }     }
-    delay(3000);+    delay(1000);
     threshold = analogRead(LDR) - sensitivity; // set light sensitivity threshold     threshold = analogRead(LDR) - sensitivity; // set light sensitivity threshold
 +    delay(1000);
   }   }
   else   else
Line 68: Line 69:
  
  
-===== ATtiny (shrinkifying sensor) ===== +===== ATtiny (shrinking the sensor) ===== 
-Now that we have tested everything, we can go on and move it to ATtiny microcontroller (tested on ATtiny45, ATtiny85), which has significantly smaller profile its cheaper and works on 3V. +Now that we have tested everything, we can port it to ATtiny microcontroller (tested with ATtiny45, ATtiny85), which has significantly smaller profileits cheaper and works on 3V. 
  
 ==== Programming an ATtiny with Arduino ==== ==== Programming an ATtiny with Arduino ====
 +Follow this instructions:
   * http://highlowtech.org/?p=1695   * http://highlowtech.org/?p=1695
-  * http://highlowtech.org/?p=1706+ 
 +{{:arduino_attiny.png?nolink|}} 
 + 
 +==== Connect LDR, LED and power ==== 
 +{{:attiny45-85.png?nolink|}}
  
 ==== ATTiny code ==== ==== ATTiny code ====
  
 <file c laser_light_sensor_ATtiny.ino> <file c laser_light_sensor_ATtiny.ino>
-#define LDR A1          // analog pin to which LDR is connected +#define LDR A1              // analog pin to which LDR is connected 
-int LDRValue = 0;       // that’s a variable to store LDR values +#define LED 1               // pin to which LED is connected 
-#define LED 1           // LED pin +const int sensitivity = 40; // setting the light sensitivity 
-int light_sensitivity // sensitivity treshold + 
-float voltage;+int LDRValue = 0;           // variable to store LDR values 
 +int threshold             // light sensitivity threshold
  
 void setup() void setup()
 { {
-  pinMode(LED, OUTPUT); +  pinMode(LED, OUTPUT);                       // configure LED pin to behave as output 
-  light_sensitivity = analogRead(LDR)-40  // setting sensitivity treshold level+  threshold = analogRead(LDR) - sensitivity // set light sensitivity threshold
 } }
  
 void loop() void loop()
 { {
-  LDRValue = analogRead(LDR);       // read LDR value +  LDRValue = analogRead(LDR);                 // read LDR value 
-  if (LDRValue < light_sensitivity+ 
-  {  +  if (LDRValue <= threshold                 // if the LDR reading is lower than the threshold 
-    digitalWrite(LED, HIGH);  +  { 
-    delay(3000);  +    for (int i = 0; i <= 50; i++) {           // blink LEDs 
-    digitalWrite(LED, LOW); +      digitalWrite(LED, HIGH); 
-    delay(1000); +      delay(50); 
 +      digitalWrite(LED, LOW); 
 +      delay(50); 
 +    } 
 +    delay(1000); 
 +    threshold = analogRead(LDR) - sensitivity; // set light sensitivity threshold 
 +    delay(1000);
   }   }
   else   else
Line 106: Line 119:
 } }
 </file> </file>
-===== Putting it all together =====+===== Putting everything together =====
  
 ==== Stripboard ==== ==== Stripboard ====
 +Cut the these lines on the stripboard (this is underside view).\\
 +{{:light_sensor_stripboard_2.png?nolink&200|}}
 +
 +... and soldier all other components\\
 +{{:light_sensor_stripboard_1.png?direct&500|}}
 +
 +==== Light diffuser ====
 +Cover the LDRs with semi-transparent material to act as light diffuser. Doing this will make sensor sensitive over bigger area. Also leave enough space between LDRs and diffuser for light to spread. You can use ping pong ball, or ball from vending machine.
    
-===== Other tips =====+===== Tips =====
   * Sensor works best in low-light conditions    * Sensor works best in low-light conditions 
-  * Recalibrate the sensor on every significant ambient light change on occasions. Do that by lighting it or removing battery+  * Recalibrate the sensor on every ambient light change 
-  *  +  * Recalibrate by triggering it or by removing battery
  
 ===== Rasources and links ===== ===== Rasources and links =====
project/laser_light_sensor.1435274405.txt.gz · Last modified: 2015/06/26 01:20 by dp