Shop OBEX P1 Docs P2 Docs Learn Events
How can the Propeller read PWM from a 2.4 RC receiver? — Parallax Forums

How can the Propeller read PWM from a 2.4 RC receiver?

How would one go about reading PWM from a Hobby King HK6S 2.4GHz receiver?

Comments

  • rjo__rjo__ Posts: 2,114
    I am not an expert, but I have done similar things with a Propeller.

    Generally speaking.

    You would have to know what it is driving... most likely a servo signal?
    Figure out the frequency of the PWM. Drive the receiver with a know source based on your measurements...With your signal as a source, measure the high or low signal coming out of the receiver...over a known period and divide by the number of cycles. Do this across the interesting range and you have what you need.

    Not perfect but it should work.

    I'm sure there will be better answers coming along shortly:)

    Rich
  • In PASM it's pretty easy: scan your channels and when any goes from 0 to 1 mark the time; when the channel transitions from 1 to 0 calculate the difference (using the clkfreq value) and write it to the hub. your high-level code can convert it to microseconds if you like.
  • I'm pretty sure Jason Dorie's flight controller code has an object to do this.
  • Yes, there are objects in both Spin and C++ to read an R/C receiver.

    Go to https://github.com/parallaxinc/Flight-Controller

    Look in the Firmware folder for Spin, or Firmware-C for C++. (Both versions use a PASM driver for accuracy, but you talk to it from Spin or C).

    The PASM code works exactly in the manner Jon describes, and the Spin / C part of the code scales the result back to 1/2 microsecond units.
Sign In or Register to comment.