Skip to content

cb161769/ArduinoDeviceCode

Repository files navigation

ArduinoDeviceCode

Screenshot

Visión General

Este codigo fuente tiene la vision de ser el ente para leer las lecturas del paso de energia electrica de una vivienda resiendencial.

Tecnologias Utilizadas

Componentes Utilizados

Configuracion del proyecto

  1. Descarga e instala Arduino
  2. Descarga e instala Arduino IDE
  3. Descarga e instala Visual Studio Code IDE.
  4. Descarga e instala GIT.
  5. clona este repositorio ArduinoDeviceCode
  6. Abre el proyecto desde Arduino IDE
  7. luego ejecuta el siguente script: publish

Documentacion sobre calibracion de sensores

Screenshot

para calibar los sensores tanto e, sensor ACS712, como el sensor CT SCT-030-30, se realizo el siguiente codigo: Screenshot

Codigo de calibracion sensor ACS712

float getVoltageTest() {
RunningStatistics inputStats;                 // create statistics to look at the raw test signal
  inputStats.setWindowSecs( windowLength );
   
  while( true ) {   
    sensorValue = analogRead(SENSOR_1);  // read the analog in value:
    inputStats.input(sensorValue);  // log to Stats function
        
    if((unsigned long)(millis() - previousMillis) >= printPeriod) {
      previousMillis = millis();   // update time
      
      // display current values to the screen
      
      // output sigma or variation values associated with the inputValue itsel
     
      // convert signal sigma value to current in amps
      current_amps = intercept + slope * inputStats.sigma();
     return current_amps;
    }
  }

}

Codigo de calibracion de sensor SCT

float getCurrent() {
  float Volt_diferencial;
  float current;
  float sum = 0;
  long times = millis();
  int counter = 0;
  while (millis() - times < 1000)
  {
    Volt_diferencial = ads.readADC_Differential_0_1() * multiplier;
    current = Volt_diferencial * FACTOR;
    current /= 1000.0;

    sum += sq(current);
    counter = counter + 1;
  }
  current = sqrt(sum / counter);
  return (current);


}

About

arduino code 4 Project

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors