XR8 rx telemetary sensors

General Help and support for the Taranis Radio.
andrewju
Posts: 784
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: XR8 rx telemetary sensors

Post by andrewju »

Ok, thanks!!!

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

Re: XR8 rx telemetary sensors

Post by Kilrah »

Scripts updated to use ID 0x17 which is the ground node as per FrSky doc (smart dashboard or radio), was also mentioned in discussions back in 2013.
User avatar
bob195558
Posts: 2377
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: X8R "XR8" rx telemetry sensors

Post by bob195558 »

Should the title be X8R receiver telemetry sensors, the "XR8" looks to be a miss-print ? :?:
Not a big deal, but could be a help for someone searching for X8R help.

Bob B.
Er9x on 9x radio, with Smartieparts Programmer and TelemetrEZ Board.
ErSky9x on Taranis, Sky9x, 9Xtreme radios.
3D-Printing: (https://openrcforums.com/forum/viewforum.php?f=129).
andrewju
Posts: 784
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: XR8 rx telemetary sensors

Post by andrewju »

Mike,

I'm sorry to raise this thread again. I think I found a small bug and I need some help...

As I understand, if there's a voltage on Pin 2 (i.e. coming from a battery through a voltage divider), corresponding telemetry value is transmitted as Temp2. Also, when Pin 3 of the Attiny is short to GND, the telemetry value is transmitted as A1 instead of Temp2.

BUT: when Pin 3 of the Attiny is short to GND, the A1 telemetry value gets "overwritten" by the voltage sensor even if there's no voltage on Pin 2.

Is there a way to fix this?

I made a few of these sensor PCBs with dual inputs (both dividers are already in place). On these PCBs, the Pin3 is always connected to GND (I thought I would never need that jumper!). As soon as this sensor is connected to a receiver, A1 disappears (even if there's no battery connected to the sensor at all). This is not a big deal in general (the receiver voltage is still there as RxBatt or something similar), but it changes the default behavior and could cause some confusion...

I looked into the source code trying to fix it myself, but unfortunately my coding knowledge is far from the level required...
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

I'm not sure I understand the problem, other than it is working as designed!
In the Tx, we receive the SPort telemetry. From a 'X' receiver, we receive the receiver battery voltage as "RxBt", this is not A1.
For backward compatibility to 'D' receivers, the Tx makes this available as the A1 value. If you receive a real A1 value, then this is used for A1 instead of the receiver battery value.
So it is not the A1 value being overwritten, rather the A1 is no longer a copy of RxBt.

Possibly, the fix would be to change the firmware in the sensor to ignore the link input, and so send the voltage as TEMP2 all the time.

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

andrewju
Posts: 784
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: XR8 rx telemetary sensors

Post by andrewju »

Hmmm.... Let me rephrase my question.

Earlier you said the second analog input only works when the value is 999 or lower:
MikeB wrote: Tue Dec 03, 2013 11:15 pm The implementation is to read the 'second' ADC input (the debug pin closest to analog connector) as a 10-bit value (0-1023). The pin is configured with an internal pullup. If the value is over 999, it is ignored. If the value is less than 1000, then the pin is changed to analog input and the read value is then sent, currently as the second temperature, having been converted to 8 bits in the same way as the original analog input.
As far as I understand, it means that if the value on Pin2 is >999, neither Temp2 nor A1 should be transmitted by the sensor.
Am I wrong?
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

Yes, but if you have fitted a voltage divider, you have added a pull-down resistor. This will cause the value read to be under 999. The internal pull-up is something like 20K to 50K.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
andrewju
Posts: 784
Joined: Tue Aug 21, 2012 7:29 am
Country: Russian Federation
Location: Moscow

Re: XR8 rx telemetary sensors

Post by andrewju »

Ahhhhh... Shame on me!
I really don't know why I decided it should work the other way around... :-(
You're absolutely right! It works exactly as it is supposed to!

Sorry for bothering you with this... And thanks a lot for taking the time to clarify (now obvious) things! :)
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

I've made a change to the firmware for the X8R2Analog device so it doesn't "hog" the SPort bus.
This update now only sends 1 or 2 frames every 200mS instead of sending every time it is polled, which could have been a frame every 24mS.
The updated firmware (which is open source) is here: https://github.com/MikeBland/x8r-analog.

I tested using a .BAS script in ersky9x (very similar to the LUA script) and it worked OK with the X8R2Analog device attached to a S8R.

You do need an Atmel AVR/Tiny programmer to update the device. I used my AVRISP-II, but a USBASP should also work.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: X8R rx telemetry sensors

Post by MikeB »

It looks like the production version, as sold by T9 and Aloft is no longer available.
I've ported the code to an Arduino Pro Mini, 3.3V 8MHz version, so this could be used instead. It will need the SPort connector wired in, together with some resistor dividers, but otherwise it should work the same way.
Since the Pro Mini has more I/O pins, I have also added options for A3 and A4 analog inputs. Alos, with the extra flash available, the SPort physical ID may be changed using the ChangeId function in ersky9x maintenance mode or the ChangeId app available when using the ersky9x bootloader.

I'll be posting more details when I have them available.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

Details and code are now available here: https://github.com/MikeBland/SportAnalog.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
jtaylor
Posts: 170
Joined: Fri Nov 01, 2013 1:31 am
Country: -
Location: Wexford (Pittsburgh), PA

Re: XR8 rx telemetary sensors

Post by jtaylor »

Thanks Mike, both for the original product and this update.

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

Re: XR8 rx telemetary sensors

Post by MikeB »

I've sorted the source code for the original design so that a TINY85 may be used instead of a TINY13A. At present this is just a replacement, but I will add the code that allows changing the physical ID "soon". Since the '85 has much more flash memory I may be able to add more features as well.
To compile for the '85 use the command:
make CPU=85

I've attached a zip file with the updated source code and makefile and a .hex for the '85.
On the '85 you need the fuses to be Low=0xE2 and High=0xDF.

Mike
Attachments
Sport85.zip
17-Jun-2019 16:17
(12.34 KiB) Downloaded 291 times
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: XR8 rx telemetary sensors

Post by jhsa »

Couldn't the code be compiled using the arduino IDE?

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
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Thanks Mike I have loaded that in a an ATTiny85 and the Tx sees A2. If I ground one of the inputs the Tx also sees A1. I think that's how it should work?

I'm getting nothing like the voltages I expect. Can I just check the pinout? S.port is in pin 6. Are the two analog inputs on pins 2 & 3?
Voltage dividers are Rin=15K and Rgnd=3k3?

Chris.
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Update, I seem to only get A1 on the Tx if I ground pin3 (PB4).
But the A1 voltage seems to be being measured if I apply that to pin 7 (PB2). I guess I have something set up wrong somewhere.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

Yes to SPort on pin 6.
The A2 voltage should be on pin 7 (PB2).
The A1 voltage should be on pin 2 (PB3). This starts out with an internal pullup resistor, and so only sends an A2 value if the voltage is on the pin is less than 97.5% of VCC. If such a voltage is detected, the pullup resistor is disabled.

The second voltage (A2) is sent as Temperature 2 unless PB4 is grounded.

The code is written expecting VCC to be 3.3V. If you are running from 5V you will get different results.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Thanks Mike. I had already realised about my supply being straight from the Rx. Parts on order to fix that.

I'd completely missed the PB4 switch between Temp and A2 though. Nice feature.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

Updated Sport85 that supports changing the physical ID over the SPort.

Mike
Attachments
Sport85.zip
(13.68 KiB) Downloaded 235 times
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Thanks Mike. What's the process for changing ID?
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

For erskyTx, I've written a script to change the ID of most sensors (over the air!), including this X8R2analog on the tiny85. It is available at www.er9x.com.

This script has been ported to a LUA script for openTx, available here: https://rcsettings.com/index.php/viewdo ... -sensor-id.

MIke
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Mike, I've been trying to use the LUA script from your link on a Taranis and a Horus that are running OpenTx. 2.2.4.
The script runs fine and if I select any other sensor, it goes off and reads the existing ID and subsequently allows changing said ID.
When I select X8R2ANA, it does not enter the Reading Id stage.

(Also on Horus it does a lot of screen flashing which is off putting, but I can live with that).

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

Re: XR8 rx telemetary sensors

Post by MikeB »

Unfortunately, I can't help much as I don't run openTx (or LUA therefore), and I didn't write the LUA version.
I'll see if I can find time to read the LUA version to look for an error in the code.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Many thanks Mike.

Maybe someone from OpenTx will spot this. Is there anywhere else I could ask?
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: XR8 rx telemetary sensors

Post by MikeB »

Try here: https://www.rcgroups.com/forums/showthr ... st42123313, you may also then be able to contact the person that did the port to LUA.

Mike
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
Chrisbott
Posts: 33
Joined: Sun Aug 06, 2017 3:43 pm
Country: -

Re: XR8 rx telemetary sensors

Post by Chrisbott »

Thanks Mike I'll ask over there.

There now seems to be a V0.3 which has fixed the flashing on Horus.
The last sensor in the list still doesn't read existing ID but I've made a copy that works for X8R2ANA by moving another sensor to last in the list.

local sensor = {sensorType = {selected = 12, list = {'Vario', 'FAS-40S', 'FLVSS', 'RPM', 'Fuel', 'Accel', 'GPS', 'Air speed', 'R Bus', 'X8R2ANA', 'Gas suit', '-'}, dataId = { 0x100, 0x200, 0x300, 0x500, 0x600, 0x700, 0x800, 0xA00, 0xB00, 0xF103 , 0xD00}, elements = 11 }, sensorId = {selected = 29, elements = 28}}

Now X8R2ANA works and Gas Suit doesn't, which is fine for me.

Chris
jtaylor
Posts: 170
Joined: Fri Nov 01, 2013 1:31 am
Country: -
Location: Wexford (Pittsburgh), PA

Re: XR8 rx telemetary sensors

Post by jtaylor »

MikeB wrote: Mon Feb 18, 2019 3:10 pm Details and code are now available here: https://github.com/MikeBland/SportAnalog.

Mike
Mike, I have used your SportAnalog in the past, but now I can't get it to compile. I don't know if I'm doing something wrong or the newer Arduino doesn't like it. Tried Arduino 1.8.12 and 1.8.13. Getting this error:

C:\download\Arduino\rc\SportAnalog\SportAnalog-.ino:96:60: internal compiler error: in type_hash_canon, at tree.c:7158
typedef uint8_t prog_uint8_t __attribute__((__progmem__));//,deprecated("prog_uint8_t type is deprecated.")));


Edit: Please disregard. I had an old SportAnalog.ino renamed in the directory and somehow the Arduino IDE was linking them. Removed the old one and it compiled fine.

Jim

Post Reply

Return to “General help (FrSky Taranis radio)”