Henry ZisesCesar SieteEdwin Campos
Published

LofT Laser Trip Project

Our spinoff on the Array of Things project, making a laser to track the activity level of areas in a high school.

BeginnerProtip2 hours891
LofT Laser Trip Project

Things used in this project

Hardware components

Photon
Particle Photon
×1
Photo resistor
Photo resistor
×1
Breadboard (generic)
Breadboard (generic)
×1
Adafruit Laser Diode - 5mW 650nm Red
×1
Adafruit Female DC Power adapter - 2.1mm jack to screw terminal block
×1
CableDeconn USB to 5.5 mm/2.1 mm 5 Volt DC Barrel Jack Power Cable
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
MakerCase
Adobe Illustrator CC
Maker service
IFTTT Maker service
Google Sheets
Google Sheets

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)

Story

Read more

Custom parts and enclosures

Main Enclosure

Laser Enclosure

Schematics

Frizting Diagram

March 9th, 2017

Code

Main Code

Arduino
int boardLed = D7;
int photoresistor = A0;
int power = A5;
int intactValue;
int brokenValue;
int beamThreshold;
bool beamBroken = false;

void setup() {
  pinMode(boardLed,OUTPUT);
  pinMode(photoresistor,INPUT);
  pinMode(power,OUTPUT);
  digitalWrite(power,HIGH);

  digitalWrite(boardLed,HIGH);
  delay(2000);

  digitalWrite(boardLed,LOW);
  digitalWrite(led,HIGH);
  delay(500);

  int on_1 = analogRead(photoresistor);
  delay(200);
  int on_2 = analogRead(photoresistor); 
  delay(300);

  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);

  digitalWrite(boardLed,HIGH);
  delay(2000);

  digitalWrite(boardLed,LOW);

  int off_1 = analogRead(photoresistor);
  delay(200);
  int off_2 = analogRead(photoresistor);
  delay(1000);

  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);
  delay(100);
  digitalWrite(boardLed,HIGH);
  delay(100);
  digitalWrite(boardLed,LOW);


  intactValue = (on_1+on_2)/2;
  brokenValue = (off_1+off_2)/2;

  beamThreshold = 2000;

}

void loop() {
  if (analogRead(photoresistor)>beamThreshold) {
    if (beamBroken==true) {
        Particle.publish("beamStatus","intact",60,PRIVATE);

        digitalWrite(boardLed,HIGH);
        delay(500);
        digitalWrite(boardLed,LOW);
        beamBroken=false;
    }
    else {
    }
  }

  else {
      if (beamBroken==false) {
        Particle.publish("beamStatus","broken",60,PRIVATE);

        digitalWrite(boardLed,HIGH);
        delay(500);
        digitalWrite(boardLed,LOW);
        beamBroken=true;
      }
      else {
      }
  }

}

Organizing Dates and Times

Java
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Enter a sentence:");
        String dt = "";
        int hour = 0;
        String am = "";
        int twelve = 0;

        int numberOfRows = 0; //Input whatever number you may have
        for(int i = 1; i < numberOfRows; i++){
              dt = scanner.nextLine();
              
              //We used this for when the dates looked something like this --> (April 5, 2017 at 08:22AM)
              //We also did not have any times that happened between midnight and 1PM either
              /*hour = (Integer.parseInt(dt.substring(17,19))) + 12;
              am = dt.substring(22,24);
              twelve = Integer.parseInt(dt.substring(17,19));
              if((am.equals("AM"))){
                System.out.println("4/0" + dt.substring(6,7) + "/17 " + dt.substring(17,19) + ":" + dt.substring(20,22) + ":00");
              }else if(twelve == 12){
                System.out.println("4/0" + dt.substring(6,7) + "/17 " + "12" + ":" + dt.substring(20,22) + ":00");
              }else{
                System.out.println("4/0" + dt.substring(6,7) + "/17 " + hour + ":" + dt.substring(20,22) + ":00");
              }*/
              
              
              //We used this for when the dates looked something like this --> (April 25, 2017 at 08:22AM)
              //We also did not have any times that happened between midnight and 1PM either
              /*
              hour = (Integer.parseInt(dt.substring(18,20))) + 12;
              am = dt.substring(23,25);
              twelve = Integer.parseInt(dt.substring(18,20));
              if((am.equals("AM"))){
                System.out.println("4/" + dt.substring(6,8) + "/17 " + dt.substring(18,20) + ":" + dt.substring(21,23) + ":00");
              }else if(twelve == 12){
                System.out.println("4/" + dt.substring(6,8) + "/17 " + "12" + ":" + dt.substring(21,23) + ":00");
              }else{
                System.out.println("4/" + dt.substring(6,8) + "/17 " + hour + ":" + dt.substring(21,23) + ":00");
              }*/
         }
    }
}

Credits

Henry Zises

Henry Zises

3 projects • 1 follower
Cesar Siete

Cesar Siete

3 projects • 1 follower
Edwin Campos

Edwin Campos

3 projects • 2 followers

Comments