Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

PWM Input from the ground up


  • Please log in to reply
4 replies to this topic

#1 XQuirrel

XQuirrel

    New Member

  • Members
  • Pip
  • 5 posts
  • LocationLondon

Posted 25 March 2012 - 03:37 PM

Although there are a couple of Netduino PWM posts here and here, both deal with PWM outputs, not PWM inputs.

What I want to do with Netduino, is plug my Futaba Receiver's digital channels one to four into Netduino as inputs, and then read the pwm values in my C# code, interpret that, and then control things with it.

To do that I'm going to need a pwm input library in my Netduino.

Does anyone have one, or have any pointers on creating one?

I surmise that if there isn't a pwm input library hanging around somewhere, that to build one will involve measuring the state of the pwm input (high or low) and then rechecking it periodically to determine its frequency.

What I already have is this:

An Arduino Mega 2560 with ArduPilot IMU shield, and into the latter my Radio Control receiver plugs in - there are, for example, eight PWM inputs to the IMU shield, each being a single line from the RC Receiver. Taking input number two, for example, if I push up the throttle on my Futaba Super 8 RC transmitter, the pwm signal changes on input number two, because that is where I have plugged the lead from the receiver module output number two. The codebase is immense, and written in C++, which I'm quite new to.

So what I basically want to do is build something like this from the ground up, but with C# in Netduino.

Kind regards,

Anthony

#2 Bainesbunch

Bainesbunch

    Advanced Member

  • Members
  • PipPipPip
  • 61 posts
  • LocationFrance

Posted 25 March 2012 - 06:07 PM

Hi Anthony, this is not as difficult as it seems since we have edge driven interrupts on the pins of our Netduinos. Basically if you have a methods that is called on both the leading (rising edge) and the falling edge of the pin then you can calculate the time between the two. This will give you your pulse width. Since you are not interested in the duty cycle then you won’t be wanting to measure time between leading edges. I can give you a snippet of code to do this in VB if you want it. Let me know. Cheers Pete.
I was going to change the world, then I discovered Netduino.
The world will have to wait.

#3 XQuirrel

XQuirrel

    New Member

  • Members
  • Pip
  • 5 posts
  • LocationLondon

Posted 25 March 2012 - 07:34 PM

Hi Anthony,

this is not as difficult as it seems since we have edge driven interrupts on the pins of our Netduinos.

Basically if you have a methods that is called on both the leading (rising edge) and the falling edge of the pin then you can calculate the time between the two. This will give you your pulse width. Since you are not interested in the duty cycle then you won’t be wanting to measure time between leading edges.

I can give you a snippet of code to do this in VB if you want it.

Let me know.

Cheers Pete.


Hi Pete, somehow my reply has got lost, this is take-2!

I've sorted it out, thanks, your idea of measuring half cycles helped alot!

Here's my code,

Kind regards,

Anthony

#4 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 26 March 2012 - 04:39 PM


What I want to do with Netduino, is plug my Futaba Receiver's digital channels one to four into Netduino as inputs, and then read the pwm values in my C# code, interpret that, and then control things with it.


Anthony, although it would require a change in xmitter and receiver, have you looked at the Spektrum stuff? Their receiver spits out straight 115,200 serial with all the channel values. A good friend is using those with an Arduino to build a product for the R/C world.

Just a thought, although I know buying a new transmitter and receivers is a spendy proposition.

-dan

#5 liqdfire

liqdfire

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 24 May 2012 - 06:20 PM

Anthony, although it would require a change in xmitter and receiver, have you looked at the Spektrum stuff? Their receiver spits out straight 115,200 serial with all the channel values. A good friend is using those with an Arduino to build a product for the R/C world.

Just a thought, although I know buying a new transmitter and receivers is a spendy proposition.

-dan



Dan,

Do you have the details on that interface? At least from the Spektrum side, I am looking to do something with R/C and was already thinking about using Spektrum.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.