Particle

IN DEVELOPMENT AND UNEDITED

What's Covered:

  • Building a hardware and software sensor to Nomad
  • Publishing your data stream
  • Possible Next steps
  • Demo Code
  • Our Favorite Projects

What you need:


Circuit

Components

Component Description
Photon or Electron Microcontroller connected to the Particle cloud
Motion Sensor Uses inferred light
Light Sensor Measures amount of UV light
Breadboard ---
Jumper cables ---
Power supply 5v 2 amps

Schematic

Before connecting the particle or electron to power connect the Motion Sensor to pin A1 and the Light Sensor to pin A0. Then connect both sensors to GND and 3v3. Now connect the board to power.

Code

If you do not already have a Particle account Sign up for one now. Next lets look at the syntax we will be using to send our sensor data from the Particle Cloud to Nomad. To publish data from your microcontroller to the Co...

Particle.publish("Name",Data,Time,Privacy);
Place Holder Description
"Name" Name of Veriable Particle Console
Data Verable in the form of a string
Time Duration of time particle stores data
Privacy Aucess of being public or private

Motion Sensor

Particle.publish("Motion", "I spy with my Little Eye", 30, PUBLIC);

Light Sensor

Particle.publish("Light", String(LightValue), 30, PUBLIC);

Example Code

/************************
 * Company | IDEO
 * Department | CoLAB
 * Project | Nomad to Particle
 *
 * Build | Version 1
 * *********************/

// VARIABLES //
#define BoardLED D7

int DELAY = 1000;
int n;

//  Main  //
void setup() {
  Serial.begin(115200); //
  pinMode(BoardLED, OUTPUT); //
}

void loop() {
  digitalWrite(BoardLED, HIGH); // BoardLED will Turn ON at begining of sensor checkSensors
  checkSensors();
  digitalWrite(BoardLED, LOW); // BoardLED will Turn OFF at begining of sensor checkSensors
  delay(DELAY);
}

// FUNCATIONS //
void checkSensors(){
  Light(); // Run Function Light()
  Motion(); // Run Function Motion()
  delay(10);
}
void Light(){
  int snsrLight = analogRead(A0);
  Particle.publish("Light", String(snsrLight), 30, PUBLIC);
}
void Motion(){
  int snsrMotion = D0;
  int snsrMotionState = LOW;
  int val = 0;
  val = digitalRead(snsrMotion);
    if (val == HIGH) {
      if (snsrMotionState == LOW) {
        //Particle.publish("Motion", "All Clear!", 30, PUBLIC);
        snsrMotionState = HIGH;
      }
    } else {
      if (snsrMotionState == HIGH){
        Particle.publish("Motion", "I see something!", 30, PUBLIC);
        snsrMotionState = LOW;
      }
    }
}

Software node in Development!

results matching ""

    No results matching ""