Site icon Ercan Koçlar

ACS712 Current Sensor- MicroC Library

ACS712-kapak-resmi

ACS712-kapak-resmi

This post is also available in: Türkçe (Turkish)



ACS712 Current Sensor

How to Estimate Current with ACS712

ACS712 Current Estimation Factors

ACS712 Pin Functions

ACS712 Pins
Number Name Description
 1 – 2  IP+  + pole connected in DC current, there is no difference in – AC current
 3 – 4  IP-  – pole is connected on DC current, – no difference in AC current
 5  GND  Grounding tip
 6 FILTER  Arranges output by connecting external condenser
 7 VIOUT  Analog output tip is connected to MCU or PIC
 8 VCC  Feeding tip is connected+5 volt

 

ACS712 Circuit Diagram

ACS712  Circuit Diagram

Necessary Materials

  1. ACS712 integration
  2. 0.1uF-63V electrolytic condenser
  3. 1nF polyester condenser
  4. 4A glass fuse and fuse holder
  5. SOIC – DIP convertor

Making Circuit

ACS712 Test Circuit

 

ACS712 Test Circuit

 

ACS712 Test Circuit

 

Converter from SOIC to DIP type

 

Converter from SOIC to DIP type

 

ACS712 MicroC Library

Functions

ACS712_AKIM_OLCME Function

Function : unsigned int ACS712_AKIM_OLCME(unsigned char SENSOR_TIPI,unsigned char ANALOG_KANAL)

Purpose : Evaluates current passes from ACS712

Parameters :

Its Usage :

ACS712_AKIM_OLCME(5,4) ;//5 amperes sensor. Reading will be done from AN4

Feedback :

 

Application of Functions

Pin Identification

sbit ACS712_VERI_PIN at RA5_bit ;               //ACS712 output tip connection pin
sbit ACS712_VERI_PIN_Direction  at TRISA5_bit; //ACS712 output tip connection pin

 

Reading Current

void  main()
{
    char deger[15];
    unsigned char i=0,j=1;
    unsigned int ercan=0;


    ADCON1=0b00000001;
    CMCON=7;

   ADC_Init();//PIC adc operations must be started
   delay_ms(100);
   SAP1024_INIT(240,128,6);//SAP1024B GLCD screen identification
   delay_ms(100);
   
while(1)
 {
   ercan = ACS712_AKIM_OLCME(5,4) ;

   inttostr(ercan,deger);
   SAP1024_YAZI_YAZMA(10,10,deger);//the read values will be printed on GLCD

   delay_ms(500);// Does reading in every 1/2 second
 }
}

 

A view from the ACS712 test

Experiment Video


Result


Library Files

 


References


 

 

This post is also available in: Türkçe (Turkish)

Exit mobile version