This is a placeholder topic for “50A Current Sensor(AC/DC)” comments.
This is a breakout board for the fully integrated Hall Effect based linear ACS758 current sensor. The sensor gives precise current measurement for both AC and DC signals.
This is a placeholder topic for “50A Current Sensor(AC/DC)” comments.
Looking for a current sensor for a 12 volt system that I can connect to a raspberry pi. It needs to record the current out to a load and also the current in from a solar charging system. Any ideas?
As the Pi doesn’t feature analog inputs like say, an Arduino, you’ll need an analog-to-digital converter (ADC) to use analog sensors like this.
Here are a couple options, but you can search for ADC on our site and find more:
All the best with your project, let us know if you have more questions, keen to see where this goes
Thanks for your reply. Forgive my lack of knowledge about this.
Are you saying I need to use an Arduino or an ADC to connect to the current sensor mentioned above?
What I am trying to do is to build a system that will record the current going into a caravan battery (solar or ac charging), and the current being used up, lights TV etc. I thought I could record those values in a database on the Raspberry Pi and then be able to graph and display them, as well as the remaining battery level, on a local web page via the Pi.
I have been experimenting with a PZEM-017 DC monitor through a RS485 connector to the Pi, and after a lot of trial and error been able to get readings for the voltage and current going from the battery, using the python serial library. Problem is the current is the same no matter if the current is going in or out of the battery. I was hoping it would be a negative or positive so I could get a balance of what is left in the battery.
Once again forgive my ignorance about this, Its just a project to amuse me in my retirement. I love playing around with the Raspberry Pi, doing all sorts of things, also done a little bit with Arduino.
Love to hear if you have any suggestions.
The device outputs a voltage that corresponds to the current. You have to read that voltage somehow. One option is an analog or digital voltmeter. Another is an Arduino, which has an ADC input and can read voltages. A third option is an ADC device such as the one mentioned to read the voltage and convert it to a digital value that the Pi can read.
Note that the most common Arduino ADC is 10 bits. That gives you a maximum resolution of 100/1024 or about 0.1A. A 16bit ADC device gives you a resolution that is actually better than the current sensor can sense. If you choose a sensor with less range (say, +/- 20A) than you also get higher maximum resolution (40/1024 or 0.04A for a 10-bit ADC).
The reason that you are getting the same reading for current in or out is that the current is determined by the devices that are using the power - the source of the voltage doesn’t make a difference to the power that they draw. To determine how much power each source is providing you need to monitor them separately at the source.
Does that mean I need two monitors, one checking for charging and one checking for discharging. I thought one monitor would show a positive for charging and negative for discharging.
Jeff is pretty much on the money here. Except the resolution is 0.125A. Reason is as follows.
This device is bi-directional. That is you apply 5V and at 0A the output is 2.5V or half way. When the current is in a positive direction the output moves toward 5V depending on the value of the current (A). When the current reverses the output moves toward ground once again depending on the value (A).
The data sheet says the sensitivity is 40mV (0.04V) per Amp which means that for a deviation between -50A and +50A the output will swing between 0.5V (2.5V-2V) and 4.5V (2.5V+2V) which is a resolution of 125mA (0.125A).
Now to turn the ADC result into something meaningful with Arduino is pretty easy. The RPi I have no idea but it must be doable.
First remap the ADC from 0 -1024 to -500 - +500. This will give - and + current direction.
This maps 0V to 5V but leaves +/- 50 A at ADC reading of -400 to +400. A very convenient 0.125A resolution.
This means that to convert to Amps for display or logging purposes simply divide the ADC number by 8.
Note this has to be a floating point calculation not integer or you will only end up with the whole number and not the decimal bit.
The other alternative is to record the ADC values and do the massaging in a spreadsheet or whatever.
Hope this helps.
Hi again Bob
Yes. Connect it between the battery and everything else. The monitor will show the net result for what is happening to the battery.
Some circumstances dictate that one needs to know the discharge and charge separately in which case 2 monitors are needed. If you only want the net conditions you need only one. By net I mean whether current is flowing into or out of the battery.
I haven’t purchased the sensor yet, but will do if thats what I need. Question is do I need an ADC to connect to the sensor and then to the Pi?
Yes I believe you do. I don’t know anything for sure about RPi. The Arduino already has analog inputs with ADC facilities.
Another thing to note, is space that the output voltage from the current sensor maps to on the ADC.
eg, if you have a 12bit ADC and you are only making use of a small portion the resolution will actually be smaller than 12-bits. i.e. if your current is only ever up to around +10A and -2A or so then the unused portion of the ±50A range is wasted.
This watt meter features I2C and can track both the voltage and current, perfect for a solar system!
Another solution could be to grab an I2C current sensor such as the INA219. Note it can only handle ±3.2A.
That assumes the ADC is measuring a voltage swing between 0v and 5v. When the sensor is powered from 5v it will only swing the voltage between 0.5v and 4.5v, so it makes sense for the Arduino ADC to be configured to those levels. That gives the maximum resolution of 1024 increments across 100A, or slightly better than 0.1A . That’s why I was very careful to state maximum in both cases. Configuring the ADC to measure 0v to 5v is a simple convenience, but does not provide the maximum available resolution.
Thanks everyone for your interest, Looks like I have some research to do to work this out. Bob
That is true but on the other hand having the ADC respond to 0 - 5V and remapping to -500 to +500 turns out to be a very convenient 125mA resolution. A simple divide by 8 to get a display in Amps. It is my philosophy that the slight gain in resolution is easily offset by the simple approach I put forward. After all it is a caravan not a lab work bench.
This indicates to me that Bob147385 is a bit new to this and if his solution can be kept as simple as practical I think it would be a good thing.
If your current ever got to 10 A you would probably need a 15 - 20A unit. Whatever it would have to exceed the largest swing and these bi directional units are symmetrical so it doesn’t matter what value the smaller reading is you are stuck with it.
The wattmeter linked is only good for 8A. I don’t this is anywhere near enough for this application. I think the occasional peak to 30A or more would not be an unreasonable assumption so the use of a 50A unit with my numbers for 125mA resolution would not be too bad and simple, which in my mind is important.
The 1NA219 unit you mention I think would be pretty useless in this application I think.
More thoughts on improved resolution.
Using that 50A unit as a model
Increase the ADC to 12 bit.
remap the ADC reading to -2000 - +2000.
Divide by 32 to get a result in Amps. Note the previous comments re floating point apply. This will give a resolution of 31.25mA (0.0325A)
Four decimal places (0.5mA) is a bit over the top for this application but if this division was rounded to 2 decimal places the resolution would still be about 35mA which for this application should be very adequate while maintaining simplicity.
Ahhhh ok, I dont have any experience with larger scale solar systems so not fully aware how many amps are pumping through them. Yeah definitely, the whole thing would probably pop ahaha.
My main concern was getting useable readings out from the modules since the curve from the current meter might transfer to an ADC a bit awkwardly. And I2C is really simple on the Raspberry Pi’s, doesn’t seem like there are any suitable ones though.
In a power monitoring system be recorded but in a system where is isn’t necessary do you think it would be worth allowing it to overflow for a small amount of time? I saw on a Pololu one that it can supposedly handle 5x the measured current.
Neither have I. I was thinking more of the discharge situation at night where someone switches on purpose or accidentally a high load item while lights, TV or other things are on. It would not take much to get to 30A+.
The output voltage versus current change is quite linear and that would not be a problem. This could be fed directly into Arduino or a separate ADC. I note that Core have a quad 12 bit converter with I2C output.
The blurb says the resolution for single ended input is 11 bit. My previous statement would work by changing the remapping to -1000 - +1000 and dividing by 16 to get a direct number in Amps. The advantage of the 50A unit is the 40mV per amp as you can see it is quite simple to get a direct Amp reading with a bit of number massaging.
I don’t see why not. About all that would happen is the readings would max out and would not go further. The actual amount of over current would depend on physics like track and chip robustness. You would no doubt get to a point where the tracks or chip would just explode.
The Pololu linked unit would be OK at 30A as I wouldn’t expect a lot more than this. To comment further than this you would have to know Bob’s van set up details. But with this unit you still need an ADC and I2C so really no advantage. Also at 66mV per amp it is a little more awkward in the number crunching department. I haven’t done the number massaging exercise (may do later) but for the sake of simplicity I would go for the 50A unit at 40mV per amp.
I am a great believer in the KISS principle.
I don’t like the idea of passing high current through a current sensor. I use -200 amp to + 200 amp LEM current transducers where the cable passes through the sensor. I do get up to 175 amps at 48 volts in one of my off-grid systems. You can choose a lower current sensor. Element14 sell these units. There is a clever approach to measuring the minus to plus range so that the voltages measured are always positive. I can help with implementing this.
I use a 12 bit ADC modules (from Core Electronics). These units provide better precision than the Arduino and make the Raspberry Pi the best way to go. I probably should have used the 16 bit units as advised earlier in this thread for the current sensing.
Multiply the negative numbers by -1.