Page 10 of 10

Re: XR8 rx telemetary sensors

Posted: Tue Jan 31, 2017 10:30 pm
by andrewju
Ok, thanks!!!

Re: XR8 rx telemetary sensors

Posted: Wed Feb 01, 2017 9:49 pm
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.

Re: X8R "XR8" rx telemetry sensors

Posted: Wed Feb 01, 2017 10:39 pm
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.

Re: XR8 rx telemetary sensors

Posted: Tue Feb 28, 2017 10:09 am
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...

Re: XR8 rx telemetary sensors

Posted: Tue Feb 28, 2017 10:25 am
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.

Re: XR8 rx telemetary sensors

Posted: Tue Feb 28, 2017 10:40 am
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?

Re: XR8 rx telemetary sensors

Posted: Tue Feb 28, 2017 3:50 pm
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.

Re: XR8 rx telemetary sensors

Posted: Tue Feb 28, 2017 10:42 pm
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! :)

Re: XR8 rx telemetary sensors

Posted: Thu Sep 06, 2018 9:20 pm
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

Re: X8R rx telemetry sensors

Posted: Sun Feb 17, 2019 9:19 pm
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

Re: XR8 rx telemetary sensors

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

Mike

Re: XR8 rx telemetary sensors

Posted: Tue Feb 19, 2019 5:25 pm
by jtaylor
Thanks Mike, both for the original product and this update.

Jim

Re: XR8 rx telemetary sensors

Posted: Mon Jun 17, 2019 3:12 pm
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

Re: XR8 rx telemetary sensors

Posted: Mon Jun 17, 2019 6:12 pm
by jhsa
Couldn't the code be compiled using the arduino IDE?

João

Re: XR8 rx telemetary sensors

Posted: Mon Jun 17, 2019 7:09 pm
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.

Re: XR8 rx telemetary sensors

Posted: Mon Jun 17, 2019 9:27 pm
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.

Re: XR8 rx telemetary sensors

Posted: Mon Jun 17, 2019 10:53 pm
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

Re: XR8 rx telemetary sensors

Posted: Tue Jun 18, 2019 7:18 am
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.

Re: XR8 rx telemetary sensors

Posted: Thu Jun 20, 2019 2:52 pm
by MikeB
Updated Sport85 that supports changing the physical ID over the SPort.

Mike

Re: XR8 rx telemetary sensors

Posted: Fri Jun 21, 2019 4:37 pm
by Chrisbott
Thanks Mike. What's the process for changing ID?

Re: XR8 rx telemetary sensors

Posted: Fri Jun 21, 2019 9:34 pm
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

Re: XR8 rx telemetary sensors

Posted: Thu Jul 18, 2019 10:12 am
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

Re: XR8 rx telemetary sensors

Posted: Fri Jul 19, 2019 10:33 pm
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

Re: XR8 rx telemetary sensors

Posted: Sat Jul 20, 2019 8:15 am
by Chrisbott
Many thanks Mike.

Maybe someone from OpenTx will spot this. Is there anywhere else I could ask?

Re: XR8 rx telemetary sensors

Posted: Sat Jul 20, 2019 9:09 am
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

Re: XR8 rx telemetary sensors

Posted: Mon Jul 22, 2019 8:50 am
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

Re: XR8 rx telemetary sensors

Posted: Fri Jan 22, 2021 2:52 pm
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