Jorge MarreroMarco MedinaDaniyal Latif

Lane of Things Group 708

Our group used a proximity sensor placed near a door to see how many people go in and out of the attendance office.

BeginnerFull instructions provided5 hours250
Lane of Things Group 708

Things used in this project

Hardware components

PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
Particle Photon
Breadboard (generic)
Breadboard (generic)
Jumper wires (generic)
Jumper wires (generic)

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)


Read more

Custom parts and enclosures

Enclosure Case Plans

Illustrator file for our enclosure which can be laser cut to create the enclosure that we used.


Fritzing Diagram

Fritzing diagram of our device. It includes the breadboard, the photon, the motion sensor and where each wires should go.


Code for PIR Motion Sensor

This is the code that we used for our project which is done in
// This #include statement was automatically added by the Particle IDE.
#include <SparkFunPhant.h>
int ledPin = 7;                // choose the pin for the LED
int inputPin = 0;               // choose the input pin (for PIR sensor)
int pirState = HIGH;             // we start, assuming no  detected
int count = 0;
int val = 0;
int value1 = 0;
int value2 = 0;
const char server[] = ""; // Phant destination server
const char publicKey[] = "n14Zx31l5mtK19j4m97j"; // Phant public key - HAS TO BE CHANGED
const char privateKey[] = "MoM7WxopDVCM8426Z472"; // Phant private key  - HAS TO BE CHANGED
Phant phant(server, publicKey, privateKey); // Create a Phant object
const int POST_RATE = 3000; // Time between posts, in ms.
unsigned long lastPost = 0;
void setup() {
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input

void loop(){
  int val = digitalRead(inputPin);  // read input value
  if (val == HIGH) { 
      // check if the input is HIGH
    digitalWrite(ledPin, HIGH);// turn LED ON
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;


 // global variable to keep track of last post time
    //Replace the if statement below with whatever your trigger is

int postToPhant()
    // Use phant.add(<field>, <value>) to add data to each field.
    // Phant requires you to update each and every field before posting,
    // make sure all fields defined in the stream are added here.
    phant.add("motion", val);
    phant.add("count", count);
    TCPClient client;
    char response[512];
    int i = 0;
    int retVal = 0;
    if (client.connect(server, 80)) // Connect to the server
		// Post message to indicate connect success
		// will return a string formatted as an HTTP POST.
		// It'll include all of the field/data values we added before.
		// Use client.print() to send that string to the server.
		// Now we'll do some simple checking to see what (if any) response
		// the server gives us.
        while (client.available())
            char c =;
            Serial.print(c);	// Print the response for debugging help.
            if (i < 512)
                response[i++] = c; // Add character to response string
		// Search the response string for "200 OK", if that's found the post
		// succeeded.
        if (strstr(response, "200 OK"))
            Serial.println("Post success!");
            retVal = 1;
        else if (strstr(response, "400 Bad Request"))
        {	// "400 Bad Request" means the Phant POST was formatted incorrectly.
			// This most commonly ocurrs because a field is either missing,
			// duplicated, or misspelled.
            Serial.println("Bad request");
            retVal = -1;
			// Otherwise we got a response we weren't looking for.
            retVal = -2;
    {	// If the connection failed, print a message:
        Serial.println("connection failed");
        retVal = -3;
    client.stop();	// Close the connection to server.
    return retVal;	// Return error (or success) code.


Jorge Marrero

Jorge Marrero

1 project • 1 follower
Marco Medina

Marco Medina

1 project • 0 followers
Daniyal Latif

Daniyal Latif

1 project • 0 followers