Program for IoT Part 1 ⏱

Getting Started with Programming the IoT Device

Introduction

Claiming Your IoT Device

This video steps you through claiming a particle device and setting up WIFI. You will want your mobile phone to complete this with the Particle App installed. Apple: https://apps.apple.com/us/app/particle-iot/id991459054 Android: https://play.google.com/store/apps/details?id=io.particle.android.app&hl=en_US

IoT Tutorial - Programming the Device

We will use the Particle tutorial for the IoT kit linked below to guide us, but the videos will deviate a bit to demonstrate things using the web programming environment. Ultimately we want to get familiar with the hardware, inputs, sensors, and programming. ★ Post questions and successes in our Slack channel as you move along.

Understanding LED Status Signals

This link comes in very handy for interpreting the different status LED signals you may get from time to time. https://docs.particle.io/troubleshooting/led/argon/

Reading Temperature and Humidity

We are covering concepts from the Particle Variables: measure temperature & humidity section of the tutorial. https://docs.particle.io/quickstart/isk-project/#particle-variables-measure-temperature-amp-humidity

1. Create a new program in Particle build.

2. Connect the temperature and humidity sensor to D2, and have your Argon device connected.

3. Include the "GROVE_TEMPERATURE_AND_HUMIDITY_SENSOR" library in your program.

4. Copy and paste the code below (except of the #include part) into your program.

// This #include statement was automatically added by the Particle IDE.
#include <Grove_Temperature_And_Humidity_Sensor.h>

DHT dht(D2);

double temp_dbl, humidity_dbl;

void setup() {
    Serial.begin(9600);

    dht.begin();
    
    Particle.variable("temp", temp_dbl);
    Particle.variable("humidity", humidity_dbl);
}

void loop() {
    float temp, humidity;

    temp = dht.getTempFarenheit();
    humidity = dht.getHumidity();

    temp_dbl = temp;
    humidity_dbl = humidity;

    delay(10000);
}

5. Save, Verify, and Flash the code to the Argon board.

6. Open the Console from particle build, select "my devices", and select your Argon.

7. Get the temp and humidity variables to check if all is working.

That's it for this step 🎉. If you are having any problems, no worry, post in our slack channel. Please share your code when it makes sense or create videos.

Controlling an LED

We are covering concepts from the Particle Functions: controlling a Chainable LED section of the tutorial. https://docs.particle.io/quickstart/isk-project/#particle-functions-controlling-a-chainable-led

Instructions coming soon...

1. Create a new program in Particle build.

2. Connect the Grove Chainable LED to A4, and have your Argon device connected.

3. Include the "Grove_ChainableLED" library in your program.

4. Copy and paste the code below (except of the #include part) into your program.

// This #include statement was automatically added by the Particle IDE.
#include <Grove_ChainableLED.h>
ChainableLED leds(A4, A5, 1);

void setup() {
    leds.init();
    leds.setColorHSB(0, 0.0, 0.0, 0.0);
    Particle.function("toggleLed", toggleLed);
}

void loop() {
    // toggleLed("");
}

int toggleLed(String args) {
    leds.setColorHSB(0, 0.0, 1.0, 0.5);
    delay(500);
    leds.setColorHSB(0, 0.0, 0.0, 0.0);
    delay(500);
    return 1;
}    

5. Save, Verify, and Flash the code to the Argon board.

6. Open the Console from particle build, select "my devices", and select your Argon.

7. Call the toggleLed function to pulse the LED one time.

That's it for this step 🎉. If you are having any problems, no worry, post in our slack channel. Please share your code when it makes sense or create videos.

Reference Material for the IoT Kit Hardware

https://docs.particle.io/quickstart/isk-project/#appendix-grove-sensor-resources

Last updated