61106

Gathering protocol from remote control helicopter

Question:

I have a (S107G) mini helicopter, and an Arduino. The possibilities sounded quite fun. So I set off to find the protocol for the transfer of data from controller to helicopter with IR. I used this code to try to figure out something of it.

void setup() { Serial.begin(9600); pinMode(12, INPUT_PULLUP); // 12 is IR sensor } void loop() { Serial.print(digitalRead(12) ? LOW : HIGH); delay(1); }

Obviously there a number of flaws with this.

<ol><li>delay(1); is arbitrarily chosen, I have no way of knowing at what speed data is transmitted.</li> <li>It could be an analog input. (Though I doubt it, as most IR sensors I found don't support that)</li> <li>I have no way of knowing when a "packet" starts or ends.</li> </ol>

If any of you have an idea of how to do this I would much appreciate it. Thanks!

EDIT: I found <a href="https://stackoverflow.com/questions/14774794/how-to-determine-checksum-from-decoded-ir-remotes" rel="nofollow">this on SO</a> and it sounds very nice, but he didn't go into depth as to how he did it, and what his findings were (speed, etc.)

Answer1:

You can find the complete code library <a href="https://github.com/mpflaga/Arduino-IRremote" rel="nofollow">here on my GITHUB</a> in which you will find the examples of IRsendDemoHelicopter.ino and IRrecvDump.ino. These and the IRremote.cpp should answer your questions. I have had it on my plan (for sometime) to implement the transmitter on an Esplora.

Below are the Micro Seconds, found at <a href="https://github.com/mpflaga/Arduino-IRremote/blob/master/IRremoteInt.h#L192" rel="nofollow">https://github.com/mpflaga/Arduino-IRremote/blob/master/IRremoteInt.h#L192</a>

#define SYMA_UPDATE_PERIOD_CH_A 120 // 0 #define SYMA_UPDATE_PERIOD_CH_B 180 // 1 #define SYMA_HDR_MARK 2000 #define SYMA_HDR_SPACE 2000 #define SYMA_BIT_MARK 320 #define SYMA_ONE_SPACE 687 #define SYMA_ZERO_SPACE 300

and here is the pattern of bits for both the R3 and R5. I believe the R5 is the most common being in production.

union helicopter { uint32_t dword; struct { uint8_t Throttle : 7; // 0..6 0 - 127 uint8_t Channel : 1; // 7 A=0, B=1 uint8_t Pitch : 7; // 8..14 0(forward) - 63(center) 127(back) uint8_t Pspacer : 1; // 15 na uint8_t Yaw : 7; // 16..22 127(left) - 63(center) - 0(right) } symaR3; struct { uint8_t Trim : 7; // 0..6 127(left) - 63(center) - 0(right) uint8_t Tspacer : 1; // 7 na uint8_t Throttle : 7; // 8..14 0 - 127 uint8_t Channel : 1; // 15 A=0, B=1 uint8_t Pitch : 7; // 16..22 0(forward) - 63(center) 127(back) uint8_t Pspacer : 1; // 23 na uint8_t Yaw : 7; // 24..30 127(left) - 63(center) - 0(right) } symaR5; };

but it is always possible they have come out with a new pattern.

Recommend

  • Could not find a valid gem 'rails' (>= 0) in any repository
  • Sockets interaction (java)
  • Delete in PhotoKit: can you skip “Recently Deleted”?
  • how to execute (exec) external system commands in Scala actor?
  • Java Card applets, secure data transmission and Secure Channel
  • How to calculate rotation angle using Android Sensors?
  • Sending and receiving data via POST in Microsoft Word 2011 for OSX
  • Android 6.0 USB Mass Storage
  • Fastest server client communication?
  • python cyclic shifting of the characters in the string
  • Android: Setting List Adapter for a ListFragment after Orientation Change Results in an Empty List
  • How to know if MAC address is attached to wireless card or ethernet card?
  • Avoid Veracode CWE-80: Improper Neutralization of Script-Related HTML in jquery htm() method
  • How to obtain amount of transferred data through Wi-Fi from other applications?
  • The semantic of call/cc and “ensure” in Ruby
  • Connecting refinery cms with Amazon S3 web services
  • Performing many small matrix operations in parallel in OpenCL
  • How to printk the first 34 bytes (Ethernet and IP headers) of each packet (EtherType: 0x0806, Protoc
  • How to encode h.264 live stream to RTP packet with Java
  • RTCP receiver report sending interval
  • How To Configure SonarQube GitHub Plugin With Jenkins
  • How to provide hyperlink in email pointing to a specific method inside gwt app (but not main page)
  • Accessing structure members with a pointer
  • Updating the composer.phar on Symfony2
  • Whats the best way of persisting data to Isolated Storage on Windows Phone 7?
  • Does Context/Scoping of a SQLAlchemy Session Require Non-Automatic Object/Attribute Expiration?
  • Zeromq with python hangs if connecting to invalid socket
  • how do i write assembly code from c#?
  • Hardware Accelerated Image Scaling in windows using C++
  • C++ Partial template specialization - design simplification
  • Is there a javascript serializer for JSON.Net?
  • Java Scanner input dilemma. Automatically inputs without allowing user to type
  • Where to put my custom functions in Wordpress?
  • Can I make an Android app that runs a web view in Chrome 39?
  • what is the difference between the asp.net mvc application and asp.net web application
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Matrix multiplication with MKL
  • How to include full .NET prerequisite for Wix Burn installer
  • Buffer size for converting unsigned long to string
  • Binding checkboxes to object values in AngularJs