Page 4 of 5

Re: FrSky Amp/Current Sensor.

Posted: Tue Feb 12, 2013 9:19 pm
by jhsa
I have a 50A one on the way to me.. one that was linked earlier on this thread. will also play with it.. but I think it is bidirectional..
will get a 100A sensor.. as soon as wife is not looking :mrgreen:

Re: FrSky Amp/Current Sensor.

Posted: Fri Feb 15, 2013 10:48 am
by isvedic
Since all hall sensors have starting offset, it would be nice to remove it.

I'm no electronics guy and this could be wrong and not efficient but simulator showed it should do the trick, if someone have more knowledge in electronics it could optimize this more because I ended with voltage divider on output.

So this will subtract 2.5V from starting voltage so instead of having range of 2.5-4.5v you will have range of 0-2V
subtractor.png

Re: FrSky Amp/Current Sensor.

Posted: Fri Feb 15, 2013 12:08 pm
by MikeB
The LM358 does not work well from a 5 volt supply, it cannot drive its output high well.
I would suggest using a MCP602, a CMOS rail-torail op-amp, same pinout. Also, as it is CMOS, it uses less current, and has much lower input loading, so you could use higher value resistors.

Mike.

Re: FrSky Amp/Current Sensor.

Posted: Fri Feb 15, 2013 1:02 pm
by isvedic
MikeB wrote:The LM358 does not work well from a 5 volt supply, it cannot drive its output high well.
I would suggest using a MCP602, a CMOS rail-torail op-amp, same pinout. Also, as it is CMOS, it uses less current, and has much lower input loading, so you could use higher value resistors.

Mike.
But diagram is OK? Is there any way not to use voltage divider on output?

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 12:26 pm
by herrkirk
Here is my current sensor.

It uses a ACS-756 (100A) and a voltage regulator to supply the 5V directly from the battery.

The output is 2.5V @ 0A and since the maximum voltage at the FrSKY receiver analog inputs is 3.3V I'm using it inverted so the output would be 0V @ 100A. I set the offset and range at Open9x and the only inconvenience is that it shows a negative value.

I tried to change the current calculations at er9x but gave up!

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 2:21 pm
by jhsa
ok, it's 2.5V @ 0v, how many volts at 100A??

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 3:03 pm
by Flaps 30
jhsa wrote:ok, it's 2.5V @ 0v, how many volts at 100A??
Here you go
herrkirk wrote:I'm using it inverted so the output would be 0V @ 100A.
:)

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 3:41 pm
by jhsa
yes, I understood that.. I meant the positive side.. We could scale it down with a divider and offset it..
I asked what the top voltage would be at 100A because I think it is very rare sensors output their supply voltage, so the max output for this sensor could be about 4.5V for example instead of the 5V. I'm feeling too lazy today to go looking for datasheets ;) :)

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 3:59 pm
by Flaps 30
I am trying to see what the problem is ... The the way that the sensor is set gives you 2.5Volts at zero Amps and zero volts at 100 Amps and that looks okay to me. As Herrkirk says. That keeps the output voltage of the sensor within the limits of the Frsky RX analogue input.

I have no doubt that with the use of an Op Amp you could invert that and offset it if needs be. But that is yet more circuitry when it is not needed, as that can be done in Open9x. It's only the inverting that might be an issue for Open9x..

Hope I have got that all correct?

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 4:18 pm
by jhsa
That is a bi-directional sensor I would say.
we can also use the 2.5 to 5V. that is what I was thinking.. with a voltage divider

João

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 5:19 pm
by Flaps 30
And how would that voltage divider work without having to add additional electronics to remove the offset?

The starting point of this device is - Vcc/2=0 Amps so it would make sense to run it so that the maximum current equals something around zero volts to keep it compatible with the Frsky RX's without having an additional component count. Using the TX software to remove the Vcc/2 offset seems the best way to me.

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 5:25 pm
by jhsa
If I'm not mistaken, open9x offers an offset on the analog inputs.. ;)
I have the feeling that this is what you've just said.. Lack of sleep, I guess :?

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 5:30 pm
by Flaps 30
IT does that... :)

Not sure if it is possible to reverse the +- aspect in Open9x to allow this method to be used without showing a negative value, or even if it makes any difference to it regarding calculations, as negative current is still current. :)

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 5:33 pm
by jhsa
with the offet, why going negative? shouldn't it be possible to offset the 2.5V to zero?
I'm asking because I haven't tried it yet as I'm new to the firmware..

João

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 5:42 pm
by Kilrah
Yes it is possible, but:
The RX can measure only up to 3.3V. So without adding components and using the offset you could measure from 2.5V (0A) to 3.3V (only 32A).

To measure the full 100A you'd need to add a divider so that when the sensor's output is 5V the RX only receives 3.3V, i.e. a 2/3 divider. This would also reduce resolution by 2/3, i.e 26.4mV/A.
By using the negative side he avoids putting components, and keeps the 40mV/A resolution.

A possibility would be to allow negative Range on the analog settings. Easy on ARM, hard on stock board because of the extra bit needed in EEPROM.

Re: FrSky Amp/Current Sensor.

Posted: Thu Feb 21, 2013 5:43 pm
by MikeB
I've posted an idea I have that is relevent to this, see viewtopic.php?f=5&t=2&p=40761#p40761.

Mike.

Re: FrSky Amp/Current Sensor.

Posted: Fri Apr 26, 2013 4:15 pm
by jhsa
Well, I ordered some Allegro ACS758 100U (Unidirectional) current sensors a while go.
reading the Datasheet I've noticed that they also work at 3.3V, but they warn that they might not be as accurate as when they are supplied with 5V. Decided to give it a go as 3.3V would make a perfect match to the A1/2 ports of the FrSky receivers and a voltage divider is not needed for the full 100A range..
After calculating the offset and range ( Thank you so much Kilrah as my math knowledge is terrible ;) ) I built one..
It is working but need to do some testing to see if it is accurate as I'm not sure if I have the range right..
The values I have at the moment are:
Range 125
Offset -15.7
The little 2 pin header is for a jumper to shunt the 3.3V regulator so the sensor can be supplied with 5V from the receiver if needed. maybe with other projects ;) Hmmm, I could for example think of the openXvario :D

For now this sensor will only work with openTX as an offset is needed and er9x doesn't provide this feature yet..
The capacitors are a 10uF and a 100nF in parallel with the regulator output.

Here are some pics.

João

P.S. - when soldering the battery connectors to the sensor (big ones) be carefull not to overheat the sensor or you will destroy it.. Ask me how I know :(
$8 down the drain.. :(
Stupid me. :D

Re: FrSky Amp/Current Sensor.

Posted: Sat Apr 27, 2013 7:04 pm
by jhsa
Ok, i think i will need some help here.. :(

tried the sensor at 3.3V but the results seem not to be so good..
Then, Bypassed the regulator so the sensor is supplied by the 5V coming from the receiver.
Built a divider from 5V down to 3.3V. well, close enough. the values of the resistors are: 11.2K (10k+1.2k), and the one to ground 22K.

measured with the multimeter the values are:
11.18K and the one to ground is 21.92K
That gives me 3.31V at the output of the divider for an input of 5V

powered by 5V and at zero amps the sensor outputs 0,6V. After the divider it should be 0.39V for zero amps.
the sensor, at 100A should output (5V supply) 0.6V + (0.04V * 100) = 4,6V

0.04V is what the sensor outputs per Ampere.
so, after the divider should be. 0.026V per ampere.
that makes 0.39 (offset after divider) + (0.026V * 100) = 2.99V

The problem starts here :)
My ESC is outputing exactly 5V (on my meter) and I have an offset of about -16A set on the radio so the display shows 0A when the motor is not running.. Played a bit with the range values and the most accurate measurements I could get was with a range of 137. But it's still way off.. closer than with the sensor being supplied by 3.3V though
Could someone help me with this one? I'm learning. ;)

Thanks.
Ahh, forgot to say that my multimeter only reads maximum 10A :( So I can only verify the accuracy until 10 amps. I have it in series with the sensor to be able to compare both at the same time.

João

EDIT: Here is the datasheet for the ACS758 100U

Re: FrSky Amp/Current Sensor.

Posted: Mon Apr 29, 2013 4:01 pm
by rainer
Hi Joao,
the interesting part would be the voltage the sensor actually puts out for various different currents. Which voltage does it put on the A1/A2 for some test currents? ( measured behind the voltage divider)
you could for example just programm your A1/A2 port to display the current measured with a range of 3.3v and an offset of 0v. ( in case you don't have a second voltmeter avaiulable). Than we could calculate a bit better which "real" values to use.
Rainer

Re: FrSky Amp/Current Sensor.

Posted: Mon Apr 29, 2013 4:25 pm
by jhsa
Hi Rainer.. I'm going to borrow a wattmeter from a friend tonight..
The problem is that my multimeters only measure 10A maximum.. According to the datasheet, the ACS758 100U outputs 0.6V at zero Amps and then 40mV per Amp for a supply of 5V

Last night I just removed the 3.3V regulator I had earlier, and replaced it with a 5V regulator (78L05) powering the sensor directly from the Lipo instead of the receiver. This to avoid fluctuations on the sensor's readings, as the offset voltage and the mV per amp change with the voltage supplied to the sensor.. So, this voltage must be as stable as possible
Will post my findings..

João

Re: FrSky Amp/Current Sensor.

Posted: Tue Apr 30, 2013 10:38 pm
by MikeB
jhsa wrote:For now this sensor will only work with openTX as an offset is needed and er9x doesn't provide this feature yet.
Actually, er9x does provide an offset for the current sensor. On the telemetry page where A1 and A2 are displayed, if either (or both) are set to "A", then pressing MENU LONG uses the present reading as zero. The value is not stored in the EEPROM (yet). I have just allocated a couple of bytes in the EEPROM for them.

Mike.

Re: FrSky Amp/Current Sensor.

Posted: Wed May 01, 2013 12:32 am
by jhsa
Ok, sorry, didn't know that.. I thought it didn't have an offset, maybe because I can't see it.. :)

João

Re: FrSky Amp/Current Sensor.

Posted: Tue May 28, 2013 9:00 pm
by LTMNO
Joao, did that work out for you?
Interested as I might build one as well.

Thanks.

Re: FrSky Amp/Current Sensor.

Posted: Tue May 28, 2013 10:11 pm
by jhsa
I'm working on it at this precise moment.. ;) :D

Re: FrSky Amp/Current Sensor.

Posted: Wed May 29, 2013 11:27 am
by Flaps 30
jhsa wrote:I'm working on it at this precise moment.. ;) :D
Have you anything to report back on this?

Re: FrSky Amp/Current Sensor.

Posted: Wed May 29, 2013 11:50 am
by jhsa
Not so much.. apart that despite all the calculations I made, and the formulas are right, I don't get the right value displayed.. It always shows less than it should.. I even measured the voltages at the sensor output and calculated from there but in circuit it behaves different.. It is linear though. With the measured voltages it gave me a resolution of aprox. 34,47mV/A. When I inserted these values, it still was showing less than it should according to the wattmeter.
Oh, I'm testing with the test code for the openXvario.
So, I got as bit p****d off with it and decided to go trial and error. So, to have a more or less correct value, at least till 30A cos I can't test it higher as I would need a more powerful motor, I reached a value of 33mV/A which is way to low compared to the 40mV/A from the datasheet :o
I thought it could be due to the supply voltage being too low at the sensor, but then why it does give the same offset voltage of 600mV at 0A? That is what I don't understand..
Anyway, more testing needed as I think this information has no great value at all at this point. that is why I didn't post it ;) :)

Joao

Re: FrSky Amp/Current Sensor.

Posted: Wed May 29, 2013 1:29 pm
by rainer
jhsa wrote: ..I think this information has no great value at all at this point. that is why I didn't post it ;) :)
Joao
Well actually you did post it :mrgreen:

Re: FrSky Amp/Current Sensor.

Posted: Wed May 29, 2013 1:37 pm
by jhsa
I meant to say that is why I didn't post it BEFORE :mrgreen: ;)

Re: FrSky Amp/Current Sensor.

Posted: Thu May 30, 2013 1:42 am
by jhsa
Ok, here is something that is worth posting ;)
After all this trial and error with the ACS758 100U sensor I think I got it working.
But the values I had to use for the mV/A are far from what the datasheet says. it states that the value is 40mV/A, but this gives way less Amps than my wattmeter.. I had to bring it down to 33mV/A and now, at least until 30A seems to be quite accurate. It still might need a little fine tunning but still inside the 0.5A resolution.. actually, I could say that the error is less than half of that value. Above 30A... I don't know.. someone else might have to test it..
I think I managed to reduce the noise at the output of the sensor by using a low pass filter as in the datasheet, but it doesn't say what values for the resistor and cap (picture attached to this post) we should use.. It only states that the cap must be maximum 10nF and the resistor minimum 4,7K.- So, I replaced the resistor with a 100K trimmer and started adjusting until the numbers were not flickering so much on the screen anymore. Got a value of 47K. I guess it could still be a little bit higher but the results are already good I think.
This time I decided to add a little 78L05 100mA 5V regulator to the sensor board with a 22uF and a 100nF caps in parallel with it's output.. This regulator power the sensor and the arduino through it's VCC input (not the raw input). From the arduino to the receiver, only one wire. The one that connects to the serial input (RX) at the receiver. I'm using a separate regulator for the sensors and arduino because the BEC supply can get quite noisy and the servos will put also load on it making it not very stable. I also avoid the regulator from the arduino as it will drop some voltage even if minimal.

One thing I mentioned in my post above is that as soon as I connect the voltage divider (Pin A3 of the arduino) to the balance plug, the reading increases by about 200mA.
the sensor is connected to the analog pin A2 on the arduino.. the voltage divider connects to A3. I have no idea why the reading increase by this amount when I connect the voltage sensor (divider) to the battery balance plug..

Ok, this is what I got till now. Next, will build another sensor with the ACS758 100U that arrived today and compare to the first.. if the readings are the same using the same values, we're good to go. If they are not.... Houston we have a problem.. :mrgreen:

João

Re: FrSky Amp/Current Sensor.

Posted: Fri May 31, 2013 9:56 am
by jhsa