Ks0274 keyestudio Current Sensor Current Detection Sensor: Difference between revisions

From Keyestudio Wiki
Jump to navigation Jump to search
Line 7: Line 7:
It can easily achieve interactive works related to environmental awareness. <br>
It can easily achieve interactive works related to environmental awareness. <br>
Used for electrical load remote monitoring; as an electronic control system of input signals; lack of phase indication, power measurement; motor running state monitoring.<br>
Used for electrical load remote monitoring; as an electronic control system of input signals; lack of phase indication, power measurement; motor running state monitoring.<br>
<br>[[File:274 (3).jpg|500px|frameless|thumb]]<br>
<br>[[File:274 (3).jpg|600px|frameless|thumb]]<br>


<br>
<br>
==Specification ==
==Specification ==
* Working voltage:5V
* Working voltage:5V

Revision as of 15:03, 15 May 2019


Introduction

Keyestudio current detection sensor is mainly composed of a current sensor TA12-200, which can convert large current into a small amplitude of voltage output.
This product can be applied to detect AC current, and its maximum detectable current is up to 5A.
Current sensor can be used in a variety of microcontroller, especially on the Arduino controller, which can be connected to the Arduino dedicated sensor expansion board with the 3P sensor cable.
It can easily achieve interactive works related to environmental awareness.
Used for electrical load remote monitoring; as an electronic control system of input signals; lack of phase indication, power measurement; motor running state monitoring.

thumb


Specification

  • Working voltage:5V
  • Detecting current:up to 5A
  • Working frequency: 20Hz~20KHz
  • Data type: analog input
  • Flame retardant conforms to UL94-VO
  • Dielectric strength 6000V AC/1min


Connection Diagram


thumb


Sample Code

#define ELECTRICITY_SENSOR A0 // Analog input pin that sensor is attached to
float amplitude_current;               //amplitude current
float effective_value;       //effective current 
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 RobotBase interface of the sensor is 5v
	amplitude_current=(float)sensor_max/1024*5/800*2000000;
	effective_value=amplitude_current/1.414;//minimum_current=1/1024*5/800*2000000/1.414=8.6(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) 
		{
			/*record the maximum sensor value*/
			sensorMax = sensorValue;
		}
	}
	return sensorMax;
}


Result

Done as the above wiring, upload the code, and then open the serial monitor, the magnitude of current is shown (not connected to the current), as the figure below.

thumb


Resources

  • PDF File:

https://drive.google.com/open?id=15IToWLGxha12wXRyInWTtnvgnBqAcVnu

  • Code:

https://drive.google.com/open?id=1QFh9azYfo0quATDilfXG0z85AXDLdYIH


Get One Now