Current sensor ACS712

Iam using this sensor

With no load or with 120mA load values from analogRead are about 3720±
Is ACS712 capable to sense smalll current?
Vout on acs712 shows 2.41V(2.5V=0A datasheet default) with or without load - is this ok for 0.1A?
sensitivity is 185mV/A
This means with 3.33Vout it would be 5A current => so this sensor configuration is not suitable for mAmps sensing?

Another question is why its 3720 analogRead for 2.41Vout(shouldn’t it represent 3.03V)?
And how to manage 12bit conversion, for arduino it was 2.5Vout=0mA=512analogRead, and so it goes to 1023

but here is 3720 for 2.41…
ACS712 and core are powered from 5v NiMh battery pack

Crafter, the ACS712 is a bi-directional hall-effect current sensor. That means that it will detect positive and negative flowing currents. Since the module runs on 5V, the output of the ACS712 is set to 1/2Vcc or approximately 2.5V to represent zero current flow. So a negative current flow will go from 2.5V down and a positive current will go from 2.5V up. So the calculation shows that 2.5v offsect (2,5). The problem is that 2.5V is great for a 5V ADC but the Spark has a 3.3V ADC, meaning its midpoint is 1.65V or an ADC output of about 2047 or so. At full current, you will exceed the maximum 3.3V input of the ADC and possible damage it.

If you are getting 2.41V out then it means the current flow is negative. One of the inputs is marked “+” and the “-”. The “-” goes to the power source and the “+” goes to the load to get a positive flow. So that explains the LOWER (than 2.5v) voltage instead of higher than 2.5V.

The ACS712 can be made more sensitive with an amplifier (see this product) on its output and can be made to output a 3.3V max. voltage compatible with the Spark. Refer to the ACS712 datasheet in the application notes. I have to run but I will give you more info later. :slight_smile:

But why its 3720 analogRead for 2.41Vout?

Crafter, I have no idea why 2.41V would give you an ADC output of 3720. I am assuming this is the RAW output of the ADC and not a calculated value of some kind, correct? If you put the analog input to ground and 3.3V does the ADC output go from 0 to 4095? Are you using the web IDE for programming?

Hi @Crafter

In prior versions of the core firmware there were some problems with the ADC but I think those all worked out now. But it does make a difference how you compile your code and if you by any chance have a old local repro of the core-firmware, you could be getting bad readings. If you are using the webIDE or a recent repro you should be fine.

If you want accurate readings, you have to measure your 5V, your 3.3V* and your ADC input to figure out why you are getting the reading you are. I have powered my core with a battery pack and it can fade considerably over time–wall power is more stable for these kinds of measurements but varies a little over minutes to hours.

You should measure the 3v3* pin since that is the ADC reference.

 ADC_Reading = (ADC_Voltage / Voltage3v3*) * 4095 

If the readings you are getting seem wrong, try replacing the ACS712 connection to the ADC input with a pair of resistors less than 10k ohm each, making a voltage divider at the ADC input pin:

          R1                   R2
3V3* ---/\/\/\--- ADC Pin ---/\/\/\--- GND
ADC_Pin = (Voltage3v3*) * R2 / (R1+R2)

You should measure the 3v3* and the ADC input and compare to the ADC_Reading you calculate.

I am also worried about the +5 nature of the part you are using. As @peekay123 said, the datasheet for it has some 3.3V solutions you should investigate.

Crafter, here is the ACS712 3.3V application note from the datasheet:

3.3V - 3.26
3.3*V - 3.14
5V - 5.1

@peekay​123, what are similar diodes to 1n4448 if I can’t find one?
What value for C1 would be good?

Crafter, the 1N4448W is a switching diode so I suspect that a 1N914 or 1N4148 will do the job. The capacitor is optional or could be a 0.01uf capacitor.

Hi all.
Hope this is the right one topic for my question, eventho it’s about current and sensors :smiley:

So I was looking at the Low Current Sensor Breakout - ACS712 and other sensores but I can not figure out how to sens if the bulb did blow up?
As I’m doing a little project for myself and for getting expirience with spark core where I do turn on and off the bulb and I thought that it would be a good idea to know if the bulb in the circuit is burnout or not.
Already done a couple of circuit board experiments, blew up couple of resistors :smiley: but seems like if my resistor (270k/1W) on pic below is higer than 6k the bulb (120V/100W) usual one does not glow or if it’s less than 6k the resistor starts smoking :smiley:

Saw alo of shematics on the net and even some wore like this but than it did not say if it works and how, the one thig is that I don’t want tu use leds bur usual bulb.
So any advice if this is possible to work?

Btw the led in this example show the spark input :smiley:

@darek_student, the circuit above is not a good one for your purpose. First, the current flowing through the bulb must also flow through the resistor and the LED. The resistor is there to limit the current going through the LED but it will also limit the current in the bulb! A 120/100 watt bulb requires 0.83 amps from ohm’s law. However, the 270K resistor limits the current to 0.4 milliamps!

The ACS712 current sensor uses a hall effect sensor to detect the current “induced” in a wire when a current flows through it. The “high” side of the sensor is essentially a very low resistance wire which connects in the circuit you are trying to sense. In your case, the ACS712’s two input terminals would connect between switch S1 and bulb X1 while the other side of the buld is connected to AC “return” or neutral side.

When the bulb is working and current flows through the circuit (and the ACS712 “wire”), the hall affect sensor in the ACS712 will output a voltage proportional to the flowing current (and the magnetic field caused by it). This output can be connected to an analog-to-digital input on the processor (Spark) to read and calculate the current. One thing to remember when using an ACS712 is that the maximum output is 5 volts (higher than the 3.3V max allowed on the Spark). Also, when no current flows, the output voltage will be 2.5 V. This is because the ACS712 can measure AC current (+ and -) so negative current will yield voltages less than 2.5v and positive current will give voltages greater than 2.5v.

So, for your broken bulb sensor, the voltage from the ACS712 would alternate around a 2.5v output depending on the current flowing. When the bulb is burnt out, the output will be a steady 2.5v. :smile:

1 Like

Thanks for the replay.
By reading your comment I guess its no use of trying to make one sensore but instead to get one ACS712 and to connect it before the bulb than it should work, right :slight_smile:

And to not exceed the output voltage of 3.3V and instead of using resistor I could just use 3.3V output of the spark for the Vcc on the ACS712 or am I wrong?

@darek_student, the ACS712 will not work at 3.3v so it MUST be powered by 5V. Can you tell me which ACS712 breakout you were looking at so I can advise you accordingly?

That it works with 5V I did not know.
So here are two of them so hope to hear which one will be better or which will work :smiley:

Hall-Effect Current Sensor Breakout - ACS712

Low Current Sensor Breakout - ACS712

Btw why it took 7h until I could see your response o.O


I did a small circuit with the spark core, acs712 and relay.
The relay and the acs712 sharing the same 5V and think because of that I get a noise problems.

@peekay123 , do you have suggestions how to solve it?

@itayd100, what max. current is your 5V supply capable of supplying? One thing you can do is put a large electrolytic/tantalum capacitor, say 1000uF (microFarads) or greater, across the relay supply to buffer any power spikes. This capacitor and the your decoupling capacitors (0.1uF) need to be close to the devices they protect (relay and ACS712). You should also have a 0.1uF across the relay supply. :smile:


Hey @peekay123 , thanks for the answer.

I don’t have 1000uF right now, but I connected 300uF to the supply of the relay and it’s more stable - almost good.
I’m not sure about something, where do I need to connect the 0.1uF on the relay?

@itayd100 the same as the larger capacitor, in parallel with it. Both capacitors need to be close the the relay.

1 Like


Im working on a project where im using ACS712 5A hall effect current sensor to measure the current. i have connected the output of the sensor to the amplifier circuit (taken from the ACS712 breakout board) with op-amp(OPA344) with gain ranging from 4.7-47. i am using MCP3202 12 bit ADC with the data being sent to the raspberry pi. I came across this link :

where i got a formula for current but without the gain taken into account. can someone help me formulate the current equation with the gain?

@suvrat, can you give a little more details on the breakout you are using and the schematic for your OPA344 circuit. The ACS712 pegs the “zero” current at 1/2 Vcc or 2.5V and your op-amp needs to take this offset into consideration. What current range are you trying to sense?

You might be better asking on a RPi forum, this forum specializes in the Spark products, which it doesn’t sound like you are using. The interfaces will differ.