Pages: 1 [2] 3   Go Down
Author Topic: ppm (sum) in to servo output, possible timer issue  (Read 2442 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Duane.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
"
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

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

Code:
  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
Logged


Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16459
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 21
Posts: 1670
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2] 3   Go Up
Jump to: