I just bought an FrSky Taranis for my quad copter and needed to get the Mavlink data up on the Taranis LCD telemetry display. So here is my solution using a Teensy3.1 as a converter between MavLink and the S.Port on FrSky X8R.
See attached file below...
hmm,,,, are you using ppm? if no (pwm) just do a Y connector from rx... :)
ppm... is a different thing,
if u are using an openLRSng you could assign one of the pins to output ch3 pwm value in addition to PPM on the other pin (actually any Ch). in this case no programming is necessary and can be done through GUI, than catch the pwm value on one of the teensy's pins (this takes off the work from apm to repack ch3 pwm into mavlink)
in case you have an X8R, now, haven't tried this, but in theory should work: connect ch3 to one of the pins on your teensy, there will be your PWM value. <--- in theory haven't tried myself but can try tonight.
first declare an variable
then you must request the APM to start sending this data, add in the loop function:
mavlink_msg_request_data_stream_pack(0xFF,0xBE,&msg,1,1,MAV_DATA_STREAM_RC_CHANNELS, MSG_RATE, START);
len = mavlink_msg_to_send_buffer(buf, &msg);
then to receive the value for the RC channel, add in the MavLink_receive function:
case MAVLINK_MSG_ID_RC_CHANNELS_RAW: //35
ap_rc_ch3 = mavlink_msg_rc_channels_raw_get_chan3_raw(&msg);
Now the ap_rc_ch3 holds the value for RC channel 3 input
You can also get the scaled output (the output value from APM) using:
case MAVLINK_MSG_ID_RC_CHANNELS_SCALED: //34
ap_rc_ch3 = mavlink_msg_rc_channels_raw_get_chan3_scaled(&msg);
I cut the trace. Now the USB serial port is no longer an option. What do I need to do to be able to use the USB as a serial monitor again?
You must supply +5V to Vin on the Teensy from the S.Port.
Disregard my last. I just connected 5V from a BEC to VIN and the USB Serial port appeared. Now I have to figure where the 5V from the SPort went.
The USB serial connection just disappeared fom the menu. Should the USB serial apperar, if the SPort provides sufficient voltage? If so, I'll put a 5V supply across VIN and GND, and see if the USB serial reappears. If it does reappear, then I need to do some investigating on the SPort. Currently I have a current sensor and voltage sensor on the SPort ahead of the Teensy. I wanted to get some data from other sensors to be sure I can read the SPort.
Thanks for the help.
Rolf, I think I've managed to modify your code and Adafruit's code so that I have a GPS trying to send data to the SPort. Nothing appears in the Taranis yet, but that is to be expected for the first try.
I currently either have the Teensy connected to USB to see the GPS data or to the SPort. I need to be able to dump the SPort data to the screen. Will cutting the bridge on the Teensy allow me to connect USB and the powered SPort at the same time?
Yes,cutting the connection between VIN and VUSB makes it save to have the USB and SPort connected at the same time.
Hey guys there is a flaw in the Teensy that is another hit to APM users, it was soeculated by the OP
Basically the teensy is 3.3v but the APM is 5v, the problem is that the teensy wont communicate with APM at this significantly higher voltadge, i wont pretend to know why?#
Simply put, if i power the apm from 3.3v it works, if i power it from 5v, it doesnt
Is there any advice and how to overcome this, also the APM i am testing on has a fried voltage regulator which is passing through 5v, is the telemetry port supposed to output 3.3v?
Permalink Reply by Rolf Blomgren on March 3, 2014 at 11:52am
There could be a problem with the signal levels from Teensy because it is 3,3V on TX output and the APM is 5V or even higher depending on the voltage you supply the APM with.
All inputs to the Teensy is 5V tolerant but it can only drive up to 3.3V. You can try to use a level converter or lower the voltage to the APM a little.
My APM is working with Teensy without a problem with a voltage supply from the 3DR Power module of 4,9V measured at the IO pins, the threshold level on ATMega2560 is ~3V @ 5.5V or ~2.8V @ 5V Vcc.
okay so i have an apm wich had a blow regulator that outputted 5v.
but after replacing it, i have found that even with 3v, the teensy still wont communicate with my APM when powered via 4.9v from USB
however when i power it with 4.95v via a UBEC it works, so that assumption is wrong, sorry, but this is noe confusing, what is it that when powered via USB the Teensy wont communicat ewith the APm and flashed red, but the moment IT is powered via a UBEC, 3v or 5V it works?