Project in progress
Laser Measurements Controlled by Arduino Nano

Laser Measurements Controlled by Arduino Nano © GPL3+

This project checks measurements automatically using lasers.

  • 2,744 views
  • 2 comments
  • 5 respects

Components and supplies

Ard nano
Arduino Nano R3
you can use your favorite Arduino - also Uno - no WIFI necessary
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
09590 01
LED (generic)
1x red, 1x yellow, 1x green
×1
Mfr 25fbf52 221r sml
Resistor 221 ohm
to protect the 3 LEDs
×3
Adafruit industries ada1536 image
Buzzer
×1
Laser-Diode 5 V DC red Transmitter Sensor
×1
Adafruit industries ada161 image 75px
Photo resistor
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
to protect the Photo-resistor
×1

Apps and online services

About this project

Background

A small company for plastic injection molding has produced over 6000 articles for a refrigerator branding. It was then necessary to find out whether the entire batch could be handed over to the customer, or whether there were articles which did not comply with the specifications, and were to be sorted out.

For this purpose, favorable employees had been hired: they took the articles individually into their hands and assessed the standard with analog measurement methods.

Ideation

When my friend told me, the idea of ​​a light barrier was born: with the help of a laser beam the specification could be checked. Articles that do not interrupt the laser beam are in the standard. Articles which slightly touch the laser beam are within the tolerance limit and articles interrupting the laser beam are sorted out as rejects.

A photocell can also be used in the area of ​​censuses and alarm systems.

Implementation

Here is the implementation in detail: the laser beam is switched permanently and hits a photo-resistor. The values ​​read by the photoresistor can be evaluated and corresponding triggers for the switching of LEDs and buzzer can be used.

If you play with the construction, you can also try a marble to break the photo-resistors. You can also use a mirror to direct the laser beam around the corner. Here, many applications are conceivable.

int threshold = 170;        // if direct Laser Light on photo-resistor we got values between 156-169 bei 10k Resistor without a marble 
int threshold_border = 180; // slight deviation / geringe Abweichung - falls Laser nur geringfügig gestreift wird 
int count_yellow = 0;       // Counter for the Thresholds 
int count_red = 0;          // Counter for the Thresholds 
 pinMode(7,OUTPUT);  // yellow control LED 
 pinMode(8,OUTPUT);  // green control LED 
 pinMode(9,OUTPUT);  // Laser 
 pinMode(10,OUTPUT); // red control LED 
 pinMode(11,OUTPUT); // Buzzer 
 pinMode(A0,INPUT);  // 10k Photo-Resistor 

You can use the serial monitor to check the determined values and adjust the two threshold values according to your requirements. A counter is also carried along: after all, the number of the committee at the end of the quality inspection (or the number of visitors to an event or the crossing of bees before a beehive) is of interest.

Results

The influence of ambient light on the photoresistor could not be ascertained in the experimental setup: it constantly measured values whether in a bright or darkened room. A check, whether a short distance, also many meters with the laser beam could be bridged did not take place: presumably stands nothing in the way. The shining of neighbor's plot several meters away in the night on his white wall worked well. Note that you will not perceive the transmitted light from the laser on the track to the photo-resist as such.

I am very glad that my first test with a laser (here I had annoyed my cat, check point F.) has now led to a meaningful purpose.

Conclusions

Like my description? You will find more under my account. Follow me to be notified when I publish new projects! Here is my Paypal link. You can also send me sensors, which I like to look at sometimes.

Code

MyLight-BarriereC/C++
v1.0
// Ingo Lohs, Arduino Uno/Nano, Photo-Resistor, Laser, 3 LEDs green, yellow, red, breadboard, jumper, 3x 220 Ohm to protect LEDs
// Lichtschranke v1.0
// 07.07.2017  

int threshold = 170;        // if direct Laser Light on photo-resistor we got values between 156-169 bei 10k Resistor without a marble
int threshold_border = 180; // slight deviation / geringe Abweichung - falls Laser nur geringfügig gestreift wird
int count_yellow = 0;       // Counter for the Thresholds
int count_red = 0;          // Counter for the Thresholds

void setup() {
  pinMode(7,OUTPUT);  // yellow control LED
  pinMode(8,OUTPUT);  // green control LED
  pinMode(9,OUTPUT);  // Laser
  pinMode(10,OUTPUT); // red control LED
  pinMode(11,OUTPUT); // Buzzer
  pinMode(A0,INPUT);  // 10k Photo-Resistor
  Serial.begin(9600);
  delay(5000);        // settle the Photo-Resistor
}

void loop() {
 
    digitalWrite(9,HIGH);              
    
    int sensorValue = analogRead(A0); 
    //Serial.println(sensorValue);

 if ((sensorValue >= threshold) && (sensorValue <= threshold_border)) {  // direct Laser Light = 156-160 bei 10k Resistor ohne Murmel
   count_yellow++;
   Serial.print("interrupted by value: ");
   Serial.print(sensorValue);
   Serial.println(" yellow");
   Serial.print("yellow-Counter: ");
   Serial.println(count_yellow);
   digitalWrite(8, LOW);   // turn the green LED off
   digitalWrite(7, HIGH);   // turn the red LED on 
   //digitalWrite(11, HIGH);  // Buzzer on
   delay(500);                       // wait for a second
   digitalWrite(7, LOW);    // turn the red LED off 
   //digitalWrite(11, LOW);     // Buzzer off
 } else if (sensorValue > threshold_border)
 {
   count_red++;
   Serial.print("interrupted by value: ");
   Serial.print(sensorValue);
   Serial.println(" red");
   Serial.print("red-Counter: ");
   Serial.println(count_red);
   digitalWrite(8, LOW);   // turn the green LED off
   digitalWrite(10, HIGH);   // turn the red LED on 
   digitalWrite(11, HIGH);  // Buzzer on
   delay(500);                       // wait for a half-second
   digitalWrite(10, LOW);    // turn the red LED off 
   digitalWrite(11, LOW);     // Buzzer off
 } else
 {
   digitalWrite(8, HIGH);   // turn the green LED on 
 }
  
}

Comments

Similar projects you might like

Create a People Counter Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 3,064 views
  • 2 comments
  • 7 respects

Arduino Laser Tripwire

Project tutorial by Ian Cumming

  • 14,683 views
  • 9 comments
  • 47 respects

Arduino Nano LCD Stopwatch Without Potentiometer

Project tutorial by TechWithZan

  • 5,173 views
  • 9 comments
  • 14 respects

Motor controlled with Arduino

by Benjamin Larralde

  • 18,249 views
  • 20 comments
  • 48 respects

Arduino Nano and Visuino: Infrared Remote Controlled Relay

Project tutorial by Boian Mitov

  • 2,688 views
  • 0 comments
  • 15 respects

PIR-Sensor Activated RGB Strip Controlled by Uno R3

Project showcase by Ingo Lohs

  • 1,499 views
  • 0 comments
  • 5 respects
Add projectSign up / Login