Quantity | 3+ units | 10+ units | 30+ units | 50+ units | More |
---|---|---|---|---|---|
Price /Unit | $7.99 | $7.82 | $7.58 | $7.25 | Contact US |
High Quality ITEAD AC Current Transformer Current Sensor Module 0-5A 3p 4p Interface for Arduino
Description:
3 wires e-block interface, input 5V-GND. S pin is as the analog output voltage value. Can use Jumper to select the output shunt resistor can be used to adjust the output range of analog values.--Transformers can sense AC only.
Test code:
Connect the S port of the electronic building blocks of the power sensor to the A0 end of the Arduino board, using the following program to read the analog value. Then send it to the computer via serial port.
#define ELECTRICITY_SENSOR A0 // connect S signal pin to AO
float amplitude_current; //Current assignment is floating point type
float effective_value; //Valid values is float type
void setup()
{
Serial.begin(9600);
pins_init();
}
void loop()
{
int sensor_max;
sensor_max = getMaxValue();
Serial.print("sensor_max = ");
Serial.println(sensor_max);
//the VCC on the Grove interface of the sensor is 5v
amplitude_current=(float)sensor_max/1024*5/200*1000000;
effective_value=amplitude_current/1.414;
//Minimum current value can be detected=1/1024*5/200*1000000/1.414=24.4(mA)
//Only for sinusoidal alternating current
Serial.println("The amplitude of the current is(in mA)");
Serial.println(amplitude_current,1);//Only one number after the decimal point
Serial.println("The effective value of the current is(in mA)");
Serial.println(effective_value,1);
}
void pins_init()
{
pinMode(ELECTRICITY_SENSOR, INPUT);
}
/*Function: Sample for 1000ms and get the maximum value from the SIG pin*/
int getMaxValue()
{
int sensorValue; //value read from the sensor
int sensorMax = 0;
uint32_t start_time = millis();
while((millis()-start_time) < 1000)//sample for 1000ms
{
sensorValue = analogRead(ELECTRICITY_SENSOR);
if (sensorValue > sensorMax)
{
Tech Support: support@iteadstudio.com
/*record the maximum sensor value*/
sensorMax = sensorValue;
}
}
return sensorMax;
}
Package included:
- 1 x Current Sensor