Jump to content
Arthur P.

Hacking the I2C interface of Spektrum DX and AR ?

Recommended Posts

Here is a waveform diagram of what should happen. The top waveform is the diode or'd R/C channels. The bottom waveform is after the HC221 IC does its stuff (at least that is what I expect it to look like).

I'm showing a 5-channel system for the example, so just extrapolate for more/less servo channels.

post-6-1185985438_thumb.jpg

Share this post


Link to post
Share on other sites

Wow. Thanks !!! I-m off to the electronics shop Saturday to get the parts and see whether this solves my problem. But I expect it will. As said I-m not a reall electronics person, actually a physician by training, but I have build my own computers from single chips and other odd bits in the late 70s, and am currently doing all sorts of wierd SMD soldering to build mikrokopters (www.mikrokopter.de) and modify ESCs to be able to understand I2C. Never too old to learn and never been one who just accepted "it can't be done", often occassionally trying to do it anyway not hindered by a lack of knowledge.

Share this post


Link to post
Share on other sites

Well, not fully there yet. I created the circuit as descibed, with R1 10 kOhm, C1 40 nF, R2 2 kOhm, C2 10 nF which according to my understanding would get me the correct pulsewidths. On pin 2 I have the pulsetraining coming off of the diodes with a 0V baseline, positive pulses up to around 2V. On pin 9 I have the singe positive pulse coming off of the last channel and bipassing the diode. On pin 5 and on pin 4 I have a straight 5V output, no pulses :( I-ll post some scope images this evening. But any ideas just on the basis of this info might already help..... E.g. could it be that the input pulse voltage is too low and how best to address that ?

Share this post


Link to post
Share on other sites

Before there is any effort to fix the low signal voltage issue, let's just see if the overall circuit concept has merit.

If you are indeed using a HC221 (not a LS221 or HCT221, or other variant), then power the IC with the MK's 3.0V VReg instead of the 5V Vreg. This will band-aide the problem and allow some testing with the low voltage Rx signals.

With 3V operation, does your o-scope show anything hopeful? I doubt the MK board will be reliable with the low voltage HC221, so use the o-scope to confirm signal life.

Share this post


Link to post
Share on other sites

Chip used is an M74HC221B1. I tried it now with 3V for the circuit and 5V for the AR7000. That indeed showed improvement. Attached the image from the scope with the top trace being the signal immediately after the diodes, and the bottom trace showing the signal off of the circuit. The rudder channel (7) is still missing but we are getting there :)

post-6-1186356698_thumb.jpg

Share this post


Link to post
Share on other sites

That is hopeful. :)

How about showing pin five on the top trace and pin four on the bottom trace.

EDIT:

Oops, I see a silly mistake in my drawing. Pin 11 should go to Vcc, not ground. Fix that, and I suspect CH-7 will appear.

Edited by Mr.RC-Cam

Share this post


Link to post
Share on other sites

Switched pin 11 to 5V, but still only 6 channels. Checked pin 4 and 5, with the same pattern of 6 channels on 4 of course, and a single VERY narrow 4.5V spike on pin 5 where the spike ending channel 7 should be and which isn't there on every scope refresh. Of course this is a USB scope so sensitivity and timing is less than of an expensive lab scope, so the 10-25 microsecond peak is probably at the lower limit of its "vision". Attached an image of pin 5 top, bin 4 bottom. Pin 12 has the reverse of pin 5. Could it be that it should be pin 12 instead of pin 5 which needs to go to pin 1 ? Or change the R2 + C2 to get a slightly wider peak ? In any case, seeing that 7th channel end peak on pin 5 is really telling me we are 99% there !!! :)

Of note, one mod vs your pic, I did add a 10nF cap over 5V to ground at the pin 16 (didn't have another immediately handy).

post-6-1186392246_thumb.jpg

Share this post


Link to post
Share on other sites

Here a pic of the topside of the current circuit including the connections to the AR7000 and the PPM output connector with open wires. Not too bad for an amateur I think. Of course going to surface mount stuff and a nice litte etched PCB would be a lot prettier....

post-6-1186392428_thumb.jpg

Share this post


Link to post
Share on other sites

I see a logic error in the original schematic. Below is a redlined workaround for that.

Once you find that the concept will work, the next step is a conversion to a 5V powered solution. The changes might be extensive.

post-6-1186418985_thumb.jpg

Share this post


Link to post
Share on other sites

Sometimes logic errors are so obvious it is difficult to see them :lol: Of course you have to feed the peak back into the orginal train.... ;=)) I-ll try that this evening, will let you know. But the logic indeed woudl dictate this to be the solution.

With respect to the 5V issue, one alternative could be to just run off the 3V rail of the MK (not all too easy to get at actually), or to put in a UA78L03 with a couple of 100nF caps and just run the circuit on 3V if that works for the MK. That could still be pushed into this footprint. The other could be my original circuit with 1 or 2 tranistors to get the voltage back to 5V. Either solution could probably still fit into the same footprint with some further shortening of space between parts. In any case in a next version I-ll probably use some thinner wire for the GND and VCC rail and wire-wrapping wire for all jumper wires. Should shave some solder weight off of the final prototype.

Share this post


Link to post
Share on other sites
Of course you have to feed the peak back into the original train.... ;=))

Actually, the circuit did that. But, a logic level was inverted at a key time. The extra diode was easier to add than to tear apart the circuit so that we could avoid an extra part. My original sketches had this extra diode, but I thought I was being clever by eliminating it. So much for saving the diode forest.

one alternative could be to just run off the 3V rail of the MK

The 3V supply in the MK does not seem to be a good pick to run any digital logic. It needs to be "quiet" for the analog Vref. So, I don't recommend sharing it with the HC221.

The other could be my original circuit with 1 or 2 transistors to get the voltage back to 5V.

If you don't mind 2 NPN transistors and four resistors then the 5V fix won't require hacking the HC221 wires. If parts count is important, then it can be done with 1 FET transistor and 1 resistor, plus a bunch of changes to the HC221's wiring. Your choice.

But, first let's see if the idea will work correctly. :)

Share this post


Link to post
Share on other sites

:P:P

Beautiful channel 7. And with some forrest of wiring to feed a 3V power supply, a 5V RX supply and a the MK controler from 3 batteries and pulling them all to the same GND the MK controler had a beautiful RX signal with all 7 channels operational.

:P:P

One minor problem, all values the MK sees are offset a about 22 points, going from -97 via 22 to +145. Haven't checked whether I can correct that by trimming on the TX side, or whether there are settings on the MK side which allow for correcting the centerpoint. Either would probably work. Most importantly, all controls seem to have full range of values if corrected for the 22 point offset.

Looking at all the wiring needed to get this to work, probably being able to feed everything off of the 5V rail of the MK controler is the better idea. So probably best to indeed go for the lower parts count. I can't say how thankful I am that you've helped me this far.

I-m off on leave for a week, so it will go quite for a short break....

post-6-1186437536_thumb.jpg

Share this post


Link to post
Share on other sites

It's grand to hear it is working.

To reduce the unwanted offset, you can try reducing R1 a bit. Perhaps change to 2.2K or so. This will narrow the synthesized pulse gaps. If the gaps are too small, the MK will probably become confused or unreliable. So, don't go wild with R1. Final tweaks to the offset can be masked by your Tx's centering mix. Let me know if this helps (if it doesn't, then the problem is probably related to the MK firmware).

When you are back from vacation we can move on to a 5V design that will accept your low voltage Rx pulses.

Share this post


Link to post
Share on other sites

Well a little update. I now have a circuit which works off of the 5V supply from the Mikrokopter controler and feeds the 5V through to the AR7000. The circuit actually runs at a lower voltage. All Vcc connections are connected to a voltage lowered by 3 diodes in series. That brings the total number of diodes up to 11 (8 for the 7 channels, 3 to drop the voltage). I changed the value of C1 from the original 40 down to 22nF leaving R1 at 10kOhm, and unchanged values for C2 at 10nF and R2 at 2 kOhm. The pulses are significantly narrower but the offset remains, going from -97 to +145 or os. However using subtrims set to about -32 on all channels I can center all sticks to 0 with a range from about -120 to +120. Values seem stable.

Here is picture of the signal immediately after the diode array. Note the vertical is 2V per block.

post-6-1188420543_thumb.jpg

Edited by Arthur P.

Share this post


Link to post
Share on other sites

Glad to hear it is working for you. Sounds like you are good to go.

[be careful to ensure that the reduced voltage on the HC221 does not cause reliability problems with the MK's microcontroller. That is because some microcontrollers have inputs that need at least 4V logic highs for reliable use. So, it would be a good idea to check its data sheet to see if this sort of issue would impact your installation.

Edited by Mr.RC-Cam

Share this post


Link to post
Share on other sites
Glad to hear it is working for you. Sounds like you are good to go.

[be careful to ensure that the reduced voltage on the HC221 does not cause reliability problems with the MK's microcontroller. That is because some microcontrollers have inputs that need at least 4V logic highs for reliable use. So, it would be a good idea to check its data sheet to see if this sort of issue would impact your installation.

Interesting. In your previous post you indicated reducing R1 from 10kOhm to 2.2kOhm to reduce the pulsewidth from 250-300 microseconds to something a bit less. R2 was already 2.2kOhm, so that was as low as you were suggesting and the R2/C2 combination was giving a 10-20microsecond pulse.

The MK seems happy enough with the 4V voltage. I believe it actually loves 3.3V but allows 5V. In fact I have run the circuit completely off of a 3V supply with the MK still happilly interpreting the values.

I think for now I-ll go with what I have and see how that works. The alternative would probably be to replace or support the diode array with a 3 to 5V level shifter which should allow the circuit to work on and output 5V?

Share this post


Link to post
Share on other sites
The alternative would probably be to replace or support the diode array with a 3 to 5V level shifter which should allow the circuit to work on and output 5V?

My thoughts were to operate the HC221 on 5V, which is the same voltage as is used on the MK's microcontroller. To keep the redesign efforts as simple as possible (read: lazy way out) it would require a couple transistors and some resistors. But, if the MK's MCU can reliably accept your provided logic levels then there is no need to do this.

Share this post


Link to post
Share on other sites

Actually the MK controler has a mix of 5V and 3.3V as can be seen here on http://www.mikrokopter.de/ in the Wiki: http://mikrocontroller.cco-ev.de/ucwiki/Fl...haltplan_kl.gif

The processor is indeed run on 5V but the gyros are on 3V. The PPM input on pin 15 is not pulled up. VRef on pin 23 would be 3.3V again.

I could see what happens if I use just 1 or 2 diodes to drop the 5V. Not sure at what level the 74H221 would start triggering reliable on the low voltage coming off of the diode array. Might give me a little safety margin on the MK side, but if the switching of the 74HC221 becomes unreliable that margin of course is gone.

Edited by Arthur P.

Share this post


Link to post
Share on other sites
Actually the MK controler has a mix of 5V and 3.3V as can be seen here

It's the 5V logic that we are concerned about. The 3.3V is for the nifty analog stuff.

I looked at the MCU's data sheet and saw that the VIH spec is >0.6Vcc. So, with a 5V powered MCU, you are fine with logic high levels that are 3.0V or higher. That gives you plenty of allowance. The VIL spec is <0.3Vcc, so with the PPM hack circuit, that is not a problem either.

Your V-drop diodes should only toy with the HC221 PPM circuit's power. The MCU power should not be reduced.

Share this post


Link to post
Share on other sites

Currently working hard to finalize the frames for the Mikrokopters (quadrocopters). The final test of course is going to be how the circuit holds up during the first test flights. I hope to reach that point the coming weekend. Will post results.

Share this post


Link to post
Share on other sites

Hi everyone. i am making the quadorcopter too www.uavp.de and i have the same spektrun DX7, but i need to say that i am a newbie in eletronics and reading all your discussion avout it i get a little lost on the way.

So if you cold can you post to me the final schema that it is actualy and components to use.

i intend to go shoping it tomorow and i my english isnĀ“t very well. so i realy need a help of you

one thing to make clear? with this circuit i just need to conect the signal out of it direct to the pic on UAVP board? i will not use the mixing uavp circuit is that ok?

thanks for the atention and plz if you cold give me a help i will be very thankful.

Osvaldo

Share this post


Link to post
Share on other sites

For the final diagram see the 6 Aug 2007 08:49 post with the red lines correcting the original error. One thing the diagram does not show is that I put 3 diodes in series between the 5V external power and the power in for the chip to lower the voltage a bit. The voltages of the PWM pulses behind the diode array were too low to get the circuit to properly trigger. With the lower input power it seems to work OK on the testbench. Note that I still haven't testflown it, so no guarantee.

In RC Groups (http://www.rcgroups.com/) , under DIY electronics, there is another thread on this topic. One of the contributors has now managed to more or less hack the digital interface between the receivers and the processor. That info could allow using the digital output from the receivers to actually have digital input into a UAVP or Mikrokopter without any need for the PPM part.

There seems to have been someone flying with a Spektrum DX system at the last Cologne Hallenfliegen on 20 Oct 2007, but I didn't manage to go. So I don't know how he converted between the receiver and his flight controler.

Share this post


Link to post
Share on other sites

Here is the revised schematic (fingers are crossed it is what Arthur used). As Arthur mentioned, the HC221 will need a 3.3V (approx) supply. I would prefer a 3.3V LDO VReg IC, but a string of 3 series diodes worked for him. Don't forget to add a .1uF ceramic decoupling cap across the HC221's power pins.

I might be able to find the time to create/order a custom SMD PCB for easier DiY assembly. But, due to the PCB's fab cost, there would need to be substantial interest in that idea. I estimate I would need 10+ folks signed up in order to justify the effort. If the custom PCB idea moved forward, the circuit would change a bit to better accommodate the low voltage signals from the Spektrum.

post-6-1193506627_thumb.jpg

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...