Sport sensor to hub protocol converter

Electronic projects that are either related to the firmwares for the 9x, or simply great for radio control applications.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Sport sensor to hub protocol converter

Post by MikeB »

It seems many of the original hub type sensors are being/have been discontinued. It should be possible to program an Arduino mini, or something similar, to 'talk' to Sport sensors, and output the old hub protocol for use by 'D' series receivers.

Is there much interest in this?

Mike.

Source code:
SportToHub.zip
27-Feb-2016 15:42
Add GPS Speed, Alt and Course.
GPS LAT/LONG now tested and working
Supports RPM, Temp1, FAS voltage and current, FLVSS Vario.
Includes GPS Lat and Long, but not tested.
(8.91 KiB) Downloaded 557 times
SportToHub.zip
26-Feb-2016 17:03
GPS LAT/LONG now tested and working
Supports RPM, Temp1, FAS voltage and current, FLVSS Vario.
Includes GPS Lat and Long, but not tested.
(8.61 KiB) Downloaded 380 times
SportToHub.zip
25-Feb-2016 18:39
Supports RPM, Temp1, FAS voltage and current, FLVSS Vario.
Includes GPS Lat and Long, but not tested.
(8.61 KiB) Downloaded 378 times
SportToHub.zip
21-Feb-2016 23:38
Addition of FLVSS support
First version - Vario only
(7.78 KiB) Downloaded 405 times
SportToHub.zip
20-Feb-2016 21:40
First version - Vario only
(7.53 KiB) Downloaded 415 times
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!

User avatar
bob195558
Posts: 2377
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: Sport sensor to hub protocol converter

Post by bob195558 »

Hi Mike,

I think I will be in the future, want this ability.

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

Re: Sport sensor to hub protocol converter

Post by MikeB »

I've made a bit of a start on code for an Arduino mini to do this. It's a bit of a side project at present, too many other things to do!

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
bob195558
Posts: 2377
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: Sport sensor to hub protocol converter

Post by bob195558 »

Hi Mike,
No hurry as of yet, I have what need for now. :D

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).
szakacs
Posts: 5
Joined: Tue Mar 06, 2012 12:50 am
Country: -

Re: Sport sensor to hub protocol converter

Post by szakacs »

Is it possible to create a D8 protocol (old hub) to D16 protocol (S.Port) bridge using a ProMini or a Teensy 3.1 instead of having to use a Variometer Sensor as a bridge. ??
This would be great as I have 3 TGY 9x tx's using opentx with XJT modules and FLD-02 display screens attached..

Garry S.

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

Re: Sport sensor to hub protocol converter

Post by MikeB »

I should be possible, I hadn't considered doing anything for this because the variometer does provide that function, and I thought the low precision one was not so costly.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
szakacs
Posts: 5
Joined: Tue Mar 06, 2012 12:50 am
Country: -

Re: Sport sensor to hub protocol converter

Post by szakacs »

The variometer does provide the function at the cost of overwriting the altitude data sent by the Flight Controller to the FLD-02 display through a X8R receiver.
I was hoping to be able to use the data supplied by the FC, mainly because the APM resets the altitude to 0 automatically at arming.

Garry S.
szakacs
Posts: 5
Joined: Tue Mar 06, 2012 12:50 am
Country: -

Re: Sport sensor to hub protocol converter

Post by szakacs »

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

Re: Sport sensor to hub protocol converter

Post by MikeB »

I've found a bit of time to re-visit this project.
I've got the 'bottom level' drivers all working. The Pro Mini is polling the SPort, receiving data from a FrSky Vario, and sending out the raw data received in a 'hub' protocol.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
bob195558
Posts: 2377
Joined: Sun Dec 16, 2012 7:24 pm
Country: United States
Location: New England, Vermont
Contact:

Re: Sport sensor to hub protocol converter

Post by bob195558 »

I am still interested as I still and have the need and see others who have DJT modules
with D8R-II Plus / D8R-XP receivers and not able to find telemetry D-Series sensors.
To have the ability to connect S.Port telemetry X-Series sensors through a Pro Mini Atmega328
to output the old hub protocol for use by 'D' series receivers would be great! :)

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).
User avatar
KAL
Posts: 552
Joined: Thu Oct 10, 2013 4:36 pm
Country: Germany
Location: somewhere near Rothenburg ob der Tauber

Re: Sport sensor to hub protocol converter

Post by KAL »

I wonder whether this could also be added to OpenXSensor?

Klaus
( TH9X / 9XTreme / FrSky DHT / Spektrum / Multi / RotEnc )
( 9XR PRO / erSKY9x  / FrSky DHT / Spektrum / Multi / RotEnc / P3 as Slider )
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sport sensor to hub protocol converter

Post by MikeB »

Probably asking a lot of it as it has to poll the SPort bus while still sending the hub serial data.

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: Sport sensor to hub protocol converter

Post by MikeB »

I've now sorted most of this so it polls all the possible physical IDs, but when it finds any that respond it polls them more frequently.
It handles all the checksums and byte stuffing.
It's sending hub data, and I've put that into a D8R-II, and received data on the Tx.
"All" I need to do now is process the actual data from SPort sensors and convert it into the correct format for the hub protocol.
So far, I've only implemented the FrSky vario, since I have one not in use. Almost not needed, as the vario by itself sends hub protocol, although I am sending the vertical speed (using the openXsensor ID) that isn't normally sent by the vario over the hub protocol.
Which SPort sensors does anyone want converted?

Mike.
Edit: Source code now on the first post.
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: Sport sensor to hub protocol converter

Post by MikeB »

Just posted, on the first post, a second version with support for the FLVSS.

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: Sport sensor to hub protocol converter

Post by MikeB »

I've put the code up on Github: https://github.com/MikeBland/SportToHub.

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: Sport sensor to hub protocol converter

Post by MikeB »

New version posted on the first post and committed to Github.
Supports RPM, Temp1, FAS voltage and current, FLVSS Vario.
It includes GPS Lat and Long, but I haven't tested this yet, I haven't got a lock with my SPort GPS sensor.

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: Sport sensor to hub protocol converter

Post by MikeB »

GPS Lat/Lon now working, new sources on first post and Github.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
michel49
Posts: 192
Joined: Sun Oct 07, 2012 10:59 am
Country: -

Re: Sport sensor to hub protocol converter

Post by michel49 »

Hi Mike,

What about designing a new telemetry module for the V2 Orange Rxs with such a range of sensors, today the Orange range is very poor...

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

Re: Sport sensor to hub protocol converter

Post by MikeB »

That is much more complicated as it includes an RF section and the code to actually transmit the telemetry data while monitoring the receiver DSM control data.
I don't have the information to do that.

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: Sport sensor to hub protocol converter

Post by MikeB »

Latest (on first post and Github), now includes GPS speed, altitude and course. Until I get this in a 'plane and test fly it I can't really test how well these work, although I am getting a speed reading when walking around my back garden.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
midelic
Posts: 128
Joined: Mon Dec 23, 2013 9:57 pm
Country: -

Re: Sport sensor to hub protocol converter

Post by midelic »

Mike,
Are you interested to put this code on an Attiny85?
I know you have that SportinyAnalog code for X8R I think it can be modified easier for SPORT to Hub converter.
It will be much smaller board too.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sport sensor to hub protocol converter

Post by MikeB »

I may look into that.The biggest problem is the lack of a 16-bit timer. The code currently relies on one of those. I don't think it will be so easy to change the code to use just an 8-bit timer.
It may also depend on how big the code/data gets.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
midelic
Posts: 128
Joined: Mon Dec 23, 2013 9:57 pm
Country: -

Re: Sport sensor to hub protocol converter

Post by midelic »

There are many software serial codes on the net on attiny that use 8 bits timer interrupt.If you are interested I can attach some here.The baudrate is low enough so I think it will work just fine on 8Mhz internal clock.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sport sensor to hub protocol converter

Post by MikeB »

Its not quite that straightforward. There are two serial ports, both software driven, at different baudrates. One or other of these are active most of the time, so I use interrupts on each bit to leave processor time for other processing. Due to the timing, I don't use the standard millis() routine, which uses interrupts, but use my own that doesn't use interrupts, but does use the 16-bit timer.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
midelic
Posts: 128
Joined: Mon Dec 23, 2013 9:57 pm
Country: -

Re: Sport sensor to hub protocol converter

Post by midelic »

Just speculating if you use one 8 bits timer / or 2 for both and stop SPORT poling/listening while you send out Hub bytes,and listening for SPORT packets in between HUB frames.The hub frame are sent 1 every 200ms second every 1 sec and third every 5 sec.In fact you can send out HUB frame at the time interval you choose.
The max bytes on full hub frame are around 50 bytes(mores with stuffed) that is roughly 50 ms...The SPORT frame can be polled/listen in between..200-50= min 150ms for SPORT and processing.This is not exact calculation,is rounded.Again just speculating.
What do you think?
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sport sensor to hub protocol converter

Post by MikeB »

The SPort needs to be polled every 12mS, around 83 times per second.
The nominal definition for the SPort is use 4mS to send a poll, 4mS to receive any response then 4mS idle. What I do is to use the third 4mS time slot to send 4 bytes of hub data, so I do avoid overlapping the two serial operations.

I am about to order a couple of Tiny85 processors, so I will be able to investigate possibilities.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
flarssen
Posts: 15
Joined: Wed Feb 25, 2015 11:37 am
Country: -

Re: Sport sensor to hub protocol converter

Post by flarssen »

I have no original SPort sensors, but tested this with my self made ones.
A few observations:
I get data for Alt and Vspd, even without any sensor connected. With a vario connected, Alt alternates between actual value and zero.
When I connect a FAS like sensor, VFAS and Current also alternates between actual values and zero.
It will continue to send last values even if SPort data is lost (no timeout).

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

Re: Sport sensor to hub protocol converter

Post by MikeB »

As I started with just a vario connected and processed the code does indeed always send hub values for this. I will need to make it conditional on seeing a vario connected.

With FrSky SPort devices I don't see alternating zeroes.

Currently you are correct in that once data has been received from a device, ad stored on the converter, it will continue to send the stored values, even if no further data arrives from the SPort device.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
midelic
Posts: 128
Joined: Mon Dec 23, 2013 9:57 pm
Country: -

Re: Sport sensor to hub protocol converter

Post by midelic »

Mike ,
I uploaded the SPort to hub code in a promini and use it with openx sensor.
I hooked up a logic analyzer to see the signal.
There is some corrupted data received. I test the same sensor with RX X4RSB and it seems to be working fine with the same sensor.
I attached the screen capture from analyzer.After polling those 2 bytes 0x7E and sensor ID ,,the first byte received is not 0x10 as it should be but 0x20 frame error.I think the next sport frame bytes are ok.All the frames received start with 0x20
Capture5-29-2016-6.37.30 PM.jpg
corrupt header.
Last edited by midelic on Sun May 29, 2016 5:25 pm, edited 1 time in total.
User avatar
MikeB
9x Developer
Posts: 17990
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sport sensor to hub protocol converter

Post by MikeB »

I thought you could select hub protocol on the openRxSensor, so not need this.
I can see a short spike at the beginning of the 0x20, that shouldn't be present. That may be shifting the bits a small amount causing 0x10 to appear as 0x20.

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

Post Reply

Return to “General RC Electronic Projects and Discussion”