alvarop / protox

Proto-x remote reversing project
78 stars 7 forks source link

Direct pairing with remote and porting to teensy 3.1 #2

Open RawLiquid opened 9 years ago

RawLiquid commented 9 years ago

Greetings! While procratinating on laying out a replacement pcb for a protoX remote, I stumbled upon a video about controlling a hubsan x4 from a pc and found a few comments claiming the rf modules might be compatable which got me thinking. Then after much searching I found your project which seems to be the only one around that actually supports decoding incoming packets. That said, I am going to make what likely will be a rather limited attempt at porting as much as I can to the arduino. Unfortunately unless it is somewhat straightforward, my limited experience may not be sufficient to complete that. While I continue attempting to digest what you have here, I did have a question or two that may help motivate me to attempt the port. I assume that it should be possible to mimic the copter side of the connection entirely, in other words to directly pair with a remote so it begins transmitting thinking that it paired with a copter.

I'm essentially trying to create a wireless buddy box so I can apply custom limits to the data before relaying it into my spektrum dx8. I tried using the stock features but they are quite lacking when it comes to adjusting anything. The bottom line is I'm not going to go buy a second dx8 remote to hand to my 15 month old. First of all just not going to happen...second even if I did do that, any limit I apply to the slave also gets applied to me, which means harder to recover for me when he tries to crash. and lastly, all the switches and buttons distracted him.

Ultimately I was attempting to figure out a power solution since I don't think the nano running at 3.3v can handle what I need to do, certainly not with my skill level anyways, yet 2s lipo's that have a footprint of 2 AAA's are pretty limited and somewhat hard to find. So being able to receive the data stream and process it directly would resolve most of my remaining issues with the project. Any additional info would certainly be helpful. Thanks, Nate

alvarop commented 9 years ago

Sounds like an awesome project. It would be great for teaching people to fly these things without sacrificing too many propellers!

I see no reason why this shouldn't work on arduino. You might have to do some lower level stuff to get the timing right, but I'm sure that's possible. I suspect you'll have to modify some of the SPI code and configuration to get it working in normal spi mode, as opposed to the half-duplex SPI I'm using. (Which is what the ProtoX remote uses.)

RawLiquid commented 9 years ago

Well, I will give it a try, I'm hoping that it turns out to be fairly straightforward otherwise I'll have to move forward with the custom board. My boy got a taste of controlling a few things and he is stuck on it. can't leave a remote sitting out he will grab it, he even knows what goes with at least two of the remotes, but he' can't get his hands around them far enough to hold them and use them. Which is why I am sorta targeting the protox remote. I placed an order for a radio module lastnight, wont be here for a month so I may end up attempting to 'extract' the rf portion of a remote...I haven't finished reading through your code yet, did you happen to have anything already written that will set up the binding? my first task will be to take a look at the output I'll be looking for so I can possibly recognize if what I end up with is valid or garbage. This will be my first attempt at porting anything so I have my fingers crossed. Wish there were some sort of guide to it but I guess if that were the case it would have been scripted long ago... Oh and propellers are the least of my worries, his first time with any control he did a B-line for a tree. I caught it in time but if any limits had been active I may not have been able to.recover in time.

In addition, assuming I am able to make this happen, it won't be limited to spektrum, should work with any remote with a similar interface to spektrums 'pilotlink' which basically makes the slave transmit the stick positions, as opposed to what would be sent to the model, and the master remote injects those in place of it's own sticks, From that point on the programming on the master is what determines what happens. The only setting that has any bearing at all is the reversing.

alvarop commented 9 years ago

All the binding/pairing code is here: https://github.com/alvarop/protox/blob/master/fw/controller/protox.c

RawLiquid commented 9 years ago

Well, I managed to find some people that did more or less what you did, but for the arduino. They do appear to have some things mislabeled, but I did get one of them working. a key difference is they update the GIO1 register and set the chip to use the standard 4wire spi, which makes it much easier to handle from arduino since the library already supports that. I'm slowly matching up what they have with what you have, but have not yet managed to come up with a sequence of commands I need to send, but I'm not yet ready to throw in the towel