Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Md. Khairul Alam
Published © MIT

Non-Intrusive Load Monitoring using SensiML & QuickFeather

Detecting home appliances from Voltage & Current waveform using Machine Learning and Monitoring Remotely.

AdvancedFull instructions provided20 hours2,962
Non-Intrusive Load Monitoring using SensiML & QuickFeather

Things used in this project

Hardware components

QuickFeather Dev Kit with UART Cable + SensiML
QuickLogic Corp. QuickFeather Dev Kit with UART Cable + SensiML
×1
Texas Instruments ADS1115 I2C Analog to Digital Converter
×2
ZMPT101B Voltage Sensing Module
How to use tutorial: https://electropeak.com/learn/interfacing-zmpt101b-voltage-sensor-with-arduino/
×1
ZMCT103C Current Sensing Module
How to use tutorial: https://electropeak.com/learn/interfacing-zmct103c-5a-ac-current-transformer-module-with-arduino/
×1
0.96" OLED 64x128 Display Module
ElectroPeak 0.96" OLED 64x128 Display Module
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Eclipse IoT Eclipse IDE
Arduino IDE
Arduino IDE
Firebase
Google Firebase
MIT App Inventor 2
MIT App Inventor 2
SensiML Analytics Toolkit
SensiML Analytics Toolkit

Story

Read more

Schematics

Schematic

For data collection and testing

Schematic with OLED

Schematic with ESP8266

ESP8266 is added for transferring data to cloud

System Block Diagram

Code

ESP8266 Node MCU Code

Arduino
This program receive the data from QuickFeather and sends to Firebase
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

// Set these to run example.
#define FIREBASE_HOST "your firebase url here"
#define FIREBASE_AUTH "you firebase auth here"
#define WIFI_SSID "your wifi network name here"
#define WIFI_PASSWORD "your wifi password here"

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete
String model_number = "";
String classification = "";

void setup() {
  Serial.begin(460800);
  // connect to wifi.
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  //Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) {
    //Serial.print(".");
    delay(500);
  }
  //Serial.println();
  //Serial.print("connected: ");
  //Serial.println(WiFi.localIP());  
  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}


void loop() {
  
   if(Serial.available())
       serial_read();
   
   if (stringComplete) {
       //Serial.println(inputString);  ////{"ModelNumber":0,"Classification":4}
       int first_colon = inputString.indexOf(":"); //get the first colon in the received string
       int second_colon = inputString.indexOf(":", first_colon + 1);  //get the second colon in the received string
       //Serial.println(first_colon);
       //Serial.println(second_colon);
       model_number = inputString.substring((first_colon + 1), (first_colon + 1) + 1); //get 1 character after first colon which is model number in our case
       classification = inputString.substring((second_colon + 1), (second_colon + 1) + 1); //get 1 character after second colon which is class number in our case
       //Serial.println(model_number);
       //Serial.println(classification);
       //Serial.println(model_number.toInt() + classification.toInt());
       inputString = "";
       stringComplete = false;
    }

  // set string value
  Firebase.setString("ModelNumber", model_number); //sends model number as string
  // handle error
  if (Firebase.failed()) {
      //Serial.print("setting /message failed:");
      //Serial.println(Firebase.error());  
      return;
  }
  delay(1000);

  Firebase.setInt("ModelNumberI", model_number.toInt()); //sends model number as intger
  // handle error
  if (Firebase.failed()) {
      //Serial.print("setting /message failed:");
      //Serial.println(Firebase.error());  
      return;
  }
  delay(1000);

  // set string value
  Firebase.setString("Classification", classification);  //sends class number as string
  // handle error
  if (Firebase.failed()) {
      //Serial.print("setting /message failed:");
      //Serial.println(Firebase.error());  
      return;
  }
  delay(1000);

  Firebase.setInt("ClassificationI", classification.toInt()); //sends class number as integer
  // handle error
  if (Firebase.failed()) {
      //Serial.print("setting /message failed:");
      //Serial.println(Firebase.error());  
      return;
  }
  delay(1000);
}

//{"ModelNumber":0,"Classification":4}

void serial_read() {
  while (Serial.available()) {    
    // get the new byte:
    char inChar = (char)Serial.read();     
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
    else
    // add it to the inputString:  
      inputString += inChar;
  }
}

DCL Project File

Plain text
Includes recorded data
No preview (download only).

Android App Source

Scratch
App Inventor Source File
No preview (download only).

Project in Github

https://github.com/taifur20/non-intrusive-load-monitoring

Credits

Md. Khairul Alam

Md. Khairul Alam

68 projects • 587 followers
Developer, Maker & Hardware Hacker. Currently working as a faculty at the University of Asia Pacific, Dhaka, Bangladesh.

Comments