Tyler CloudAustin Simmons
Published

The Range Hunter

For this project, a LIDAR Lite V3 range finder was used in order to get a range and send said range to an LCD screen via a Particle Photon.

IntermediateFull instructions provided4 hours742
The Range Hunter

Things used in this project

Hardware components

LIDAR-Lite V3HP
×1
Photon
Particle Photon
×2
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×1
680uF Capacitor 25V
×1
Resistor 1k ohm
Resistor 1k ohm
×2
5 mm LED: Red
5 mm LED: Red
Any color works!
×1

Software apps and online services

Atomiot.com

Story

Read more

Schematics

IOT Circuit Diagram

Code

Lidar Lite V3 HD CODE

C/C++
This is the code used to program the "Lidar Lite V3 HD" distance sensor. It tels the sensor to take a measurement and then publishes this to the cloud for later use.
unsigned long pulseWidth;
unsigned long dist;


void setup()

{

  Serial.begin(115200); // Start serial communications



  pinMode(D2, OUTPUT); // Set pin 2 as trigger pin

  digitalWrite(D2, LOW); // Set trigger LOW for continuous read


  pinMode(D3, INPUT); // Set pin 3 as monitor pin
  Particle.variable("dist", dist);
}



void loop()

{
    
    digitalRead(D7);
 
  //---------------------------------------
  pulseWidth = pulseIn(D3, HIGH); // Count how long the pulse is high in microseconds
  // If we get a reading that isn't zero, let's print it
            if(pulseWidth != 0)
     {
    
    pulseWidth = pulseWidth / 10; // 10usec = 1 cm of distance
    dist = pulseWidth;
    Serial.println(pulseWidth); // Print the distance
    Particle.publish("dist29753", String(pulseWidth));

    delay(5000);
        }
 //------------------------------------
    }  
  

LCD CODE

C/C++
This is the code used to gather information from the cloud and then display the data aquired on the LCD screen used in this project.
// This #include statement was automatically added by the Particle IDE.
#include <LiquidCrystal.h>

// This #include statement was automatically added by the Particle IDE.


LiquidCrystal lcd(5, 4, 3, 2, 1, 0);


//----------------------------------------------------------------------------

void setup() {
Serial.begin(115200);
    Particle.subscribe("dist29753", anything, "34001e000c47363330353437");
    
      lcd.begin(16, 2);
     lcd.print("cm");
   pinMode(D7, OUTPUT);
  }
//---------------------------------------------------------------------------

void loop(){
      digitalWrite(D7, HIGH);
   
}



//-----------------------------------------------------------------------------

void anything(const char *event, const char *data)
{
    
  lcd.setCursor(0, 0);
  lcd.print("dist: ");
lcd.print(data);
  lcd.setCursor(0, 1);
  lcd.print("cm");

delay(2000);
}

Credits

Tyler Cloud

Tyler Cloud

1 project • 1 follower
Austin Simmons

Austin Simmons

1 project • 1 follower
Thanks to John Robert McAlpine V.

Comments