Analog input for X8R

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: 16484
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Analog input for X8R

Post by MikeB » Sun Oct 13, 2013 11:08 am

Reason for project.
FrSky have chosen not to put any analog input ports on the X8R receiver. Many users would find one such input very useful.

Implementation:
Use a small Arduino to read an analog signal and send this to the X8R using the SPort protocol.
I used a Mini Lite, but the Pro Mini is the basically the same device.

Connections:
SPort +V ---> Arduino +9V
SPort -V ---> Arduino 0V
SPort signal <--- Arduino I/O 4

Arduino 0V <--- Analog ground
Arduino A3 <--- Analog input 0-3.3V (tolerates 4.5V)

Here is my first code effort.
SPortAnalog.zip
13 Oct 2013 12:10
(7.69 KiB) Downloaded 446 times
Unzip the files as an Arduino sketch and download to the Arduino Mini.

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


User avatar
Rob Thomson
Site Admin
Posts: 4541
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Re: Analog input for X8R

Post by Rob Thomson » Sun Oct 13, 2013 4:21 pm

Great. Very useful addition.

Sent from my GT-I9300 using Tapatalk now Free
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!

User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Analog input for X8R

Post by ShowMaster » Sun Oct 13, 2013 4:26 pm

Pro mini's on order now.

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

Re: Analog input for X8R

Post by Kilrah » Sun Oct 13, 2013 5:17 pm

Cool :)

Just one thing, why create an independent codebase instead of simply integrating it in the openxsensor? Then there's only one page, codebase, set of instructions etc to maintain for one thing that does it all...

Especially as the hardware is the same, and that it's only a couple of lines to add to measure an additional analog input and put the value out :)

User avatar
Rob Thomson
Site Admin
Posts: 4541
Joined: Tue Dec 27, 2011 11:34 am
Country: United Kingdom
Location: Albury, Guildford
Contact:

Re: Analog input for X8R

Post by Rob Thomson » Sun Oct 13, 2013 5:18 pm

Now that's a good idea!

Sent from my GT-I9300 using Tapatalk now Free
Slope Soaring, FPV, and pretty much anything 'high tech'
...........if you think it should be in the wiki.. ask me for wiki access, then go add it!


User avatar
jhsa
Posts: 18817
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Analog input for X8R

Post by jhsa » Sun Oct 13, 2013 5:26 pm

the oXs already measures voltage.. My question is, will we have a define for choosing what system the sensor will be running with? "D" or "X" series? Better a difine to choose between the two or the complete thing will be a mess ;)
Or maybe making 2 codes.. D series and X series. then we just flash the one we are using.. less confusion and more space in the arduino.
Just my two bottles of whiskey.. :mrgreen:

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

ReSt
Posts: 1510
Joined: Tue Dec 27, 2011 11:34 pm
Country: -

Re: Analog input for X8R

Post by ReSt » Sun Oct 13, 2013 5:53 pm

jhsa wrote:My question is, will we have a define for choosing what system the sensor will be running with? "D" or "X" series?
or none at all :D
as I use it without frsky receivers

Reinhard

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

Re: Analog input for X8R

Post by MikeB » Sun Oct 13, 2013 7:34 pm

Kilrah wrote:Just one thing, why create an independent codebase instead of simply integrating it in the openxsensor? Then there's only one page, codebase, set of instructions etc to maintain for one thing that does it all...
I thought I'd keep things simple for those that just want the analog input. They don't need the pressure sensor and this, I think, makes it easy to just have the analog input.

I was also thinking it might be useable on a smaller processor, although with the low cost of some Arduino mini clones it probably isn't worth the effort.

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

User avatar
jhsa
Posts: 18817
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Analog input for X8R

Post by jhsa » Sun Oct 13, 2013 7:41 pm

you mean an attiny?? If possible it would make it smaller in my opinion..

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: 16484
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Analog input for X8R

Post by MikeB » Sun Oct 13, 2013 7:51 pm

Yes. With the code as it is, you would need an external crystal (or resonator). I could look into using the internal oscillator, but I would then need to measure the incoming baud rate to get the outgoing baudrate correct. If I got that working then the whole thing might just need to be the processor, no external compomemts at all.

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

User avatar
jhsa
Posts: 18817
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Analog input for X8R

Post by jhsa » Sun Oct 13, 2013 8:28 pm

Exactly.. A bit of strip board with the same size as the attiny to avoid shorts and give some solder points. a bit of shrink tube and done. very small A1/2 ports for the X8R ;) :)

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: 16484
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Analog input for X8R

Post by MikeB » Sun Oct 13, 2013 8:48 pm

As a result of some other testing of the SPort in general, I will need to be changing the SPort driver code.

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

User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Analog input for X8R

Post by ShowMaster » Sun Oct 13, 2013 10:49 pm

FTDI cable?
I'm ordering many of the Arduino components mentioned as well as the sensor for the OpenXsensor. I thought I'd do my best to learn about all this. So do I own anything Frsky that's FTDI cable? A search says USB to rs232 but some mention to TTL maybe?
I have USB to castle creation programing adapter cables. Also the Frsky USB to rs232 cable. I also have a Arduino UNO. Also USBasp

Will any of these work? If not I need a link to one.
Thanks

ttabbal
Posts: 21
Joined: Fri Jan 13, 2012 8:53 pm
Country: -

Re: Analog input for X8R

Post by ttabbal » Wed Oct 16, 2013 8:45 pm

I'd love to make some of these with a bare ATtiny or a little stripboard. Using an external resonator will work for me. Will the code work at 16Mhz? I was thinking I might order up some chips and resonators to try out.

I was going to try this exact thing myself, but FrSky hasn't gotten back to me for a while about specs/NDA.

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

Re: Analog input for X8R

Post by MikeB » Wed Oct 16, 2013 9:20 pm

The code is for 16MHz. I think you will need a minimum of 4K flash to fit the code in.
It should work on an ATtiny, you only need one analog input and one digital I/O.

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

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: Analog input for X8R

Post by Clivew » Wed Oct 16, 2013 10:24 pm

Is it really impossible to re-route the existing analogue port or just hellish difficult??
This does seem to be a sledgehammer to crack a nut :P

ttabbal
Posts: 21
Joined: Fri Jan 13, 2012 8:53 pm
Country: -

Re: Analog input for X8R

Post by ttabbal » Wed Oct 16, 2013 10:53 pm

Clivew wrote:Is it really impossible to re-route the existing analogue port or just hellish difficult??
This does seem to be a sledgehammer to crack a nut :P
From what I have read, to get to the existing A1, you have to separate 2 boards inside the receiver box as the only place you could get to it is between them. And then it's probably some fine pitch solder work, which I can handle, but it's a lot easier to just solder a chip, resonator and 4 wires up. Oh, and 2 resistors.

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: Analog input for X8R

Post by Clivew » Wed Oct 16, 2013 11:21 pm

It just seems overly complicated to me, adding yet another module and connectors.
I would love to see some closeup photos of the board(s).
I was always told "simplificate, and add more lightness" :roll:

User avatar
jhsa
Posts: 18817
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Analog input for X8R

Post by jhsa » Wed Oct 16, 2013 11:40 pm

I think, in this case, the easiest way is really to use the attiny :D :p
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: 16484
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Analog input for X8R

Post by MikeB » Wed Oct 16, 2013 11:49 pm

Preserves your Rx warranty, keeps the existing internal analog data and gives me a chance to program the SPort driver!

Also, we can probably include some other inputs of some sort if not using the openXsensor.

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

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: Analog input for X8R

Post by Clivew » Wed Oct 16, 2013 11:53 pm

I want to do it the hard way (after someone else did it of course!) ;)

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: Analog input for X8R

Post by Clivew » Thu Oct 17, 2013 12:01 am

MikeB wrote:Preserves your Rx warranty, keeps the existing internal analog data and gives me a chance to program the SPort driver!

Also, we can probably include some other inputs of some sort if not using the openXsensor.

Mike.
Aha, in that case I'm with you all the way :P

(I would still be interested to see what is involved for a simple model solution without extra
modules/cables though!)

Clive
Last edited by Clivew on Thu Oct 17, 2013 12:10 am, edited 1 time in total.

User avatar
jhsa
Posts: 18817
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Analog input for X8R

Post by jhsa » Thu Oct 17, 2013 12:03 am

Dismantling a receiver completely? ;) no, not me :mrgreen: mrgreen:

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: 16484
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Analog input for X8R

Post by MikeB » Thu Oct 17, 2013 7:47 am

Clivew: Have you read this thread from here?
http://openrcforums.com/forum/viewtopic ... X8R#p59640

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

Clivew
Posts: 338
Joined: Tue Dec 27, 2011 8:08 pm
Country: -
Location: Stroud, Glos, England

Re: Analog input for X8R

Post by Clivew » Thu Oct 17, 2013 10:45 am

Thanks Mike, missed that one completely!

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

Re: Analog input for X8R

Post by MikeB » Fri Oct 18, 2013 9:57 am

I'm looking into implementing this on an attiny13 (8-pin device). I've converted the code to a 'proper' makefile project. Arduino adds too much coe not required, and the attiny13 only has 1K of flash. It also doesn't have a bootloader.
The program is currently around 520 bytes, so I have some spare flash. I've still to actually test it!
You have to use the internal oscillator, but I intend to add code to detect the actual bit rate from the SPort receive data and adjust the timing to match.
My intention is to use a 3.3V regulator to power the attiny, and this will also therefore act as the reference voltage for the A2D.
So I'm looking at, a 3.3V regulator, 2 small caps and the attiny13.

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

User avatar
jhsa
Posts: 18817
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Analog input for X8R

Post by jhsa » Fri Oct 18, 2013 10:11 am

5V would give you better resolution? Or you are using 3.3V to keep things compatible with the frsky sensors?

I use the 5V on the openXsensor. the sensor just takes 2 resistors.. I can see an advantage on the 3.3V though. You just get power from the 5V BEC and it will be regulated to 3.3V while at 5 you would have to power it from batt voltage, as the voltage from the receiver/BEC might fluctuate a bit with the load from the servos.. Or is my thinking wrong?

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
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Analog input for X8R

Post by ShowMaster » Fri Oct 18, 2013 4:28 pm

FYI
X8R photo
The top board covers the A1 resistor area and probably needs to be removed.
As for rec warranty,
I'm not sure the $ to replace the rec if I need the feature is worth worrying about. No reason to think the rec will fail under the warranty time.
If only Frsky would not be so secret about their plans and release dates now that they have a following. If HK gets their new 9XR to market this year at an attractive price and can fold it may shift the $. As good as the Taranis is, it's main selling feature is what it does for the price. Lower the price with the same features and suddenly the sales shift to that product. Many just want a programmable/flashable tx that talks and displays telemetry at the lowest price. That could be the new 9XR.
Let's go Frsky, get your release dates in print.
In the meantime Mike, keep the good ideas gong. We all want to use our x8r with the same features the D rec have. It is so easy to use the A1 and A2 ports in the D receiver.
ImageUploadedByTapatalk1382112544.523736.jpg
ImageUploadedByTapatalk1382112580.072686.jpg

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

Re: Analog input for X8R

Post by MikeB » Fri Oct 18, 2013 4:38 pm

We are replaceing an A2D that provides 8 bit resolution at 3.3V reference, so this is providing the same. Also, unlike the mega328 on the openX sensor, the attiny13 does not have the 1.1V bandgap reference to correct for changes in supply voltage.
A 3.3V regulator also handles powering from a 4/5 cell NiMh receiver battery.

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

User avatar
ShowMaster
Posts: 4327
Joined: Thu Dec 29, 2011 3:44 am
Country: -
Location: Los Angeles, CA USA

Re: Analog input for X8R

Post by ShowMaster » Fri Oct 18, 2013 4:54 pm

I'm in!


Post Reply

Return to “General RC Electronic Projects and Discussion”