Building a 50A sensor module for openXvario

Development & General Chat for the superb openxvario project.

Moderator: rainer

User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Building a 50A sensor module for openXvario

Post by kaos »

I am in the process of building the openXvario (still waiting for the gy63 to arrive). I also want a current sensor go along with it. I looked at the google code page, it uses ready made current sensor but all of them I found is only up to 30A. my application is running mostly high20+A to high 40+A. I like to build a 50A sensor module for the openXvario. I bought a ACS758LCB050B sensor http://www.ebay.com/itm/390341332320?ss ... 1439.l2649
Can any one help me of the schematics and the other components spec needed (ie, resistors, caps..)? so i can start the project while still waiting the gy63.
thx.

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

I built a current sensor for the openXsensor but I used the ACS758LCB-050U, which is unidirectional and gives better resolution.
I did post somewhere here on the forums but don't remember where.. :(

EDIT: Found it.

viewtopic.php?f=86&t=3420&start=30#p59268
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

thx Jhsa. that was what I was looking for too (I remember I read that at one time). just could not find it. I will be back if I running into problems.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

If your're not using more than 3 cells, you can use the regulator from the arduino.
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

I will be using it for 3 and 4S. I am thinking using a 5V reg (L78M05CV) to power it and draw the power directly from lipo.

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

That's what I did before. Now I still take the power from the lipo but use the arduino's regulator. The arduino and sensor need to be powered by the same source. What you could do is to use for example a 7808 (8 volts) regulator before the arduino's regulator. For 4 cells maybe even a 7812.
With only a 7805 the drop in voltage is quite big and the regulator will get hot at low current. When I used it, mine did get quite warm with a 3 cell lipo.

Joao

Sent from my GT-I9195 using Tapatalk
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

Which kind of receiver are you using?
Please note that the current version on google (r197-r198) does not transmit (yet) the current to the tx when connected to a X8R or X6R receiver. Those receivers use the SPORT protocol and the current version of oxs transmits only vertical speed, altitude and Rpm over the SPORT protocol.
The r197-r198 version should be OK to transmit the current for D series receivers.

If you want to use an openxsensor with a X serie receiver to get more informations, I can send you another version of the program that works only for SPORT protocol but can measure and transmit several voltages (at least 5), current (on top of altitude and vertical speed).I use it to get e.g. the voltage of each cell of a 3S lipo.

Note : personally, my oxs get the power supply from the receiver (via the SPORT connector). If you receiver get about 5-6 volt from a separate battery or from a BEC, there is no need adding a 78xx.
This is OK because the current sensor you are using has a galvanic isolation between on one side the 3 pins to connect to the arduino (VCC, Grnd, VIOUT) and on the other side the 2 big pins where the current go through.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

We are talking about the D series receivers. I think kaos also uses them, so what he wants is the oXs from the google repository.

On my version, only one wire goes to the receiver. Ground is on the battery side. Sensor and arduino share the same supply. The sensor is connected to the VCC pin of the arduino.
Sent from my GT-I9195 using Tapatalk
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

mstrens:
Thx for the wonderful summary of oXs. I was confused with the D and Sport version for sure. yes, I am using D rx (it would be a long time for me to get a XJT module, really have no need at the present time. My Tx is already running 16ch with DHT+DJT) and mostly I am using ESC with built in BEC at 5-6V. would that work as a power source for the oXs without a separate UBEC? Will the ASC785 good enough to isolate the noise.
I wonder if the D version of oXs support those cell voltages or not? would be nice to have those all in a small package. ;) Your version for the X rx would be the ideal set up for my D rx. :) I was surprised the oXs made a turn to Sport instead of continuous development for the D series.

jhsa:
Have you tried using the rx power to supply Arduino and the current sensor?
just to confirm, in your drawing there is C1= 10uF C2=100nF C3=10nF right? u and n looks pretty similar. ;)
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

Kaos,
I do not expect any problem using the BEC (from ESC) as power source for the Arduino.
I imagine you are using an arduino pro mini.
You can then connect the +5-6 volt from ESC to the "Raw" pin from arduino board.
You can than connect the "VCC" pin from Arduino to:
- VCC of GY-63
- VCC from your current sensor.
So both GY-63 and your current sensor should get the power supply from the regulated voltage already present on Arduino board.
I do not expect that there would be to much noise if the voltage provided by ESC is about 5.1 or 5.2 volt because the voltage regulator from arduino board should regulate the voltage.
If the voltage provided by ESC is to low (e.g. 4.8 volt), the voltage regulator from arduino board can't regulate anymore and there could be more noise as wel on the arduino (and so on his ADC) as on the current sensor.

If you look on google, you can find several branches e.g. for openxvario/openxsensor.
The original branch was openxvario. This branch allows you to measure individual cells.
You could try it (I have no experience with this version).
I expect it does not support the SPORT protocol but this is not an issue for you.

Afterwards, the code has been rewritten (and branch openxsensor has been created); SPORT protocol has been partly added but a functionality like multi cell measurement has been removed (I do not know why).

Personnally, I wanted a version for SPORT that could measure and transmit more voltages.
So I developped my own version but it works only using SPORT protocol.

It is foreseen that Mike would integrate the functionalities I added to the openxsensor version available on google (supporting Hub and SPORT protocols) but he had no yet time to do so.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

thx mstrens.
All of my ESC/BEC are 5.25V or 6V, none below 5.1V (i have measured them with meter) so that takes care of the power source issue. no need for extra power source. :)
I will look into the branches on google once I get the hardware done.
and yes, I am using pro mini running 5V 12 MHz. I found out they are quite useful for different projects. People are developing devices/functions using it. I bought 5 of them and used two already. This is the 3rd one to be used. ;)
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

Are you sure that your pro mini runs at 12 Mhz?
Pro mini I use are running at 16 Mhz (5 Volt).
I suspect that the version in branch openxsensor should not run at 12 Mhz (at least not without some changes) because there are some parameters regarding the serial communication with Rx
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

I wouldn't power the arduino and sensor from the BEC. The voltage under load is not stable, there is a lot of noise also..
Better to power arduino and sensor from the battery, even if we have to use a 8 or 12V regulator to pre regulate before the arduino.. I have 2 or 3 current sensors already working with oXs. 2x100A and 1x 50A. all working good.
But that is the way I do it and will continue to do it that way as it works good :)
just to confirm, in your drawing there is C1= 10uF C2=100nF C3=10nF right?
Correct..

I'm trying to find the other schematic for my latest sensor using the arduino regulator. Sometime ago my computer exploded and I might have lost some stuff.. But If i don't find it I know someone that might have a copy.. :D :mrgreen:

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

mstrens wrote:Are you sure that your pro mini runs at 12 Mhz?
Pro mini I use are running at 16 Mhz (5 Volt).
I suspect that the version in branch openxsensor should not run at 12 Mhz (at least not without some changes) because there are some parameters regarding the serial communication with Rx
I think it was a typo and he meant to write 16Mhz.. :)

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

I think it is very possible it is a 16MHz. I don't trust my memory any more. ;)

edit: just checked, it is a 16MHz. my memory is just shot. that is part of the reason I could not find jhsa's thread. I knew i have read/seen it. ;)
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

jhsa wrote:I wouldn't power the arduino and sensor from the BEC. The voltage under load is not stable, there is a lot of noise also..
Better to power arduino and sensor from the battery, even if we have to use a 8 or 12V regulator to pre regulate before the arduino.. I have 2 or 3 current sensors already working with oXs. 2x100A and 1x 50A. all working good.
But that is the way I do it and will continue to do it that way as it works good :)
I will try both ways to see, may be I have a better ESC/BEC. :mrgreen:
I try to make this thing as small as possible/useable. I will try to see if I can solder everything together without using a bread board. The 100A Frysky current sensor is just huge.
thx for the heads up.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

Another question? what would be the spec needed for those resistors/ caps? 10V? 50V? 1/4 W?
does it make any difference whether it is ceramic, or tantalum caps?

I was over Fry's electronic today. Darn it, to get the 100nF and 10nF caps i have to pay 16.99+tax to buy a lot of 600+ various caps. :S
found on ebay for 1000 pc lot of caps is only 4.55 free shipping. I think I will wait for the slow boat. ;)
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

Kaos,
I do not know which schema you are using but I expect that you could already test the arduino and the current sensor without any capacitor if arduino is powered from the receiver on the raw pin.
You just have to connect :
- VCC from arduino to VCC from current sensor
- Gnd from arduino to Gnd from current sensor
- an analog pin from arduino to VIOUT from current sensor. Take care to adapt config.h file accordingly the analog pin you choose.

Later on you can always add a 100 nf between VCC and Gnd form the sensor (best is that this capacitor is as close as possible from current sensor pins). For such a capacitor value, a ceramic capacitor is ok. The capacitor can help reducing noise on the measured current but I do not expect it should be critical.
It should even be possible to add one resistor and one capacitor on the arduino side (on the analog pin) if the measured current would still be to noisy. In this case, you could probably use :
- a 10k resistor (value and size as not critical at all) between Analog pin (from arduino) and VIOUT (from current sensor)
- a 100nf capacitor (value and size as not critical at all) between Analog pin (from arduino) and Gnd (from Arduino)
Better to add those 2 components close from arduino pins.
Personally, I would start without any resistor and capacitor and I would add them later on if measurement is to noisy.

Note : a capacitor of 100nf and a 10 k resistor (values not critical) are quite common. Perhaps you can find some in an old electronic device that you do not use anymore.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

thx I will start testing. did not know I can test it without caps/resistors. I already ordered from ebay for a total of 1000 resistors and 1020 ceramic caps of various type for total of ~10.00. I figure I can use the rest for something else later.
the schematics I refer to is by Jhsa in his post linking to his build.
I have a few hundreds of resistors that came with LEDs I bought but no 47K. from what i have, I have to use at least 4 of them to get a 47K. unfortunately, most of my old electronics when they went bad, I just throw them away until recently starting fooling around with these DIY thingy. ;) what I have left are 3 computer related pcb boards with only smd components and the cap is no way to determine what they are.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

According to the ACS758 datasheet, you can't connect a cap bigger than 10nF at the sensor's output. Yes, on my testing the output was very noisy, and yes the filter helped. Now I can read the values without the numbers jumping around.

Sent from my GT-I9195 using Tapatalk
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

I had just a look at the schema from jhsa.
C1 is only required when using a external 78xx voltage regulator (it could then be a tantalium capacitor with minimum 5 volt but can be more than 5 volt).
C2 is the capacitor to add as close as possible from current sensor. It is the first capacitor I was speaking in my post. It is there only to reduce noise on the sensor.
R1 and C3 are the resistor + capacitor I speek at the end of my mail. Values are not critical. Normally when you increase R, you can decrease C. I had propose value 10 k and 100n. This would give about the same effect as 47 k and 10n. They can help filtering the signal. Filtering effect depends on R multiplied by C (so 10 * 100 is nearly 47 * 10).
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

I didn't have a schematic for my latest sensor, but a friend of mine did it and sent me the files. Thank you to HaGeHa for these files..
Note that this works with a 3 cell lipo. for 4 cells, another regulator is needed before the arduino.
This way, the voltage is very stable. the allegro sensors's accuracy depend on a stable supply as they are ratiometric.. The best way of achieving this is to connect the arduino and sensor to the flight battery and only one wire to the RX..

João
Attachments
OpenXsensor - Vario-current-voltage.zip
(35.3 KiB) Downloaded 216 times
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

mstrens and jhsa:
both of you are of great help. Thank you. those info are great. I think once I receive my caps and baro sensor I can make one. thx a lot. I will start working on putting the code in pro mini for now.
my goal is trying to build the current sensor part as small as possible. I found most of the current sensor in the 50A-100A range are bulky, I will put minimum parts at the sensor end and using a lead to the pro mini where it will be with the baro sensor. and the pro mini with baro sensor will be very close to Rx.
among my models, where the lipo connector is located is also the place crammed with space. keep the current sensor small would help placing it.
I looked into the oXs code a little. There is only range numbers for ASC712 and up to 30A only.

Jhsa: what numbers are you using in the code for a 50A ACS758?
by the way, the shcematic from your friend is great, may be it should go to the wiki oXs.
edit: oops, I think those are already in the zip file. :mrgreen:
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

Jhsa:
I looked at your arduino files again. there is no number entered in there for max/min current. Is that a number needs to be done by trial and error?

I just finished I think may be the hardest part to make this small, soldering the connectors directly to the ASC758. If I have not cooked the sensor. :mrgreen:
Here is what the sensor size will be, add one 100nF cap between pin 1,2 then a 3 lead servo wires to Pro mini where 47K R and 10nF cap will be.
Attachments
140301-1.jpg
140301.jpg
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

you have a bi directional sensor, so zero AMPs will be VCC/2. You will have to insert that on the code.. Also look in the datasheet for the mV/A value. I don't remember what it was, and my sensor is unidirectional anyway, so the numbers are completely different..
I'll try to find time tomorrow to look at the datasheet.. Too late here now :)
João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

I expect you could start with following values
#define IdleMillivolts 2500
#define MillivoltsPerAmpere 40

Then you can adjust them in order to calibrate your sensor.
First change the value 2500 in order to get 0 milliamp on your Tx screen when there is no current going through your sensor.
"40" means that you sensor has a sensitivity of 40 mv per amp. It is the value defined in the datasheet. If have an Amperemeter, you could make a test an adjust this parameter according to your measurement.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

ha, mstrens: I just figured that out when you post it and I am writing this post.;)

I think I figured it out. actually, in Rainer's wiki already included a spread sheet to figure out the max/min current milliamp.
0 amp voltage: 2.5V, according to data sheet 40 mV/A
so for rainer's ino file:
mincurrentmilliamp -62500
maxcurrentmilliamp 62500

I see in Rainer's wiki there is option to measure individual cell voltage, but i think it does not seem to measure the total voltage (>5V) without adding a divider??
It is nice to be able to measure the total voltage, that may be all I need.

In jhsa's sketch/build, it does have an option for a divider to measure total voltage up to 20.38V, but in the sketch it says 33K and 56K while in the schematic it prints 33k and 82K??? what should be used for the divider?
I wonder if we can mod Rainer's ino file to add the divider and measure total voltage? I am not sure I can do that. I will probably miss out some programing lines.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: Building a 50A sensor module for openXvario

Post by mstrens »

The 2 parameters I wrote where for the openxsensor (another version of the software).
The 2 you mentioned are for the openxvario.
Both versions use the same hardware (arduino, ms5611, ...) but there are minor differences e.g. about voltage measurements.
I normally use the openxsensor version but I just had a quick look at openxvario branch on google.
The openxsensor version on google can only measure one voltage (and not the voltage of each cell).
On the contrary, I think that openxvario can only measure/transmit cell voltages but not the total. This could easily be changed but it requires a small modification of the program.
It would then be easier to use the openxsensor version.

On the other side, I ask my self why you want to use the openxvario (or even openxsensor) to measure the total voltage of your lipo because, if you are using D series receivers, you can already measure your lipo voltage connecting the lipo to "A2" of the receiver via a divider.
User avatar
kaos
Posts: 3247
Joined: Wed Dec 28, 2011 1:15 am
Country: United States

Re: Building a 50A sensor module for openXvario

Post by kaos »

yes, that is the FBVS-01 which I am using now. I just figure since the oXs is already there. why not save a plugging/unplugging during usage. It is easy to add two wires to the current sensor but hard to add the code-for me. ;)
I will start testing the current sensor tomorrow, or today - darn it is late/early. need to go to sleep. :mrgreen:
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Building a 50A sensor module for openXvario

Post by jhsa »

Kaos, the values of the resistors are more or less up to you. Bear in mind that the arduino max voltage at the pins is 5V. Then you can calculate the divider for the max voltage you need. The same as we do for the receiver's analog ports. Another tip for accuracy is to measure your resistors with a multimeter and insert the exact values on the code.

I do use the voltage sensor on the arduino as I leave the analog ports free for sensors that are still not supported. And I find the arduino more accurate. I also like to keep it all together and have just one wire going to the receiver. That will also avoid damage to the rx in case something goes wrong and some big current tries to pass through the reciever. Seen that happen.

Joao

Sent from my GT-I9195 using Tapatalk
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Post Reply

Return to “OpenXVario - an open source vario supported by the open source firmwares!!”