sobota 11. února 2017

Měření procházejícího proudu

Cena: $3,99 ~ 77,-Kč

  1. Current sensor chip: ACS712ELC-05B 
  2. pin inserted 5V power supply,on board power indicator;
  3. Can measure plus and minus 5A current,corresponding simulation output 185mV/A ;
  4. When testing no current though,the output voltage is VCC/2; (2,5V ~ 2500mV)
  5. PCB board dimension: 31(mm)x13(mm) 
  6. NOTE: ACS712 is based on the principle of Hall detectionon,please try to avoid the magnetic field affect when using it.



eBay: http://www.ebay.com/itm/121047153862?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
Zdroje:
http://forum.arduino.cc/index.php?topic=265094.0
http://www.cnx-software.com/2016/01/23/acs712-module-measures-currents-30a-1-dollar/
http://www.dustynrobots.com/academia/research/digital-signal-processing-and-filtering-motor-current-sensing/



int currentPin = A0;
// constants
float volt_per_amp = 185; // resolution according to hardware page
// variables
float currentRaw; // the raw analogRead ranging from 0-1023
float currentVolts; // raw reading changed to Volts
float currentAmps; // Voltage reading changed to Amps
void setup() {
  Serial.begin(9600);
}
void loop() {
  currentRaw = analogRead(currentPin);
  currentVolts = currentRaw *(5000.0/1024.0);
  currentAmps = (currentVolts-2500)/volt_per_amp;
  Serial.println(currentAmps);
}

Přidání filtru průměrnou hodnotou

Z obrázku je vidět, že je linka méně "chlupatá".

int currentPin = A0;
// constants
float volt_per_amp = 185; // resolution according to hardware page

// variables
float currentRaw; // the raw analogRead ranging from 0-1023
float currentVolts; // raw reading changed to Volts
float currentAmps; // Voltage reading changed to Amps

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

void loop() {
  float average = 0;
  for(int i = 0; i < 15; i++) {

    currentRaw = analogRead(currentPin);
    currentVolts = currentRaw *(5000.0/1024.0);
    currentAmps = (currentVolts-2500)/volt_per_amp;
    average = average+currentAmps;
    delay(1);

  }
  Serial.println(average/15);
}

Žádné komentáře:

Okomentovat