Hacking the I2C interface of Spektrum DX and AR ?
#101
Posted 08 January 2008 - 10:07 PM
Richard
#102
Posted 09 January 2008 - 09:20 AM
I popped in a .1uf electrolytic I had laying around (see picture below). Time scale is 5 uS per division (top and bottom traces as before). There is plenty of time for the D9/R3 junction to reach 0v and the signal makes it to its peak in 20uS. The U1A fired though only 10uS after the falling edge of ch7. So if the PWM range is about 1000uS then this produces only about 1% offset error. I have more than that in some of the other channels.
What do you think?
#103
Posted 09 January 2008 - 09:57 AM
The race condition problem makes me nervous. Below is my proposal to avoid it. There are two identical one-shots, one for all the rising edges, and one for the lone Ch-7 falling edge. These are followed by a discrete component NOR gate. None of the new components are critical and can vary a bit if you don't have the exact part. Just use sane substitutes.
The D1-D7 diodes are listed as 1N4148's since they are usually in a techie's junk box. However, I would probably use some schottky diodes with low Vf specs to maintain the highest servo signal levels from the Rx. I expect that if well chosen shottky's were used at D1-D7, then U1 could be changed to a 74HCT221 and the circuit could be run on 5V instead of the 3.3V that is shown.
The nice thing is that the logic level at the PPM Output is set by the voltage you apply to R6 (MCU Vcc). This allows you to match those that are used at the host (5VDC or 3.3VDC). Just connect it to the Vcc of the host MCU. The R6 connection is not needed if the host MCU (i.e., MK board) already has a pullup resistor on it.
Of course this circuit could need tweaks too, so be prepared for that. Fortunately you have the tools and experience for that. Breadboard it first.
Lastly, I tried to save as much of your original board as I could. Frankly, I think the best solution would involve a microcontroller, but there doesn't seem to be enough interest to justify the development of that. So, we will stick with simple old-school solutions for now.
#104
Posted 09 January 2008 - 11:37 AM
By the way, I have also breadboarded up one of your Pan-Can chips (three, one for the Pan and the other two as switches for bypass and home). Works great!!!
One question though. I want to use the Pan-Cam chip for the tilt servo as well, the only problem is that the Home function (as I put it above) is actually a “Center” function. For the tilt I would like that to move to the end of the travel (ie looking straight ahead) and not at an angle down (center). Is there a simple way of recompiling the source code with the Center changed to the end point (one or both depending on how the servo is mounted). I was hoping that “Center” point was a static variable in your code and that changing that variable would be an easy way to change the “home” position.
Thanks, Richard
#105
Posted 09 January 2008 - 12:01 PM
It's simple to recompile, but the code validation that I perform takes a lot of time. I'm already buried in work projects and my time spent on the forum is not helping much. So, let's talk about that later (plus, it probably should be in its own thread to keep this one OT).Is there a simple way of recompiling the source code with the Center changed to the end point (one or both depending on how the servo is mounted).
#106
Posted 09 January 2008 - 05:33 PM
Richard
Picture 1:
Edit: as a mater of fact you have a 2.2K in series with a 10K path to ground in the "transistor" part of the schematic, never mind, that would clean it up as well. I should have just done the whole thing
Edited by brashley, 09 January 2008 - 07:19 PM.
#107
Posted 09 January 2008 - 06:06 PM
#108
Posted 09 January 2008 - 07:09 PM
The logic polarity at the transistor output should be the same as before (assuming you were using U1-4 for the MK's PPM input signal). But, if it is reversed from how you were using it earlier, then just tell the MK board to use the opposite polarity. *Otherwise, you can move the two NOR'ing diodes to the Q-Not outputs to create hardware based logic inversion.
*EDIT: Oops, merely moving the two diodes won't give inverted logic; it would be best to just add another inverting stage using a transistor.
The new photos show that we are on to a good solution. Keep on trucking!
Edited by Mr.RC-Cam, 03 February 2008 - 09:49 AM.
Added correction about inverting the PPM output.
#109
Posted 09 January 2008 - 07:37 PM
Thanks again for all your help
PPM-Out:
Edited by brashley, 09 January 2008 - 07:40 PM.
#110
Posted 09 January 2008 - 07:44 PM
You are welcome -- it was my pleasure to help where I could.
#111
Posted 09 January 2008 - 07:57 PM
Richard
Edited by brashley, 09 January 2008 - 08:00 PM.
#112
Posted 09 January 2008 - 08:13 PM
Excellent. Less work for me.will update my schematic and layout as well and once I make a new one and test it I will post it back here (with part sources) so others can make it if needed.
#113
Posted 11 January 2008 - 12:06 PM
One note is that I don't get a lost signal condition. When the AR7000 looses signal it holds the channels (PWM) as is (except the throttle) so the MK will never know it lost contact with the Tx. Any code in the MK to handle a lost signal condition will never get activated (like GPS go home).
Richard
Edited by brashley, 11 January 2008 - 12:10 PM.
#114
Posted 11 January 2008 - 12:22 PM
Success is sweet.It works great with the MK FltCtr
That suggests that the MK board can auto-detect the polarity. FWIW, there's no standard for the PPM stream's logic polarity. So, there are no doubt many others using "inverted" logic on the various flavors of hacked Rx's. Frankly, I wouldn't worry about it.I left the PPM output as inverted at the moment (will fix with next version/build).
In case others ask, what sort of offsets did you have to dial in?I was able to correct all offsets on the Tx side of things and I now get all channels to move from -145 to 145 as seen on the MK by the ATmega644, with centers all at zero .
Spektrum really missed the boat with their DX6 and DX7 fail safe implementation. It would have been grand if they allowed you to setup each servo channel for specific fail-safe states (hold or programmable servo position). That way you could have configured an "unused" channel to be used as a fail-safe on/off indicator.One note is that I don't get a lost signal condition. When the AR7000 looses signal it holds the channels (PWM) as is (except the throttle) so the MK will never know it lost contact with the Tx.
#115
Posted 12 January 2008 - 08:51 AM
As a reminder, for my AR7000 the sequence is a follows (w/ DX7 adjustments):
AR7000---- Ch sequ out--------MK------------SubTrim-----TravAdjHigh------TravAdjLow
______________________________________________________________________
Thro--------------6--------------Gass------------L44-------------128%------------115%
Aile --------------1---------------Roll-------------R34------------121%------------120%
Elev--------------4---------------Nick------------U34-------------122%------------120%
Rudd-------------7---------------Gier-------------R6-------------120%------------121%
Gear -------------3--------------Poti_x------------?---------------100%-----------139%
Aux1--------------2--------------Poti_y----------D35-------------121%-----------117%
Aux2--------------5--------------Poti_z------------?---------------100%-----------137%
Richard
Edited by brashley, 12 January 2008 - 09:05 AM.
#117
Posted 12 January 2008 - 08:51 AM
Edited by brashley, 12 January 2008 - 08:52 AM.
#118
Posted 12 January 2008 - 08:58 AM
I completely agree. I don't understand their thinking.Spektrum really missed the boat with their DX6 and DX7 fail safe implementation. It would have been grand if they allowed you to setup each servo channel for specific fail-safe states (hold or programmable servo position). That way you could have configured an "unused" channel to be used as a fail-safe on/off indicator.
The AR9000 DOES allow you to set failsafe positions for each channel. If they can do it on that one, you'd think they'd implement that on all the receivers.



