Allegro ACS 712 Current Sensor

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Allegro ACS 712 Current Sensor

Post by JohnCrow »

Introduction.

The Allegro ACS 712 is a hall effect current transducer, which in the case of the version being used here can measure up to a maximum current of 5A.

The device used is the PPBOB-08882 supplied by Proto-Pic as a Break Out Board (BOB)

Equipment Needed.

EB-006 Multi-Programmer
EB-005 LCD Display
EB-016 Protoboard
16F877A Microcontroller

ACS712 Current Sensor

Digital Multimeter
Various Test Leads

Also a 1nF and a 0.1uF Capacitors are needed.

Calculations.

The ACS712 output has a very linear operation.

The min & max outputs are as follows

@ 0A output = 2.5V dc
@ 5A output = 4.5 dc
These are read by the ADC input on the PIC Microcontroller.

This gives a span of 2V
i.e for every volt output from the ACS712 = 2.5A input

Slope = FScale/Span
Slope = 5/2
Slope = 2.5

Offset = 2.5 * 2.5 = 6.25

Current = (Slope * Fscale) - Offset
Current = (2.5 * 4.5) - 6.25
Current = 5A

In practice it was found the displayed current value was half the true value.
This was compensated for my multiplying the final value by 2.

Error Detection.

The flowchart will detect if the ACS output goes

Below 2.5 V – Under Range
Above 4.5 V – Over Range.

In these cases the display clears and a warning is displayed.



Current Testing.

The test current was generated by a 6V battery pack and a 2.2R high power resistor.

This was connected in series to the ACS712 through a digital multimeter.

The theoretical current should have been 2.7A, according to ohms law, but the loading pulled the battery voltage down to about 3.3 V.

This gives a current of 1.5A, which is the approximate value that was displayed.
System Setup
System Setup
Setup.JPG (111.18 KiB) Viewed 18167 times
Sensor Close Up
Sensor Close Up
Sensor.JPG (80.48 KiB) Viewed 18167 times
Accuracy Check
Accuracy Check
Accuracy.JPG (130.63 KiB) Viewed 18167 times
I think it would be fairly easy to modify this project to function as a multirange power meter.
Reading voltage using a 2nd ADC input and a potental divider chain for voltage scaling.

Other versions of the sensor are available that read upto 30A full scale.
Otherwise a current transformer could be used to step down to match this sensor.

Flowcode file below
Last edited by JohnCrow on Sun Dec 18, 2011 2:49 pm, edited 2 times in total.
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by JohnCrow »

ACS712 - Current Transducer V2.fcf
Current Sensor
(15.5 KiB) Downloaded 747 times
1 in 10 people understand binary, the other one doesn't !

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by medelec35 »

Hi John. That's an interesting project!
I am going to have a play with some hall effect sensors myself.
Thanks for sharing :)

Martin
Martin

Werner
Posts: 95
Joined: Sat Jun 11, 2011 4:12 am
Has thanked: 87 times
Been thanked: 31 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by Werner »

Great project John, Thanks for sharing it! I was able to order a small ACS712 BOB from Sparkfun USA 10.00. I am putting this one on my todo list. :D
Have a great day Buddy!
Werner
Werner
STUDENT OF: Martin - Professor of Flowcode, John, Jan, Fotios and Nicolas "Spanish Dude"

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by JohnCrow »

I have now made the ACS712 module into a working circuit.

Connections from the SIL header are right to left

Vcc
Gnd
N/C
Output - To Microcontroller
Small ceramic capacitor is 1nF
The Green screw terminal block is the current connection.
ACS712.JPG
ACS712.JPG (106.83 KiB) Viewed 17808 times
1 in 10 people understand binary, the other one doesn't !

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi John!

I bought a pair of ASC 712th But it is 20 amps. version. I've tried to look in your very fine project and see if I could figure out how to change your calculations so that it can be used for this. But I'm not a Master. Will you help with where I need to modify the software to use it to 20A model. Or if it´s possible to readout lest 15A I measured it provides 100mV per Amp. :D

I Use FC 5.4

Best regard

Jorgen.

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by Enamul »

Hi Jorgan/John,

Where you bought that from? Can you please post the link? I am looking for something can handle up to 100A.
Enamul
University of Nottingham
enamul4mm@gmail.com

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi Enamul!

Ebay I bougth this: http://viewitem.eim.ebay.dk/New-design- ... 3917998008
Best regard


Jorgen

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by Enamul »

Thanks a lot. I will order one right now.
Edit: I have ordered one which can handle 30A and I have seen couple in Farnell which can handle 100A. I am very interested to look now John's code. Thanks John for posting nice sensor idea.
Enamul
University of Nottingham
enamul4mm@gmail.com

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by Enamul »

Hello
I believe the following change will make the meter range to 20A..

Code: Select all

// Setup Variables
// Adjust to trim readings
Current_FS = 10
Span = 2
Offset_Reference = 2.5
Enamul
University of Nottingham
enamul4mm@gmail.com

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi Enamul! :D

Thank´s for update to 20A I will test it tonigth. Hope you also get succes with the sensor. I´ts amazing they can handle all these Amp´s

Regard

Jorgen

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by Enamul »

Hi Jorgan,

You are welcome. Yes, that also amaze me. These are cool sensors hope that also remain cool while sensing as hall sensor :lol:
Enamul
University of Nottingham
enamul4mm@gmail.com

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi Enamul!

Perfect, it works with ACS 20A :D Thank´s. And thank´s to John for nice project.

Best regard

Jorgen.

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by JohnCrow »

Hi Jorgen

Glad you found it useful
1 in 10 people understand binary, the other one doesn't !

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi John!

Well I can use it, and it's a very good project. I have taken the liberty to change in your program and add a voltmeter and calculate watts.
But don´t laugh when you look at it and I will not exclude that there are errors, but it works, except Watts does not appear as floating, dosn´t matter.

Made in FC 5.4

Jorgen.
Attachments
ACS712_VoltAmp_Watt_God.fcf
(26.63 KiB) Downloaded 440 times

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by JohnCrow »

That was something I'd thought of doing myself.
I'll have a look at you program when I get chance
1 in 10 people understand binary, the other one doesn't !

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi!

Sorry a little correction.. :oops:

When displayedd Watt below 10W it did not delete one digit.

Jorgen..
Attachments
ACS712_VoltAmp_Watt_God.fcf
(27.33 KiB) Downloaded 446 times

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by jgu1 »

Hi!

Here is another model as a single component ACS758. up to 50 A with large terminals. if any are interested. :D

http://docs-europe.electrocomponents.co ... d885f6.pdf

But how we fit it to John´s project, I don´t know.

Best regard

Jorgen

User avatar
Enamul
Posts: 1772
Joined: Mon Mar 05, 2012 11:34 pm
Location: Nottingham, UK
Has thanked: 271 times
Been thanked: 814 times
Contact:

Re: Allegro ACS 712 Current Sensor

Post by Enamul »

Hi Jorgan,

Thanks. I have seen that. I will order 100A version of that. I will post when I can finish.
Enamul
University of Nottingham
enamul4mm@gmail.com

Post Reply