OpenXSensor SPORT Interface
Moderator: rainer
-
- Posts: 87
- Joined: Sat Jun 22, 2013 2:12 pm
- Country: United Kingdom
- Location: Wiltshire
Re: OpenXSensor SPORT Interface
Hi Mike,
Michel has been doing quite a bit of work with the filtering.
I've sorted out my flying test beds so I can run in parallel either the Beta Frsky Hi Precision Sensor or GPS with the OxS to evaluate the performance.
I can test any improvement live weather permitting.
Thanks neil
Michel has been doing quite a bit of work with the filtering.
I've sorted out my flying test beds so I can run in parallel either the Beta Frsky Hi Precision Sensor or GPS with the OxS to evaluate the performance.
I can test any improvement live weather permitting.
Thanks neil
-
- Posts: 87
- Joined: Sat Jun 22, 2013 2:12 pm
- Country: United Kingdom
- Location: Wiltshire
Re: OpenXSensor SPORT Interface
Michel
I've loaded your latest version onto oxs, I've now lost the negative altitude I'll test live asap.
Thanks neil
I've loaded your latest version onto oxs, I've now lost the negative altitude I'll test live asap.
Thanks neil
Re: OpenXSensor SPORT Interface
Neil,NeilRogers wrote:Michel
I've loaded your latest version onto oxs, I've now lost the negative altitude I'll test live asap.
Thanks neil
If you make a test, best to use the version I made this morning.
I fixed a bug when using multiplier and divider in the config file. It has been reported by another user.
I fixed a bug that exists in the code from the original openxvario and that I had kept (when using PPM, kalman filter - or smoothing) could get out of range).
Even if I fixed an issue with PPM, it is probably better not to use it so yo check the default sensitivity.
Here is the version. I added in the config file the transmission of the sensitivity in the field VFAS (you can select another one if you prefer). Logging sensitivity will perhaps help finding the issues you had. Normally the value in the log should be 0,5 (and could increase up to 1,0 with high sink or climb).
With this version (and this setup) my compiler reports 16562 bytes.
Do you get the same size?
- Attachments
-
- openxsensor_Sport_Volt_10fev2013_1330.rar
- (27.1 KiB) Downloaded 190 times
Re: OpenXSensor SPORT Interface
Mike,MikeB wrote:I'm just finding a bit of time to look at this again, although I have been reading along!
I have got some new code running that does millis() and micros() WITHOUT using interrupts, just reading timer1. It works fine as long as you call either millis() or micros() at least once every 4 mS.
What I would now like to do is convert the I2C from using interrupts to using polling, I have the code referred to earlier in this thread for that.
This would mean we have full control of all interrupts in use.
Mike.
FYI (as I probaly already said), I did not noticed wrong values returned by micro() and millis() after I change your code in Aserial in order not to exit from the interrupt as long as there is at least one bit (on the 8) to transmit.
Anyway, it would be better to use the modifications you prepare.
It would once be good to decide which version of openxsensor would become the standard one (for github).
I made several unofficial modifications (improvements I think) to the current version on github but I do not know if they will be kept for a future official version (e.g. currently I removed the code regarding hub protocol).
Michel
Re: OpenXSensor SPORT Interface
So, openXsensor doesn't support the D series receivers anymore? Also it's home was in google code. Is it moving?
Sent from my GT-I9195 using Tapatalk
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
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
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
As far as I'm concerned it is still on Googlecode and may be compiled for either HUB or SPort use.
This is the code I added at the end of Aserial.cpp
Mike.
This is the code I added at the end of Aserial.cpp
Code: Select all
uint16_t MillisPrecount ;
uint16_t lastTimerValue ;
uint32_t TotalMicros ;
uint32_t TotalMillis ;
uint32_t micros()
{
uint16_t elapsed ;
uint8_t millisToAdd ;
uint8_t oldSREG = SREG ;
cli() ;
uint16_t time = TCNT1 ; // Read timer 1
SREG = oldSREG ;
elapsed = time - lastTimerValue ;
lastTimerValue = time ;
elapsed >>= 4 ;
TotalMicros += elapsed ;
elapsed += MillisPrecount;
millisToAdd = 0 ;
if ( elapsed > 3999 )
{
millisToAdd = 4 ;
elapsed -= 4000 ;
}
else if ( elapsed > 2999 )
{
millisToAdd = 3 ;
elapsed -= 3000 ;
}
else if ( elapsed > 1999 )
{
millisToAdd = 2 ;
elapsed -= 2000 ;
}
else if ( elapsed > 999 )
{
millisToAdd = 1 ;
elapsed -= 1000 ;
}
TotalMillis += millisToAdd ;
MillisPrecount = elapsed ;
return TotalMicros ;
}
uint32_t millis()
{
micros() ;
return TotalMillis ;
}
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
void init()
{
// Timer1
TIMSK1 &= ~( 1<< OCIE1A ) ;
TCCR1A = 0x00 ; //Init.
TCCR1B = 0xC1 ; // I/p noise cancel, rising edge, Clock/1
#if defined(ADCSRA)
// set a2d prescale factor to 128
// 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range.
// XXX: this will not work properly for other clock speeds, and
// this code should use F_CPU to determine the prescale factor.
sbi(ADCSRA, ADPS2);
sbi(ADCSRA, ADPS1);
sbi(ADCSRA, ADPS0);
// enable a2d conversions
sbi(ADCSRA, ADEN);
#endif
// the bootloader connects pins 0 and 1 to the USART; disconnect them
// here so they can be used as normal digital i/o; they will be
// reconnected in Serial.begin()
#if defined(UCSRB)
UCSRB = 0;
#elif defined(UCSR0B)
UCSR0B = 0;
#endif
sei();
}
void delay(unsigned long ms)
{
uint16_t start = (uint16_t)micros();
while (ms > 0) {
if (((uint16_t)micros() - start) >= 1000) {
ms--;
start += 1000;
}
}
}
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 87
- Joined: Sat Jun 22, 2013 2:12 pm
- Country: United Kingdom
- Location: Wiltshire
Re: OpenXSensor SPORT Interface
Michel
On ardiuno 1.5.4 I get 16486 byte.
I'm just going to add Mike's new code and cut a version to do some static tests
Thanks neil
On ardiuno 1.5.4 I get 16486 byte.
I'm just going to add Mike's new code and cut a version to do some static tests
Thanks neil
Re: OpenXSensor SPORT Interface
The code you find on google has not been modified since several weeks.jhsa wrote:So, openXsensor doesn't support the D series receivers anymore? Also it's home was in google code. Is it moving?
Sent from my GT-I9195 using Tapatalk
This code did not work for X serie receiver but Mike worked on it and he puts on this forum a version that worked.
The version distributed by Mike supports both D and X series receivers but not at the same time (the program you upload in the OXS is not the same for the 2 series, but the samle hardware can be use for both)
Still for X receivers (SPORT protocol) this code transmits only the Altitude and the vertical speed (no voltage, no current, ...).
When I build an oxs to be used with my X8R, I first used the "Mike" code but I found that it was possible to provide several improvements.
Here are some modifications I made:
- better filtering and faster reading of the barametric sensor in order to get faster response (without more noise)
- calculating and transmitting vertical speed more often (faster updates on TX what is useful because Tx seems not always to receive all sent data)
- transmitting all available data (voltage, current, sensitivity, ...) over SPORT
- more flexibibility when you choose which OXS data is sent in which telemetry field (including a kind of change of decimal point).
- measurement and transmission of up to 6 voltages (as it exists in the openxvario; openxsensor measures only one voltage)
- better accuracy in voltage measurements (I think).
The developments I made are not published on Google.
I just share them, via this forum, with people using XOS with X8R (or X6R).
At some stage, the question will come where it has to be decided if all (or part of ) my developments will be published on the OXS google site or not.
If required I could work on the hub protocol too but I do not have the hardware to test it.
Note : on his side, Mike continue to work on some other (more technical) improvements (initially SPORT related).
I hope this is enough clear.
Michel
Re: OpenXSensor SPORT Interface
Mike,MikeB wrote:
This is the code I added at the end of Aserial.cppMike.Code: Select all
void init() { // Timer1 TIMSK1 &= ~( 1<< OCIE1A ) ; TCCR1A = 0x00 ; //Init. TCCR1B = 0xC1 ; // I/p noise cancel, rising edge, Clock/1 #if defined(ADCSRA) // set a2d prescale factor to 128 // 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range. // XXX: this will not work properly for other clock speeds, and // this code should use F_CPU to determine the prescale factor. sbi(ADCSRA, ADPS2); sbi(ADCSRA, ADPS1); sbi(ADCSRA, ADPS0); // enable a2d conversions sbi(ADCSRA, ADEN); #endif // the bootloader connects pins 0 and 1 to the USART; disconnect them // here so they can be used as normal digital i/o; they will be // reconnected in Serial.begin() #if defined(UCSRB) UCSRB = 0; #elif defined(UCSR0B) UCSR0B = 0; #endif sei(); }
part of the code concerns a function "init()".
In previous version, Aserial contains already a function named initSportUart(....) that initializes timer1.
Is init() here really needed?
What are UCSRB and UCSR0B? Are they part of oxs?
Michel
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
I forgot to mention that the lines:
// Timer1
TIMSK1 &= ~( 1<< OCIE1A ) ;
TCCR1A = 0x00 ; //Init.
TCCR1B = 0xC1 ; // I/p noise cancel, rising edge, Clock/1
are removed from intiSportUart() AND initHubUart().
Yes, this init() is NEEDED. It overrides the default one in the Arduino supplied wiring.cpp, and stops all the code from wiring.cpp being included (millis(), micros(), delay(), init() etc.)
Mike.
// Timer1
TIMSK1 &= ~( 1<< OCIE1A ) ;
TCCR1A = 0x00 ; //Init.
TCCR1B = 0xC1 ; // I/p noise cancel, rising edge, Clock/1
are removed from intiSportUart() AND initHubUart().
Yes, this init() is NEEDED. It overrides the default one in the Arduino supplied wiring.cpp, and stops all the code from wiring.cpp being included (millis(), micros(), delay(), init() etc.)
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: OpenXSensor SPORT Interface
Mike,
when I only add your code at the end of Aserial.cpp, I get compilation errors because some functions (millis(), micros(), delays(), init()) are duplicated.
I am using Arduino IDE 1.0.5 .
I have 2 questions:
- Is there an easy way to avoid those compilation errors without removing the "wiring.c" file from the arduino cores folder ? So for other arduino projects the standard arduino code would still be used.
- is it not necessary to include the file Aserial.h in all cpp files using one of the micros(), millis(), delay() functions? Is it not necessary to include an include to Aserial.h in the .ino file (to let the compiler find the init() function.
Thanks for advice.
when I only add your code at the end of Aserial.cpp, I get compilation errors because some functions (millis(), micros(), delays(), init()) are duplicated.
I am using Arduino IDE 1.0.5 .
I have 2 questions:
- Is there an easy way to avoid those compilation errors without removing the "wiring.c" file from the arduino cores folder ? So for other arduino projects the standard arduino code would still be used.
- is it not necessary to include the file Aserial.h in all cpp files using one of the micros(), millis(), delay() functions? Is it not necessary to include an include to Aserial.h in the .ino file (to let the compiler find the init() function.
Thanks for advice.
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
Coming back to this having done changes a while ago!
Looks like I added :
extern unsigned long micros( void ) ;
extern unsigned long millis( void ) ;
at the top of any .cpp file that calls them.
I'm also using the IDE 1.0.5.
Mike.
Looks like I added :
extern unsigned long micros( void ) ;
extern unsigned long millis( void ) ;
at the top of any .cpp file that calls them.
I'm also using the IDE 1.0.5.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
I've just tested this, seems to work:
1 INT0 - used for PPM measurement, set to NOBLOCK
5 PCINT2 - used to detect SPort input
11 Timer 1 COMPA - used in SPort code
18 & 19 - USART, only used whe debugging.
Mike.
Only 5 interrupt vectors now exist:1 INT0 - used for PPM measurement, set to NOBLOCK
5 PCINT2 - used to detect SPort input
11 Timer 1 COMPA - used in SPort code
18 & 19 - USART, only used whe debugging.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: OpenXSensor SPORT Interface
Thanks for the code.MikeB wrote:I've just tested this, seems to work:Only 5 interrupt vectors now exist:
1 INT0 - used for PPM measurement, set to NOBLOCK
5 PCINT2 - used to detect SPort input
11 Timer 1 COMPA - used in SPort code
18 & 19 - USART, only used whe debugging.
Mike.
I can compile without error.
I will futher test and try to integrate it into my version.
Still I do not understand how it can work:
In the ino file I see:
extern void xinit( void ) ;
Where is function xinit()?
I imagine that you mean extern void init( void ) ;
If I set this instruction as comment, it still compile without error.
So, this instruction is not required.
I imagine that the init() function in Aserial is always called by Arduino IDE itself because if I put it as comment, I get errors about duplicate definitions of millis, micros and delay.
Re: OpenXSensor SPORT Interface
Mike,
I think that I understand how IDE works.
The Arduino wiring.c file is compiled if the project uses at least one function defined in this file and that this function is not redefined into the project.
If the wiring.c file is compiled because (it is needed for one function), all functions inside wiring.c are compiled and this generates duplicates.
I my case, I was using the function delayMicroseconds too (in order to use shorter delays).
I solved this by copying the original code for delayMicroseconds into the Aserial file.
I have integrated all your changes (including I2C) in my version and I get no compilation error anymore.
I will now further test it.
I keep you inform.
Michel
I think that I understand how IDE works.
The Arduino wiring.c file is compiled if the project uses at least one function defined in this file and that this function is not redefined into the project.
If the wiring.c file is compiled because (it is needed for one function), all functions inside wiring.c are compiled and this generates duplicates.
I my case, I was using the function delayMicroseconds too (in order to use shorter delays).
I solved this by copying the original code for delayMicroseconds into the Aserial file.
I have integrated all your changes (including I2C) in my version and I get no compilation error anymore.
I will now further test it.
I keep you inform.
Michel
-
- Posts: 87
- Joined: Sat Jun 22, 2013 2:12 pm
- Country: United Kingdom
- Location: Wiltshire
Re: OpenXSensor SPORT Interface
Mike's version compiles ok using ardiuno 1.5.4 size 30720.
Michel I'll hold on modifying your version until your version of aserial is available.
Thanks neil
Michel I'll hold on modifying your version until your version of aserial is available.
Thanks neil
Re: OpenXSensor SPORT Interface
Neil,
I expect that the size of Mike version is less than 30720 because this is the max size.
When I compile this version with 1.0.5 I get 18484 (but I am not sure that I did not change the config in the Mike file).
Anyway, I integrated all the changes from Mike in my version and it compile good.
I am currently testing it.
If you want my updated version yet, just ask for it, otherwise I will make a few test before giving some feedback and putting it on the forum.
I expect that the size of Mike version is less than 30720 because this is the max size.
When I compile this version with 1.0.5 I get 18484 (but I am not sure that I did not change the config in the Mike file).
Anyway, I integrated all the changes from Mike in my version and it compile good.
I am currently testing it.
If you want my updated version yet, just ask for it, otherwise I will make a few test before giving some feedback and putting it on the forum.
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
xinit() is left over from when I was testing, it may be (should be!) deleted.
Mike.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 87
- Joined: Sat Jun 22, 2013 2:12 pm
- Country: United Kingdom
- Location: Wiltshire
Re: OpenXSensor SPORT Interface
I'm back in work until Thursday so I can't test live until then, I'll for the best version to test for then.
Thanks neil
Thanks neil
Re: OpenXSensor SPORT Interface
Mike, Neil,
FYI I uploaded my version which integrates all changes done by Mike (I2C, delay, micros, ...) and it seems OK.
It runs for 20 min (on the table) without blocking.
I logged the data and I did not see abnormal stops in the log data.
FYI I uploaded my version which integrates all changes done by Mike (I2C, delay, micros, ...) and it seems OK.
It runs for 20 min (on the table) without blocking.
I logged the data and I did not see abnormal stops in the log data.
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
Having taken over the function for micros(), I've now added handling the timer 1 input capture for RPM measurement. This seems to work, and I have an RPM value on the Transmitter display (using Sport interface). I just need to add the serial output code for the HUB and that will be complete.
I simply measure the time between one input edge and the fourth similar input edge and calculate the frequency. This is the value we need to send to the Tx. The Tx is then programmed with the number of blades and converts the value to RPM.
I have a 2 second timeout, so if there aren't 4 edges in the 2 seconds the RPM value is set to 0. THis means the lowest RPM we can measure is 120.
This generally seems to work, I fed a servo output from the Rx into the pin (IO8, PB0/ICP1) and got an RPM figure of 1650. The 'scope says the pulse frequency is 55.555 (18.0 mS period). So 55.555 * 60 = 3333. With 2 blades this is 1666 RPM, quite close. Since the frequency is sent as an integer, it is sent as 55(.00). 55 * 60 = 3300. Divided by 2 (blades) gives 1650, the displayed value.
The higher the RPM (pulse frequency), the more accurate it becomes as the decimal part becomes less significant.
Mike.
I simply measure the time between one input edge and the fourth similar input edge and calculate the frequency. This is the value we need to send to the Tx. The Tx is then programmed with the number of blades and converts the value to RPM.
I have a 2 second timeout, so if there aren't 4 edges in the 2 seconds the RPM value is set to 0. THis means the lowest RPM we can measure is 120.
This generally seems to work, I fed a servo output from the Rx into the pin (IO8, PB0/ICP1) and got an RPM figure of 1650. The 'scope says the pulse frequency is 55.555 (18.0 mS period). So 55.555 * 60 = 3333. With 2 blades this is 1666 RPM, quite close. Since the frequency is sent as an integer, it is sent as 55(.00). 55 * 60 = 3300. Divided by 2 (blades) gives 1650, the displayed value.
The higher the RPM (pulse frequency), the more accurate it becomes as the decimal part becomes less significant.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
-
- Posts: 241
- Joined: Tue Jan 15, 2013 9:41 pm
- Country: -
Re: OpenXSensor SPORT Interface
Great Mike! Are you still using Rainer's alti/vario code or have you incorporated Michel's new version?
Joe
Joe
Re: OpenXSensor SPORT Interface
Yesterday, Mike used the Rainer code.
Yesterday, based on the improvements Mike did around interrupts , I changed my version to incorporate the Mike improvements (so not RPM).
On the other side I continued this morning to improve my version.
It was already foressen to measure and transmit up to 6 voltages (as Temp1, Temp2, Fuel, ...).
It can now send transmit some (with a parameters) voltages as it would be several cells. E.g if you have a 3S lipo, OXS can measure voltages between ground and cell1, between ground and cell2 and between ground and cell3. It then calculates the voltages on cell2 and on cell3 (applying differences on the original measurements) and it transmits the cell voltages over the telemetry. So they can be displayed the same way as with an Frsky sensor.
I have no idea on the precision you can get. For sure a better precision would be achieved using a specicic IC (e.g. form Maxim)
that measures each directly the voltages between each cell.
Note : as already, my version does not support currently Hub protocol (sorry for that).
Yesterday, based on the improvements Mike did around interrupts , I changed my version to incorporate the Mike improvements (so not RPM).
On the other side I continued this morning to improve my version.
It was already foressen to measure and transmit up to 6 voltages (as Temp1, Temp2, Fuel, ...).
It can now send transmit some (with a parameters) voltages as it would be several cells. E.g if you have a 3S lipo, OXS can measure voltages between ground and cell1, between ground and cell2 and between ground and cell3. It then calculates the voltages on cell2 and on cell3 (applying differences on the original measurements) and it transmits the cell voltages over the telemetry. So they can be displayed the same way as with an Frsky sensor.
I have no idea on the precision you can get. For sure a better precision would be achieved using a specicic IC (e.g. form Maxim)
that measures each directly the voltages between each cell.
Note : as already, my version does not support currently Hub protocol (sorry for that).
Re: OpenXSensor SPORT Interface
Please don't take my posts above as criticism. You are doing a wonderful job.
Sent from my GT-I9195 using Tapatalk
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
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
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
I thinking about storing the interface and sensor options in th EEPROM. Then we could have just a single firmware that you configure to suit your specific application. Maybe even allow for the configuration to be done over the serial port (more work though).
Individual cell voltages would, perhaps, be best sent using the LiPo sensor ID and methods.
Mike.
Individual cell voltages would, perhaps, be best sent using the LiPo sensor ID and methods.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: OpenXSensor SPORT Interface
Mike,MikeB wrote:I thinking about storing the interface and sensor options in th EEPROM. Then we could have just a single firmware that you configure to suit your specific application. Maybe even allow for the configuration to be done over the serial port (more work though).
Individual cell voltages would, perhaps, be best sent using the LiPo sensor ID and methods.
Mike.
Do you think that it would be possible/usefull to load one firmware having as well the Hub and the SPORT protocols already loaded in the Arduino?
Would it not become to big if new extensions are developped?
As extension of oxs it could make sense adding:
- an interface to a special IC to measure lipo voltages with more accuracy. I presume that those kind of IC ( that can measure up to 12 cells) communicates using I2C;
- adding a second pressure sensor (e.g. to measure air speed or to get speed compensation on the vario).
Would it really be a benefit? I presume the user would still need to connect the oxs to a PC if he want to change a parameter in the EEPROM.
The main advantage would probably be that once the firmware is loaded, the user could use a more user friendly interface without using the Arduino IDE.
Could you better explain what is the Lipo sensor method.
Currently I had no documentation and I looked at the code used the TX side (for Sport interface).
So, for each couple of cells, I put on the SPORT a 32 bits value composed as 0xXXXYYY0Z where
- XXX = voltage of a cell in millivolt / 2
- YYY = voltage of next cell in millivolt / 2 (or 0 if there are no cell)
- Z = Id for XXX cell (0, 2, 4).
Prior this, I make some checks (each measured voltage > 500 mv, calculated voltage of each cell > 500 mv), wrong values are replaced by zero.
Does it exist a better way?
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
I think it is worth looking into. I haven't had much of a look at the code to see if I can make it smaller. I think there is a lot of scope for that. There is a lot of 32-bit arithmetic and some floating point as well. Easy to write code using them, but not always necessary. Often 32-bit integers can be used instead of floating point, and 16-bit integers instead of 32-bit ones.
Also there are a lot of absolute addresses used, code may be saved by using a pointer to memory instead.
0xXXXYYYCZ for the SPORT cells data,
YYY is cell Z
XXX is cell Z+1
Z is 0, 2 or 4
C is total number of cells
I've got some circuits somewhere for translating cell voltages down to a ground reference, not sure where though!
Mike.
Also there are a lot of absolute addresses used, code may be saved by using a pointer to memory instead.
0xXXXYYYCZ for the SPORT cells data,
YYY is cell Z
XXX is cell Z+1
Z is 0, 2 or 4
C is total number of cells
I've got some circuits somewhere for translating cell voltages down to a ground reference, not sure where though!
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: OpenXSensor SPORT Interface
Mike,
Thanks,
I did not know about C (total number of cells); I will add it.
I think that YYY and XXX are cell voltages in millivolt divided by 2 (otherwise it can't go above 4095 mv what is not enough for a Lipo cell).
I get correct voltage on taranis when I do so.
Michel
Thanks,
I did not know about C (total number of cells); I will add it.
I think that YYY and XXX are cell voltages in millivolt divided by 2 (otherwise it can't go above 4095 mv what is not enough for a Lipo cell).
I get correct voltage on taranis when I do so.
Michel
- MikeB
- 9x Developer
- Posts: 17993
- Joined: Tue Dec 27, 2011 1:24 pm
- Country: -
- Location: Poole, Dorset, UK
Re: OpenXSensor SPORT Interface
Yes, millivolt / 2.
Just checking, I see I already use the same serial transmit code for SPort and Hub, just hard coded the bit time. If I make that soft, it doesn't need much more code to have both in for that part.
Mike.
Just checking, I see I already use the same serial transmit code for SPort and Hub, just hard coded the bit time. If I make that soft, it doesn't need much more code to have both in for that part.
Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
The difficult we do immediately,
The impossible takes a little longer!
Re: OpenXSensor SPORT Interface
Mike,
One improvement for openxsensor that makes sense could be to offer the following:
In the config user add 3 options
- only Hub protocol (he select this if has only one D serie receivers)
- only SPORT protocol (he select this if has only one X serie receivers)
- both (in this case the user add a switch/jumper to select the one he want) Openxsensor take care of this on reset.
Even better : Openxsensor detect automatically if he is connected to a D or a X receiver.
So, the user can remove a device from a plane and connect it in another plane using a different receiver without having to reload a firmware.
What do you think about this?
One improvement for openxsensor that makes sense could be to offer the following:
In the config user add 3 options
- only Hub protocol (he select this if has only one D serie receivers)
- only SPORT protocol (he select this if has only one X serie receivers)
- both (in this case the user add a switch/jumper to select the one he want) Openxsensor take care of this on reset.
Even better : Openxsensor detect automatically if he is connected to a D or a X receiver.
So, the user can remove a device from a plane and connect it in another plane using a different receiver without having to reload a firmware.
What do you think about this?