Go Down

Topic: ppm (sum) in to servo output, possible timer issue (Read 4249 times) previous topic - next topic

Seeing as your online now I'll grab my arduino and see if I cant get it sorted

And a FAQ would be great help. This is the only code I've come across to deal with both ppm in and servo out and would be a benefit to many people I imagine

DuaneB

Internally its nice code, it just has a bit of an awkward interface to get started. Let me know how you get on

Duane.
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Also where in the code can I chuck a set of serial.prints so I can confirm the inputs are correct, its very much hot and miss with just a servo plugged in atm? In uS would be good.

I also edited a post on the previous page, I think you may have missed it.

"Edit: 1 bit of clarification. I have changed that lump of code to this

#define RC_CHANNEL_IN_COUNT 8
// two ticks per us, 3000 us * 2 ticks = 6000 minimum frame space
#define MINIMUM_FRAME_SPACE 16000
#define MAXIMUM_PULSE_SPACE 5000

Does MAXIMUM_PULSE_SPACE need to be changed as well?
"

DuaneB

Hi,

Whenever a channel reads as not 0 it has a valid value -

Code: [Select]

  uint16_t unThrottleIn =  CRCArduinoPPMChannels::getChannel(SERVO_THROTTLE);
  // Test if its something other than zero, if so its valid and we can use it
  if(unThrottleIn)
  {
    CRCArduinoFastServos::writeMicroseconds(SERVO_THROTTLE,unThrottleIn);
    // Add a serial print here
    Serial.println(unThrottleIn);
  }


Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

DuaneB

As for the other defines, leave them as they are -

// two ticks per us, 3000 us * 2 ticks = 6000 minimum frame space
#define MINIMUM_FRAME_SPACE 6000
#define MAXIMUM_PULSE_SPACE 5000

I notice you have

#define MINIMUM_FRAME_SPACE 16000

It should be

#define MINIMUM_FRAME_SPACE 16000

As per the original code.

The background is Timer1 is running at 2 ticks per microsecond, with 8 channels you have
8*2,000us = 16,000us
16,000 us in timer ticks = 32,000

Then we have a total frame size of 1/50 = 20,000 us or 40,000 ticks

40,000 ticks - 32,000 signal space = 8,000 frame space

so for 8 channels we expect around 8,000 ticks of frame space, the default setting is 6,000 so we are good for 8 channels or less with the default setting.

Duane
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

retrolefty

Quote
I notice you have

#define MINIMUM_FRAME_SPACE 16000

It should be

#define MINIMUM_FRAME_SPACE 16000


LOL, I must be blind, I don't see the difference?

Lefty

Ok ppm input is looking good now, servo output still very jerky. getting there though

DuaneB

Ok, for the servos are you using the test sketch in its original form or have you made any changes to the sketch of library so far ?

We will need to make some changes for the number of servos, but if possible lets start with the original

Duane

Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

Just the updated sketch from your website and unmodified library files except the RC_CHANNEL_IN_COUNT

DuaneB

Hi,
   I can't see any software reason for jerky servos, can you confirm that the servo is attached to the same pin that you are printing the channel input for ? and that the channel input is steady ?

If so, how are you powering the servo ?

Duane B
Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

that was my bad, I had changed #define RC_CHANNEL_OUT_COUNT and hadn't set it back to 4.
It is working now. Last thing, add more servo outputs..

DuaneB

I have to turn in for the evening now, tomorrow I will add additional comments to the example code to show how and where to add additional servos. Its been good to work through it with someone, it really does need better documentation which I will put together over the weekend.

Duane B

rcarduino.blogspot.com

Read this
http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html
then watch this
http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

Rcarduino.blogspot.com

I know that felling and thankyou for your help.
I'll keep on playing around with the code and keep an eye out for your updated sample code.

Go Up