Go Down

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

DuaneB

It might not be the most useful FAQ just yet, but its a start

http://rcarduino.blogspot.com/2013/02/rcarduino-libraries-faq.html

Let me know if it helps or which bits could be clearer

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

FAQ looks good, thankyou.
I am just in the middle of adding my servos and should be testing oit soon.

You mentioned ppm out as well. That could be very useful for one project I have in mind, mainly to reduce wire clutter.

DuaneB

Hi,
   I have a variation of the Serial Servos code in the link below which outputs PPM

http://rcarduino.blogspot.com/2012/08/arduino-serial-servos.html

The clock signal that gets sent to the 4017 counter is very similar to PPM so it was a trivial conversion to output PPM instead - I should consolidate the code into a single library with the option of PPM out or serial output to a counter but thats a job for another day.

I have not tested the PPM output modification in anger, but have sent it to a few people that have asked for it.

People always come back if something has a problem, on the basis that no one has got back I have to assume that it works perfectly.

I will send you the library, at some point in the next day or two.

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

Got it all working now. I had 10 servo outputs but they all seemed like they had steps when you slowly swept across the full throw of the Tx stick. I went down to 9 and it is far smoother now.

Thankyou for sharing your code to BTW

DuaneB

Hi,
   With 10 servos you don't need a framespace, try it again without setting a framespace and I wil update the FAQ with this later today.

   To try it, set RC_CHANNEL_OUT_COUNT to 10

   Attach your servos from 0 to 9

   Dont use setFramespace

   Then just work away on your 10 servos.

   You could actually drive 20 servos, the library is able to drive a second bank of upto ten if you define MORE_SERVOS_PLEASE

   Thats probably something else that should go in the FAQ.

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

Will do, I had fame space set to 0 but will remove it completely and try again

Did what you suggested and it is all working great now. What to use all the spare servos channels for now :P

I finally managed to replicate my bug and record it as well.
I can make the following occur by using any channel.
If left at neutral there is no twitching, slight jitter but that can be put down to other causes.

1590 throttle   1498 alerion   1528 rudder   1558 elevator   1247 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
1590 throttle   1498 alerion   1524 rudder   1562 elevator   1246 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
1590 throttle   1498 alerion   1524 rudder   1563 elevator   1247 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
1591 throttle   1498 alerion   1524 rudder   1562 elevator   1247 flight mode   991 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
382 throttle   1386 alerion   1499 rudder   1525 elevator   1562 flight mode   1247 flaps    990 failsafe   1503 pan   1000 buzzer   1000 spare   
1590 throttle   1498 alerion   1524 rudder   1562 elevator   1247 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
1590 throttle   1498 alerion   1524 rudder   1564 elevator   1246 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
1590 throttle   1498 alerion   1524 rudder   1563 elevator   1247 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   
1590 throttle   1498 alerion   1524 rudder   1563 elevator   1246 flight mode   990 flaps    1503 failsafe   1502 pan   1000 buzzer   1000 spare   

Note the single line of epic fail.
I was inputting a small amount of throttle then everything violently twitched.
I tried commenting out all of my code until all I was left with was the ppmin and servo out so I assed something up along the way.
When I did the testing the other day I was using 2 9g servos, in the test bed used here is 1 full sized sevro and an esc.
I'm going to double check my .h file settings and will post back if I discover anything I missed.


Code is available here if you need to look at it.
https://dl.dropbox.com/u/11371953/DIY_RTH_10.rar

Update: nothing in the h files looks out of the wrong.
And if left along long enough it does twitch equally as violently as when controls are being inputted, abet not as frequently.
The one hint I can see is that with the printout I post above the last 2 channel have no glitching, those to channels are hard coded to put out 1000 were as the rest are read from ppm. So I suspect it is somewhere in the ppm in that things are going astray.


I shall now take the absoltue minimum code needed to move servos and see if that works in this platform.

Update 2: Pulled a new set of .cpp .h and the demo sketch from your website, the only change I made was channel input number to 8 as that is what my setup is spiting out.

Exact same result, if I wiggle the steering quickly the throttle bounces all over the place.

Any idea as to what it could be?  (to be honest it is probably me doing something wrong)

I have been over on the multiwii forums and one of the guys has made a ppm in servo out lump of code from multiwii. As a test of the hardware I'll  set that up and see of the results are the same. I am hopping to use your code though as it is far more flexible and easier to work with.

DuaneB

Hi,
   There is a function that will tell you if you are getting bad signals -

Code: [Select]

uint8_t CRCArduinoPPMChannels::getSynchErrorCounter()
{
  uint8_t sErrors = m_sOutOfSynchErrorCounter;

  m_sOutOfSynchErrorCounter = 0;

  return sErrors;
}


Its already in the library, so you can just add it to your loop. Its 0 if there were no errors since it was last called or > 0 if there were errors.

You should expect to see the occasional non zero  value from general radio interference, if you see errors consistently, you transmitter/receiver might be outputting more or less channels that indicated which is what I suspect from what you have described.

The other possibility is interference from having signal wires passing too close to power lines within your project - I have had this problem once or twice and its solved by moving ariels and other sensitive lines away from batter, ESC and motor wires.

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

I think this time I have the issue nailed down. fingers crossed.
I tried running multiwii - differnt 328p - differnt code - same hardware - same issue
This is extremely weird as I use ppm in on my multicopters and it has run fine for years, so deff a hardware issue.
I grabbed the wing from the plane this will be going in (4 9g digital servos) and tested both yours and the multiwii code, both work flawlessly.
To confirm what on my test bed was causing issues I swapped one servo on the wing for first the esc on the test bed. Work like gold, then swapped the esc for the servo (as the test bed is a rock crawler it is a full size all metal gear beast of a servo, but it is analog....) once that was in the system all hell broke lose once again.
This is confirmed both by visually seeing the servos twitch and from the multiwii gui/prints in your code

So as far as time goes it was that servo causing all the issues, somehow creating a bucketload of noise in the system. A ferrite ring may weed out the issue, or giving it its own power.

This brings me to another scenario, my original code that used servo timer 2 may have never been broken in the first place. When I removed the esc from that setup it worked fine - possibility that specific pieces of hardware (or combination of) cause can cause issues.

If I get the time I may try to sort that issue, it would be nice to have a solution now that I know the problem.

Thankyou for your help and I hope this discovery of mine can shed light on any future problems you may run into.

Will post back with ether A)sucses story of project or B)another issue

Go Up