Arduino Current Sensor The Current Sensor Module Arduino

ආර්ඩුනෝ මගින් AC ධාරාවක් මනින්නේ කෙසේද?



මේ සඳහා උවමනා ප්‍රධාන උපකරණය TA12-100 Current Sensor Module එකය. මෙය රු.300 වැනි මුදලකට පිටකොටුවේ unitech ආයතනයෙන් ලබා ගත හැකිය. මෙහි ඇති විශේෂ වාසිය නම්  ධාරාව මැනෙන පරිපථය සමග ආර්ඩුනෝ පරිපථ සමග සෘජු සම්බන්ධයක් නැතිවීමය.මෙහි භාවිතා වන්නේ Clip on Ammter එකක ඇති සිද්ධාන්ත වේ.මෙහි ඇත්තේ ධාරා පරිණාමකයකි. ප්‍රත්‍යාවර්ත ධාරාව මගින් TA12-100 හි ඇති දඟරයේ ප්‍රේරණය වේ. එමගින් ඇතිවන් ප්‍රේරිත ධාරාව microcontroller එක මගින් මනිනු ලබයි.

 ඉහත දක්වා ඇත්තේ එම උපකරණයයි.
එහි pinout  එක පහත දක්වා ඇත.

TA12-100 Arduino AC Current Sensor Pinouts

  1. ආර්ඩුනෝ Uno -1
  2. TA12-100 Current Sensor Module -1
  3. Jumper wires
පහත පරිදි පරිපථය සාදා ගන්න.


ආර්ඩුනෝ Code එක පහතින් දැක්වේ. Thanks to Henry's Bench.(ඔහුගේ වෙබ් පිටුවෙන් උපුටා ගන්නා ලදි.)

// Henry's Bench TA-1200 AC Current Sensor Tutorial


int sensorTA12 = A0; // Analog input pin that sensor is attached to

float nVPP;   // Voltage measured across resistor
float nCurrThruResistorPP; // Peak Current Measured Through Resistor
float nCurrThruResistorRMS; // RMS current through Resistor
float nCurrentThruWire;     // Actual RMS current in Wire

void setup()
 {
   Serial.begin(9600);
   pinMode(sensorTA12, INPUT);
 }
 
 
 void loop()
 {
  
  
   nVPP = getVPP();
  
   /*
   Use Ohms law to calculate current across resistor
   and express in mA
   */
  
   nCurrThruResistorPP = (nVPP/200.0) * 1000.0;
  
   /*
   Use Formula for SINE wave to convert
   to RMS
   */
  
   nCurrThruResistorRMS = nCurrThruResistorPP * 0.707;
  
   /*
   Current Transformer Ratio is 1000:1...
  
   Therefore current through 200 ohm resistor
   is multiplied by 1000 to get input current
   */
  
   nCurrentThruWire = nCurrThruResistorRMS * 1000;

  
   Serial.print("Volts Peak : ");
   Serial.println(nVPP,3);
 
  
   Serial.print("Current Through Resistor (Peak) : ");
   Serial.print(nCurrThruResistorPP,3);
   Serial.println(" mA Peak to Peak");
  
   Serial.print("Current Through Resistor (RMS) : ");
   Serial.print(nCurrThruResistorRMS,3);
   Serial.println(" mA RMS");
  
   Serial.print("Current Through Wire : ");
   Serial.print(nCurrentThruWire,3);
   Serial.println(" mA RMS");
  
   Serial.println();
}


 /************************************
In order to calculate RMS current, we need to know
the peak to peak voltage measured at the output across the
200 Ohm Resistor

The following function takes one second worth of samples
and returns the peak value that is measured
 *************************************/
 
 
float getVPP()
{
  float result;
  int readValue;             //value read from the sensor
  int maxValue = 0;          // store max value here
   uint32_t start_time = millis();
   while((millis()-start_time) < 1000) //sample for 1 Sec
   {
       readValue = analogRead(sensorTA12);
       // see if you have a new maxValue
       if (readValue > maxValue)
       {
           /*record the maximum sensor value*/
           maxValue = readValue;
       }
   }
  
   // Convert the digital data to a voltage
   result = (maxValue * 5.0)/1024.0;
 
   return result;
 }
මෙහි code  එක වෙනස් කිරීමෙන් තප්පර 80ක පමණ දත්න ලබා ගත හැකිය.
එහි ප්‍රස්තාරය මෙලෙස අදිනු ලැබිය හැකිය.

Serial Plotter  එක මගින්ද මෙය ලබා ගත හැකිය.







Comments

Popular posts from this blog

Sinhala Horoscope Software Free (kendra)