OpenXSensor SPORT Interface

Development & General Chat for the superb openxvario project.

Moderator: rainer

User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: OpenXSensor SPORT Interface

Post by MikeB »

It may be possible to auto-detect. We would need to sense the SPort polling input, but I'm not sure how soon after power on we get the SPort signal, I'll check.

I think I've found a few 32-bit unsigned ints that can be 16-bit. Saves quite a bit of code.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Good Morning Michel,
There looks to a small weather window opening here, so I'll have an opportunity to test live test a configuration if you would like one tested.

Thanks neil
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

Neil,
Thanks.

Here the latest version I have.
It integrates the changes done by Mike and it allows sending several voltages in the cells fields.

You can test it.
Take care to adapt the config file because it is probably not you want.
Adding the sensitivy could perhaps helps finding what is blocking.

Please, to be safe, when you upload the code in an arduino for flying, I think it is best to put all "#define DEBUGxxxxxx" as comment. So it avoids the serial interface (perhaps it is this one that block the vario).
Michel
Attachments
openxsensor_Sport_Cells.rar
(35.54 KiB) Downloaded 218 times
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Thanks Michel

I'm getting a declaration error
Arduino: 1.5.4 (Windows XP), Board: "Arduino Pro or Pro Mini, ATmega328 (5V, 16 MHz)"

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=154 -DARDUINO_AVR_PRO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\Arduino\libraries\EEPROM\src -IC:\Program Files (x86)\Arduino\libraries\EEPROM\arch\avr C:\Users\neil\AppData\Local\Temp\build165332188183853036.tmp\Aserial.cpp -o C:\Users\neil\AppData\Local\Temp\build165332188183853036.tmp\Aserial.cpp.o

In file included from Aserial.cpp:18:
oxs_config.h:197: error: expected unqualified-id before numeric constant
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:4,
from Aserial.cpp:19:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:143: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:144: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:175: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:175: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:290: error: 'size_t' was not declared in this scope
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:302: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:319: error: 'size_t' was not declared in this scope
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:319: error: 'size_t' was not declared in this scope
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:319: error: initializer expression list treated as compound expression
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:338: error: 'size_t' has not been declared
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:5,
from Aserial.cpp:19:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:113: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:114: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:115: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:116: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:117: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:117: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:118: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:119: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:120: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:128: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:130: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:131: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:132: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:134: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:135: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:136: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:137: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:138: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/string.h:143: error: 'size_t' does not name a type
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:8,
from Aserial.cpp:19:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:744: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:745: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:746: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:747: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:747: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:748: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:756: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:757: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:758: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:759: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:760: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:761: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:762: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:763: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:764: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:768: error: 'size_t' does not name a type
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:24,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:28,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:195,
from Aserial.cpp:19:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdio.h:685: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdio.h:691: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdio.h:713: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdio.h:719: error: 'size_t' has not been declared
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdio.h:762: error: 'size_t' does not name a type
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdio.h:840: error: 'size_t' does not name a type
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h:23,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:27,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:28,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:195,
from Aserial.cpp:19:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/new.h:10: error: declaration of 'operator new' as non-function
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/new.h:10: error: 'size_t' was not declared in this scope
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/new.h:11: error: declaration of 'operator new []' as non-function
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/new.h:11: error: 'size_t' was not declared in this scope
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:27,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:28,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:195,
from Aserial.cpp:19:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Printable.h:36: error: 'size_t' does not name a type
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:26,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:28,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:195,
from Aserial.cpp:19:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:38: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:39: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:48: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:49: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:53: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:55: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:56: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:57: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:58: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:59: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:60: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:61: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:62: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:63: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:64: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:65: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:67: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:68: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:69: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:70: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:71: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:72: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:73: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:74: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:75: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:76: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:77: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Print.h:78: error: 'size_t' does not name a type
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:28,
from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:195,
from Aserial.cpp:19:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:62: error: 'size_t' has not been declared
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:67: error: 'size_t' has not been declared
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:67: error: 'size_t' has not been declared
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:76: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Stream.h:80: error: 'size_t' does not name a type
In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:195,
from Aserial.cpp:19:
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:80: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:81: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:82: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:83: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:84: error: 'size_t' does not name a type
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/HardwareSerial.h:85: error: no members matching 'Print::write' in 'class Print'

At point I just uncommented my T1 / T2 in config.sys. and commented your cell data

Neil
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

Neil,
The version I put in previous mail compiled fine on my side.

The first error reported shows that the error in the config file where you define which fields are transmitted.
In file included from Aserial.cpp:18:
oxs_config.h:197: error: expected unqualified-id before numeric constant

I suspect that you did not strickly respect the format. #define that are spread on several lines have to end with "\".
You can also put all parameters on one line if you prefer.
Michel

NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

thanks I ll double check
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

I'm being pick up for slope in 5mins, but I managed to compile with sensitivity and Vspd it is just altitude that causes the compile error.

I think there may be an issue there, I look when I get a chance, still the vspd is the many interest
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

Hey guys

Wow, I read the whole thread. Great job of all! I will jump in as a user (with limmited programming-skills compared to you). I will not use it for vario stuff, but more fore voltage measurement (lipo and temperature). If it is possible to have mixed both version (hub and sport) in one project, it will be fine. But - do you really have a mixed rx-setup? I completle run the hangar with x8r.

Any other important thing to me. It should be "outsourced" as much as possible. The code needed in the main-file (.ino) should be very less. If someone (as me) has to take even more functionality to the arduino, I can't be in line with all the modifications. And my addons are not for public because they are addressing some other requirements. This is my wish for the future ;)

Some words about voltage-reading of cells. Be careful when Calculating cell2 = tot - cell1. The voltage has to be divided with external resistors. Depending on their precision you will end up in differencies - even when using resistors with 1% tolerance. The fault with 2 and 3 cell is not that much. I have to track a 10S lipo and I cant use this method. So I have to measure each cell directly. Therefore, 10 Values sending to the taranis is huge. I like to use only two values. One for the lowest cell-voltage and another for the number of that cell. The Arduino should find out, wich cell it is (contolled by a mux). You see, not a normal requirement for anybody.

So I would be habby if the main code is very light and stable.

But first, I try to get Michaels code up and running and try to measure one voltage...
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: OpenXSensor SPORT Interface

Post by MikeB »

If you use the hardware serial it does include two interrupts. These will probably upset the SPort timing. I've just done some changes so that if DEBUG is off, the hardware serial code is no longer included. I've also done some changes to make the code smaller!

I would agree we seem to have a lot of options, but I'm not sure we can easily reduce them. Different users would like different things.

I'm still only looking at this "part time".
I'm going to run some tests, and if I'm happy the code I have is working fine, I'll commit that on the googlecode page.
After that, I'll look into merging in Michel's code.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

nique wrote: do you really have a mixed rx-setup? I completle run the hangar with x8r.
I have a mix (2 X D4 and 4X X8R).
I think many people have a mix.
For sure it is possible to build several OXS but it would be easier if one OXS can fit directly in both.
nique wrote: Any other important thing to me. It should be "outsourced" as much as possible. The code needed in the main-file (.ino) should be very less. If someone (as me) has to take even more functionality to the arduino, I can't be in line with all the modifications. And my addons are not for public because they are addressing some other requirements. This is my wish for the future ;)
Did you look at the code in the branch OpenXvario or the code in OpenXsensor. The one to use normally is openXsensor. The .ino file is already much lighter and specific functions (vario, voltage, current, SPORT, ... ) are already moved in separate files (and even in classes).
It would be quite easy to put some more code from the .ino file into a different file (e.g. check button) but this would not make a great difference.
nique wrote: Some words about voltage-reading of cells. Be careful when Calculating cell2 = tot - cell1. The voltage has to be divided with external resistors. Depending on their precision you will end up in differencies - even when using resistors with 1% tolerance. The fault with 2 and 3 cell is not that much. I have to track a 10S lipo and I cant use this method. So I have to measure each cell directly. Therefore, 10 Values sending to the taranis is huge. I like to use only two values. One for the lowest cell-voltage and another for the number of that cell. The Arduino should find out, wich cell it is (contolled by a mux). You see, not a normal requirement for anybody.
You are right, it is not possible to measure with accuracy the voltage of many cells by difference of the voltages to ground. I am using 3 cells and I hope that OXS would be good enough.
I think the best solution is then to interface OXS with a specific IC. Maxim produces such an IC that can measure up to 12 cells. Still the datasheet does not recomend to use it anymore. I did not find an equivalent.
Why not using the FrSky module. It is foreseen for 6 cells but I do not know if it is not possible to put 2 in cascade. On the Frsky forum there was a request for 12 cells lipo and I think I read a positive reply from Frsky.
Note : I do not know which IC Frsky is using but I read on the forum that it is very accurate.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

MikeB wrote:If you use the hardware serial it does include two interrupts. These will probably upset the SPort timing. I've just done some changes so that if DEBUG is off, the hardware serial code is no longer included.
I presume that this change is small.
If you say me how you did (or send a copy of the file even on my email) , I could already integrate this into my version.
MikeB wrote: After that, I'll look into merging in Michel's code.
Mike, when you are ready to start with this, just say it. if you want, I can explain what I changed and why.

Michel
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: OpenXSensor SPORT Interface

Post by Kilrah »

FrSky measure all cells to ground with equal dividers, at least in the current 6-cell meters. But they use a microcontroller with a 12-bit ADC, and likely a calibration procedure to account for the resistor tolerances. Seems to be quite common, I looked at various HK cell meters and they seem to often use that solution. With an external 12bit ADC in the case of those based on AVRs or similar chips with low res internal ADCs.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

NeilRogers wrote:I'm being pick up for slope in 5mins, but I managed to compile with sensitivity and Vspd it is just altitude that causes the compile error.

I think there may be an issue there, I look when I get a chance, still the vspd is the many interest
Neil,
If config contains this:
#define SETUP_DATA_TO_SEND \
T1_FIRST_ID , ALTIMETER , 1 , 1 ,\
ADC2_ID , SENSITIVITY , 1, 1 ,\
T2_FIRST_ID , VERTICAL_SPEED , 1 , 1
it compiles fine.

But if you put comment lines after a line ending by "\" , it generates compiling error.
So this do not work:
#define SETUP_DATA_TO_SEND \
// CELLS_FIRST_ID , CELLS_1_2 , 1, 1 ,\
// CELLS_SECOND_ID , CELLS_3_4 , 1, 1
T1_FIRST_ID , ALTIMETER , 1 , 1 ,\
ADC2_ID , SENSITIVITY , 1, 1 ,\
T2_FIRST_ID , VERTICAL_SPEED , 1 , 1

This is not a program issue but a compiling rule

Michel
NeilRogers
Posts: 87
Joined: Sat Jun 22, 2013 2:12 pm
Country: United Kingdom
Location: Wiltshire

Re: OpenXSensor SPORT Interface

Post by NeilRogers »

Thanks Michel
That was my problem, I'll do some static tests I did n't get it sorted before I was picked up, conditions were pretty useless anyway.
We have another massive storm due tomorrow and Saturday but hopefully I ll be back testing Sunday.
I ll let you know how I get on

cheers neil
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

Got the Code from Michel (today 12:31) on my Mini. Without any error.

My first Bench-Setup is a Resistor an A0 and an lm35 (temp-sensor) on A1. I set "PIN_Voltage1 0" and "PIN_Voltage2 1". Is that correct? And as I understud, S.Port goes to Digital Pin 4.

(Michel, can you tell me, which value I have to select in the Telemetry-Screen to bring up these two voltages?)

Edit: got it too, it seams to be that easy. I have now in the SETUP_DATA_TO_SEND
T1_FIRST_ID , VOLT1 , 1 , 1 ,\
T2_FIRST_ID , VOLT2 , 1 , 1

Hope thats right. In the telemetry-screen I have now setup just T1 and T2, but I get allways 0, doesn't matter what is on A0 and A1. So I'm wrong somewhere... :(

Thanks for hint.
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

mstrens wrote: I think the best solution is then to interface OXS with a specific IC. Maxim produces such an IC that can measure up to 12 cells. Still the datasheet does not recomend to use it anymore. I did not find an equivalent.
Did you mean the MAX14920? Damn, that looks easy but needs a lot of additional components for 12S...
mstrens wrote:Why not using the FrSky module. It is foreseen for 6 cells but I do not know if it is not possible to put 2 in cascade. On the Frsky forum there was a request for 12 cells lipo and I think I read a positive reply from Frsky.
Yes, why not. I don't like to have several modules in my plane. wiring will be hell. So I like the oxs. All done by the arduino, just need a minimum of wiring - well probably only a wish for next christmas, will see. First, I want to see my two values on the taranis. Then I have some parts from cn to try my 12s-thing...
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

nique wrote:Got the Code from Michel (today 12:31) on my Mini. Without any error.

My first Bench-Setup is a Resistor an A0 and an lm35 (temp-sensor) on A1. I set "PIN_Voltage1 0" and "PIN_Voltage2 1". Is that correct? And as I understud, S.Port goes to Digital Pin 4.

(Michel, can you tell me, which value I have to select in the Telemetry-Screen to bring up these two voltages?)

Edit: got it too, it seams to be that easy. I have now in the SETUP_DATA_TO_SEND
T1_FIRST_ID , VOLT1 , 1 , 1 ,\
T2_FIRST_ID , VOLT2 , 1 , 1

Hope thats right. In the telemetry-screen I have now setup just T1 and T2, but I get allways 0, doesn't matter what is on A0 and A1. So I'm wrong somewhere... :(

Thanks for hint.
I am not sure that I understand 100% how you build your hardware.
You speek about a resistor on A0.
Just to clarify: the program configures the arduino to read voltages of max about 1.1 volt (+/- 10% I think)(because it uses the arduino internal voltage reference).
So, if the voltage you want to measure is less than about 1 volt, you can connect it directly to one of pins marked "A0", "A1", ..."A7". Still even in this case, it is safe to use a resistor between the "A0" (or "A1", "A2", ...) and the voltage you want to measure in order to limit the current if the voltage accidentally would be bigger than 1 volt (or VCC- I would have to check the datasheet). It would prevent damaging the arduino. This resistor could be about 10 k I think.
On the other side, if the voltage you want to measure is higher than say 1 volt, you need to use 2 resistors. One point of a resistor must be connected to the ground (0v) , the other end should be connected as wel to the arduino pin (A0, or A1, ...) as to one end of the second resistor. Finally the other end of the second resistor has to be connected to the voltage to measure. The 2 resistors have to be calculated in order that for the max voltage to measure, the voltage on the mid point should be around 1 volt.

For the temperature sensor, I had a look at the datasheet and it is possible just to connect ground to ground, VCC to arduino 5 volt and the lm35 output directly to the arduino pin A1 (or another). The voltage on the arduino pin wil be 10mv/degree celcius so it would reach 1 volt only for 100 c.

To avoid any hadware issue, did you measure with a voltmeter that the voltages on A0 and A1 where greater than 0 and less than 1.1.
If so, the arduino should measure the voltage and send values to the TX via the SPORT. This suppose that you a using a receiver X8R or X6R and that the configuration is OK.
So, the Sport signal from Rx should be connected to digital Pin 4 (as you said) if you config file contains this line:
#define PIN_SerialTX 4

If the arduino has a separate power supply, do not forget to connect the arduino ground to the RX ground.

Then in the config file, you have to instruct the arduino that it has to measure only 2 voltages.
So the config must say:
#define PIN_Voltage1 0 // Pin for measuring Voltage 1 is A0
#define PIN_Voltage2 1 // Pin for measuring Voltage 2 is A1
#define PIN_Voltage3 8 // Not used
#define PIN_Voltage4 8 // Not used
#define PIN_Voltage5 8 // Not used
#define PIN_Voltage6 8 // Not used

You must instruct the Arduino which fields has to be transmitted.
Take care of the syntax here. It is also possible to put all parameters on a single line (avoiding the "\"). So in you case you should have:
#define SETUP_DATA_TO_SEND T1_FIRST_ID , VOLT1, 1 , 1 , T2_FIRST_ID , VOLT2 , 1 , 1

And finally you have to instruct arduino how it has to convert his voltage measurements.
You can start with this configuration.
It means that if the voltage on arduino analog ping is 100 mv, then the transmitted value should be about 100.
You can afterwards calibrate this as explained in the config file.
#define offset_1 0 // Offset to apply for voltage 1
#define mVoltPerStep_1 1 // millivolt per step from Analoge to Digital Converter for voltage 1
#define offset_2 0 // Offset to apply for voltage 2 (default value = 0)
#define mVoltPerStep_2 1 // millivolt per step from Analoge to Digital Converter for voltage 2 (calibration value = 1)

If you need more help, do not hesitate to ask for.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

nique wrote: Did you mean the MAX14920? Damn, that looks easy but needs a lot of additional components for 12S...
I was thinking about MAX11068 but I did not look in detail.

http://para.maximintegrated.com/results ... %20Monitor

If you do not want to transit the voltage of each cell but if just want to get a signal if at least one cell goes low, then I think that texas makes also some ICs (that seems much simple - less pinsat least)
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

Thanks for your support

I have the X8R. I Power the Arduino and with the 5V from it, I feed the X8R. So, the wiring should be ok.

Interesting what you said about the Ax Inputpower. It can be 5V! (see here: http://arduino.cc/en/Main/ArduinoBoardMini). If you using AREFF, it can be also more. But anyway. I have connected a potentiometer of 10kOhm funcitioning as a voltage-dividor as you described. So I can turn the knob an feed from 0 to 5V to pin A0.

Hmm, I'm not jet confirm with all your debug stuff. I have to do it to see, where my bug is. What I can say is, the X8R works as I can see the RSSI-Values in the telemetry-page.

Next to check:
- what is measured on A0 and A1
- does arduino communicate with the x8r on D4 (and what of course)

Edit: I have a clone of the mini-pro. But also the pro accepts 5V on Analog-Inputs.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXSensor SPORT Interface

Post by jhsa »

Guys, if you need to read positive temperatures only check this sensor out.. The "TMP37" This would give better resolution I guess.
I got some as I want to measure the engine temperature on my IC powered models, and I only need positive values.

http://www.analog.com/static/imported-f ... _36_37.pdf

The TMP35 is basically the same as the LM35.
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: OpenXSensor SPORT Interface

Post by mstrens »

Nique,
I am using a clone of pro mini to.
I think that arduino accept on analog port a voltage up to VCC (so here 5v).
The Analog digital converter (ADC) can measure a voltage in 1024 steps of a voltage on AREF.
Even if there is a pin AREF on the AVR chip, you can't get access to this pin on the peripheric side of the arduino board so it is difficult to conect it to an external (stabile) voltage ref.
By program, you can connect internally connect this pin to VCC ( normally 5volt) or to an internal ref (1.1 volt).
I prefered to connect it (by software) to the internal ref; if ithe arduino board get a lower power supply (e.g. 4.8 volt or even less from a nimh battery), the measurement should remain (nearly) correct.
If you put a voltage higher than 1.1 volt (but less than VCC, say 5 volt) on an analog pin, I expect that the arduino will support it but the ADC will return a value 1023 (the max value of 2 exp0 10); so above 1.1 you just saturate it.

There are a lot of debug possibilities in the code.
If you do not find quickly, I can instruct you some lines you just would have to uncomment. This would allow you to check if arduino:
- start up (he gives messages on the monitor terminal = PC screen)
- it internally measures voltages even if there is no X8R connected (they can be given on the PC)
- It get polling from the X8R
- it transmit data to the X8R.

If you are confuse with the xos_config file, you can send me a copy of the config file you use and I can check.


AREF can be connected
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

Thanks for help.
My setup with the poti is like this here: http://arduino.cc/en/Tutorial/AnalogInput
I expect reading correct values if useing analogRead(). Unfortunatly, I cannot read your code from above, because .rar is blocked at work. Don't you use this function? If yes, the 5V should give a value of 1023...

So I can tell more in several hours.
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

nique wrote:Thanks for help.
My setup with the poti is like this here: http://arduino.cc/en/Tutorial/AnalogInput
I expect reading correct values if useing analogRead(). Unfortunatly, I cannot read your code from above, because .rar is blocked at work. Don't you use this function? If yes, the 5V should give a value of 1023...

So I can tell more in several hours.
Openxsensor uses the function analogRead(). So there is no reason that you add it (it is already in the code).
I use the function analogreference to because per default arduino ADC use VCC as reference and I wanted the internal 1.1 volt reference (better accuracy than VCC in most cases).
If you want the files (without compression) I can send to you but probaly best per mail.
Otherwise, it is for later.
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: OpenXSensor SPORT Interface

Post by Kilrah »

Couldn't you guys use the googlecode repo or some other source control/collaborative tool? I've been trying to follow a bit, but to be fair ZIPs and RARs going back and forth in different forum threads is a bit of a nightmare to keep track of...
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

Kilrah wrote:Couldn't you guys use the googlecode repo or some other source control/collaborative tool? I've been trying to follow a bit, but to be fair ZIPs and RARs going back and forth in different forum threads is a bit of a nightmare to keep track of...
Kilrah,
sure it could but currently I do'nt have access to a collaborative tool.
I have no experience with it but this is not an issue (I can learn it).

On the other side, Bsongis had a similar reaction as you and I just explained by mail that :

I started slowly alone just trying to understand the openxsensor.
Afterwards I made more and more changes on the rainer code.
Still I was mainly interested in the SPORT protocol and to keep it simple I remove all the code for Hub protocol. Because some people were interested in some developments I made (e.g sending more than altitude and Vspeed on SPORT, measuring several voltages,...) I sent regulary my latest version as attachment on openRCforums to help them.
Mike on his side continues to work on openxsensor too but always refering to the version of Rainer. So there are currently some divergencies.
Mike had planned to merge the 2 codes in one version (that could even perhaps support the 2 protocols without reloading the firmware).
So, in order to avoid adding confusion for normal user, I am not sure that it is the right time to publish my code on github asking Rainer an access. Perhaps better waiting a few days (weeks) that Mike makes an "official" version.

I am open to any suggestion and I wait your feedback.

Michel
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

Thanks, got it too. I guess you use somewhere "analogReference(INTERNAL)".

Probably, I can play with other Types of analogReference and see what happens. So there remain two solutions. I reduce the A0-Input for all sensor to max 1.1V (with an external divider) or I use AREF and connect it to VCC to read correct values, if VCC lowers to 4.8 or similar.

Well, if analogReference remains on type DEFAULT, it should result the same - not? Tests will give the answer.

I do not like to build an external divider for 1.1V support, because you need more parts and you have again the resistors tolerance to respect. I prefer to asure the 5V as there are some other parts they require exactly 5V. In the plane I use almost pololu-step-down modules. They are good and they use a very high frequency that will not disturb video-signals... (sorry, OT).

First, I will enable some debug and then try 'till smoke ;)
User avatar
nique
Posts: 14
Joined: Wed Feb 12, 2014 3:05 pm
Country: Switzerland
Location: Bern

Re: OpenXSensor SPORT Interface

Post by nique »

After reading all quots in this thread, I was also confused about the version and where to got them. It is still early development! If any "dummy" user (as me) wants to step in, you have to handle it. I think I can and grab the code from Michel. I knwo, one fine day if all is cleand up, I have to do some settings again. Thats the deal: be engaged or wait until someone sells them.

These awesome guys works actually with 3 concepts to find one big solution - You have my thumb up!
mstrens
Posts: 1435
Joined: Fri Dec 27, 2013 7:49 pm
Country: -

Re: OpenXSensor SPORT Interface

Post by mstrens »

nique wrote:Thanks, got it too. I guess you use somewhere "analogReference(INTERNAL)".

Probably, I can play with other Types of analogReference and see what happens. So there remain two solutions. I reduce the A0-Input for all sensor to max 1.1V (with an external divider) or I use AREF and connect it to VCC to read correct values, if VCC lowers to 4.8 or similar.

Well, if analogReference remains on type DEFAULT, it should result the same - not? Tests will give the answer.

I do not like to build an external divider for 1.1V support, because you need more parts and you have again the resistors tolerance to respect. I prefer to asure the 5V as there are some other parts they require exactly 5V. In the plane I use almost pololu-step-down modules. They are good and they use a very high frequency that will not disturb video-signals... (sorry, OT).

First, I will enable some debug and then try 'till smoke ;)
In the file oxs_arduino.cpp you will find the instruction
analogReference(INTERNAL) ;
If you put this instruction as comment, ADC will perform all conversion regarding VCC.
If you have a stable power supply, this can be a good choice.
It is even better when you sensor return a value that is a fraction of VCC (e.g. most current sensor return VCC/2 for 0 amp).
For each voltage, you can still adjust the offset and the mVoltPerStep in order to get the best accurate and readable value on the TX.
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: OpenXSensor SPORT Interface

Post by jhsa »

(e.g. most current sensor return VCC/2 for 0 amp).
Many sensors do it, which is bad for our application. You get only half of the resolution.
I use the ACS758 100 and 50, but only the "U" type, which is Unidirectional. around 0.6V at zero amps.. I say around because the sensors are ratiometric which means their readings depend on the supply voltage.
The Bi-directional sensors are also ratiometric.

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
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: OpenXSensor SPORT Interface

Post by MikeB »

I've just committed all the changes I have. I believe it is all working, but I can't test all possible combinations.

Changes:
Byte stuffing on the SPort interface added.
Custom versions of millis(), micros(), init(), delay() and delayMicroseconds() without interrupts.
RPM, input MUST be on IO8 (ICR1). This is sent over hub and SPort interfaces.
The PPM pulse measurement may be on either IO2 or IO3. Only these will work as they rely on the hardware interrupts INT0 or INT1.
I slimmed the code in places by using either pointers, or 16 bit values instead of 32 bit values.
If DEBUG is not defined, then the code compiles WITHOUT the hardware serial code included.

This probably needs a bit of tidying up, I put the new millis() etc. in Aserial.cpp. I think we may need another source file to have these in.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

Post Reply

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